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