200-uclibc-locale.patch 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237
  1. diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4
  2. --- gcc-4.0.0-100/libstdc++-v3/acinclude.m4 2005-04-30 13:06:53.000000000 -0500
  3. +++ gcc-4.0.0/libstdc++-v3/acinclude.m4 2005-04-28 20:19:01.000000000 -0500
  4. @@ -1104,7 +1104,7 @@
  5. AC_MSG_CHECKING([for C locale to use])
  6. GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
  7. [use MODEL for target locale package],
  8. - [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
  9. + [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
  10. # If they didn't use this option switch, or if they specified --enable
  11. # with no specific model, we'll have to look for one. If they
  12. @@ -1120,6 +1120,9 @@
  13. # Default to "generic".
  14. if test $enable_clocale_flag = auto; then
  15. case ${target_os} in
  16. + *-uclibc*)
  17. + enable_clocale_flag=uclibc
  18. + ;;
  19. linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
  20. AC_EGREP_CPP([_GLIBCXX_ok], [
  21. #include <features.h>
  22. @@ -1263,6 +1266,40 @@
  23. CTIME_CC=config/locale/generic/time_members.cc
  24. CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
  25. ;;
  26. + uclibc)
  27. + AC_MSG_RESULT(uclibc)
  28. +
  29. + # Declare intention to use gettext, and add support for specific
  30. + # languages.
  31. + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
  32. + ALL_LINGUAS="de fr"
  33. +
  34. + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
  35. + AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
  36. + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
  37. + USE_NLS=yes
  38. + fi
  39. + # Export the build objects.
  40. + for ling in $ALL_LINGUAS; do \
  41. + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
  42. + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
  43. + done
  44. + AC_SUBST(glibcxx_MOFILES)
  45. + AC_SUBST(glibcxx_POFILES)
  46. +
  47. + CLOCALE_H=config/locale/uclibc/c_locale.h
  48. + CLOCALE_CC=config/locale/uclibc/c_locale.cc
  49. + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
  50. + CCOLLATE_CC=config/locale/uclibc/collate_members.cc
  51. + CCTYPE_CC=config/locale/uclibc/ctype_members.cc
  52. + CMESSAGES_H=config/locale/uclibc/messages_members.h
  53. + CMESSAGES_CC=config/locale/uclibc/messages_members.cc
  54. + CMONEY_CC=config/locale/uclibc/monetary_members.cc
  55. + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
  56. + CTIME_H=config/locale/uclibc/time_members.h
  57. + CTIME_CC=config/locale/uclibc/time_members.cc
  58. + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
  59. + ;;
  60. esac
  61. # This is where the testsuite looks for locale catalogs, using the
  62. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
  63. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600
  64. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2005-04-28 01:13:15.000000000 -0500
  65. @@ -0,0 +1,59 @@
  66. +// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
  67. +
  68. +// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
  69. +//
  70. +// This file is part of the GNU ISO C++ Library. This library is free
  71. +// software; you can redistribute it and/or modify it under the
  72. +// terms of the GNU General Public License as published by the
  73. +// Free Software Foundation; either version 2, or (at your option)
  74. +// any later version.
  75. +
  76. +// This library is distributed in the hope that it will be useful,
  77. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  78. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  79. +// GNU General Public License for more details.
  80. +
  81. +// You should have received a copy of the GNU General Public License along
  82. +// with this library; see the file COPYING. If not, write to the Free
  83. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  84. +// USA.
  85. +
  86. +// As a special exception, you may use this file as part of a free software
  87. +// library without restriction. Specifically, if other files instantiate
  88. +// templates or use macros or inline functions from this file, or you compile
  89. +// this file and link it with other files to produce an executable, this
  90. +// file does not by itself cause the resulting executable to be covered by
  91. +// the GNU General Public License. This exception does not however
  92. +// invalidate any other reasons why the executable file might be covered by
  93. +// the GNU General Public License.
  94. +
  95. +// Written by Jakub Jelinek <jakub@redhat.com>
  96. +
  97. +#include <clocale>
  98. +
  99. +#ifdef __UCLIBC_MJN3_ONLY__
  100. +#warning clean this up
  101. +#endif
  102. +
  103. +#ifdef __UCLIBC_HAS_XLOCALE__
  104. +
  105. +extern "C" __typeof(iswctype_l) __iswctype_l;
  106. +extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
  107. +extern "C" __typeof(strcoll_l) __strcoll_l;
  108. +extern "C" __typeof(strftime_l) __strftime_l;
  109. +extern "C" __typeof(strtod_l) __strtod_l;
  110. +extern "C" __typeof(strtof_l) __strtof_l;
  111. +extern "C" __typeof(strtold_l) __strtold_l;
  112. +extern "C" __typeof(strxfrm_l) __strxfrm_l;
  113. +extern "C" __typeof(towlower_l) __towlower_l;
  114. +extern "C" __typeof(towupper_l) __towupper_l;
  115. +extern "C" __typeof(wcscoll_l) __wcscoll_l;
  116. +extern "C" __typeof(wcsftime_l) __wcsftime_l;
  117. +extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
  118. +extern "C" __typeof(wctype_l) __wctype_l;
  119. +extern "C" __typeof(newlocale) __newlocale;
  120. +extern "C" __typeof(freelocale) __freelocale;
  121. +extern "C" __typeof(duplocale) __duplocale;
  122. +extern "C" __typeof(uselocale) __uselocale;
  123. +
  124. +#endif // GLIBC 2.3 and later
  125. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
  126. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600
  127. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2005-04-28 01:13:15.000000000 -0500
  128. @@ -0,0 +1,160 @@
  129. +// Wrapper for underlying C-language localization -*- C++ -*-
  130. +
  131. +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
  132. +//
  133. +// This file is part of the GNU ISO C++ Library. This library is free
  134. +// software; you can redistribute it and/or modify it under the
  135. +// terms of the GNU General Public License as published by the
  136. +// Free Software Foundation; either version 2, or (at your option)
  137. +// any later version.
  138. +
  139. +// This library is distributed in the hope that it will be useful,
  140. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  141. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  142. +// GNU General Public License for more details.
  143. +
  144. +// You should have received a copy of the GNU General Public License along
  145. +// with this library; see the file COPYING. If not, write to the Free
  146. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  147. +// USA.
  148. +
  149. +// As a special exception, you may use this file as part of a free software
  150. +// library without restriction. Specifically, if other files instantiate
  151. +// templates or use macros or inline functions from this file, or you compile
  152. +// this file and link it with other files to produce an executable, this
  153. +// file does not by itself cause the resulting executable to be covered by
  154. +// the GNU General Public License. This exception does not however
  155. +// invalidate any other reasons why the executable file might be covered by
  156. +// the GNU General Public License.
  157. +
  158. +//
  159. +// ISO C++ 14882: 22.8 Standard locale categories.
  160. +//
  161. +
  162. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  163. +
  164. +#include <cerrno> // For errno
  165. +#include <locale>
  166. +#include <stdexcept>
  167. +#include <langinfo.h>
  168. +#include <bits/c++locale_internal.h>
  169. +
  170. +#ifndef __UCLIBC_HAS_XLOCALE__
  171. +#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
  172. +#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
  173. +#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
  174. +#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
  175. +#define __strtof_l(S, E, L) strtof((S), (E))
  176. +#define __strtod_l(S, E, L) strtod((S), (E))
  177. +#define __strtold_l(S, E, L) strtold((S), (E))
  178. +#warning should dummy __newlocale check for C|POSIX ?
  179. +#define __newlocale(a, b, c) NULL
  180. +#define __freelocale(a) ((void)0)
  181. +#define __duplocale(a) __c_locale()
  182. +#endif
  183. +
  184. +namespace std
  185. +{
  186. + template<>
  187. + void
  188. + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
  189. + const __c_locale& __cloc)
  190. + {
  191. + if (!(__err & ios_base::failbit))
  192. + {
  193. + char* __sanity;
  194. + errno = 0;
  195. + float __f = __strtof_l(__s, &__sanity, __cloc);
  196. + if (__sanity != __s && errno != ERANGE)
  197. + __v = __f;
  198. + else
  199. + __err |= ios_base::failbit;
  200. + }
  201. + }
  202. +
  203. + template<>
  204. + void
  205. + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
  206. + const __c_locale& __cloc)
  207. + {
  208. + if (!(__err & ios_base::failbit))
  209. + {
  210. + char* __sanity;
  211. + errno = 0;
  212. + double __d = __strtod_l(__s, &__sanity, __cloc);
  213. + if (__sanity != __s && errno != ERANGE)
  214. + __v = __d;
  215. + else
  216. + __err |= ios_base::failbit;
  217. + }
  218. + }
  219. +
  220. + template<>
  221. + void
  222. + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
  223. + const __c_locale& __cloc)
  224. + {
  225. + if (!(__err & ios_base::failbit))
  226. + {
  227. + char* __sanity;
  228. + errno = 0;
  229. + long double __ld = __strtold_l(__s, &__sanity, __cloc);
  230. + if (__sanity != __s && errno != ERANGE)
  231. + __v = __ld;
  232. + else
  233. + __err |= ios_base::failbit;
  234. + }
  235. + }
  236. +
  237. + void
  238. + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
  239. + __c_locale __old)
  240. + {
  241. + __cloc = __newlocale(1 << LC_ALL, __s, __old);
  242. +#ifdef __UCLIBC_HAS_XLOCALE__
  243. + if (!__cloc)
  244. + {
  245. + // This named locale is not supported by the underlying OS.
  246. + __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
  247. + "name not valid"));
  248. + }
  249. +#endif
  250. + }
  251. +
  252. + void
  253. + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
  254. + {
  255. + if (_S_get_c_locale() != __cloc)
  256. + __freelocale(__cloc);
  257. + }
  258. +
  259. + __c_locale
  260. + locale::facet::_S_clone_c_locale(__c_locale& __cloc)
  261. + { return __duplocale(__cloc); }
  262. +} // namespace std
  263. +
  264. +namespace __gnu_cxx
  265. +{
  266. + const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
  267. + {
  268. + "LC_CTYPE",
  269. + "LC_NUMERIC",
  270. + "LC_TIME",
  271. + "LC_COLLATE",
  272. + "LC_MONETARY",
  273. + "LC_MESSAGES",
  274. +#if _GLIBCXX_NUM_CATEGORIES != 0
  275. + "LC_PAPER",
  276. + "LC_NAME",
  277. + "LC_ADDRESS",
  278. + "LC_TELEPHONE",
  279. + "LC_MEASUREMENT",
  280. + "LC_IDENTIFICATION"
  281. +#endif
  282. + };
  283. +}
  284. +
  285. +namespace std
  286. +{
  287. + const char* const* const locale::_S_categories = __gnu_cxx::category_names;
  288. +} // namespace std
  289. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h
  290. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600
  291. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2005-04-28 01:13:15.000000000 -0500
  292. @@ -0,0 +1,115 @@
  293. +// Wrapper for underlying C-language localization -*- C++ -*-
  294. +
  295. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  296. +//
  297. +// This file is part of the GNU ISO C++ Library. This library is free
  298. +// software; you can redistribute it and/or modify it under the
  299. +// terms of the GNU General Public License as published by the
  300. +// Free Software Foundation; either version 2, or (at your option)
  301. +// any later version.
  302. +
  303. +// This library is distributed in the hope that it will be useful,
  304. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  305. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  306. +// GNU General Public License for more details.
  307. +
  308. +// You should have received a copy of the GNU General Public License along
  309. +// with this library; see the file COPYING. If not, write to the Free
  310. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  311. +// USA.
  312. +
  313. +// As a special exception, you may use this file as part of a free software
  314. +// library without restriction. Specifically, if other files instantiate
  315. +// templates or use macros or inline functions from this file, or you compile
  316. +// this file and link it with other files to produce an executable, this
  317. +// file does not by itself cause the resulting executable to be covered by
  318. +// the GNU General Public License. This exception does not however
  319. +// invalidate any other reasons why the executable file might be covered by
  320. +// the GNU General Public License.
  321. +
  322. +//
  323. +// ISO C++ 14882: 22.8 Standard locale categories.
  324. +//
  325. +
  326. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  327. +
  328. +#ifndef _C_LOCALE_H
  329. +#define _C_LOCALE_H 1
  330. +
  331. +#pragma GCC system_header
  332. +
  333. +#include <cstring> // get std::strlen
  334. +#include <cstdio> // get std::snprintf or std::sprintf
  335. +#include <clocale>
  336. +#include <langinfo.h> // For codecvt
  337. +#ifdef __UCLIBC_MJN3_ONLY__
  338. +#warning fix this
  339. +#endif
  340. +#ifdef __UCLIBC_HAS_LOCALE__
  341. +#include <iconv.h> // For codecvt using iconv, iconv_t
  342. +#endif
  343. +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
  344. +#include <libintl.h> // For messages
  345. +#endif
  346. +
  347. +#ifdef __UCLIBC_MJN3_ONLY__
  348. +#warning what is _GLIBCXX_C_LOCALE_GNU for
  349. +#endif
  350. +#define _GLIBCXX_C_LOCALE_GNU 1
  351. +
  352. +#ifdef __UCLIBC_MJN3_ONLY__
  353. +#warning fix categories
  354. +#endif
  355. +// #define _GLIBCXX_NUM_CATEGORIES 6
  356. +#define _GLIBCXX_NUM_CATEGORIES 0
  357. +
  358. +#ifdef __UCLIBC_HAS_XLOCALE__
  359. +namespace __gnu_cxx
  360. +{
  361. + extern "C" __typeof(uselocale) __uselocale;
  362. +}
  363. +#endif
  364. +
  365. +namespace std
  366. +{
  367. +#ifdef __UCLIBC_HAS_XLOCALE__
  368. + typedef __locale_t __c_locale;
  369. +#else
  370. + typedef int* __c_locale;
  371. +#endif
  372. +
  373. + // Convert numeric value of type _Tv to string and return length of
  374. + // string. If snprintf is available use it, otherwise fall back to
  375. + // the unsafe sprintf which, in general, can be dangerous and should
  376. + // be avoided.
  377. + template<typename _Tv>
  378. + int
  379. + __convert_from_v(char* __out, const int __size, const char* __fmt,
  380. +#ifdef __UCLIBC_HAS_XLOCALE__
  381. + _Tv __v, const __c_locale& __cloc, int __prec)
  382. + {
  383. + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
  384. +#else
  385. + _Tv __v, const __c_locale&, int __prec)
  386. + {
  387. +# ifdef __UCLIBC_HAS_LOCALE__
  388. + char* __old = std::setlocale(LC_ALL, NULL);
  389. + char* __sav = new char[std::strlen(__old) + 1];
  390. + std::strcpy(__sav, __old);
  391. + std::setlocale(LC_ALL, "C");
  392. +# endif
  393. +#endif
  394. +
  395. + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
  396. +
  397. +#ifdef __UCLIBC_HAS_XLOCALE__
  398. + __gnu_cxx::__uselocale(__old);
  399. +#elif defined __UCLIBC_HAS_LOCALE__
  400. + std::setlocale(LC_ALL, __sav);
  401. + delete [] __sav;
  402. +#endif
  403. + return __ret;
  404. + }
  405. +}
  406. +
  407. +#endif
  408. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
  409. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600
  410. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2005-04-28 01:13:15.000000000 -0500
  411. @@ -0,0 +1,306 @@
  412. +// std::codecvt implementation details, GNU version -*- C++ -*-
  413. +
  414. +// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
  415. +//
  416. +// This file is part of the GNU ISO C++ Library. This library is free
  417. +// software; you can redistribute it and/or modify it under the
  418. +// terms of the GNU General Public License as published by the
  419. +// Free Software Foundation; either version 2, or (at your option)
  420. +// any later version.
  421. +
  422. +// This library is distributed in the hope that it will be useful,
  423. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  424. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  425. +// GNU General Public License for more details.
  426. +
  427. +// You should have received a copy of the GNU General Public License along
  428. +// with this library; see the file COPYING. If not, write to the Free
  429. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  430. +// USA.
  431. +
  432. +// As a special exception, you may use this file as part of a free software
  433. +// library without restriction. Specifically, if other files instantiate
  434. +// templates or use macros or inline functions from this file, or you compile
  435. +// this file and link it with other files to produce an executable, this
  436. +// file does not by itself cause the resulting executable to be covered by
  437. +// the GNU General Public License. This exception does not however
  438. +// invalidate any other reasons why the executable file might be covered by
  439. +// the GNU General Public License.
  440. +
  441. +//
  442. +// ISO C++ 14882: 22.2.1.5 - Template class codecvt
  443. +//
  444. +
  445. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  446. +
  447. +#include <locale>
  448. +#include <bits/c++locale_internal.h>
  449. +
  450. +namespace std
  451. +{
  452. + // Specializations.
  453. +#ifdef _GLIBCXX_USE_WCHAR_T
  454. + codecvt_base::result
  455. + codecvt<wchar_t, char, mbstate_t>::
  456. + do_out(state_type& __state, const intern_type* __from,
  457. + const intern_type* __from_end, const intern_type*& __from_next,
  458. + extern_type* __to, extern_type* __to_end,
  459. + extern_type*& __to_next) const
  460. + {
  461. + result __ret = ok;
  462. + state_type __tmp_state(__state);
  463. +
  464. +#ifdef __UCLIBC_HAS_XLOCALE__
  465. + __c_locale __old = __uselocale(_M_c_locale_codecvt);
  466. +#endif
  467. +
  468. + // wcsnrtombs is *very* fast but stops if encounters NUL characters:
  469. + // in case we fall back to wcrtomb and then continue, in a loop.
  470. + // NB: wcsnrtombs is a GNU extension
  471. + for (__from_next = __from, __to_next = __to;
  472. + __from_next < __from_end && __to_next < __to_end
  473. + && __ret == ok;)
  474. + {
  475. + const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
  476. + __from_end - __from_next);
  477. + if (!__from_chunk_end)
  478. + __from_chunk_end = __from_end;
  479. +
  480. + __from = __from_next;
  481. + const size_t __conv = wcsnrtombs(__to_next, &__from_next,
  482. + __from_chunk_end - __from_next,
  483. + __to_end - __to_next, &__state);
  484. + if (__conv == static_cast<size_t>(-1))
  485. + {
  486. + // In case of error, in order to stop at the exact place we
  487. + // have to start again from the beginning with a series of
  488. + // wcrtomb.
  489. + for (; __from < __from_next; ++__from)
  490. + __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
  491. + __state = __tmp_state;
  492. + __ret = error;
  493. + }
  494. + else if (__from_next && __from_next < __from_chunk_end)
  495. + {
  496. + __to_next += __conv;
  497. + __ret = partial;
  498. + }
  499. + else
  500. + {
  501. + __from_next = __from_chunk_end;
  502. + __to_next += __conv;
  503. + }
  504. +
  505. + if (__from_next < __from_end && __ret == ok)
  506. + {
  507. + extern_type __buf[MB_LEN_MAX];
  508. + __tmp_state = __state;
  509. + const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
  510. + if (__conv > static_cast<size_t>(__to_end - __to_next))
  511. + __ret = partial;
  512. + else
  513. + {
  514. + memcpy(__to_next, __buf, __conv);
  515. + __state = __tmp_state;
  516. + __to_next += __conv;
  517. + ++__from_next;
  518. + }
  519. + }
  520. + }
  521. +
  522. +#ifdef __UCLIBC_HAS_XLOCALE__
  523. + __uselocale(__old);
  524. +#endif
  525. +
  526. + return __ret;
  527. + }
  528. +
  529. + codecvt_base::result
  530. + codecvt<wchar_t, char, mbstate_t>::
  531. + do_in(state_type& __state, const extern_type* __from,
  532. + const extern_type* __from_end, const extern_type*& __from_next,
  533. + intern_type* __to, intern_type* __to_end,
  534. + intern_type*& __to_next) const
  535. + {
  536. + result __ret = ok;
  537. + state_type __tmp_state(__state);
  538. +
  539. +#ifdef __UCLIBC_HAS_XLOCALE__
  540. + __c_locale __old = __uselocale(_M_c_locale_codecvt);
  541. +#endif
  542. +
  543. + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
  544. + // in case we store a L'\0' and then continue, in a loop.
  545. + // NB: mbsnrtowcs is a GNU extension
  546. + for (__from_next = __from, __to_next = __to;
  547. + __from_next < __from_end && __to_next < __to_end
  548. + && __ret == ok;)
  549. + {
  550. + const extern_type* __from_chunk_end;
  551. + __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
  552. + __from_end
  553. + - __from_next));
  554. + if (!__from_chunk_end)
  555. + __from_chunk_end = __from_end;
  556. +
  557. + __from = __from_next;
  558. + size_t __conv = mbsnrtowcs(__to_next, &__from_next,
  559. + __from_chunk_end - __from_next,
  560. + __to_end - __to_next, &__state);
  561. + if (__conv == static_cast<size_t>(-1))
  562. + {
  563. + // In case of error, in order to stop at the exact place we
  564. + // have to start again from the beginning with a series of
  565. + // mbrtowc.
  566. + for (;; ++__to_next, __from += __conv)
  567. + {
  568. + __conv = mbrtowc(__to_next, __from, __from_end - __from,
  569. + &__tmp_state);
  570. + if (__conv == static_cast<size_t>(-1)
  571. + || __conv == static_cast<size_t>(-2))
  572. + break;
  573. + }
  574. + __from_next = __from;
  575. + __state = __tmp_state;
  576. + __ret = error;
  577. + }
  578. + else if (__from_next && __from_next < __from_chunk_end)
  579. + {
  580. + // It is unclear what to return in this case (see DR 382).
  581. + __to_next += __conv;
  582. + __ret = partial;
  583. + }
  584. + else
  585. + {
  586. + __from_next = __from_chunk_end;
  587. + __to_next += __conv;
  588. + }
  589. +
  590. + if (__from_next < __from_end && __ret == ok)
  591. + {
  592. + if (__to_next < __to_end)
  593. + {
  594. + // XXX Probably wrong for stateful encodings
  595. + __tmp_state = __state;
  596. + ++__from_next;
  597. + *__to_next++ = L'\0';
  598. + }
  599. + else
  600. + __ret = partial;
  601. + }
  602. + }
  603. +
  604. +#ifdef __UCLIBC_HAS_XLOCALE__
  605. + __uselocale(__old);
  606. +#endif
  607. +
  608. + return __ret;
  609. + }
  610. +
  611. + int
  612. + codecvt<wchar_t, char, mbstate_t>::
  613. + do_encoding() const throw()
  614. + {
  615. + // XXX This implementation assumes that the encoding is
  616. + // stateless and is either single-byte or variable-width.
  617. + int __ret = 0;
  618. +#ifdef __UCLIBC_HAS_XLOCALE__
  619. + __c_locale __old = __uselocale(_M_c_locale_codecvt);
  620. +#endif
  621. + if (MB_CUR_MAX == 1)
  622. + __ret = 1;
  623. +#ifdef __UCLIBC_HAS_XLOCALE__
  624. + __uselocale(__old);
  625. +#endif
  626. + return __ret;
  627. + }
  628. +
  629. + int
  630. + codecvt<wchar_t, char, mbstate_t>::
  631. + do_max_length() const throw()
  632. + {
  633. +#ifdef __UCLIBC_HAS_XLOCALE__
  634. + __c_locale __old = __uselocale(_M_c_locale_codecvt);
  635. +#endif
  636. + // XXX Probably wrong for stateful encodings.
  637. + int __ret = MB_CUR_MAX;
  638. +#ifdef __UCLIBC_HAS_XLOCALE__
  639. + __uselocale(__old);
  640. +#endif
  641. + return __ret;
  642. + }
  643. +
  644. + int
  645. + codecvt<wchar_t, char, mbstate_t>::
  646. + do_length(state_type& __state, const extern_type* __from,
  647. + const extern_type* __end, size_t __max) const
  648. + {
  649. + int __ret = 0;
  650. + state_type __tmp_state(__state);
  651. +
  652. +#ifdef __UCLIBC_HAS_XLOCALE__
  653. + __c_locale __old = __uselocale(_M_c_locale_codecvt);
  654. +#endif
  655. +
  656. + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
  657. + // in case we advance past it and then continue, in a loop.
  658. + // NB: mbsnrtowcs is a GNU extension
  659. +
  660. + // A dummy internal buffer is needed in order for mbsnrtocws to consider
  661. + // its fourth parameter (it wouldn't with NULL as first parameter).
  662. + wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
  663. + * __max));
  664. + while (__from < __end && __max)
  665. + {
  666. + const extern_type* __from_chunk_end;
  667. + __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
  668. + __end
  669. + - __from));
  670. + if (!__from_chunk_end)
  671. + __from_chunk_end = __end;
  672. +
  673. + const extern_type* __tmp_from = __from;
  674. + size_t __conv = mbsnrtowcs(__to, &__from,
  675. + __from_chunk_end - __from,
  676. + __max, &__state);
  677. + if (__conv == static_cast<size_t>(-1))
  678. + {
  679. + // In case of error, in order to stop at the exact place we
  680. + // have to start again from the beginning with a series of
  681. + // mbrtowc.
  682. + for (__from = __tmp_from;; __from += __conv)
  683. + {
  684. + __conv = mbrtowc(NULL, __from, __end - __from,
  685. + &__tmp_state);
  686. + if (__conv == static_cast<size_t>(-1)
  687. + || __conv == static_cast<size_t>(-2))
  688. + break;
  689. + }
  690. + __state = __tmp_state;
  691. + __ret += __from - __tmp_from;
  692. + break;
  693. + }
  694. + if (!__from)
  695. + __from = __from_chunk_end;
  696. +
  697. + __ret += __from - __tmp_from;
  698. + __max -= __conv;
  699. +
  700. + if (__from < __end && __max)
  701. + {
  702. + // XXX Probably wrong for stateful encodings
  703. + __tmp_state = __state;
  704. + ++__from;
  705. + ++__ret;
  706. + --__max;
  707. + }
  708. + }
  709. +
  710. +#ifdef __UCLIBC_HAS_XLOCALE__
  711. + __uselocale(__old);
  712. +#endif
  713. +
  714. + return __ret;
  715. + }
  716. +#endif
  717. +}
  718. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
  719. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600
  720. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2005-04-28 01:13:15.000000000 -0500
  721. @@ -0,0 +1,80 @@
  722. +// std::collate implementation details, GNU version -*- C++ -*-
  723. +
  724. +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
  725. +//
  726. +// This file is part of the GNU ISO C++ Library. This library is free
  727. +// software; you can redistribute it and/or modify it under the
  728. +// terms of the GNU General Public License as published by the
  729. +// Free Software Foundation; either version 2, or (at your option)
  730. +// any later version.
  731. +
  732. +// This library is distributed in the hope that it will be useful,
  733. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  734. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  735. +// GNU General Public License for more details.
  736. +
  737. +// You should have received a copy of the GNU General Public License along
  738. +// with this library; see the file COPYING. If not, write to the Free
  739. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  740. +// USA.
  741. +
  742. +// As a special exception, you may use this file as part of a free software
  743. +// library without restriction. Specifically, if other files instantiate
  744. +// templates or use macros or inline functions from this file, or you compile
  745. +// this file and link it with other files to produce an executable, this
  746. +// file does not by itself cause the resulting executable to be covered by
  747. +// the GNU General Public License. This exception does not however
  748. +// invalidate any other reasons why the executable file might be covered by
  749. +// the GNU General Public License.
  750. +
  751. +//
  752. +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
  753. +//
  754. +
  755. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  756. +
  757. +#include <locale>
  758. +#include <bits/c++locale_internal.h>
  759. +
  760. +#ifndef __UCLIBC_HAS_XLOCALE__
  761. +#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
  762. +#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
  763. +#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
  764. +#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
  765. +#endif
  766. +
  767. +namespace std
  768. +{
  769. + // These are basically extensions to char_traits, and perhaps should
  770. + // be put there instead of here.
  771. + template<>
  772. + int
  773. + collate<char>::_M_compare(const char* __one, const char* __two) const
  774. + {
  775. + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
  776. + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
  777. + }
  778. +
  779. + template<>
  780. + size_t
  781. + collate<char>::_M_transform(char* __to, const char* __from,
  782. + size_t __n) const
  783. + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
  784. +
  785. +#ifdef _GLIBCXX_USE_WCHAR_T
  786. + template<>
  787. + int
  788. + collate<wchar_t>::_M_compare(const wchar_t* __one,
  789. + const wchar_t* __two) const
  790. + {
  791. + int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
  792. + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
  793. + }
  794. +
  795. + template<>
  796. + size_t
  797. + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
  798. + size_t __n) const
  799. + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
  800. +#endif
  801. +}
  802. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
  803. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600
  804. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2005-04-28 01:13:15.000000000 -0500
  805. @@ -0,0 +1,300 @@
  806. +// std::ctype implementation details, GNU version -*- C++ -*-
  807. +
  808. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  809. +//
  810. +// This file is part of the GNU ISO C++ Library. This library is free
  811. +// software; you can redistribute it and/or modify it under the
  812. +// terms of the GNU General Public License as published by the
  813. +// Free Software Foundation; either version 2, or (at your option)
  814. +// any later version.
  815. +
  816. +// This library is distributed in the hope that it will be useful,
  817. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  818. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  819. +// GNU General Public License for more details.
  820. +
  821. +// You should have received a copy of the GNU General Public License along
  822. +// with this library; see the file COPYING. If not, write to the Free
  823. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  824. +// USA.
  825. +
  826. +// As a special exception, you may use this file as part of a free software
  827. +// library without restriction. Specifically, if other files instantiate
  828. +// templates or use macros or inline functions from this file, or you compile
  829. +// this file and link it with other files to produce an executable, this
  830. +// file does not by itself cause the resulting executable to be covered by
  831. +// the GNU General Public License. This exception does not however
  832. +// invalidate any other reasons why the executable file might be covered by
  833. +// the GNU General Public License.
  834. +
  835. +//
  836. +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
  837. +//
  838. +
  839. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  840. +
  841. +#define _LIBC
  842. +#include <locale>
  843. +#undef _LIBC
  844. +#include <bits/c++locale_internal.h>
  845. +
  846. +#ifndef __UCLIBC_HAS_XLOCALE__
  847. +#define __wctype_l(S, L) wctype((S))
  848. +#define __towupper_l(C, L) towupper((C))
  849. +#define __towlower_l(C, L) towlower((C))
  850. +#define __iswctype_l(C, M, L) iswctype((C), (M))
  851. +#endif
  852. +
  853. +namespace std
  854. +{
  855. + // NB: The other ctype<char> specializations are in src/locale.cc and
  856. + // various /config/os/* files.
  857. + template<>
  858. + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
  859. + : ctype<char>(0, false, __refs)
  860. + {
  861. + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
  862. + {
  863. + this->_S_destroy_c_locale(this->_M_c_locale_ctype);
  864. + this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
  865. +#ifdef __UCLIBC_HAS_XLOCALE__
  866. + this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
  867. + this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
  868. + this->_M_table = this->_M_c_locale_ctype->__ctype_b;
  869. +#endif
  870. + }
  871. + }
  872. +
  873. +#ifdef _GLIBCXX_USE_WCHAR_T
  874. + ctype<wchar_t>::__wmask_type
  875. + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
  876. + {
  877. + __wmask_type __ret;
  878. + switch (__m)
  879. + {
  880. + case space:
  881. + __ret = __wctype_l("space", _M_c_locale_ctype);
  882. + break;
  883. + case print:
  884. + __ret = __wctype_l("print", _M_c_locale_ctype);
  885. + break;
  886. + case cntrl:
  887. + __ret = __wctype_l("cntrl", _M_c_locale_ctype);
  888. + break;
  889. + case upper:
  890. + __ret = __wctype_l("upper", _M_c_locale_ctype);
  891. + break;
  892. + case lower:
  893. + __ret = __wctype_l("lower", _M_c_locale_ctype);
  894. + break;
  895. + case alpha:
  896. + __ret = __wctype_l("alpha", _M_c_locale_ctype);
  897. + break;
  898. + case digit:
  899. + __ret = __wctype_l("digit", _M_c_locale_ctype);
  900. + break;
  901. + case punct:
  902. + __ret = __wctype_l("punct", _M_c_locale_ctype);
  903. + break;
  904. + case xdigit:
  905. + __ret = __wctype_l("xdigit", _M_c_locale_ctype);
  906. + break;
  907. + case alnum:
  908. + __ret = __wctype_l("alnum", _M_c_locale_ctype);
  909. + break;
  910. + case graph:
  911. + __ret = __wctype_l("graph", _M_c_locale_ctype);
  912. + break;
  913. + default:
  914. + __ret = __wmask_type();
  915. + }
  916. + return __ret;
  917. + }
  918. +
  919. + wchar_t
  920. + ctype<wchar_t>::do_toupper(wchar_t __c) const
  921. + { return __towupper_l(__c, _M_c_locale_ctype); }
  922. +
  923. + const wchar_t*
  924. + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
  925. + {
  926. + while (__lo < __hi)
  927. + {
  928. + *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
  929. + ++__lo;
  930. + }
  931. + return __hi;
  932. + }
  933. +
  934. + wchar_t
  935. + ctype<wchar_t>::do_tolower(wchar_t __c) const
  936. + { return __towlower_l(__c, _M_c_locale_ctype); }
  937. +
  938. + const wchar_t*
  939. + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
  940. + {
  941. + while (__lo < __hi)
  942. + {
  943. + *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
  944. + ++__lo;
  945. + }
  946. + return __hi;
  947. + }
  948. +
  949. + bool
  950. + ctype<wchar_t>::
  951. + do_is(mask __m, wchar_t __c) const
  952. + {
  953. + // Highest bitmask in ctype_base == 10, but extra in "C"
  954. + // library for blank.
  955. + bool __ret = false;
  956. + const size_t __bitmasksize = 11;
  957. + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
  958. + if (__m & _M_bit[__bitcur]
  959. + && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
  960. + {
  961. + __ret = true;
  962. + break;
  963. + }
  964. + return __ret;
  965. + }
  966. +
  967. + const wchar_t*
  968. + ctype<wchar_t>::
  969. + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
  970. + {
  971. + for (; __lo < __hi; ++__vec, ++__lo)
  972. + {
  973. + // Highest bitmask in ctype_base == 10, but extra in "C"
  974. + // library for blank.
  975. + const size_t __bitmasksize = 11;
  976. + mask __m = 0;
  977. + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
  978. + if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
  979. + __m |= _M_bit[__bitcur];
  980. + *__vec = __m;
  981. + }
  982. + return __hi;
  983. + }
  984. +
  985. + const wchar_t*
  986. + ctype<wchar_t>::
  987. + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
  988. + {
  989. + while (__lo < __hi && !this->do_is(__m, *__lo))
  990. + ++__lo;
  991. + return __lo;
  992. + }
  993. +
  994. + const wchar_t*
  995. + ctype<wchar_t>::
  996. + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
  997. + {
  998. + while (__lo < __hi && this->do_is(__m, *__lo) != 0)
  999. + ++__lo;
  1000. + return __lo;
  1001. + }
  1002. +
  1003. + wchar_t
  1004. + ctype<wchar_t>::
  1005. + do_widen(char __c) const
  1006. + { return _M_widen[static_cast<unsigned char>(__c)]; }
  1007. +
  1008. + const char*
  1009. + ctype<wchar_t>::
  1010. + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
  1011. + {
  1012. + while (__lo < __hi)
  1013. + {
  1014. + *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
  1015. + ++__lo;
  1016. + ++__dest;
  1017. + }
  1018. + return __hi;
  1019. + }
  1020. +
  1021. + char
  1022. + ctype<wchar_t>::
  1023. + do_narrow(wchar_t __wc, char __dfault) const
  1024. + {
  1025. + if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
  1026. + return _M_narrow[__wc];
  1027. +#ifdef __UCLIBC_HAS_XLOCALE__
  1028. + __c_locale __old = __uselocale(_M_c_locale_ctype);
  1029. +#endif
  1030. + const int __c = wctob(__wc);
  1031. +#ifdef __UCLIBC_HAS_XLOCALE__
  1032. + __uselocale(__old);
  1033. +#endif
  1034. + return (__c == EOF ? __dfault : static_cast<char>(__c));
  1035. + }
  1036. +
  1037. + const wchar_t*
  1038. + ctype<wchar_t>::
  1039. + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
  1040. + char* __dest) const
  1041. + {
  1042. +#ifdef __UCLIBC_HAS_XLOCALE__
  1043. + __c_locale __old = __uselocale(_M_c_locale_ctype);
  1044. +#endif
  1045. + if (_M_narrow_ok)
  1046. + while (__lo < __hi)
  1047. + {
  1048. + if (*__lo >= 0 && *__lo < 128)
  1049. + *__dest = _M_narrow[*__lo];
  1050. + else
  1051. + {
  1052. + const int __c = wctob(*__lo);
  1053. + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
  1054. + }
  1055. + ++__lo;
  1056. + ++__dest;
  1057. + }
  1058. + else
  1059. + while (__lo < __hi)
  1060. + {
  1061. + const int __c = wctob(*__lo);
  1062. + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
  1063. + ++__lo;
  1064. + ++__dest;
  1065. + }
  1066. +#ifdef __UCLIBC_HAS_XLOCALE__
  1067. + __uselocale(__old);
  1068. +#endif
  1069. + return __hi;
  1070. + }
  1071. +
  1072. + void
  1073. + ctype<wchar_t>::_M_initialize_ctype()
  1074. + {
  1075. +#ifdef __UCLIBC_HAS_XLOCALE__
  1076. + __c_locale __old = __uselocale(_M_c_locale_ctype);
  1077. +#endif
  1078. + wint_t __i;
  1079. + for (__i = 0; __i < 128; ++__i)
  1080. + {
  1081. + const int __c = wctob(__i);
  1082. + if (__c == EOF)
  1083. + break;
  1084. + else
  1085. + _M_narrow[__i] = static_cast<char>(__c);
  1086. + }
  1087. + if (__i == 128)
  1088. + _M_narrow_ok = true;
  1089. + else
  1090. + _M_narrow_ok = false;
  1091. + for (size_t __j = 0;
  1092. + __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
  1093. + _M_widen[__j] = btowc(__j);
  1094. +
  1095. + for (size_t __k = 0; __k <= 11; ++__k)
  1096. + {
  1097. + _M_bit[__k] = static_cast<mask>(_ISbit(__k));
  1098. + _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
  1099. + }
  1100. +#ifdef __UCLIBC_HAS_XLOCALE__
  1101. + __uselocale(__old);
  1102. +#endif
  1103. + }
  1104. +#endif // _GLIBCXX_USE_WCHAR_T
  1105. +}
  1106. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
  1107. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 18:00:00.000000000 -0600
  1108. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2005-04-28 01:13:15.000000000 -0500
  1109. @@ -0,0 +1,100 @@
  1110. +// std::messages implementation details, GNU version -*- C++ -*-
  1111. +
  1112. +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
  1113. +//
  1114. +// This file is part of the GNU ISO C++ Library. This library is free
  1115. +// software; you can redistribute it and/or modify it under the
  1116. +// terms of the GNU General Public License as published by the
  1117. +// Free Software Foundation; either version 2, or (at your option)
  1118. +// any later version.
  1119. +
  1120. +// This library is distributed in the hope that it will be useful,
  1121. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1122. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1123. +// GNU General Public License for more details.
  1124. +
  1125. +// You should have received a copy of the GNU General Public License along
  1126. +// with this library; see the file COPYING. If not, write to the Free
  1127. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1128. +// USA.
  1129. +
  1130. +// As a special exception, you may use this file as part of a free software
  1131. +// library without restriction. Specifically, if other files instantiate
  1132. +// templates or use macros or inline functions from this file, or you compile
  1133. +// this file and link it with other files to produce an executable, this
  1134. +// file does not by itself cause the resulting executable to be covered by
  1135. +// the GNU General Public License. This exception does not however
  1136. +// invalidate any other reasons why the executable file might be covered by
  1137. +// the GNU General Public License.
  1138. +
  1139. +//
  1140. +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
  1141. +//
  1142. +
  1143. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  1144. +
  1145. +#include <locale>
  1146. +#include <bits/c++locale_internal.h>
  1147. +
  1148. +#ifdef __UCLIBC_MJN3_ONLY__
  1149. +#warning fix gettext stuff
  1150. +#endif
  1151. +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
  1152. +extern "C" char *__dcgettext(const char *domainname,
  1153. + const char *msgid, int category);
  1154. +#undef gettext
  1155. +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
  1156. +#else
  1157. +#undef gettext
  1158. +#define gettext(msgid) (msgid)
  1159. +#endif
  1160. +
  1161. +namespace std
  1162. +{
  1163. + // Specializations.
  1164. + template<>
  1165. + string
  1166. + messages<char>::do_get(catalog, int, int, const string& __dfault) const
  1167. + {
  1168. +#ifdef __UCLIBC_HAS_XLOCALE__
  1169. + __c_locale __old = __uselocale(_M_c_locale_messages);
  1170. + const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
  1171. + __uselocale(__old);
  1172. + return string(__msg);
  1173. +#elif defined __UCLIBC_HAS_LOCALE__
  1174. + char* __old = strdup(setlocale(LC_ALL, NULL));
  1175. + setlocale(LC_ALL, _M_name_messages);
  1176. + const char* __msg = gettext(__dfault.c_str());
  1177. + setlocale(LC_ALL, __old);
  1178. + free(__old);
  1179. + return string(__msg);
  1180. +#else
  1181. + const char* __msg = gettext(__dfault.c_str());
  1182. + return string(__msg);
  1183. +#endif
  1184. + }
  1185. +
  1186. +#ifdef _GLIBCXX_USE_WCHAR_T
  1187. + template<>
  1188. + wstring
  1189. + messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
  1190. + {
  1191. +# ifdef __UCLIBC_HAS_XLOCALE__
  1192. + __c_locale __old = __uselocale(_M_c_locale_messages);
  1193. + char* __msg = gettext(_M_convert_to_char(__dfault));
  1194. + __uselocale(__old);
  1195. + return _M_convert_from_char(__msg);
  1196. +# elif defined __UCLIBC_HAS_LOCALE__
  1197. + char* __old = strdup(setlocale(LC_ALL, NULL));
  1198. + setlocale(LC_ALL, _M_name_messages);
  1199. + char* __msg = gettext(_M_convert_to_char(__dfault));
  1200. + setlocale(LC_ALL, __old);
  1201. + free(__old);
  1202. + return _M_convert_from_char(__msg);
  1203. +# else
  1204. + char* __msg = gettext(_M_convert_to_char(__dfault));
  1205. + return _M_convert_from_char(__msg);
  1206. +# endif
  1207. + }
  1208. +#endif
  1209. +}
  1210. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h
  1211. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600
  1212. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2005-04-28 01:13:15.000000000 -0500
  1213. @@ -0,0 +1,118 @@
  1214. +// std::messages implementation details, GNU version -*- C++ -*-
  1215. +
  1216. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  1217. +//
  1218. +// This file is part of the GNU ISO C++ Library. This library is free
  1219. +// software; you can redistribute it and/or modify it under the
  1220. +// terms of the GNU General Public License as published by the
  1221. +// Free Software Foundation; either version 2, or (at your option)
  1222. +// any later version.
  1223. +
  1224. +// This library is distributed in the hope that it will be useful,
  1225. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1226. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1227. +// GNU General Public License for more details.
  1228. +
  1229. +// You should have received a copy of the GNU General Public License along
  1230. +// with this library; see the file COPYING. If not, write to the Free
  1231. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1232. +// USA.
  1233. +
  1234. +// As a special exception, you may use this file as part of a free software
  1235. +// library without restriction. Specifically, if other files instantiate
  1236. +// templates or use macros or inline functions from this file, or you compile
  1237. +// this file and link it with other files to produce an executable, this
  1238. +// file does not by itself cause the resulting executable to be covered by
  1239. +// the GNU General Public License. This exception does not however
  1240. +// invalidate any other reasons why the executable file might be covered by
  1241. +// the GNU General Public License.
  1242. +
  1243. +//
  1244. +// ISO C++ 14882: 22.2.7.1.2 messages functions
  1245. +//
  1246. +
  1247. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  1248. +
  1249. +#ifdef __UCLIBC_MJN3_ONLY__
  1250. +#warning fix prototypes for *textdomain funcs
  1251. +#endif
  1252. +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
  1253. +extern "C" char *__textdomain(const char *domainname);
  1254. +extern "C" char *__bindtextdomain(const char *domainname,
  1255. + const char *dirname);
  1256. +#else
  1257. +#undef __textdomain
  1258. +#undef __bindtextdomain
  1259. +#define __textdomain(D) ((void)0)
  1260. +#define __bindtextdomain(D,P) ((void)0)
  1261. +#endif
  1262. +
  1263. + // Non-virtual member functions.
  1264. + template<typename _CharT>
  1265. + messages<_CharT>::messages(size_t __refs)
  1266. + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
  1267. + _M_name_messages(_S_get_c_name())
  1268. + { }
  1269. +
  1270. + template<typename _CharT>
  1271. + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
  1272. + size_t __refs)
  1273. + : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
  1274. + _M_name_messages(__s)
  1275. + {
  1276. + char* __tmp = new char[std::strlen(__s) + 1];
  1277. + std::strcpy(__tmp, __s);
  1278. + _M_name_messages = __tmp;
  1279. + }
  1280. +
  1281. + template<typename _CharT>
  1282. + typename messages<_CharT>::catalog
  1283. + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
  1284. + const char* __dir) const
  1285. + {
  1286. + __bindtextdomain(__s.c_str(), __dir);
  1287. + return this->do_open(__s, __loc);
  1288. + }
  1289. +
  1290. + // Virtual member functions.
  1291. + template<typename _CharT>
  1292. + messages<_CharT>::~messages()
  1293. + {
  1294. + if (_M_name_messages != _S_get_c_name())
  1295. + delete [] _M_name_messages;
  1296. + _S_destroy_c_locale(_M_c_locale_messages);
  1297. + }
  1298. +
  1299. + template<typename _CharT>
  1300. + typename messages<_CharT>::catalog
  1301. + messages<_CharT>::do_open(const basic_string<char>& __s,
  1302. + const locale&) const
  1303. + {
  1304. + // No error checking is done, assume the catalog exists and can
  1305. + // be used.
  1306. + __textdomain(__s.c_str());
  1307. + return 0;
  1308. + }
  1309. +
  1310. + template<typename _CharT>
  1311. + void
  1312. + messages<_CharT>::do_close(catalog) const
  1313. + { }
  1314. +
  1315. + // messages_byname
  1316. + template<typename _CharT>
  1317. + messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
  1318. + : messages<_CharT>(__refs)
  1319. + {
  1320. + if (this->_M_name_messages != locale::facet::_S_get_c_name())
  1321. + delete [] this->_M_name_messages;
  1322. + char* __tmp = new char[std::strlen(__s) + 1];
  1323. + std::strcpy(__tmp, __s);
  1324. + this->_M_name_messages = __tmp;
  1325. +
  1326. + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
  1327. + {
  1328. + this->_S_destroy_c_locale(this->_M_c_locale_messages);
  1329. + this->_S_create_c_locale(this->_M_c_locale_messages, __s);
  1330. + }
  1331. + }
  1332. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
  1333. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 18:00:00.000000000 -0600
  1334. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2005-04-28 01:23:02.000000000 -0500
  1335. @@ -0,0 +1,692 @@
  1336. +// std::moneypunct implementation details, GNU version -*- C++ -*-
  1337. +
  1338. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  1339. +//
  1340. +// This file is part of the GNU ISO C++ Library. This library is free
  1341. +// software; you can redistribute it and/or modify it under the
  1342. +// terms of the GNU General Public License as published by the
  1343. +// Free Software Foundation; either version 2, or (at your option)
  1344. +// any later version.
  1345. +
  1346. +// This library is distributed in the hope that it will be useful,
  1347. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1348. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1349. +// GNU General Public License for more details.
  1350. +
  1351. +// You should have received a copy of the GNU General Public License along
  1352. +// with this library; see the file COPYING. If not, write to the Free
  1353. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1354. +// USA.
  1355. +
  1356. +// As a special exception, you may use this file as part of a free software
  1357. +// library without restriction. Specifically, if other files instantiate
  1358. +// templates or use macros or inline functions from this file, or you compile
  1359. +// this file and link it with other files to produce an executable, this
  1360. +// file does not by itself cause the resulting executable to be covered by
  1361. +// the GNU General Public License. This exception does not however
  1362. +// invalidate any other reasons why the executable file might be covered by
  1363. +// the GNU General Public License.
  1364. +
  1365. +//
  1366. +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
  1367. +//
  1368. +
  1369. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  1370. +
  1371. +#define _LIBC
  1372. +#include <locale>
  1373. +#undef _LIBC
  1374. +#include <bits/c++locale_internal.h>
  1375. +
  1376. +#ifdef __UCLIBC_MJN3_ONLY__
  1377. +#warning optimize this for uclibc
  1378. +#warning tailor for stub locale support
  1379. +#endif
  1380. +
  1381. +#ifndef __UCLIBC_HAS_XLOCALE__
  1382. +#define __nl_langinfo_l(N, L) nl_langinfo((N))
  1383. +#endif
  1384. +
  1385. +namespace std
  1386. +{
  1387. + // Construct and return valid pattern consisting of some combination of:
  1388. + // space none symbol sign value
  1389. + money_base::pattern
  1390. + money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
  1391. + {
  1392. + pattern __ret;
  1393. +
  1394. + // This insanely complicated routine attempts to construct a valid
  1395. + // pattern for use with monyepunct. A couple of invariants:
  1396. +
  1397. + // if (__precedes) symbol -> value
  1398. + // else value -> symbol
  1399. +
  1400. + // if (__space) space
  1401. + // else none
  1402. +
  1403. + // none == never first
  1404. + // space never first or last
  1405. +
  1406. + // Any elegant implementations of this are welcome.
  1407. + switch (__posn)
  1408. + {
  1409. + case 0:
  1410. + case 1:
  1411. + // 1 The sign precedes the value and symbol.
  1412. + __ret.field[0] = sign;
  1413. + if (__space)
  1414. + {
  1415. + // Pattern starts with sign.
  1416. + if (__precedes)
  1417. + {
  1418. + __ret.field[1] = symbol;
  1419. + __ret.field[3] = value;
  1420. + }
  1421. + else
  1422. + {
  1423. + __ret.field[1] = value;
  1424. + __ret.field[3] = symbol;
  1425. + }
  1426. + __ret.field[2] = space;
  1427. + }
  1428. + else
  1429. + {
  1430. + // Pattern starts with sign and ends with none.
  1431. + if (__precedes)
  1432. + {
  1433. + __ret.field[1] = symbol;
  1434. + __ret.field[2] = value;
  1435. + }
  1436. + else
  1437. + {
  1438. + __ret.field[1] = value;
  1439. + __ret.field[2] = symbol;
  1440. + }
  1441. + __ret.field[3] = none;
  1442. + }
  1443. + break;
  1444. + case 2:
  1445. + // 2 The sign follows the value and symbol.
  1446. + if (__space)
  1447. + {
  1448. + // Pattern either ends with sign.
  1449. + if (__precedes)
  1450. + {
  1451. + __ret.field[0] = symbol;
  1452. + __ret.field[2] = value;
  1453. + }
  1454. + else
  1455. + {
  1456. + __ret.field[0] = value;
  1457. + __ret.field[2] = symbol;
  1458. + }
  1459. + __ret.field[1] = space;
  1460. + __ret.field[3] = sign;
  1461. + }
  1462. + else
  1463. + {
  1464. + // Pattern ends with sign then none.
  1465. + if (__precedes)
  1466. + {
  1467. + __ret.field[0] = symbol;
  1468. + __ret.field[1] = value;
  1469. + }
  1470. + else
  1471. + {
  1472. + __ret.field[0] = value;
  1473. + __ret.field[1] = symbol;
  1474. + }
  1475. + __ret.field[2] = sign;
  1476. + __ret.field[3] = none;
  1477. + }
  1478. + break;
  1479. + case 3:
  1480. + // 3 The sign immediately precedes the symbol.
  1481. + if (__precedes)
  1482. + {
  1483. + __ret.field[0] = sign;
  1484. + __ret.field[1] = symbol;
  1485. + if (__space)
  1486. + {
  1487. + __ret.field[2] = space;
  1488. + __ret.field[3] = value;
  1489. + }
  1490. + else
  1491. + {
  1492. + __ret.field[2] = value;
  1493. + __ret.field[3] = none;
  1494. + }
  1495. + }
  1496. + else
  1497. + {
  1498. + __ret.field[0] = value;
  1499. + if (__space)
  1500. + {
  1501. + __ret.field[1] = space;
  1502. + __ret.field[2] = sign;
  1503. + __ret.field[3] = symbol;
  1504. + }
  1505. + else
  1506. + {
  1507. + __ret.field[1] = sign;
  1508. + __ret.field[2] = symbol;
  1509. + __ret.field[3] = none;
  1510. + }
  1511. + }
  1512. + break;
  1513. + case 4:
  1514. + // 4 The sign immediately follows the symbol.
  1515. + if (__precedes)
  1516. + {
  1517. + __ret.field[0] = symbol;
  1518. + __ret.field[1] = sign;
  1519. + if (__space)
  1520. + {
  1521. + __ret.field[2] = space;
  1522. + __ret.field[3] = value;
  1523. + }
  1524. + else
  1525. + {
  1526. + __ret.field[2] = value;
  1527. + __ret.field[3] = none;
  1528. + }
  1529. + }
  1530. + else
  1531. + {
  1532. + __ret.field[0] = value;
  1533. + if (__space)
  1534. + {
  1535. + __ret.field[1] = space;
  1536. + __ret.field[2] = symbol;
  1537. + __ret.field[3] = sign;
  1538. + }
  1539. + else
  1540. + {
  1541. + __ret.field[1] = symbol;
  1542. + __ret.field[2] = sign;
  1543. + __ret.field[3] = none;
  1544. + }
  1545. + }
  1546. + break;
  1547. + default:
  1548. + __ret = pattern();
  1549. + }
  1550. + return __ret;
  1551. + }
  1552. +
  1553. + template<>
  1554. + void
  1555. + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
  1556. + const char*)
  1557. + {
  1558. + if (!_M_data)
  1559. + _M_data = new __moneypunct_cache<char, true>;
  1560. +
  1561. + if (!__cloc)
  1562. + {
  1563. + // "C" locale
  1564. + _M_data->_M_decimal_point = '.';
  1565. + _M_data->_M_thousands_sep = ',';
  1566. + _M_data->_M_grouping = "";
  1567. + _M_data->_M_grouping_size = 0;
  1568. + _M_data->_M_curr_symbol = "";
  1569. + _M_data->_M_curr_symbol_size = 0;
  1570. + _M_data->_M_positive_sign = "";
  1571. + _M_data->_M_positive_sign_size = 0;
  1572. + _M_data->_M_negative_sign = "";
  1573. + _M_data->_M_negative_sign_size = 0;
  1574. + _M_data->_M_frac_digits = 0;
  1575. + _M_data->_M_pos_format = money_base::_S_default_pattern;
  1576. + _M_data->_M_neg_format = money_base::_S_default_pattern;
  1577. +
  1578. + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1579. + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
  1580. + }
  1581. + else
  1582. + {
  1583. + // Named locale.
  1584. + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
  1585. + __cloc));
  1586. + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
  1587. + __cloc));
  1588. + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1589. + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1590. + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1591. + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
  1592. +
  1593. + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
  1594. + if (!__nposn)
  1595. + _M_data->_M_negative_sign = "()";
  1596. + else
  1597. + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
  1598. + __cloc);
  1599. + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
  1600. +
  1601. + // _Intl == true
  1602. + _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
  1603. + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
  1604. + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
  1605. + __cloc));
  1606. + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
  1607. + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
  1608. + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
  1609. + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
  1610. + __pposn);
  1611. + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
  1612. + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
  1613. + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
  1614. + __nposn);
  1615. + }
  1616. + }
  1617. +
  1618. + template<>
  1619. + void
  1620. + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
  1621. + const char*)
  1622. + {
  1623. + if (!_M_data)
  1624. + _M_data = new __moneypunct_cache<char, false>;
  1625. +
  1626. + if (!__cloc)
  1627. + {
  1628. + // "C" locale
  1629. + _M_data->_M_decimal_point = '.';
  1630. + _M_data->_M_thousands_sep = ',';
  1631. + _M_data->_M_grouping = "";
  1632. + _M_data->_M_grouping_size = 0;
  1633. + _M_data->_M_curr_symbol = "";
  1634. + _M_data->_M_curr_symbol_size = 0;
  1635. + _M_data->_M_positive_sign = "";
  1636. + _M_data->_M_positive_sign_size = 0;
  1637. + _M_data->_M_negative_sign = "";
  1638. + _M_data->_M_negative_sign_size = 0;
  1639. + _M_data->_M_frac_digits = 0;
  1640. + _M_data->_M_pos_format = money_base::_S_default_pattern;
  1641. + _M_data->_M_neg_format = money_base::_S_default_pattern;
  1642. +
  1643. + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1644. + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
  1645. + }
  1646. + else
  1647. + {
  1648. + // Named locale.
  1649. + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
  1650. + __cloc));
  1651. + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
  1652. + __cloc));
  1653. + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1654. + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1655. + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1656. + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
  1657. +
  1658. + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
  1659. + if (!__nposn)
  1660. + _M_data->_M_negative_sign = "()";
  1661. + else
  1662. + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
  1663. + __cloc);
  1664. + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
  1665. +
  1666. + // _Intl == false
  1667. + _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
  1668. + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
  1669. + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
  1670. + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
  1671. + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
  1672. + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
  1673. + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
  1674. + __pposn);
  1675. + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
  1676. + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
  1677. + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
  1678. + __nposn);
  1679. + }
  1680. + }
  1681. +
  1682. + template<>
  1683. + moneypunct<char, true>::~moneypunct()
  1684. + { delete _M_data; }
  1685. +
  1686. + template<>
  1687. + moneypunct<char, false>::~moneypunct()
  1688. + { delete _M_data; }
  1689. +
  1690. +#ifdef _GLIBCXX_USE_WCHAR_T
  1691. + template<>
  1692. + void
  1693. + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
  1694. +#ifdef __UCLIBC_HAS_XLOCALE__
  1695. + const char*)
  1696. +#else
  1697. + const char* __name)
  1698. +#endif
  1699. + {
  1700. + if (!_M_data)
  1701. + _M_data = new __moneypunct_cache<wchar_t, true>;
  1702. +
  1703. + if (!__cloc)
  1704. + {
  1705. + // "C" locale
  1706. + _M_data->_M_decimal_point = L'.';
  1707. + _M_data->_M_thousands_sep = L',';
  1708. + _M_data->_M_grouping = "";
  1709. + _M_data->_M_grouping_size = 0;
  1710. + _M_data->_M_curr_symbol = L"";
  1711. + _M_data->_M_curr_symbol_size = 0;
  1712. + _M_data->_M_positive_sign = L"";
  1713. + _M_data->_M_positive_sign_size = 0;
  1714. + _M_data->_M_negative_sign = L"";
  1715. + _M_data->_M_negative_sign_size = 0;
  1716. + _M_data->_M_frac_digits = 0;
  1717. + _M_data->_M_pos_format = money_base::_S_default_pattern;
  1718. + _M_data->_M_neg_format = money_base::_S_default_pattern;
  1719. +
  1720. + // Use ctype::widen code without the facet...
  1721. + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1722. + _M_data->_M_atoms[__i] =
  1723. + static_cast<wchar_t>(money_base::_S_atoms[__i]);
  1724. + }
  1725. + else
  1726. + {
  1727. + // Named locale.
  1728. +#ifdef __UCLIBC_HAS_XLOCALE__
  1729. + __c_locale __old = __uselocale(__cloc);
  1730. +#else
  1731. + // Switch to named locale so that mbsrtowcs will work.
  1732. + char* __old = strdup(setlocale(LC_ALL, NULL));
  1733. + setlocale(LC_ALL, __name);
  1734. +#endif
  1735. +
  1736. +#ifdef __UCLIBC_MJN3_ONLY__
  1737. +#warning fix this... should be monetary
  1738. +#endif
  1739. +#ifdef __UCLIBC__
  1740. +# ifdef __UCLIBC_HAS_XLOCALE__
  1741. + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
  1742. + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
  1743. +# else
  1744. + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
  1745. + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
  1746. +# endif
  1747. +#else
  1748. + union { char *__s; wchar_t __w; } __u;
  1749. + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
  1750. + _M_data->_M_decimal_point = __u.__w;
  1751. +
  1752. + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
  1753. + _M_data->_M_thousands_sep = __u.__w;
  1754. +#endif
  1755. + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1756. + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1757. +
  1758. + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1759. + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  1760. + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
  1761. +
  1762. + wchar_t* __wcs_ps = 0;
  1763. + wchar_t* __wcs_ns = 0;
  1764. + const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
  1765. + try
  1766. + {
  1767. + mbstate_t __state;
  1768. + size_t __len = strlen(__cpossign);
  1769. + if (__len)
  1770. + {
  1771. + ++__len;
  1772. + memset(&__state, 0, sizeof(mbstate_t));
  1773. + __wcs_ps = new wchar_t[__len];
  1774. + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
  1775. + _M_data->_M_positive_sign = __wcs_ps;
  1776. + }
  1777. + else
  1778. + _M_data->_M_positive_sign = L"";
  1779. + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
  1780. +
  1781. + __len = strlen(__cnegsign);
  1782. + if (!__nposn)
  1783. + _M_data->_M_negative_sign = L"()";
  1784. + else if (__len)
  1785. + {
  1786. + ++__len;
  1787. + memset(&__state, 0, sizeof(mbstate_t));
  1788. + __wcs_ns = new wchar_t[__len];
  1789. + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
  1790. + _M_data->_M_negative_sign = __wcs_ns;
  1791. + }
  1792. + else
  1793. + _M_data->_M_negative_sign = L"";
  1794. + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
  1795. +
  1796. + // _Intl == true.
  1797. + __len = strlen(__ccurr);
  1798. + if (__len)
  1799. + {
  1800. + ++__len;
  1801. + memset(&__state, 0, sizeof(mbstate_t));
  1802. + wchar_t* __wcs = new wchar_t[__len];
  1803. + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
  1804. + _M_data->_M_curr_symbol = __wcs;
  1805. + }
  1806. + else
  1807. + _M_data->_M_curr_symbol = L"";
  1808. + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
  1809. + }
  1810. + catch (...)
  1811. + {
  1812. + delete _M_data;
  1813. + _M_data = 0;
  1814. + delete __wcs_ps;
  1815. + delete __wcs_ns;
  1816. +#ifdef __UCLIBC_HAS_XLOCALE__
  1817. + __uselocale(__old);
  1818. +#else
  1819. + setlocale(LC_ALL, __old);
  1820. + free(__old);
  1821. +#endif
  1822. + __throw_exception_again;
  1823. + }
  1824. +
  1825. + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
  1826. + __cloc));
  1827. + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
  1828. + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
  1829. + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
  1830. + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
  1831. + __pposn);
  1832. + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
  1833. + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
  1834. + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
  1835. + __nposn);
  1836. +
  1837. +#ifdef __UCLIBC_HAS_XLOCALE__
  1838. + __uselocale(__old);
  1839. +#else
  1840. + setlocale(LC_ALL, __old);
  1841. + free(__old);
  1842. +#endif
  1843. + }
  1844. + }
  1845. +
  1846. + template<>
  1847. + void
  1848. + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
  1849. +#ifdef __UCLIBC_HAS_XLOCALE__
  1850. + const char*)
  1851. +#else
  1852. + const char* __name)
  1853. +#endif
  1854. + {
  1855. + if (!_M_data)
  1856. + _M_data = new __moneypunct_cache<wchar_t, false>;
  1857. +
  1858. + if (!__cloc)
  1859. + {
  1860. + // "C" locale
  1861. + _M_data->_M_decimal_point = L'.';
  1862. + _M_data->_M_thousands_sep = L',';
  1863. + _M_data->_M_grouping = "";
  1864. + _M_data->_M_grouping_size = 0;
  1865. + _M_data->_M_curr_symbol = L"";
  1866. + _M_data->_M_curr_symbol_size = 0;
  1867. + _M_data->_M_positive_sign = L"";
  1868. + _M_data->_M_positive_sign_size = 0;
  1869. + _M_data->_M_negative_sign = L"";
  1870. + _M_data->_M_negative_sign_size = 0;
  1871. + _M_data->_M_frac_digits = 0;
  1872. + _M_data->_M_pos_format = money_base::_S_default_pattern;
  1873. + _M_data->_M_neg_format = money_base::_S_default_pattern;
  1874. +
  1875. + // Use ctype::widen code without the facet...
  1876. + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1877. + _M_data->_M_atoms[__i] =
  1878. + static_cast<wchar_t>(money_base::_S_atoms[__i]);
  1879. + }
  1880. + else
  1881. + {
  1882. + // Named locale.
  1883. +#ifdef __UCLIBC_HAS_XLOCALE__
  1884. + __c_locale __old = __uselocale(__cloc);
  1885. +#else
  1886. + // Switch to named locale so that mbsrtowcs will work.
  1887. + char* __old = strdup(setlocale(LC_ALL, NULL));
  1888. + setlocale(LC_ALL, __name);
  1889. +#endif
  1890. +
  1891. +#ifdef __UCLIBC_MJN3_ONLY__
  1892. +#warning fix this... should be monetary
  1893. +#endif
  1894. +#ifdef __UCLIBC__
  1895. +# ifdef __UCLIBC_HAS_XLOCALE__
  1896. + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
  1897. + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
  1898. +# else
  1899. + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
  1900. + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
  1901. +# endif
  1902. +#else
  1903. + union { char *__s; wchar_t __w; } __u;
  1904. + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
  1905. + _M_data->_M_decimal_point = __u.__w;
  1906. +
  1907. + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
  1908. + _M_data->_M_thousands_sep = __u.__w;
  1909. +#endif
  1910. + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1911. + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1912. +
  1913. + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1914. + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  1915. + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
  1916. +
  1917. + wchar_t* __wcs_ps = 0;
  1918. + wchar_t* __wcs_ns = 0;
  1919. + const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
  1920. + try
  1921. + {
  1922. + mbstate_t __state;
  1923. + size_t __len;
  1924. + __len = strlen(__cpossign);
  1925. + if (__len)
  1926. + {
  1927. + ++__len;
  1928. + memset(&__state, 0, sizeof(mbstate_t));
  1929. + __wcs_ps = new wchar_t[__len];
  1930. + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
  1931. + _M_data->_M_positive_sign = __wcs_ps;
  1932. + }
  1933. + else
  1934. + _M_data->_M_positive_sign = L"";
  1935. + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
  1936. +
  1937. + __len = strlen(__cnegsign);
  1938. + if (!__nposn)
  1939. + _M_data->_M_negative_sign = L"()";
  1940. + else if (__len)
  1941. + {
  1942. + ++__len;
  1943. + memset(&__state, 0, sizeof(mbstate_t));
  1944. + __wcs_ns = new wchar_t[__len];
  1945. + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
  1946. + _M_data->_M_negative_sign = __wcs_ns;
  1947. + }
  1948. + else
  1949. + _M_data->_M_negative_sign = L"";
  1950. + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
  1951. +
  1952. + // _Intl == true.
  1953. + __len = strlen(__ccurr);
  1954. + if (__len)
  1955. + {
  1956. + ++__len;
  1957. + memset(&__state, 0, sizeof(mbstate_t));
  1958. + wchar_t* __wcs = new wchar_t[__len];
  1959. + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
  1960. + _M_data->_M_curr_symbol = __wcs;
  1961. + }
  1962. + else
  1963. + _M_data->_M_curr_symbol = L"";
  1964. + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
  1965. + }
  1966. + catch (...)
  1967. + {
  1968. + delete _M_data;
  1969. + _M_data = 0;
  1970. + delete __wcs_ps;
  1971. + delete __wcs_ns;
  1972. +#ifdef __UCLIBC_HAS_XLOCALE__
  1973. + __uselocale(__old);
  1974. +#else
  1975. + setlocale(LC_ALL, __old);
  1976. + free(__old);
  1977. +#endif
  1978. + __throw_exception_again;
  1979. + }
  1980. +
  1981. + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
  1982. + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
  1983. + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
  1984. + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
  1985. + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
  1986. + __pposn);
  1987. + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
  1988. + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
  1989. + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
  1990. + __nposn);
  1991. +
  1992. +#ifdef __UCLIBC_HAS_XLOCALE__
  1993. + __uselocale(__old);
  1994. +#else
  1995. + setlocale(LC_ALL, __old);
  1996. + free(__old);
  1997. +#endif
  1998. + }
  1999. + }
  2000. +
  2001. + template<>
  2002. + moneypunct<wchar_t, true>::~moneypunct()
  2003. + {
  2004. + if (_M_data->_M_positive_sign_size)
  2005. + delete [] _M_data->_M_positive_sign;
  2006. + if (_M_data->_M_negative_sign_size
  2007. + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
  2008. + delete [] _M_data->_M_negative_sign;
  2009. + if (_M_data->_M_curr_symbol_size)
  2010. + delete [] _M_data->_M_curr_symbol;
  2011. + delete _M_data;
  2012. + }
  2013. +
  2014. + template<>
  2015. + moneypunct<wchar_t, false>::~moneypunct()
  2016. + {
  2017. + if (_M_data->_M_positive_sign_size)
  2018. + delete [] _M_data->_M_positive_sign;
  2019. + if (_M_data->_M_negative_sign_size
  2020. + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
  2021. + delete [] _M_data->_M_negative_sign;
  2022. + if (_M_data->_M_curr_symbol_size)
  2023. + delete [] _M_data->_M_curr_symbol;
  2024. + delete _M_data;
  2025. + }
  2026. +#endif
  2027. +}
  2028. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
  2029. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600
  2030. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2005-04-28 01:20:20.000000000 -0500
  2031. @@ -0,0 +1,173 @@
  2032. +// std::numpunct implementation details, GNU version -*- C++ -*-
  2033. +
  2034. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  2035. +//
  2036. +// This file is part of the GNU ISO C++ Library. This library is free
  2037. +// software; you can redistribute it and/or modify it under the
  2038. +// terms of the GNU General Public License as published by the
  2039. +// Free Software Foundation; either version 2, or (at your option)
  2040. +// any later version.
  2041. +
  2042. +// This library is distributed in the hope that it will be useful,
  2043. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  2044. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2045. +// GNU General Public License for more details.
  2046. +
  2047. +// You should have received a copy of the GNU General Public License along
  2048. +// with this library; see the file COPYING. If not, write to the Free
  2049. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  2050. +// USA.
  2051. +
  2052. +// As a special exception, you may use this file as part of a free software
  2053. +// library without restriction. Specifically, if other files instantiate
  2054. +// templates or use macros or inline functions from this file, or you compile
  2055. +// this file and link it with other files to produce an executable, this
  2056. +// file does not by itself cause the resulting executable to be covered by
  2057. +// the GNU General Public License. This exception does not however
  2058. +// invalidate any other reasons why the executable file might be covered by
  2059. +// the GNU General Public License.
  2060. +
  2061. +//
  2062. +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
  2063. +//
  2064. +
  2065. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  2066. +
  2067. +#define _LIBC
  2068. +#include <locale>
  2069. +#undef _LIBC
  2070. +#include <bits/c++locale_internal.h>
  2071. +
  2072. +#ifdef __UCLIBC_MJN3_ONLY__
  2073. +#warning tailor for stub locale support
  2074. +#endif
  2075. +#ifndef __UCLIBC_HAS_XLOCALE__
  2076. +#define __nl_langinfo_l(N, L) nl_langinfo((N))
  2077. +#endif
  2078. +
  2079. +namespace std
  2080. +{
  2081. + template<>
  2082. + void
  2083. + numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
  2084. + {
  2085. + if (!_M_data)
  2086. + _M_data = new __numpunct_cache<char>;
  2087. +
  2088. + if (!__cloc)
  2089. + {
  2090. + // "C" locale
  2091. + _M_data->_M_grouping = "";
  2092. + _M_data->_M_grouping_size = 0;
  2093. + _M_data->_M_use_grouping = false;
  2094. +
  2095. + _M_data->_M_decimal_point = '.';
  2096. + _M_data->_M_thousands_sep = ',';
  2097. +
  2098. + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
  2099. + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
  2100. +
  2101. + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
  2102. + _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
  2103. + }
  2104. + else
  2105. + {
  2106. + // Named locale.
  2107. + _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
  2108. + __cloc));
  2109. + _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
  2110. + __cloc));
  2111. +
  2112. + // Check for NULL, which implies no grouping.
  2113. + if (_M_data->_M_thousands_sep == '\0')
  2114. + _M_data->_M_grouping = "";
  2115. + else
  2116. + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  2117. + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  2118. + }
  2119. +
  2120. + // NB: There is no way to extact this info from posix locales.
  2121. + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
  2122. + _M_data->_M_truename = "true";
  2123. + _M_data->_M_truename_size = 4;
  2124. + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
  2125. + _M_data->_M_falsename = "false";
  2126. + _M_data->_M_falsename_size = 5;
  2127. + }
  2128. +
  2129. + template<>
  2130. + numpunct<char>::~numpunct()
  2131. + { delete _M_data; }
  2132. +
  2133. +#ifdef _GLIBCXX_USE_WCHAR_T
  2134. + template<>
  2135. + void
  2136. + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
  2137. + {
  2138. + if (!_M_data)
  2139. + _M_data = new __numpunct_cache<wchar_t>;
  2140. +
  2141. + if (!__cloc)
  2142. + {
  2143. + // "C" locale
  2144. + _M_data->_M_grouping = "";
  2145. + _M_data->_M_grouping_size = 0;
  2146. + _M_data->_M_use_grouping = false;
  2147. +
  2148. + _M_data->_M_decimal_point = L'.';
  2149. + _M_data->_M_thousands_sep = L',';
  2150. +
  2151. + // Use ctype::widen code without the facet...
  2152. + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
  2153. + _M_data->_M_atoms_out[__i] =
  2154. + static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
  2155. +
  2156. + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
  2157. + _M_data->_M_atoms_in[__j] =
  2158. + static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
  2159. + }
  2160. + else
  2161. + {
  2162. + // Named locale.
  2163. + // NB: In the GNU model wchar_t is always 32 bit wide.
  2164. +#ifdef __UCLIBC_MJN3_ONLY__
  2165. +#warning fix this
  2166. +#endif
  2167. +#ifdef __UCLIBC__
  2168. +# ifdef __UCLIBC_HAS_XLOCALE__
  2169. + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
  2170. + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
  2171. +# else
  2172. + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
  2173. + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
  2174. +# endif
  2175. +#else
  2176. + union { char *__s; wchar_t __w; } __u;
  2177. + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
  2178. + _M_data->_M_decimal_point = __u.__w;
  2179. +
  2180. + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
  2181. + _M_data->_M_thousands_sep = __u.__w;
  2182. +#endif
  2183. +
  2184. + if (_M_data->_M_thousands_sep == L'\0')
  2185. + _M_data->_M_grouping = "";
  2186. + else
  2187. + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  2188. + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  2189. + }
  2190. +
  2191. + // NB: There is no way to extact this info from posix locales.
  2192. + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
  2193. + _M_data->_M_truename = L"true";
  2194. + _M_data->_M_truename_size = 4;
  2195. + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
  2196. + _M_data->_M_falsename = L"false";
  2197. + _M_data->_M_falsename_size = 5;
  2198. + }
  2199. +
  2200. + template<>
  2201. + numpunct<wchar_t>::~numpunct()
  2202. + { delete _M_data; }
  2203. + #endif
  2204. +}
  2205. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc
  2206. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 18:00:00.000000000 -0600
  2207. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2005-04-28 01:13:15.000000000 -0500
  2208. @@ -0,0 +1,406 @@
  2209. +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
  2210. +
  2211. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  2212. +//
  2213. +// This file is part of the GNU ISO C++ Library. This library is free
  2214. +// software; you can redistribute it and/or modify it under the
  2215. +// terms of the GNU General Public License as published by the
  2216. +// Free Software Foundation; either version 2, or (at your option)
  2217. +// any later version.
  2218. +
  2219. +// This library is distributed in the hope that it will be useful,
  2220. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  2221. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2222. +// GNU General Public License for more details.
  2223. +
  2224. +// You should have received a copy of the GNU General Public License along
  2225. +// with this library; see the file COPYING. If not, write to the Free
  2226. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  2227. +// USA.
  2228. +
  2229. +// As a special exception, you may use this file as part of a free software
  2230. +// library without restriction. Specifically, if other files instantiate
  2231. +// templates or use macros or inline functions from this file, or you compile
  2232. +// this file and link it with other files to produce an executable, this
  2233. +// file does not by itself cause the resulting executable to be covered by
  2234. +// the GNU General Public License. This exception does not however
  2235. +// invalidate any other reasons why the executable file might be covered by
  2236. +// the GNU General Public License.
  2237. +
  2238. +//
  2239. +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
  2240. +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
  2241. +//
  2242. +
  2243. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  2244. +
  2245. +#include <locale>
  2246. +#include <bits/c++locale_internal.h>
  2247. +
  2248. +#ifdef __UCLIBC_MJN3_ONLY__
  2249. +#warning tailor for stub locale support
  2250. +#endif
  2251. +#ifndef __UCLIBC_HAS_XLOCALE__
  2252. +#define __nl_langinfo_l(N, L) nl_langinfo((N))
  2253. +#endif
  2254. +
  2255. +namespace std
  2256. +{
  2257. + template<>
  2258. + void
  2259. + __timepunct<char>::
  2260. + _M_put(char* __s, size_t __maxlen, const char* __format,
  2261. + const tm* __tm) const
  2262. + {
  2263. +#ifdef __UCLIBC_HAS_XLOCALE__
  2264. + const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
  2265. + _M_c_locale_timepunct);
  2266. +#else
  2267. + char* __old = strdup(setlocale(LC_ALL, NULL));
  2268. + setlocale(LC_ALL, _M_name_timepunct);
  2269. + const size_t __len = strftime(__s, __maxlen, __format, __tm);
  2270. + setlocale(LC_ALL, __old);
  2271. + free(__old);
  2272. +#endif
  2273. + // Make sure __s is null terminated.
  2274. + if (__len == 0)
  2275. + __s[0] = '\0';
  2276. + }
  2277. +
  2278. + template<>
  2279. + void
  2280. + __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
  2281. + {
  2282. + if (!_M_data)
  2283. + _M_data = new __timepunct_cache<char>;
  2284. +
  2285. + if (!__cloc)
  2286. + {
  2287. + // "C" locale
  2288. + _M_c_locale_timepunct = _S_get_c_locale();
  2289. +
  2290. + _M_data->_M_date_format = "%m/%d/%y";
  2291. + _M_data->_M_date_era_format = "%m/%d/%y";
  2292. + _M_data->_M_time_format = "%H:%M:%S";
  2293. + _M_data->_M_time_era_format = "%H:%M:%S";
  2294. + _M_data->_M_date_time_format = "";
  2295. + _M_data->_M_date_time_era_format = "";
  2296. + _M_data->_M_am = "AM";
  2297. + _M_data->_M_pm = "PM";
  2298. + _M_data->_M_am_pm_format = "";
  2299. +
  2300. + // Day names, starting with "C"'s Sunday.
  2301. + _M_data->_M_day1 = "Sunday";
  2302. + _M_data->_M_day2 = "Monday";
  2303. + _M_data->_M_day3 = "Tuesday";
  2304. + _M_data->_M_day4 = "Wednesday";
  2305. + _M_data->_M_day5 = "Thursday";
  2306. + _M_data->_M_day6 = "Friday";
  2307. + _M_data->_M_day7 = "Saturday";
  2308. +
  2309. + // Abbreviated day names, starting with "C"'s Sun.
  2310. + _M_data->_M_aday1 = "Sun";
  2311. + _M_data->_M_aday2 = "Mon";
  2312. + _M_data->_M_aday3 = "Tue";
  2313. + _M_data->_M_aday4 = "Wed";
  2314. + _M_data->_M_aday5 = "Thu";
  2315. + _M_data->_M_aday6 = "Fri";
  2316. + _M_data->_M_aday7 = "Sat";
  2317. +
  2318. + // Month names, starting with "C"'s January.
  2319. + _M_data->_M_month01 = "January";
  2320. + _M_data->_M_month02 = "February";
  2321. + _M_data->_M_month03 = "March";
  2322. + _M_data->_M_month04 = "April";
  2323. + _M_data->_M_month05 = "May";
  2324. + _M_data->_M_month06 = "June";
  2325. + _M_data->_M_month07 = "July";
  2326. + _M_data->_M_month08 = "August";
  2327. + _M_data->_M_month09 = "September";
  2328. + _M_data->_M_month10 = "October";
  2329. + _M_data->_M_month11 = "November";
  2330. + _M_data->_M_month12 = "December";
  2331. +
  2332. + // Abbreviated month names, starting with "C"'s Jan.
  2333. + _M_data->_M_amonth01 = "Jan";
  2334. + _M_data->_M_amonth02 = "Feb";
  2335. + _M_data->_M_amonth03 = "Mar";
  2336. + _M_data->_M_amonth04 = "Apr";
  2337. + _M_data->_M_amonth05 = "May";
  2338. + _M_data->_M_amonth06 = "Jun";
  2339. + _M_data->_M_amonth07 = "Jul";
  2340. + _M_data->_M_amonth08 = "Aug";
  2341. + _M_data->_M_amonth09 = "Sep";
  2342. + _M_data->_M_amonth10 = "Oct";
  2343. + _M_data->_M_amonth11 = "Nov";
  2344. + _M_data->_M_amonth12 = "Dec";
  2345. + }
  2346. + else
  2347. + {
  2348. + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
  2349. +
  2350. + _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
  2351. + _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
  2352. + _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
  2353. + _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
  2354. + _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
  2355. + _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
  2356. + __cloc);
  2357. + _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
  2358. + _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
  2359. + _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
  2360. +
  2361. + // Day names, starting with "C"'s Sunday.
  2362. + _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
  2363. + _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
  2364. + _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
  2365. + _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
  2366. + _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
  2367. + _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
  2368. + _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
  2369. +
  2370. + // Abbreviated day names, starting with "C"'s Sun.
  2371. + _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
  2372. + _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
  2373. + _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
  2374. + _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
  2375. + _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
  2376. + _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
  2377. + _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
  2378. +
  2379. + // Month names, starting with "C"'s January.
  2380. + _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
  2381. + _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
  2382. + _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
  2383. + _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
  2384. + _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
  2385. + _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
  2386. + _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
  2387. + _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
  2388. + _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
  2389. + _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
  2390. + _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
  2391. + _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
  2392. +
  2393. + // Abbreviated month names, starting with "C"'s Jan.
  2394. + _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
  2395. + _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
  2396. + _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
  2397. + _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
  2398. + _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
  2399. + _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
  2400. + _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
  2401. + _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
  2402. + _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
  2403. + _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
  2404. + _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
  2405. + _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
  2406. + }
  2407. + }
  2408. +
  2409. +#ifdef _GLIBCXX_USE_WCHAR_T
  2410. + template<>
  2411. + void
  2412. + __timepunct<wchar_t>::
  2413. + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
  2414. + const tm* __tm) const
  2415. + {
  2416. +#ifdef __UCLIBC_HAS_XLOCALE__
  2417. + __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
  2418. + const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
  2419. + _M_c_locale_timepunct);
  2420. +#else
  2421. + char* __old = strdup(setlocale(LC_ALL, NULL));
  2422. + setlocale(LC_ALL, _M_name_timepunct);
  2423. + const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
  2424. + setlocale(LC_ALL, __old);
  2425. + free(__old);
  2426. +#endif
  2427. + // Make sure __s is null terminated.
  2428. + if (__len == 0)
  2429. + __s[0] = L'\0';
  2430. + }
  2431. +
  2432. + template<>
  2433. + void
  2434. + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
  2435. + {
  2436. + if (!_M_data)
  2437. + _M_data = new __timepunct_cache<wchar_t>;
  2438. +
  2439. +#warning wide time stuff
  2440. +// if (!__cloc)
  2441. + {
  2442. + // "C" locale
  2443. + _M_c_locale_timepunct = _S_get_c_locale();
  2444. +
  2445. + _M_data->_M_date_format = L"%m/%d/%y";
  2446. + _M_data->_M_date_era_format = L"%m/%d/%y";
  2447. + _M_data->_M_time_format = L"%H:%M:%S";
  2448. + _M_data->_M_time_era_format = L"%H:%M:%S";
  2449. + _M_data->_M_date_time_format = L"";
  2450. + _M_data->_M_date_time_era_format = L"";
  2451. + _M_data->_M_am = L"AM";
  2452. + _M_data->_M_pm = L"PM";
  2453. + _M_data->_M_am_pm_format = L"";
  2454. +
  2455. + // Day names, starting with "C"'s Sunday.
  2456. + _M_data->_M_day1 = L"Sunday";
  2457. + _M_data->_M_day2 = L"Monday";
  2458. + _M_data->_M_day3 = L"Tuesday";
  2459. + _M_data->_M_day4 = L"Wednesday";
  2460. + _M_data->_M_day5 = L"Thursday";
  2461. + _M_data->_M_day6 = L"Friday";
  2462. + _M_data->_M_day7 = L"Saturday";
  2463. +
  2464. + // Abbreviated day names, starting with "C"'s Sun.
  2465. + _M_data->_M_aday1 = L"Sun";
  2466. + _M_data->_M_aday2 = L"Mon";
  2467. + _M_data->_M_aday3 = L"Tue";
  2468. + _M_data->_M_aday4 = L"Wed";
  2469. + _M_data->_M_aday5 = L"Thu";
  2470. + _M_data->_M_aday6 = L"Fri";
  2471. + _M_data->_M_aday7 = L"Sat";
  2472. +
  2473. + // Month names, starting with "C"'s January.
  2474. + _M_data->_M_month01 = L"January";
  2475. + _M_data->_M_month02 = L"February";
  2476. + _M_data->_M_month03 = L"March";
  2477. + _M_data->_M_month04 = L"April";
  2478. + _M_data->_M_month05 = L"May";
  2479. + _M_data->_M_month06 = L"June";
  2480. + _M_data->_M_month07 = L"July";
  2481. + _M_data->_M_month08 = L"August";
  2482. + _M_data->_M_month09 = L"September";
  2483. + _M_data->_M_month10 = L"October";
  2484. + _M_data->_M_month11 = L"November";
  2485. + _M_data->_M_month12 = L"December";
  2486. +
  2487. + // Abbreviated month names, starting with "C"'s Jan.
  2488. + _M_data->_M_amonth01 = L"Jan";
  2489. + _M_data->_M_amonth02 = L"Feb";
  2490. + _M_data->_M_amonth03 = L"Mar";
  2491. + _M_data->_M_amonth04 = L"Apr";
  2492. + _M_data->_M_amonth05 = L"May";
  2493. + _M_data->_M_amonth06 = L"Jun";
  2494. + _M_data->_M_amonth07 = L"Jul";
  2495. + _M_data->_M_amonth08 = L"Aug";
  2496. + _M_data->_M_amonth09 = L"Sep";
  2497. + _M_data->_M_amonth10 = L"Oct";
  2498. + _M_data->_M_amonth11 = L"Nov";
  2499. + _M_data->_M_amonth12 = L"Dec";
  2500. + }
  2501. +#if 0
  2502. + else
  2503. + {
  2504. + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
  2505. +
  2506. + union { char *__s; wchar_t *__w; } __u;
  2507. +
  2508. + __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
  2509. + _M_data->_M_date_format = __u.__w;
  2510. + __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
  2511. + _M_data->_M_date_era_format = __u.__w;
  2512. + __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
  2513. + _M_data->_M_time_format = __u.__w;
  2514. + __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
  2515. + _M_data->_M_time_era_format = __u.__w;
  2516. + __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
  2517. + _M_data->_M_date_time_format = __u.__w;
  2518. + __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
  2519. + _M_data->_M_date_time_era_format = __u.__w;
  2520. + __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
  2521. + _M_data->_M_am = __u.__w;
  2522. + __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
  2523. + _M_data->_M_pm = __u.__w;
  2524. + __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
  2525. + _M_data->_M_am_pm_format = __u.__w;
  2526. +
  2527. + // Day names, starting with "C"'s Sunday.
  2528. + __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
  2529. + _M_data->_M_day1 = __u.__w;
  2530. + __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
  2531. + _M_data->_M_day2 = __u.__w;
  2532. + __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
  2533. + _M_data->_M_day3 = __u.__w;
  2534. + __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
  2535. + _M_data->_M_day4 = __u.__w;
  2536. + __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
  2537. + _M_data->_M_day5 = __u.__w;
  2538. + __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
  2539. + _M_data->_M_day6 = __u.__w;
  2540. + __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
  2541. + _M_data->_M_day7 = __u.__w;
  2542. +
  2543. + // Abbreviated day names, starting with "C"'s Sun.
  2544. + __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
  2545. + _M_data->_M_aday1 = __u.__w;
  2546. + __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
  2547. + _M_data->_M_aday2 = __u.__w;
  2548. + __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
  2549. + _M_data->_M_aday3 = __u.__w;
  2550. + __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
  2551. + _M_data->_M_aday4 = __u.__w;
  2552. + __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
  2553. + _M_data->_M_aday5 = __u.__w;
  2554. + __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
  2555. + _M_data->_M_aday6 = __u.__w;
  2556. + __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
  2557. + _M_data->_M_aday7 = __u.__w;
  2558. +
  2559. + // Month names, starting with "C"'s January.
  2560. + __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
  2561. + _M_data->_M_month01 = __u.__w;
  2562. + __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
  2563. + _M_data->_M_month02 = __u.__w;
  2564. + __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
  2565. + _M_data->_M_month03 = __u.__w;
  2566. + __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
  2567. + _M_data->_M_month04 = __u.__w;
  2568. + __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
  2569. + _M_data->_M_month05 = __u.__w;
  2570. + __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
  2571. + _M_data->_M_month06 = __u.__w;
  2572. + __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
  2573. + _M_data->_M_month07 = __u.__w;
  2574. + __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
  2575. + _M_data->_M_month08 = __u.__w;
  2576. + __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
  2577. + _M_data->_M_month09 = __u.__w;
  2578. + __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
  2579. + _M_data->_M_month10 = __u.__w;
  2580. + __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
  2581. + _M_data->_M_month11 = __u.__w;
  2582. + __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
  2583. + _M_data->_M_month12 = __u.__w;
  2584. +
  2585. + // Abbreviated month names, starting with "C"'s Jan.
  2586. + __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
  2587. + _M_data->_M_amonth01 = __u.__w;
  2588. + __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
  2589. + _M_data->_M_amonth02 = __u.__w;
  2590. + __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
  2591. + _M_data->_M_amonth03 = __u.__w;
  2592. + __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
  2593. + _M_data->_M_amonth04 = __u.__w;
  2594. + __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
  2595. + _M_data->_M_amonth05 = __u.__w;
  2596. + __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
  2597. + _M_data->_M_amonth06 = __u.__w;
  2598. + __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
  2599. + _M_data->_M_amonth07 = __u.__w;
  2600. + __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
  2601. + _M_data->_M_amonth08 = __u.__w;
  2602. + __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
  2603. + _M_data->_M_amonth09 = __u.__w;
  2604. + __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
  2605. + _M_data->_M_amonth10 = __u.__w;
  2606. + __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
  2607. + _M_data->_M_amonth11 = __u.__w;
  2608. + __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
  2609. + _M_data->_M_amonth12 = __u.__w;
  2610. + }
  2611. +#endif // 0
  2612. + }
  2613. +#endif
  2614. +}
  2615. diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h
  2616. --- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 18:00:00.000000000 -0600
  2617. +++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h 2004-05-22 18:46:31.000000000 -0500
  2618. @@ -0,0 +1,68 @@
  2619. +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
  2620. +
  2621. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  2622. +//
  2623. +// This file is part of the GNU ISO C++ Library. This library is free
  2624. +// software; you can redistribute it and/or modify it under the
  2625. +// terms of the GNU General Public License as published by the
  2626. +// Free Software Foundation; either version 2, or (at your option)
  2627. +// any later version.
  2628. +
  2629. +// This library is distributed in the hope that it will be useful,
  2630. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  2631. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2632. +// GNU General Public License for more details.
  2633. +
  2634. +// You should have received a copy of the GNU General Public License along
  2635. +// with this library; see the file COPYING. If not, write to the Free
  2636. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  2637. +// USA.
  2638. +
  2639. +// As a special exception, you may use this file as part of a free software
  2640. +// library without restriction. Specifically, if other files instantiate
  2641. +// templates or use macros or inline functions from this file, or you compile
  2642. +// this file and link it with other files to produce an executable, this
  2643. +// file does not by itself cause the resulting executable to be covered by
  2644. +// the GNU General Public License. This exception does not however
  2645. +// invalidate any other reasons why the executable file might be covered by
  2646. +// the GNU General Public License.
  2647. +
  2648. +//
  2649. +// ISO C++ 14882: 22.2.5.1.2 - time_get functions
  2650. +// ISO C++ 14882: 22.2.5.3.2 - time_put functions
  2651. +//
  2652. +
  2653. +// Written by Benjamin Kosnik <bkoz@redhat.com>
  2654. +
  2655. + template<typename _CharT>
  2656. + __timepunct<_CharT>::__timepunct(size_t __refs)
  2657. + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
  2658. + _M_name_timepunct(_S_get_c_name())
  2659. + { _M_initialize_timepunct(); }
  2660. +
  2661. + template<typename _CharT>
  2662. + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
  2663. + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
  2664. + _M_name_timepunct(_S_get_c_name())
  2665. + { _M_initialize_timepunct(); }
  2666. +
  2667. + template<typename _CharT>
  2668. + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
  2669. + size_t __refs)
  2670. + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
  2671. + _M_name_timepunct(__s)
  2672. + {
  2673. + char* __tmp = new char[std::strlen(__s) + 1];
  2674. + std::strcpy(__tmp, __s);
  2675. + _M_name_timepunct = __tmp;
  2676. + _M_initialize_timepunct(__cloc);
  2677. + }
  2678. +
  2679. + template<typename _CharT>
  2680. + __timepunct<_CharT>::~__timepunct()
  2681. + {
  2682. + if (_M_name_timepunct != _S_get_c_name())
  2683. + delete [] _M_name_timepunct;
  2684. + delete _M_data;
  2685. + _S_destroy_c_locale(_M_c_locale_timepunct);
  2686. + }
  2687. diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h
  2688. --- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 18:00:00.000000000 -0600
  2689. +++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h 2005-04-28 01:10:27.000000000 -0500
  2690. @@ -0,0 +1,64 @@
  2691. +// Locale support -*- C++ -*-
  2692. +
  2693. +// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
  2694. +// Free Software Foundation, Inc.
  2695. +//
  2696. +// This file is part of the GNU ISO C++ Library. This library is free
  2697. +// software; you can redistribute it and/or modify it under the
  2698. +// terms of the GNU General Public License as published by the
  2699. +// Free Software Foundation; either version 2, or (at your option)
  2700. +// any later version.
  2701. +
  2702. +// This library is distributed in the hope that it will be useful,
  2703. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  2704. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2705. +// GNU General Public License for more details.
  2706. +
  2707. +// You should have received a copy of the GNU General Public License along
  2708. +// with this library; see the file COPYING. If not, write to the Free
  2709. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  2710. +// USA.
  2711. +
  2712. +// As a special exception, you may use this file as part of a free software
  2713. +// library without restriction. Specifically, if other files instantiate
  2714. +// templates or use macros or inline functions from this file, or you compile
  2715. +// this file and link it with other files to produce an executable, this
  2716. +// file does not by itself cause the resulting executable to be covered by
  2717. +// the GNU General Public License. This exception does not however
  2718. +// invalidate any other reasons why the executable file might be covered by
  2719. +// the GNU General Public License.
  2720. +
  2721. +//
  2722. +// ISO C++ 14882: 22.1 Locales
  2723. +//
  2724. +
  2725. +/** @file ctype_base.h
  2726. + * This is an internal header file, included by other library headers.
  2727. + * You should not attempt to use it directly.
  2728. + */
  2729. +
  2730. +// Information as gleaned from /usr/include/ctype.h
  2731. +
  2732. + /// @brief Base class for ctype.
  2733. + struct ctype_base
  2734. + {
  2735. + // Note: In uClibc, the following two types depend on configuration.
  2736. +
  2737. + // Non-standard typedefs.
  2738. + typedef const __ctype_touplow_t* __to_type;
  2739. +
  2740. + // NB: Offsets into ctype<char>::_M_table force a particular size
  2741. + // on the mask type. Because of this, we don't use an enum.
  2742. + typedef __ctype_mask_t mask;
  2743. + static const mask upper = _ISupper;
  2744. + static const mask lower = _ISlower;
  2745. + static const mask alpha = _ISalpha;
  2746. + static const mask digit = _ISdigit;
  2747. + static const mask xdigit = _ISxdigit;
  2748. + static const mask space = _ISspace;
  2749. + static const mask print = _ISprint;
  2750. + static const mask graph = _ISalpha | _ISdigit | _ISpunct;
  2751. + static const mask cntrl = _IScntrl;
  2752. + static const mask punct = _ISpunct;
  2753. + static const mask alnum = _ISalpha | _ISdigit;
  2754. + };
  2755. diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h
  2756. --- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600
  2757. +++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h 2002-06-24 00:49:19.000000000 -0500
  2758. @@ -0,0 +1,69 @@
  2759. +// Locale support -*- C++ -*-
  2760. +
  2761. +// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
  2762. +//
  2763. +// This file is part of the GNU ISO C++ Library. This library is free
  2764. +// software; you can redistribute it and/or modify it under the
  2765. +// terms of the GNU General Public License as published by the
  2766. +// Free Software Foundation; either version 2, or (at your option)
  2767. +// any later version.
  2768. +
  2769. +// This library is distributed in the hope that it will be useful,
  2770. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  2771. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2772. +// GNU General Public License for more details.
  2773. +
  2774. +// You should have received a copy of the GNU General Public License along
  2775. +// with this library; see the file COPYING. If not, write to the Free
  2776. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  2777. +// USA.
  2778. +
  2779. +// As a special exception, you may use this file as part of a free software
  2780. +// library without restriction. Specifically, if other files instantiate
  2781. +// templates or use macros or inline functions from this file, or you compile
  2782. +// this file and link it with other files to produce an executable, this
  2783. +// file does not by itself cause the resulting executable to be covered by
  2784. +// the GNU General Public License. This exception does not however
  2785. +// invalidate any other reasons why the executable file might be covered by
  2786. +// the GNU General Public License.
  2787. +
  2788. +//
  2789. +// ISO C++ 14882: 22.1 Locales
  2790. +//
  2791. +
  2792. +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
  2793. +// functions go in ctype.cc
  2794. +
  2795. + bool
  2796. + ctype<char>::
  2797. + is(mask __m, char __c) const
  2798. + { return _M_table[static_cast<unsigned char>(__c)] & __m; }
  2799. +
  2800. + const char*
  2801. + ctype<char>::
  2802. + is(const char* __low, const char* __high, mask* __vec) const
  2803. + {
  2804. + while (__low < __high)
  2805. + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
  2806. + return __high;
  2807. + }
  2808. +
  2809. + const char*
  2810. + ctype<char>::
  2811. + scan_is(mask __m, const char* __low, const char* __high) const
  2812. + {
  2813. + while (__low < __high
  2814. + && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
  2815. + ++__low;
  2816. + return __low;
  2817. + }
  2818. +
  2819. + const char*
  2820. + ctype<char>::
  2821. + scan_not(mask __m, const char* __low, const char* __high) const
  2822. + {
  2823. + while (__low < __high
  2824. + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
  2825. + ++__low;
  2826. + return __low;
  2827. + }
  2828. diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h
  2829. --- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 18:00:00.000000000 -0600
  2830. +++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2005-04-28 01:10:27.000000000 -0500
  2831. @@ -0,0 +1,92 @@
  2832. +// Locale support -*- C++ -*-
  2833. +
  2834. +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
  2835. +// Free Software Foundation, Inc.
  2836. +//
  2837. +// This file is part of the GNU ISO C++ Library. This library is free
  2838. +// software; you can redistribute it and/or modify it under the
  2839. +// terms of the GNU General Public License as published by the
  2840. +// Free Software Foundation; either version 2, or (at your option)
  2841. +// any later version.
  2842. +
  2843. +// This library is distributed in the hope that it will be useful,
  2844. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  2845. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2846. +// GNU General Public License for more details.
  2847. +
  2848. +// You should have received a copy of the GNU General Public License along
  2849. +// with this library; see the file COPYING. If not, write to the Free
  2850. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  2851. +// USA.
  2852. +
  2853. +// As a special exception, you may use this file as part of a free software
  2854. +// library without restriction. Specifically, if other files instantiate
  2855. +// templates or use macros or inline functions from this file, or you compile
  2856. +// this file and link it with other files to produce an executable, this
  2857. +// file does not by itself cause the resulting executable to be covered by
  2858. +// the GNU General Public License. This exception does not however
  2859. +// invalidate any other reasons why the executable file might be covered by
  2860. +// the GNU General Public License.
  2861. +
  2862. +//
  2863. +// ISO C++ 14882: 22.1 Locales
  2864. +//
  2865. +
  2866. +// Information as gleaned from /usr/include/ctype.h
  2867. +
  2868. + const ctype_base::mask*
  2869. + ctype<char>::classic_table() throw()
  2870. + { return __C_ctype_b; }
  2871. +
  2872. + ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
  2873. + size_t __refs)
  2874. + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
  2875. + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
  2876. + {
  2877. + _M_toupper = __C_ctype_toupper;
  2878. + _M_tolower = __C_ctype_tolower;
  2879. + _M_table = __table ? __table : __C_ctype_b;
  2880. + memset(_M_widen, 0, sizeof(_M_widen));
  2881. + memset(_M_narrow, 0, sizeof(_M_narrow));
  2882. + }
  2883. +
  2884. + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
  2885. + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
  2886. + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
  2887. + {
  2888. + _M_toupper = __C_ctype_toupper;
  2889. + _M_tolower = __C_ctype_tolower;
  2890. + _M_table = __table ? __table : __C_ctype_b;
  2891. + memset(_M_widen, 0, sizeof(_M_widen));
  2892. + memset(_M_narrow, 0, sizeof(_M_narrow));
  2893. + }
  2894. +
  2895. + char
  2896. + ctype<char>::do_toupper(char __c) const
  2897. + { return _M_toupper[static_cast<unsigned char>(__c)]; }
  2898. +
  2899. + const char*
  2900. + ctype<char>::do_toupper(char* __low, const char* __high) const
  2901. + {
  2902. + while (__low < __high)
  2903. + {
  2904. + *__low = _M_toupper[static_cast<unsigned char>(*__low)];
  2905. + ++__low;
  2906. + }
  2907. + return __high;
  2908. + }
  2909. +
  2910. + char
  2911. + ctype<char>::do_tolower(char __c) const
  2912. + { return _M_tolower[static_cast<unsigned char>(__c)]; }
  2913. +
  2914. + const char*
  2915. + ctype<char>::do_tolower(char* __low, const char* __high) const
  2916. + {
  2917. + while (__low < __high)
  2918. + {
  2919. + *__low = _M_tolower[static_cast<unsigned char>(*__low)];
  2920. + ++__low;
  2921. + }
  2922. + return __high;
  2923. + }
  2924. diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h
  2925. --- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 18:00:00.000000000 -0600
  2926. +++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h 2005-04-28 01:10:27.000000000 -0500
  2927. @@ -0,0 +1,44 @@
  2928. +// Specific definitions for GNU/Linux -*- C++ -*-
  2929. +
  2930. +// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
  2931. +//
  2932. +// This file is part of the GNU ISO C++ Library. This library is free
  2933. +// software; you can redistribute it and/or modify it under the
  2934. +// terms of the GNU General Public License as published by the
  2935. +// Free Software Foundation; either version 2, or (at your option)
  2936. +// any later version.
  2937. +
  2938. +// This library is distributed in the hope that it will be useful,
  2939. +// but WITHOUT ANY WARRANTY; without even the implied warranty of
  2940. +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2941. +// GNU General Public License for more details.
  2942. +
  2943. +// You should have received a copy of the GNU General Public License along
  2944. +// with this library; see the file COPYING. If not, write to the Free
  2945. +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  2946. +// USA.
  2947. +
  2948. +// As a special exception, you may use this file as part of a free software
  2949. +// library without restriction. Specifically, if other files instantiate
  2950. +// templates or use macros or inline functions from this file, or you compile
  2951. +// this file and link it with other files to produce an executable, this
  2952. +// file does not by itself cause the resulting executable to be covered by
  2953. +// the GNU General Public License. This exception does not however
  2954. +// invalidate any other reasons why the executable file might be covered by
  2955. +// the GNU General Public License.
  2956. +
  2957. +#ifndef _GLIBCXX_OS_DEFINES
  2958. +#define _GLIBCXX_OS_DEFINES 1
  2959. +
  2960. +// System-specific #define, typedefs, corrections, etc, go here. This
  2961. +// file will come before all others.
  2962. +
  2963. +// This keeps isanum, et al from being propagated as macros.
  2964. +#define __NO_CTYPE 1
  2965. +
  2966. +#include <features.h>
  2967. +
  2968. +// We must not see the optimized string functions GNU libc defines.
  2969. +#define __NO_STRING_INLINES
  2970. +
  2971. +#endif
  2972. diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure
  2973. --- gcc-4.0.0-100/libstdc++-v3/configure 2005-04-30 13:06:53.683055232 -0500
  2974. +++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 12:24:24.000000000 -0500
  2975. @@ -3998,6 +3998,11 @@
  2976. lt_cv_deplibs_check_method=pass_all
  2977. ;;
  2978. +linux-uclibc*)
  2979. + lt_cv_deplibs_check_method=pass_all
  2980. + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
  2981. + ;;
  2982. +
  2983. netbsd* | knetbsd*-gnu)
  2984. if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
  2985. lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  2986. @@ -5672,7 +5677,7 @@
  2987. enableval="$enable_clocale"
  2988. case "$enableval" in
  2989. - generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
  2990. + generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
  2991. *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
  2992. echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
  2993. { (exit 1); exit 1; }; } ;;
  2994. @@ -5697,6 +5702,9 @@
  2995. # Default to "generic".
  2996. if test $enable_clocale_flag = auto; then
  2997. case ${target_os} in
  2998. + linux-uclibc*)
  2999. + enable_clocale_flag=uclibc
  3000. + ;;
  3001. linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
  3002. cat >conftest.$ac_ext <<_ACEOF
  3003. /* confdefs.h. */
  3004. @@ -5927,6 +5935,76 @@
  3005. CTIME_CC=config/locale/generic/time_members.cc
  3006. CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
  3007. ;;
  3008. + uclibc)
  3009. + echo "$as_me:$LINENO: result: uclibc" >&5
  3010. +echo "${ECHO_T}uclibc" >&6
  3011. +
  3012. + # Declare intention to use gettext, and add support for specific
  3013. + # languages.
  3014. + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
  3015. + ALL_LINGUAS="de fr"
  3016. +
  3017. + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
  3018. + # Extract the first word of "msgfmt", so it can be a program name with args.
  3019. +set dummy msgfmt; ac_word=$2
  3020. +echo "$as_me:$LINENO: checking for $ac_word" >&5
  3021. +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  3022. +if test "${ac_cv_prog_check_msgfmt+set}" = set; then
  3023. + echo $ECHO_N "(cached) $ECHO_C" >&6
  3024. +else
  3025. + if test -n "$check_msgfmt"; then
  3026. + ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
  3027. +else
  3028. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  3029. +for as_dir in $PATH
  3030. +do
  3031. + IFS=$as_save_IFS
  3032. + test -z "$as_dir" && as_dir=.
  3033. + for ac_exec_ext in '' $ac_executable_extensions; do
  3034. + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  3035. + ac_cv_prog_check_msgfmt="yes"
  3036. + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  3037. + break 2
  3038. + fi
  3039. +done
  3040. +done
  3041. +
  3042. + test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
  3043. +fi
  3044. +fi
  3045. +check_msgfmt=$ac_cv_prog_check_msgfmt
  3046. +if test -n "$check_msgfmt"; then
  3047. + echo "$as_me:$LINENO: result: $check_msgfmt" >&5
  3048. +echo "${ECHO_T}$check_msgfmt" >&6
  3049. +else
  3050. + echo "$as_me:$LINENO: result: no" >&5
  3051. +echo "${ECHO_T}no" >&6
  3052. +fi
  3053. +
  3054. + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
  3055. + USE_NLS=yes
  3056. + fi
  3057. + # Export the build objects.
  3058. + for ling in $ALL_LINGUAS; do \
  3059. + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
  3060. + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
  3061. + done
  3062. +
  3063. +
  3064. +
  3065. + CLOCALE_H=config/locale/uclibc/c_locale.h
  3066. + CLOCALE_CC=config/locale/uclibc/c_locale.cc
  3067. + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
  3068. + CCOLLATE_CC=config/locale/uclibc/collate_members.cc
  3069. + CCTYPE_CC=config/locale/uclibc/ctype_members.cc
  3070. + CMESSAGES_H=config/locale/uclibc/messages_members.h
  3071. + CMESSAGES_CC=config/locale/uclibc/messages_members.cc
  3072. + CMONEY_CC=config/locale/uclibc/monetary_members.cc
  3073. + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
  3074. + CTIME_H=config/locale/uclibc/time_members.h
  3075. + CTIME_CC=config/locale/uclibc/time_members.cc
  3076. + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
  3077. + ;;
  3078. esac
  3079. # This is where the testsuite looks for locale catalogs, using the
  3080. diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host
  3081. --- gcc-4.0.0-100/libstdc++-v3/configure.host 2005-04-30 13:06:53.688054472 -0500
  3082. +++ gcc-4.0.0/libstdc++-v3/configure.host 2005-04-28 20:20:32.000000000 -0500
  3083. @@ -249,6 +249,12 @@
  3084. ;;
  3085. esac
  3086. +# Override for uClibc since linux-uclibc gets mishandled above.
  3087. +case "${host_os}" in
  3088. + *-uclibc*)
  3089. + os_include_dir="os/uclibc"
  3090. + ;;
  3091. +esac
  3092. # Set any OS-dependent and CPU-dependent bits.
  3093. # THIS TABLE IS SORTED. KEEP IT THAT WAY.
  3094. diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4
  3095. --- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 2005-04-30 13:06:53.689054320 -0500
  3096. +++ gcc-4.0.0/libstdc++-v3/crossconfig.m4 2005-04-28 20:27:15.000000000 -0500
  3097. @@ -142,6 +142,98 @@
  3098. ;;
  3099. esac
  3100. ;;
  3101. + *-uclibc*)
  3102. +# Temporary hack until we implement the float versions of the libm funcs
  3103. + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
  3104. + machine/endian.h machine/param.h sys/machine.h sys/types.h \
  3105. + fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
  3106. + SECTION_FLAGS='-ffunction-sections -fdata-sections'
  3107. + AC_SUBST(SECTION_FLAGS)
  3108. + GLIBCXX_CHECK_LINKER_FEATURES
  3109. + GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
  3110. + GLIBCXX_CHECK_WCHAR_T_SUPPORT
  3111. +
  3112. + # For LFS.
  3113. + AC_DEFINE(HAVE_INT64_T)
  3114. + case "$target" in
  3115. + *-uclinux*)
  3116. + # Don't enable LFS with uClinux
  3117. + ;;
  3118. + *)
  3119. + AC_DEFINE(_GLIBCXX_USE_LFS)
  3120. + esac
  3121. +
  3122. + # For showmanyc_helper().
  3123. + AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
  3124. + GLIBCXX_CHECK_POLL
  3125. + GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
  3126. +
  3127. + # For xsputn_2().
  3128. + AC_CHECK_HEADERS(sys/uio.h)
  3129. + GLIBCXX_CHECK_WRITEV
  3130. +
  3131. +# AC_DEFINE(HAVE_ACOSF)
  3132. +# AC_DEFINE(HAVE_ASINF)
  3133. +# AC_DEFINE(HAVE_ATANF)
  3134. +# AC_DEFINE(HAVE_ATAN2F)
  3135. + AC_DEFINE(HAVE_CEILF)
  3136. + AC_DEFINE(HAVE_COPYSIGN)
  3137. +# AC_DEFINE(HAVE_COPYSIGNF)
  3138. +# AC_DEFINE(HAVE_COSF)
  3139. +# AC_DEFINE(HAVE_COSHF)
  3140. +# AC_DEFINE(HAVE_EXPF)
  3141. +# AC_DEFINE(HAVE_FABSF)
  3142. + AC_DEFINE(HAVE_FINITE)
  3143. + AC_DEFINE(HAVE_FINITEF)
  3144. + AC_DEFINE(HAVE_FLOORF)
  3145. +# AC_DEFINE(HAVE_FMODF)
  3146. +# AC_DEFINE(HAVE_FREXPF)
  3147. + AC_DEFINE(HAVE_HYPOT)
  3148. +# AC_DEFINE(HAVE_HYPOTF)
  3149. + AC_DEFINE(HAVE_ISINF)
  3150. + AC_DEFINE(HAVE_ISINFF)
  3151. + AC_DEFINE(HAVE_ISNAN)
  3152. + AC_DEFINE(HAVE_ISNANF)
  3153. +# AC_DEFINE(HAVE_LOGF)
  3154. +# AC_DEFINE(HAVE_LOG10F)
  3155. +# AC_DEFINE(HAVE_MODFF)
  3156. +# AC_DEFINE(HAVE_SINF)
  3157. +# AC_DEFINE(HAVE_SINHF)
  3158. +# AC_DEFINE(HAVE_SINCOS)
  3159. +# AC_DEFINE(HAVE_SINCOSF)
  3160. + AC_DEFINE(HAVE_SQRTF)
  3161. +# AC_DEFINE(HAVE_TANF)
  3162. +# AC_DEFINE(HAVE_TANHF)
  3163. + if test x"long_double_math_on_this_cpu" = x"yes"; then
  3164. +# AC_DEFINE(HAVE_ACOSL)
  3165. +# AC_DEFINE(HAVE_ASINL)
  3166. +# AC_DEFINE(HAVE_ATANL)
  3167. +# AC_DEFINE(HAVE_ATAN2L)
  3168. +# AC_DEFINE(HAVE_CEILL)
  3169. +# AC_DEFINE(HAVE_COPYSIGNL)
  3170. +# AC_DEFINE(HAVE_COSL)
  3171. +# AC_DEFINE(HAVE_COSHL)
  3172. +# AC_DEFINE(HAVE_EXPL)
  3173. +# AC_DEFINE(HAVE_FABSL)
  3174. +# AC_DEFINE(HAVE_FINITEL)
  3175. +# AC_DEFINE(HAVE_FLOORL)
  3176. +# AC_DEFINE(HAVE_FMODL)
  3177. +# AC_DEFINE(HAVE_FREXPL)
  3178. +# AC_DEFINE(HAVE_HYPOTL)
  3179. +# AC_DEFINE(HAVE_ISINFL)
  3180. +# AC_DEFINE(HAVE_ISNANL)
  3181. +# AC_DEFINE(HAVE_LOGL)
  3182. +# AC_DEFINE(HAVE_LOG10L)
  3183. +# AC_DEFINE(HAVE_MODFL)
  3184. +# AC_DEFINE(HAVE_POWL)
  3185. +# AC_DEFINE(HAVE_SINL)
  3186. +# AC_DEFINE(HAVE_SINHL)
  3187. +# AC_DEFINE(HAVE_SINCOSL)
  3188. +# AC_DEFINE(HAVE_SQRTL)
  3189. +# AC_DEFINE(HAVE_TANL)
  3190. +# AC_DEFINE(HAVE_TANHL)
  3191. + fi
  3192. + ;;
  3193. *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
  3194. AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
  3195. machine/endian.h machine/param.h sys/machine.h sys/types.h \
  3196. @@ -156,7 +248,7 @@
  3197. AC_DEFINE(HAVE_INT64_T)
  3198. case "$target" in
  3199. *-uclinux*)
  3200. - # Don't enable LFS with uClibc
  3201. + # Don't enable LFS with uClinux
  3202. ;;
  3203. *)
  3204. AC_DEFINE(_GLIBCXX_USE_LFS)
  3205. diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h
  3206. --- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-30 13:06:53.690054168 -0500
  3207. +++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h 2005-04-28 20:15:56.000000000 -0500
  3208. @@ -101,7 +101,9 @@
  3209. using std::wmemcpy;
  3210. using std::wmemmove;
  3211. using std::wmemset;
  3212. +#if _GLIBCXX_HAVE_WCSFTIME
  3213. using std::wcsftime;
  3214. +#endif
  3215. #if _GLIBCXX_USE_C99
  3216. using std::wcstold;
  3217. diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h
  3218. --- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-30 13:06:53.691054016 -0500
  3219. +++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h 2005-04-28 20:15:56.000000000 -0500
  3220. @@ -179,7 +179,9 @@
  3221. using ::wcscoll;
  3222. using ::wcscpy;
  3223. using ::wcscspn;
  3224. +#if _GLIBCXX_HAVE_WCSFTIME
  3225. using ::wcsftime;
  3226. +#endif
  3227. using ::wcslen;
  3228. using ::wcsncat;
  3229. using ::wcsncmp;