OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3278 lines
110 KiB

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