200-uclibc-locale.patch 112 KB

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