202-uclibc-locale.patch 90 KB

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