200-uclibc-locale.patch 105 KB

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