200-uclibc-locale.patch 110 KB

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