scripts/addToolsVersion: properly handle .in vs. .in.2
While most components have their version in the .in file, some
have it in the .in.2 (eg. elf2flt).
Currently, to handle this case, we indiscriminately munge both files,
but this is wrong: in the elf2flt case, if we add a binutils version,
we do not want it to be added to elf2flt, and conversely.
So, for each tool, we need to explicitly know what file to munge.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
1 diff -durN gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 gcc-4.2.1/libstdc++-v3/acinclude.m4
2 --- gcc-4.2.1.orig/libstdc++-v3/acinclude.m4 2007-06-29 01:02:05.000000000 +0200
3 +++ gcc-4.2.1/libstdc++-v3/acinclude.m4 2007-08-03 20:30:21.000000000 +0200
5 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
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 # Deal with gettext issues. Default to not using it (=no) until we detect
12 # support for it later. Let the user turn it off via --e/d, but let that
14 # Default to "generic".
15 if test $enable_clocale_flag = auto; then
18 + enable_clocale_flag=uclibc
20 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
21 enable_clocale_flag=gnu
23 @@ -1526,6 +1529,40 @@
24 CTIME_CC=config/locale/generic/time_members.cc
25 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
28 + AC_MSG_RESULT(uclibc)
30 + # Declare intention to use gettext, and add support for specific
32 + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
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
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"; \
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
63 # This is where the testsuite looks for locale catalogs, using the
64 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
65 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100
66 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-08-03 20:30:21.000000000 +0200
68 +// Wrapper for underlying C-language localization -*- C++ -*-
70 +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
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,
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.
98 +// ISO C++ 14882: 22.8 Standard locale categories.
101 +// Written by Benjamin Kosnik <bkoz@redhat.com>
103 +#include <cerrno> // For errno
105 +#include <stdexcept>
106 +#include <langinfo.h>
107 +#include <bits/c++locale_internal.h>
109 +#ifndef __UCLIBC_HAS_XLOCALE__
110 +#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
111 +#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
112 +#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
113 +#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
114 +#define __strtof_l(S, E, L) strtof((S), (E))
115 +#define __strtod_l(S, E, L) strtod((S), (E))
116 +#define __strtold_l(S, E, L) strtold((S), (E))
117 +#warning should dummy __newlocale check for C|POSIX ?
118 +#define __newlocale(a, b, c) NULL
119 +#define __freelocale(a) ((void)0)
120 +#define __duplocale(a) __c_locale()
127 + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
128 + const __c_locale& __cloc)
130 + if (!(__err & ios_base::failbit))
134 + float __f = __strtof_l(__s, &__sanity, __cloc);
135 + if (__sanity != __s && errno != ERANGE)
138 + __err |= ios_base::failbit;
144 + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
145 + const __c_locale& __cloc)
147 + if (!(__err & ios_base::failbit))
151 + double __d = __strtod_l(__s, &__sanity, __cloc);
152 + if (__sanity != __s && errno != ERANGE)
155 + __err |= ios_base::failbit;
161 + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
162 + const __c_locale& __cloc)
164 + if (!(__err & ios_base::failbit))
168 + long double __ld = __strtold_l(__s, &__sanity, __cloc);
169 + if (__sanity != __s && errno != ERANGE)
172 + __err |= ios_base::failbit;
177 + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
180 + __cloc = __newlocale(1 << LC_ALL, __s, __old);
181 +#ifdef __UCLIBC_HAS_XLOCALE__
184 + // This named locale is not supported by the underlying OS.
185 + __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
186 + "name not valid"));
192 + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
194 + if (_S_get_c_locale() != __cloc)
195 + __freelocale(__cloc);
199 + locale::facet::_S_clone_c_locale(__c_locale& __cloc)
200 + { return __duplocale(__cloc); }
205 + const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
213 +#if _GLIBCXX_NUM_CATEGORIES != 0
219 + "LC_IDENTIFICATION"
226 + const char* const* const locale::_S_categories = __gnu_cxx::category_names;
228 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h
229 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100
230 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-08-03 20:30:21.000000000 +0200
232 +// Wrapper for underlying C-language localization -*- C++ -*-
234 +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
236 +// This file is part of the GNU ISO C++ Library. This library is free
237 +// software; you can redistribute it and/or modify it under the
238 +// terms of the GNU General Public License as published by the
239 +// Free Software Foundation; either version 2, or (at your option)
240 +// any later version.
242 +// This library is distributed in the hope that it will be useful,
243 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
244 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
245 +// GNU General Public License for more details.
247 +// You should have received a copy of the GNU General Public License along
248 +// with this library; see the file COPYING. If not, write to the Free
249 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
252 +// As a special exception, you may use this file as part of a free software
253 +// library without restriction. Specifically, if other files instantiate
254 +// templates or use macros or inline functions from this file, or you compile
255 +// this file and link it with other files to produce an executable, this
256 +// file does not by itself cause the resulting executable to be covered by
257 +// the GNU General Public License. This exception does not however
258 +// invalidate any other reasons why the executable file might be covered by
259 +// the GNU General Public License.
262 +// ISO C++ 14882: 22.8 Standard locale categories.
265 +// Written by Benjamin Kosnik <bkoz@redhat.com>
268 +#define _C_LOCALE_H 1
270 +#pragma GCC system_header
272 +#include <cstring> // get std::strlen
273 +#include <cstdio> // get std::snprintf or std::sprintf
275 +#include <langinfo.h> // For codecvt
276 +#ifdef __UCLIBC_MJN3_ONLY__
279 +#ifdef __UCLIBC_HAS_LOCALE__
280 +#include <iconv.h> // For codecvt using iconv, iconv_t
282 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
283 +#include <libintl.h> // For messages
286 +#ifdef __UCLIBC_MJN3_ONLY__
287 +#warning what is _GLIBCXX_C_LOCALE_GNU for
289 +#define _GLIBCXX_C_LOCALE_GNU 1
291 +#ifdef __UCLIBC_MJN3_ONLY__
292 +#warning fix categories
294 +// #define _GLIBCXX_NUM_CATEGORIES 6
295 +#define _GLIBCXX_NUM_CATEGORIES 0
297 +#ifdef __UCLIBC_HAS_XLOCALE__
300 + extern "C" __typeof(uselocale) __uselocale;
306 +#ifdef __UCLIBC_HAS_XLOCALE__
307 + typedef __locale_t __c_locale;
309 + typedef int* __c_locale;
312 + // Convert numeric value of type _Tv to string and return length of
313 + // string. If snprintf is available use it, otherwise fall back to
314 + // the unsafe sprintf which, in general, can be dangerous and should
316 + template<typename _Tv>
318 + __convert_from_v(char* __out,
319 + const int __size __attribute__ ((__unused__)),
321 +#ifdef __UCLIBC_HAS_XCLOCALE__
322 + _Tv __v, const __c_locale& __cloc, int __prec)
324 + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
326 + _Tv __v, const __c_locale&, int __prec)
328 +# ifdef __UCLIBC_HAS_LOCALE__
329 + char* __old = std::setlocale(LC_ALL, NULL);
330 + char* __sav = new char[std::strlen(__old) + 1];
331 + std::strcpy(__sav, __old);
332 + std::setlocale(LC_ALL, "C");
336 + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
338 +#ifdef __UCLIBC_HAS_XCLOCALE__
339 + __gnu_cxx::__uselocale(__old);
340 +#elif defined __UCLIBC_HAS_LOCALE__
341 + std::setlocale(LC_ALL, __sav);
349 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
350 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100
351 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-08-03 20:30:21.000000000 +0200
353 +// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
355 +// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
357 +// This file is part of the GNU ISO C++ Library. This library is free
358 +// software; you can redistribute it and/or modify it under the
359 +// terms of the GNU General Public License as published by the
360 +// Free Software Foundation; either version 2, or (at your option)
361 +// any later version.
363 +// This library is distributed in the hope that it will be useful,
364 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
365 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
366 +// GNU General Public License for more details.
368 +// You should have received a copy of the GNU General Public License along
369 +// with this library; see the file COPYING. If not, write to the Free
370 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
373 +// As a special exception, you may use this file as part of a free software
374 +// library without restriction. Specifically, if other files instantiate
375 +// templates or use macros or inline functions from this file, or you compile
376 +// this file and link it with other files to produce an executable, this
377 +// file does not by itself cause the resulting executable to be covered by
378 +// the GNU General Public License. This exception does not however
379 +// invalidate any other reasons why the executable file might be covered by
380 +// the GNU General Public License.
382 +// Written by Jakub Jelinek <jakub@redhat.com>
384 +#include <bits/c++config.h>
387 +#ifdef __UCLIBC_MJN3_ONLY__
388 +#warning clean this up
391 +#ifdef __UCLIBC_HAS_XLOCALE__
393 +extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
394 +extern "C" __typeof(strcoll_l) __strcoll_l;
395 +extern "C" __typeof(strftime_l) __strftime_l;
396 +extern "C" __typeof(strtod_l) __strtod_l;
397 +extern "C" __typeof(strtof_l) __strtof_l;
398 +extern "C" __typeof(strtold_l) __strtold_l;
399 +extern "C" __typeof(strxfrm_l) __strxfrm_l;
400 +extern "C" __typeof(newlocale) __newlocale;
401 +extern "C" __typeof(freelocale) __freelocale;
402 +extern "C" __typeof(duplocale) __duplocale;
403 +extern "C" __typeof(uselocale) __uselocale;
405 +#ifdef _GLIBCXX_USE_WCHAR_T
406 +extern "C" __typeof(iswctype_l) __iswctype_l;
407 +extern "C" __typeof(towlower_l) __towlower_l;
408 +extern "C" __typeof(towupper_l) __towupper_l;
409 +extern "C" __typeof(wcscoll_l) __wcscoll_l;
410 +extern "C" __typeof(wcsftime_l) __wcsftime_l;
411 +extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
412 +extern "C" __typeof(wctype_l) __wctype_l;
415 +#endif // GLIBC 2.3 and later
416 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
417 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100
418 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-08-03 20:30:21.000000000 +0200
420 +// std::codecvt implementation details, GNU version -*- C++ -*-
422 +// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
424 +// This file is part of the GNU ISO C++ Library. This library is free
425 +// software; you can redistribute it and/or modify it under the
426 +// terms of the GNU General Public License as published by the
427 +// Free Software Foundation; either version 2, or (at your option)
428 +// any later version.
430 +// This library is distributed in the hope that it will be useful,
431 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
432 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
433 +// GNU General Public License for more details.
435 +// You should have received a copy of the GNU General Public License along
436 +// with this library; see the file COPYING. If not, write to the Free
437 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
440 +// As a special exception, you may use this file as part of a free software
441 +// library without restriction. Specifically, if other files instantiate
442 +// templates or use macros or inline functions from this file, or you compile
443 +// this file and link it with other files to produce an executable, this
444 +// file does not by itself cause the resulting executable to be covered by
445 +// the GNU General Public License. This exception does not however
446 +// invalidate any other reasons why the executable file might be covered by
447 +// the GNU General Public License.
450 +// ISO C++ 14882: 22.2.1.5 - Template class codecvt
453 +// Written by Benjamin Kosnik <bkoz@redhat.com>
456 +#include <bits/c++locale_internal.h>
460 + // Specializations.
461 +#ifdef _GLIBCXX_USE_WCHAR_T
462 + codecvt_base::result
463 + codecvt<wchar_t, char, mbstate_t>::
464 + do_out(state_type& __state, const intern_type* __from,
465 + const intern_type* __from_end, const intern_type*& __from_next,
466 + extern_type* __to, extern_type* __to_end,
467 + extern_type*& __to_next) const
470 + state_type __tmp_state(__state);
472 +#ifdef __UCLIBC_HAS_XLOCALE__
473 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
476 + // wcsnrtombs is *very* fast but stops if encounters NUL characters:
477 + // in case we fall back to wcrtomb and then continue, in a loop.
478 + // NB: wcsnrtombs is a GNU extension
479 + for (__from_next = __from, __to_next = __to;
480 + __from_next < __from_end && __to_next < __to_end
483 + const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
484 + __from_end - __from_next);
485 + if (!__from_chunk_end)
486 + __from_chunk_end = __from_end;
488 + __from = __from_next;
489 + const size_t __conv = wcsnrtombs(__to_next, &__from_next,
490 + __from_chunk_end - __from_next,
491 + __to_end - __to_next, &__state);
492 + if (__conv == static_cast<size_t>(-1))
494 + // In case of error, in order to stop at the exact place we
495 + // have to start again from the beginning with a series of
497 + for (; __from < __from_next; ++__from)
498 + __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
499 + __state = __tmp_state;
502 + else if (__from_next && __from_next < __from_chunk_end)
504 + __to_next += __conv;
509 + __from_next = __from_chunk_end;
510 + __to_next += __conv;
513 + if (__from_next < __from_end && __ret == ok)
515 + extern_type __buf[MB_LEN_MAX];
516 + __tmp_state = __state;
517 + const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
518 + if (__conv > static_cast<size_t>(__to_end - __to_next))
522 + memcpy(__to_next, __buf, __conv);
523 + __state = __tmp_state;
524 + __to_next += __conv;
530 +#ifdef __UCLIBC_HAS_XLOCALE__
531 + __uselocale(__old);
537 + codecvt_base::result
538 + codecvt<wchar_t, char, mbstate_t>::
539 + do_in(state_type& __state, const extern_type* __from,
540 + const extern_type* __from_end, const extern_type*& __from_next,
541 + intern_type* __to, intern_type* __to_end,
542 + intern_type*& __to_next) const
545 + state_type __tmp_state(__state);
547 +#ifdef __UCLIBC_HAS_XLOCALE__
548 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
551 + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
552 + // in case we store a L'\0' and then continue, in a loop.
553 + // NB: mbsnrtowcs is a GNU extension
554 + for (__from_next = __from, __to_next = __to;
555 + __from_next < __from_end && __to_next < __to_end
558 + const extern_type* __from_chunk_end;
559 + __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
562 + if (!__from_chunk_end)
563 + __from_chunk_end = __from_end;
565 + __from = __from_next;
566 + size_t __conv = mbsnrtowcs(__to_next, &__from_next,
567 + __from_chunk_end - __from_next,
568 + __to_end - __to_next, &__state);
569 + if (__conv == static_cast<size_t>(-1))
571 + // In case of error, in order to stop at the exact place we
572 + // have to start again from the beginning with a series of
574 + for (;; ++__to_next, __from += __conv)
576 + __conv = mbrtowc(__to_next, __from, __from_end - __from,
578 + if (__conv == static_cast<size_t>(-1)
579 + || __conv == static_cast<size_t>(-2))
582 + __from_next = __from;
583 + __state = __tmp_state;
586 + else if (__from_next && __from_next < __from_chunk_end)
588 + // It is unclear what to return in this case (see DR 382).
589 + __to_next += __conv;
594 + __from_next = __from_chunk_end;
595 + __to_next += __conv;
598 + if (__from_next < __from_end && __ret == ok)
600 + if (__to_next < __to_end)
602 + // XXX Probably wrong for stateful encodings
603 + __tmp_state = __state;
605 + *__to_next++ = L'\0';
612 +#ifdef __UCLIBC_HAS_XLOCALE__
613 + __uselocale(__old);
620 + codecvt<wchar_t, char, mbstate_t>::
621 + do_encoding() const throw()
623 + // XXX This implementation assumes that the encoding is
624 + // stateless and is either single-byte or variable-width.
626 +#ifdef __UCLIBC_HAS_XLOCALE__
627 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
629 + if (MB_CUR_MAX == 1)
631 +#ifdef __UCLIBC_HAS_XLOCALE__
632 + __uselocale(__old);
638 + codecvt<wchar_t, char, mbstate_t>::
639 + do_max_length() const throw()
641 +#ifdef __UCLIBC_HAS_XLOCALE__
642 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
644 + // XXX Probably wrong for stateful encodings.
645 + int __ret = MB_CUR_MAX;
646 +#ifdef __UCLIBC_HAS_XLOCALE__
647 + __uselocale(__old);
653 + codecvt<wchar_t, char, mbstate_t>::
654 + do_length(state_type& __state, const extern_type* __from,
655 + const extern_type* __end, size_t __max) const
658 + state_type __tmp_state(__state);
660 +#ifdef __UCLIBC_HAS_XLOCALE__
661 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
664 + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
665 + // in case we advance past it and then continue, in a loop.
666 + // NB: mbsnrtowcs is a GNU extension
668 + // A dummy internal buffer is needed in order for mbsnrtocws to consider
669 + // its fourth parameter (it wouldn't with NULL as first parameter).
670 + wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
672 + while (__from < __end && __max)
674 + const extern_type* __from_chunk_end;
675 + __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
678 + if (!__from_chunk_end)
679 + __from_chunk_end = __end;
681 + const extern_type* __tmp_from = __from;
682 + size_t __conv = mbsnrtowcs(__to, &__from,
683 + __from_chunk_end - __from,
685 + if (__conv == static_cast<size_t>(-1))
687 + // In case of error, in order to stop at the exact place we
688 + // have to start again from the beginning with a series of
690 + for (__from = __tmp_from;; __from += __conv)
692 + __conv = mbrtowc(NULL, __from, __end - __from,
694 + if (__conv == static_cast<size_t>(-1)
695 + || __conv == static_cast<size_t>(-2))
698 + __state = __tmp_state;
699 + __ret += __from - __tmp_from;
703 + __from = __from_chunk_end;
705 + __ret += __from - __tmp_from;
708 + if (__from < __end && __max)
710 + // XXX Probably wrong for stateful encodings
711 + __tmp_state = __state;
718 +#ifdef __UCLIBC_HAS_XLOCALE__
719 + __uselocale(__old);
726 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
727 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100
728 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-08-03 20:30:21.000000000 +0200
730 +// std::collate implementation details, GNU version -*- C++ -*-
732 +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
734 +// This file is part of the GNU ISO C++ Library. This library is free
735 +// software; you can redistribute it and/or modify it under the
736 +// terms of the GNU General Public License as published by the
737 +// Free Software Foundation; either version 2, or (at your option)
738 +// any later version.
740 +// This library is distributed in the hope that it will be useful,
741 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
742 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
743 +// GNU General Public License for more details.
745 +// You should have received a copy of the GNU General Public License along
746 +// with this library; see the file COPYING. If not, write to the Free
747 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
750 +// As a special exception, you may use this file as part of a free software
751 +// library without restriction. Specifically, if other files instantiate
752 +// templates or use macros or inline functions from this file, or you compile
753 +// this file and link it with other files to produce an executable, this
754 +// file does not by itself cause the resulting executable to be covered by
755 +// the GNU General Public License. This exception does not however
756 +// invalidate any other reasons why the executable file might be covered by
757 +// the GNU General Public License.
760 +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
763 +// Written by Benjamin Kosnik <bkoz@redhat.com>
766 +#include <bits/c++locale_internal.h>
768 +#ifndef __UCLIBC_HAS_XLOCALE__
769 +#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
770 +#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
771 +#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
772 +#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
777 + // These are basically extensions to char_traits, and perhaps should
778 + // be put there instead of here.
781 + collate<char>::_M_compare(const char* __one, const char* __two) const
783 + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
784 + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
789 + collate<char>::_M_transform(char* __to, const char* __from,
791 + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
793 +#ifdef _GLIBCXX_USE_WCHAR_T
796 + collate<wchar_t>::_M_compare(const wchar_t* __one,
797 + const wchar_t* __two) const
799 + int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
800 + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
805 + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
807 + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
810 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
811 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100
812 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-08-03 20:30:21.000000000 +0200
814 +// std::ctype implementation details, GNU version -*- C++ -*-
816 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
818 +// This file is part of the GNU ISO C++ Library. This library is free
819 +// software; you can redistribute it and/or modify it under the
820 +// terms of the GNU General Public License as published by the
821 +// Free Software Foundation; either version 2, or (at your option)
822 +// any later version.
824 +// This library is distributed in the hope that it will be useful,
825 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
826 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
827 +// GNU General Public License for more details.
829 +// You should have received a copy of the GNU General Public License along
830 +// with this library; see the file COPYING. If not, write to the Free
831 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
834 +// As a special exception, you may use this file as part of a free software
835 +// library without restriction. Specifically, if other files instantiate
836 +// templates or use macros or inline functions from this file, or you compile
837 +// this file and link it with other files to produce an executable, this
838 +// file does not by itself cause the resulting executable to be covered by
839 +// the GNU General Public License. This exception does not however
840 +// invalidate any other reasons why the executable file might be covered by
841 +// the GNU General Public License.
844 +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
847 +// Written by Benjamin Kosnik <bkoz@redhat.com>
852 +#include <bits/c++locale_internal.h>
854 +#ifndef __UCLIBC_HAS_XLOCALE__
855 +#define __wctype_l(S, L) wctype((S))
856 +#define __towupper_l(C, L) towupper((C))
857 +#define __towlower_l(C, L) towlower((C))
858 +#define __iswctype_l(C, M, L) iswctype((C), (M))
863 + // NB: The other ctype<char> specializations are in src/locale.cc and
864 + // various /config/os/* files.
866 + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
867 + : ctype<char>(0, false, __refs)
869 + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
871 + this->_S_destroy_c_locale(this->_M_c_locale_ctype);
872 + this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
873 +#ifdef __UCLIBC_HAS_XLOCALE__
874 + this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
875 + this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
876 + this->_M_table = this->_M_c_locale_ctype->__ctype_b;
881 +#ifdef _GLIBCXX_USE_WCHAR_T
882 + ctype<wchar_t>::__wmask_type
883 + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
885 + __wmask_type __ret;
889 + __ret = __wctype_l("space", _M_c_locale_ctype);
892 + __ret = __wctype_l("print", _M_c_locale_ctype);
895 + __ret = __wctype_l("cntrl", _M_c_locale_ctype);
898 + __ret = __wctype_l("upper", _M_c_locale_ctype);
901 + __ret = __wctype_l("lower", _M_c_locale_ctype);
904 + __ret = __wctype_l("alpha", _M_c_locale_ctype);
907 + __ret = __wctype_l("digit", _M_c_locale_ctype);
910 + __ret = __wctype_l("punct", _M_c_locale_ctype);
913 + __ret = __wctype_l("xdigit", _M_c_locale_ctype);
916 + __ret = __wctype_l("alnum", _M_c_locale_ctype);
919 + __ret = __wctype_l("graph", _M_c_locale_ctype);
922 + __ret = __wmask_type();
928 + ctype<wchar_t>::do_toupper(wchar_t __c) const
929 + { return __towupper_l(__c, _M_c_locale_ctype); }
932 + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
934 + while (__lo < __hi)
936 + *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
943 + ctype<wchar_t>::do_tolower(wchar_t __c) const
944 + { return __towlower_l(__c, _M_c_locale_ctype); }
947 + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
949 + while (__lo < __hi)
951 + *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
959 + do_is(mask __m, wchar_t __c) const
961 + // Highest bitmask in ctype_base == 10, but extra in "C"
962 + // library for blank.
963 + bool __ret = false;
964 + const size_t __bitmasksize = 11;
965 + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
966 + if (__m & _M_bit[__bitcur]
967 + && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
977 + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
979 + for (; __lo < __hi; ++__vec, ++__lo)
981 + // Highest bitmask in ctype_base == 10, but extra in "C"
982 + // library for blank.
983 + const size_t __bitmasksize = 11;
985 + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
986 + if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
987 + __m |= _M_bit[__bitcur];
995 + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
997 + while (__lo < __hi && !this->do_is(__m, *__lo))
1004 + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1006 + while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1013 + do_widen(char __c) const
1014 + { return _M_widen[static_cast<unsigned char>(__c)]; }
1018 + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1020 + while (__lo < __hi)
1022 + *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1031 + do_narrow(wchar_t __wc, char __dfault) const
1033 + if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1034 + return _M_narrow[__wc];
1035 +#ifdef __UCLIBC_HAS_XLOCALE__
1036 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1038 + const int __c = wctob(__wc);
1039 +#ifdef __UCLIBC_HAS_XLOCALE__
1040 + __uselocale(__old);
1042 + return (__c == EOF ? __dfault : static_cast<char>(__c));
1047 + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1048 + char* __dest) const
1050 +#ifdef __UCLIBC_HAS_XLOCALE__
1051 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1054 + while (__lo < __hi)
1056 + if (*__lo >= 0 && *__lo < 128)
1057 + *__dest = _M_narrow[*__lo];
1060 + const int __c = wctob(*__lo);
1061 + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1067 + while (__lo < __hi)
1069 + const int __c = wctob(*__lo);
1070 + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1074 +#ifdef __UCLIBC_HAS_XLOCALE__
1075 + __uselocale(__old);
1081 + ctype<wchar_t>::_M_initialize_ctype()
1083 +#ifdef __UCLIBC_HAS_XLOCALE__
1084 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1087 + for (__i = 0; __i < 128; ++__i)
1089 + const int __c = wctob(__i);
1093 + _M_narrow[__i] = static_cast<char>(__c);
1096 + _M_narrow_ok = true;
1098 + _M_narrow_ok = false;
1099 + for (size_t __j = 0;
1100 + __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1101 + _M_widen[__j] = btowc(__j);
1103 + for (size_t __k = 0; __k <= 11; ++__k)
1105 + _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1106 + _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1108 +#ifdef __UCLIBC_HAS_XLOCALE__
1109 + __uselocale(__old);
1112 +#endif // _GLIBCXX_USE_WCHAR_T
1114 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
1115 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100
1116 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-08-03 20:30:21.000000000 +0200
1118 +// std::messages implementation details, GNU version -*- C++ -*-
1120 +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1122 +// This file is part of the GNU ISO C++ Library. This library is free
1123 +// software; you can redistribute it and/or modify it under the
1124 +// terms of the GNU General Public License as published by the
1125 +// Free Software Foundation; either version 2, or (at your option)
1126 +// any later version.
1128 +// This library is distributed in the hope that it will be useful,
1129 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1130 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1131 +// GNU General Public License for more details.
1133 +// You should have received a copy of the GNU General Public License along
1134 +// with this library; see the file COPYING. If not, write to the Free
1135 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1138 +// As a special exception, you may use this file as part of a free software
1139 +// library without restriction. Specifically, if other files instantiate
1140 +// templates or use macros or inline functions from this file, or you compile
1141 +// this file and link it with other files to produce an executable, this
1142 +// file does not by itself cause the resulting executable to be covered by
1143 +// the GNU General Public License. This exception does not however
1144 +// invalidate any other reasons why the executable file might be covered by
1145 +// the GNU General Public License.
1148 +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1151 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1154 +#include <bits/c++locale_internal.h>
1156 +#ifdef __UCLIBC_MJN3_ONLY__
1157 +#warning fix gettext stuff
1159 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1160 +extern "C" char *__dcgettext(const char *domainname,
1161 + const char *msgid, int category);
1163 +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1166 +#define gettext(msgid) (msgid)
1171 + // Specializations.
1174 + messages<char>::do_get(catalog, int, int, const string& __dfault) const
1176 +#ifdef __UCLIBC_HAS_XLOCALE__
1177 + __c_locale __old = __uselocale(_M_c_locale_messages);
1178 + const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1179 + __uselocale(__old);
1180 + return string(__msg);
1181 +#elif defined __UCLIBC_HAS_LOCALE__
1182 + char* __old = strdup(setlocale(LC_ALL, NULL));
1183 + setlocale(LC_ALL, _M_name_messages);
1184 + const char* __msg = gettext(__dfault.c_str());
1185 + setlocale(LC_ALL, __old);
1187 + return string(__msg);
1189 + const char* __msg = gettext(__dfault.c_str());
1190 + return string(__msg);
1194 +#ifdef _GLIBCXX_USE_WCHAR_T
1197 + messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1199 +# ifdef __UCLIBC_HAS_XLOCALE__
1200 + __c_locale __old = __uselocale(_M_c_locale_messages);
1201 + char* __msg = gettext(_M_convert_to_char(__dfault));
1202 + __uselocale(__old);
1203 + return _M_convert_from_char(__msg);
1204 +# elif defined __UCLIBC_HAS_LOCALE__
1205 + char* __old = strdup(setlocale(LC_ALL, NULL));
1206 + setlocale(LC_ALL, _M_name_messages);
1207 + char* __msg = gettext(_M_convert_to_char(__dfault));
1208 + setlocale(LC_ALL, __old);
1210 + return _M_convert_from_char(__msg);
1212 + char* __msg = gettext(_M_convert_to_char(__dfault));
1213 + return _M_convert_from_char(__msg);
1218 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h
1219 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100
1220 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-08-03 20:30:21.000000000 +0200
1222 +// std::messages implementation details, GNU version -*- C++ -*-
1224 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1226 +// This file is part of the GNU ISO C++ Library. This library is free
1227 +// software; you can redistribute it and/or modify it under the
1228 +// terms of the GNU General Public License as published by the
1229 +// Free Software Foundation; either version 2, or (at your option)
1230 +// any later version.
1232 +// This library is distributed in the hope that it will be useful,
1233 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1234 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1235 +// GNU General Public License for more details.
1237 +// You should have received a copy of the GNU General Public License along
1238 +// with this library; see the file COPYING. If not, write to the Free
1239 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1242 +// As a special exception, you may use this file as part of a free software
1243 +// library without restriction. Specifically, if other files instantiate
1244 +// templates or use macros or inline functions from this file, or you compile
1245 +// this file and link it with other files to produce an executable, this
1246 +// file does not by itself cause the resulting executable to be covered by
1247 +// the GNU General Public License. This exception does not however
1248 +// invalidate any other reasons why the executable file might be covered by
1249 +// the GNU General Public License.
1252 +// ISO C++ 14882: 22.2.7.1.2 messages functions
1255 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1257 +#ifdef __UCLIBC_MJN3_ONLY__
1258 +#warning fix prototypes for *textdomain funcs
1260 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1261 +extern "C" char *__textdomain(const char *domainname);
1262 +extern "C" char *__bindtextdomain(const char *domainname,
1263 + const char *dirname);
1265 +#undef __textdomain
1266 +#undef __bindtextdomain
1267 +#define __textdomain(D) ((void)0)
1268 +#define __bindtextdomain(D,P) ((void)0)
1271 + // Non-virtual member functions.
1272 + template<typename _CharT>
1273 + messages<_CharT>::messages(size_t __refs)
1274 + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1275 + _M_name_messages(_S_get_c_name())
1278 + template<typename _CharT>
1279 + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1281 + : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1282 + _M_name_messages(__s)
1284 + char* __tmp = new char[std::strlen(__s) + 1];
1285 + std::strcpy(__tmp, __s);
1286 + _M_name_messages = __tmp;
1289 + template<typename _CharT>
1290 + typename messages<_CharT>::catalog
1291 + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1292 + const char* __dir) const
1294 + __bindtextdomain(__s.c_str(), __dir);
1295 + return this->do_open(__s, __loc);
1298 + // Virtual member functions.
1299 + template<typename _CharT>
1300 + messages<_CharT>::~messages()
1302 + if (_M_name_messages != _S_get_c_name())
1303 + delete [] _M_name_messages;
1304 + _S_destroy_c_locale(_M_c_locale_messages);
1307 + template<typename _CharT>
1308 + typename messages<_CharT>::catalog
1309 + messages<_CharT>::do_open(const basic_string<char>& __s,
1310 + const locale&) const
1312 + // No error checking is done, assume the catalog exists and can
1314 + __textdomain(__s.c_str());
1318 + template<typename _CharT>
1320 + messages<_CharT>::do_close(catalog) const
1323 + // messages_byname
1324 + template<typename _CharT>
1325 + messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1326 + : messages<_CharT>(__refs)
1328 + if (this->_M_name_messages != locale::facet::_S_get_c_name())
1329 + delete [] this->_M_name_messages;
1330 + char* __tmp = new char[std::strlen(__s) + 1];
1331 + std::strcpy(__tmp, __s);
1332 + this->_M_name_messages = __tmp;
1334 + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1336 + this->_S_destroy_c_locale(this->_M_c_locale_messages);
1337 + this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1340 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1341 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100
1342 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-08-03 20:30:21.000000000 +0200
1344 +// std::moneypunct implementation details, GNU version -*- C++ -*-
1346 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1348 +// This file is part of the GNU ISO C++ Library. This library is free
1349 +// software; you can redistribute it and/or modify it under the
1350 +// terms of the GNU General Public License as published by the
1351 +// Free Software Foundation; either version 2, or (at your option)
1352 +// any later version.
1354 +// This library is distributed in the hope that it will be useful,
1355 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1356 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1357 +// GNU General Public License for more details.
1359 +// You should have received a copy of the GNU General Public License along
1360 +// with this library; see the file COPYING. If not, write to the Free
1361 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1364 +// As a special exception, you may use this file as part of a free software
1365 +// library without restriction. Specifically, if other files instantiate
1366 +// templates or use macros or inline functions from this file, or you compile
1367 +// this file and link it with other files to produce an executable, this
1368 +// file does not by itself cause the resulting executable to be covered by
1369 +// the GNU General Public License. This exception does not however
1370 +// invalidate any other reasons why the executable file might be covered by
1371 +// the GNU General Public License.
1374 +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1377 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1382 +#include <bits/c++locale_internal.h>
1384 +#ifdef __UCLIBC_MJN3_ONLY__
1385 +#warning optimize this for uclibc
1386 +#warning tailor for stub locale support
1389 +#ifndef __UCLIBC_HAS_XLOCALE__
1390 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
1395 + // Construct and return valid pattern consisting of some combination of:
1396 + // space none symbol sign value
1397 + money_base::pattern
1398 + money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1402 + // This insanely complicated routine attempts to construct a valid
1403 + // pattern for use with monyepunct. A couple of invariants:
1405 + // if (__precedes) symbol -> value
1406 + // else value -> symbol
1408 + // if (__space) space
1411 + // none == never first
1412 + // space never first or last
1414 + // Any elegant implementations of this are welcome.
1419 + // 1 The sign precedes the value and symbol.
1420 + __ret.field[0] = sign;
1423 + // Pattern starts with sign.
1426 + __ret.field[1] = symbol;
1427 + __ret.field[3] = value;
1431 + __ret.field[1] = value;
1432 + __ret.field[3] = symbol;
1434 + __ret.field[2] = space;
1438 + // Pattern starts with sign and ends with none.
1441 + __ret.field[1] = symbol;
1442 + __ret.field[2] = value;
1446 + __ret.field[1] = value;
1447 + __ret.field[2] = symbol;
1449 + __ret.field[3] = none;
1453 + // 2 The sign follows the value and symbol.
1456 + // Pattern either ends with sign.
1459 + __ret.field[0] = symbol;
1460 + __ret.field[2] = value;
1464 + __ret.field[0] = value;
1465 + __ret.field[2] = symbol;
1467 + __ret.field[1] = space;
1468 + __ret.field[3] = sign;
1472 + // Pattern ends with sign then none.
1475 + __ret.field[0] = symbol;
1476 + __ret.field[1] = value;
1480 + __ret.field[0] = value;
1481 + __ret.field[1] = symbol;
1483 + __ret.field[2] = sign;
1484 + __ret.field[3] = none;
1488 + // 3 The sign immediately precedes the symbol.
1491 + __ret.field[0] = sign;
1492 + __ret.field[1] = symbol;
1495 + __ret.field[2] = space;
1496 + __ret.field[3] = value;
1500 + __ret.field[2] = value;
1501 + __ret.field[3] = none;
1506 + __ret.field[0] = value;
1509 + __ret.field[1] = space;
1510 + __ret.field[2] = sign;
1511 + __ret.field[3] = symbol;
1515 + __ret.field[1] = sign;
1516 + __ret.field[2] = symbol;
1517 + __ret.field[3] = none;
1522 + // 4 The sign immediately follows the symbol.
1525 + __ret.field[0] = symbol;
1526 + __ret.field[1] = sign;
1529 + __ret.field[2] = space;
1530 + __ret.field[3] = value;
1534 + __ret.field[2] = value;
1535 + __ret.field[3] = none;
1540 + __ret.field[0] = value;
1543 + __ret.field[1] = space;
1544 + __ret.field[2] = symbol;
1545 + __ret.field[3] = sign;
1549 + __ret.field[1] = symbol;
1550 + __ret.field[2] = sign;
1551 + __ret.field[3] = none;
1563 + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1567 + _M_data = new __moneypunct_cache<char, true>;
1572 + _M_data->_M_decimal_point = '.';
1573 + _M_data->_M_thousands_sep = ',';
1574 + _M_data->_M_grouping = "";
1575 + _M_data->_M_grouping_size = 0;
1576 + _M_data->_M_curr_symbol = "";
1577 + _M_data->_M_curr_symbol_size = 0;
1578 + _M_data->_M_positive_sign = "";
1579 + _M_data->_M_positive_sign_size = 0;
1580 + _M_data->_M_negative_sign = "";
1581 + _M_data->_M_negative_sign_size = 0;
1582 + _M_data->_M_frac_digits = 0;
1583 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1584 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1586 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1587 + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1592 + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1594 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1596 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1597 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1598 + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1599 + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1601 + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1603 + _M_data->_M_negative_sign = "()";
1605 + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1607 + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1610 + _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1611 + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1612 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1614 + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1615 + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1616 + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1617 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1619 + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1620 + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1621 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1628 + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1632 + _M_data = new __moneypunct_cache<char, false>;
1637 + _M_data->_M_decimal_point = '.';
1638 + _M_data->_M_thousands_sep = ',';
1639 + _M_data->_M_grouping = "";
1640 + _M_data->_M_grouping_size = 0;
1641 + _M_data->_M_curr_symbol = "";
1642 + _M_data->_M_curr_symbol_size = 0;
1643 + _M_data->_M_positive_sign = "";
1644 + _M_data->_M_positive_sign_size = 0;
1645 + _M_data->_M_negative_sign = "";
1646 + _M_data->_M_negative_sign_size = 0;
1647 + _M_data->_M_frac_digits = 0;
1648 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1649 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1651 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1652 + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1657 + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1659 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1661 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1662 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1663 + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1664 + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1666 + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1668 + _M_data->_M_negative_sign = "()";
1670 + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1672 + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1675 + _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1676 + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1677 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1678 + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1679 + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1680 + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1681 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1683 + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1684 + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1685 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1691 + moneypunct<char, true>::~moneypunct()
1692 + { delete _M_data; }
1695 + moneypunct<char, false>::~moneypunct()
1696 + { delete _M_data; }
1698 +#ifdef _GLIBCXX_USE_WCHAR_T
1701 + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1702 +#ifdef __UCLIBC_HAS_XLOCALE__
1705 + const char* __name)
1709 + _M_data = new __moneypunct_cache<wchar_t, true>;
1714 + _M_data->_M_decimal_point = L'.';
1715 + _M_data->_M_thousands_sep = L',';
1716 + _M_data->_M_grouping = "";
1717 + _M_data->_M_grouping_size = 0;
1718 + _M_data->_M_curr_symbol = L"";
1719 + _M_data->_M_curr_symbol_size = 0;
1720 + _M_data->_M_positive_sign = L"";
1721 + _M_data->_M_positive_sign_size = 0;
1722 + _M_data->_M_negative_sign = L"";
1723 + _M_data->_M_negative_sign_size = 0;
1724 + _M_data->_M_frac_digits = 0;
1725 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1726 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1728 + // Use ctype::widen code without the facet...
1729 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1730 + _M_data->_M_atoms[__i] =
1731 + static_cast<wchar_t>(money_base::_S_atoms[__i]);
1736 +#ifdef __UCLIBC_HAS_XLOCALE__
1737 + __c_locale __old = __uselocale(__cloc);
1739 + // Switch to named locale so that mbsrtowcs will work.
1740 + char* __old = strdup(setlocale(LC_ALL, NULL));
1741 + setlocale(LC_ALL, __name);
1744 +#ifdef __UCLIBC_MJN3_ONLY__
1745 +#warning fix this... should be monetary
1748 +# ifdef __UCLIBC_HAS_XLOCALE__
1749 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1750 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1752 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1753 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1756 + union { char *__s; wchar_t __w; } __u;
1757 + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1758 + _M_data->_M_decimal_point = __u.__w;
1760 + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1761 + _M_data->_M_thousands_sep = __u.__w;
1763 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1764 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1766 + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1767 + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1768 + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1770 + wchar_t* __wcs_ps = 0;
1771 + wchar_t* __wcs_ns = 0;
1772 + const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1775 + mbstate_t __state;
1776 + size_t __len = strlen(__cpossign);
1780 + memset(&__state, 0, sizeof(mbstate_t));
1781 + __wcs_ps = new wchar_t[__len];
1782 + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1783 + _M_data->_M_positive_sign = __wcs_ps;
1786 + _M_data->_M_positive_sign = L"";
1787 + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1789 + __len = strlen(__cnegsign);
1791 + _M_data->_M_negative_sign = L"()";
1795 + memset(&__state, 0, sizeof(mbstate_t));
1796 + __wcs_ns = new wchar_t[__len];
1797 + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1798 + _M_data->_M_negative_sign = __wcs_ns;
1801 + _M_data->_M_negative_sign = L"";
1802 + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1805 + __len = strlen(__ccurr);
1809 + memset(&__state, 0, sizeof(mbstate_t));
1810 + wchar_t* __wcs = new wchar_t[__len];
1811 + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1812 + _M_data->_M_curr_symbol = __wcs;
1815 + _M_data->_M_curr_symbol = L"";
1816 + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1824 +#ifdef __UCLIBC_HAS_XLOCALE__
1825 + __uselocale(__old);
1827 + setlocale(LC_ALL, __old);
1830 + __throw_exception_again;
1833 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1835 + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1836 + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1837 + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1838 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1840 + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1841 + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1842 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1845 +#ifdef __UCLIBC_HAS_XLOCALE__
1846 + __uselocale(__old);
1848 + setlocale(LC_ALL, __old);
1856 + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1857 +#ifdef __UCLIBC_HAS_XLOCALE__
1860 + const char* __name)
1864 + _M_data = new __moneypunct_cache<wchar_t, false>;
1869 + _M_data->_M_decimal_point = L'.';
1870 + _M_data->_M_thousands_sep = L',';
1871 + _M_data->_M_grouping = "";
1872 + _M_data->_M_grouping_size = 0;
1873 + _M_data->_M_curr_symbol = L"";
1874 + _M_data->_M_curr_symbol_size = 0;
1875 + _M_data->_M_positive_sign = L"";
1876 + _M_data->_M_positive_sign_size = 0;
1877 + _M_data->_M_negative_sign = L"";
1878 + _M_data->_M_negative_sign_size = 0;
1879 + _M_data->_M_frac_digits = 0;
1880 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1881 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1883 + // Use ctype::widen code without the facet...
1884 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1885 + _M_data->_M_atoms[__i] =
1886 + static_cast<wchar_t>(money_base::_S_atoms[__i]);
1891 +#ifdef __UCLIBC_HAS_XLOCALE__
1892 + __c_locale __old = __uselocale(__cloc);
1894 + // Switch to named locale so that mbsrtowcs will work.
1895 + char* __old = strdup(setlocale(LC_ALL, NULL));
1896 + setlocale(LC_ALL, __name);
1899 +#ifdef __UCLIBC_MJN3_ONLY__
1900 +#warning fix this... should be monetary
1903 +# ifdef __UCLIBC_HAS_XLOCALE__
1904 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1905 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1907 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1908 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1911 + union { char *__s; wchar_t __w; } __u;
1912 + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1913 + _M_data->_M_decimal_point = __u.__w;
1915 + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1916 + _M_data->_M_thousands_sep = __u.__w;
1918 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1919 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1921 + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1922 + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1923 + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1925 + wchar_t* __wcs_ps = 0;
1926 + wchar_t* __wcs_ns = 0;
1927 + const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1930 + mbstate_t __state;
1932 + __len = strlen(__cpossign);
1936 + memset(&__state, 0, sizeof(mbstate_t));
1937 + __wcs_ps = new wchar_t[__len];
1938 + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1939 + _M_data->_M_positive_sign = __wcs_ps;
1942 + _M_data->_M_positive_sign = L"";
1943 + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1945 + __len = strlen(__cnegsign);
1947 + _M_data->_M_negative_sign = L"()";
1951 + memset(&__state, 0, sizeof(mbstate_t));
1952 + __wcs_ns = new wchar_t[__len];
1953 + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1954 + _M_data->_M_negative_sign = __wcs_ns;
1957 + _M_data->_M_negative_sign = L"";
1958 + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1961 + __len = strlen(__ccurr);
1965 + memset(&__state, 0, sizeof(mbstate_t));
1966 + wchar_t* __wcs = new wchar_t[__len];
1967 + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1968 + _M_data->_M_curr_symbol = __wcs;
1971 + _M_data->_M_curr_symbol = L"";
1972 + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1980 +#ifdef __UCLIBC_HAS_XLOCALE__
1981 + __uselocale(__old);
1983 + setlocale(LC_ALL, __old);
1986 + __throw_exception_again;
1989 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1990 + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1991 + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1992 + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1993 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1995 + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1996 + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1997 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2000 +#ifdef __UCLIBC_HAS_XLOCALE__
2001 + __uselocale(__old);
2003 + setlocale(LC_ALL, __old);
2010 + moneypunct<wchar_t, true>::~moneypunct()
2012 + if (_M_data->_M_positive_sign_size)
2013 + delete [] _M_data->_M_positive_sign;
2014 + if (_M_data->_M_negative_sign_size
2015 + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2016 + delete [] _M_data->_M_negative_sign;
2017 + if (_M_data->_M_curr_symbol_size)
2018 + delete [] _M_data->_M_curr_symbol;
2023 + moneypunct<wchar_t, false>::~moneypunct()
2025 + if (_M_data->_M_positive_sign_size)
2026 + delete [] _M_data->_M_positive_sign;
2027 + if (_M_data->_M_negative_sign_size
2028 + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2029 + delete [] _M_data->_M_negative_sign;
2030 + if (_M_data->_M_curr_symbol_size)
2031 + delete [] _M_data->_M_curr_symbol;
2036 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2037 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100
2038 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-08-03 20:30:21.000000000 +0200
2040 +// std::numpunct implementation details, GNU version -*- C++ -*-
2042 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2044 +// This file is part of the GNU ISO C++ Library. This library is free
2045 +// software; you can redistribute it and/or modify it under the
2046 +// terms of the GNU General Public License as published by the
2047 +// Free Software Foundation; either version 2, or (at your option)
2048 +// any later version.
2050 +// This library is distributed in the hope that it will be useful,
2051 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2052 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2053 +// GNU General Public License for more details.
2055 +// You should have received a copy of the GNU General Public License along
2056 +// with this library; see the file COPYING. If not, write to the Free
2057 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2060 +// As a special exception, you may use this file as part of a free software
2061 +// library without restriction. Specifically, if other files instantiate
2062 +// templates or use macros or inline functions from this file, or you compile
2063 +// this file and link it with other files to produce an executable, this
2064 +// file does not by itself cause the resulting executable to be covered by
2065 +// the GNU General Public License. This exception does not however
2066 +// invalidate any other reasons why the executable file might be covered by
2067 +// the GNU General Public License.
2070 +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2073 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2078 +#include <bits/c++locale_internal.h>
2080 +#ifdef __UCLIBC_MJN3_ONLY__
2081 +#warning tailor for stub locale support
2083 +#ifndef __UCLIBC_HAS_XLOCALE__
2084 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
2091 + numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2094 + _M_data = new __numpunct_cache<char>;
2099 + _M_data->_M_grouping = "";
2100 + _M_data->_M_grouping_size = 0;
2101 + _M_data->_M_use_grouping = false;
2103 + _M_data->_M_decimal_point = '.';
2104 + _M_data->_M_thousands_sep = ',';
2106 + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2107 + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2109 + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2110 + _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2115 + _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2117 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2120 + // Check for NULL, which implies no grouping.
2121 + if (_M_data->_M_thousands_sep == '\0')
2122 + _M_data->_M_grouping = "";
2124 + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2125 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2128 + // NB: There is no way to extact this info from posix locales.
2129 + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2130 + _M_data->_M_truename = "true";
2131 + _M_data->_M_truename_size = 4;
2132 + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2133 + _M_data->_M_falsename = "false";
2134 + _M_data->_M_falsename_size = 5;
2138 + numpunct<char>::~numpunct()
2139 + { delete _M_data; }
2141 +#ifdef _GLIBCXX_USE_WCHAR_T
2144 + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2147 + _M_data = new __numpunct_cache<wchar_t>;
2152 + _M_data->_M_grouping = "";
2153 + _M_data->_M_grouping_size = 0;
2154 + _M_data->_M_use_grouping = false;
2156 + _M_data->_M_decimal_point = L'.';
2157 + _M_data->_M_thousands_sep = L',';
2159 + // Use ctype::widen code without the facet...
2160 + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2161 + _M_data->_M_atoms_out[__i] =
2162 + static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2164 + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2165 + _M_data->_M_atoms_in[__j] =
2166 + static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2171 + // NB: In the GNU model wchar_t is always 32 bit wide.
2172 + union { char *__s; wchar_t __w; } __u;
2173 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2174 + _M_data->_M_decimal_point = __u.__w;
2176 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2177 + _M_data->_M_thousands_sep = __u.__w;
2179 + if (_M_data->_M_thousands_sep == L'\0')
2180 + _M_data->_M_grouping = "";
2182 + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2183 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2186 + // NB: There is no way to extact this info from posix locales.
2187 + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2188 + _M_data->_M_truename = L"true";
2189 + _M_data->_M_truename_size = 4;
2190 + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2191 + _M_data->_M_falsename = L"false";
2192 + _M_data->_M_falsename_size = 5;
2196 + numpunct<wchar_t>::~numpunct()
2197 + { delete _M_data; }
2200 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc
2201 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100
2202 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-08-03 20:30:21.000000000 +0200
2204 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2206 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2208 +// This file is part of the GNU ISO C++ Library. This library is free
2209 +// software; you can redistribute it and/or modify it under the
2210 +// terms of the GNU General Public License as published by the
2211 +// Free Software Foundation; either version 2, or (at your option)
2212 +// any later version.
2214 +// This library is distributed in the hope that it will be useful,
2215 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2216 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2217 +// GNU General Public License for more details.
2219 +// You should have received a copy of the GNU General Public License along
2220 +// with this library; see the file COPYING. If not, write to the Free
2221 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2224 +// As a special exception, you may use this file as part of a free software
2225 +// library without restriction. Specifically, if other files instantiate
2226 +// templates or use macros or inline functions from this file, or you compile
2227 +// this file and link it with other files to produce an executable, this
2228 +// file does not by itself cause the resulting executable to be covered by
2229 +// the GNU General Public License. This exception does not however
2230 +// invalidate any other reasons why the executable file might be covered by
2231 +// the GNU General Public License.
2234 +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2235 +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2238 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2241 +#include <bits/c++locale_internal.h>
2243 +#ifdef __UCLIBC_MJN3_ONLY__
2244 +#warning tailor for stub locale support
2246 +#ifndef __UCLIBC_HAS_XLOCALE__
2247 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
2254 + __timepunct<char>::
2255 + _M_put(char* __s, size_t __maxlen, const char* __format,
2256 + const tm* __tm) const
2258 +#ifdef __UCLIBC_HAS_XLOCALE__
2259 + const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2260 + _M_c_locale_timepunct);
2262 + char* __old = strdup(setlocale(LC_ALL, NULL));
2263 + setlocale(LC_ALL, _M_name_timepunct);
2264 + const size_t __len = strftime(__s, __maxlen, __format, __tm);
2265 + setlocale(LC_ALL, __old);
2268 + // Make sure __s is null terminated.
2275 + __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2278 + _M_data = new __timepunct_cache<char>;
2283 + _M_c_locale_timepunct = _S_get_c_locale();
2285 + _M_data->_M_date_format = "%m/%d/%y";
2286 + _M_data->_M_date_era_format = "%m/%d/%y";
2287 + _M_data->_M_time_format = "%H:%M:%S";
2288 + _M_data->_M_time_era_format = "%H:%M:%S";
2289 + _M_data->_M_date_time_format = "";
2290 + _M_data->_M_date_time_era_format = "";
2291 + _M_data->_M_am = "AM";
2292 + _M_data->_M_pm = "PM";
2293 + _M_data->_M_am_pm_format = "";
2295 + // Day names, starting with "C"'s Sunday.
2296 + _M_data->_M_day1 = "Sunday";
2297 + _M_data->_M_day2 = "Monday";
2298 + _M_data->_M_day3 = "Tuesday";
2299 + _M_data->_M_day4 = "Wednesday";
2300 + _M_data->_M_day5 = "Thursday";
2301 + _M_data->_M_day6 = "Friday";
2302 + _M_data->_M_day7 = "Saturday";
2304 + // Abbreviated day names, starting with "C"'s Sun.
2305 + _M_data->_M_aday1 = "Sun";
2306 + _M_data->_M_aday2 = "Mon";
2307 + _M_data->_M_aday3 = "Tue";
2308 + _M_data->_M_aday4 = "Wed";
2309 + _M_data->_M_aday5 = "Thu";
2310 + _M_data->_M_aday6 = "Fri";
2311 + _M_data->_M_aday7 = "Sat";
2313 + // Month names, starting with "C"'s January.
2314 + _M_data->_M_month01 = "January";
2315 + _M_data->_M_month02 = "February";
2316 + _M_data->_M_month03 = "March";
2317 + _M_data->_M_month04 = "April";
2318 + _M_data->_M_month05 = "May";
2319 + _M_data->_M_month06 = "June";
2320 + _M_data->_M_month07 = "July";
2321 + _M_data->_M_month08 = "August";
2322 + _M_data->_M_month09 = "September";
2323 + _M_data->_M_month10 = "October";
2324 + _M_data->_M_month11 = "November";
2325 + _M_data->_M_month12 = "December";
2327 + // Abbreviated month names, starting with "C"'s Jan.
2328 + _M_data->_M_amonth01 = "Jan";
2329 + _M_data->_M_amonth02 = "Feb";
2330 + _M_data->_M_amonth03 = "Mar";
2331 + _M_data->_M_amonth04 = "Apr";
2332 + _M_data->_M_amonth05 = "May";
2333 + _M_data->_M_amonth06 = "Jun";
2334 + _M_data->_M_amonth07 = "Jul";
2335 + _M_data->_M_amonth08 = "Aug";
2336 + _M_data->_M_amonth09 = "Sep";
2337 + _M_data->_M_amonth10 = "Oct";
2338 + _M_data->_M_amonth11 = "Nov";
2339 + _M_data->_M_amonth12 = "Dec";
2343 + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2345 + _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2346 + _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2347 + _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2348 + _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2349 + _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2350 + _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2352 + _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2353 + _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2354 + _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2356 + // Day names, starting with "C"'s Sunday.
2357 + _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2358 + _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2359 + _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2360 + _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2361 + _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2362 + _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2363 + _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2365 + // Abbreviated day names, starting with "C"'s Sun.
2366 + _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2367 + _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2368 + _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2369 + _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2370 + _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2371 + _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2372 + _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2374 + // Month names, starting with "C"'s January.
2375 + _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2376 + _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2377 + _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2378 + _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2379 + _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2380 + _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2381 + _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2382 + _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2383 + _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2384 + _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2385 + _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2386 + _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2388 + // Abbreviated month names, starting with "C"'s Jan.
2389 + _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2390 + _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2391 + _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2392 + _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2393 + _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2394 + _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2395 + _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2396 + _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2397 + _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2398 + _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2399 + _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2400 + _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2404 +#ifdef _GLIBCXX_USE_WCHAR_T
2407 + __timepunct<wchar_t>::
2408 + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2409 + const tm* __tm) const
2411 +#ifdef __UCLIBC_HAS_XLOCALE__
2412 + __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2413 + const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2414 + _M_c_locale_timepunct);
2416 + char* __old = strdup(setlocale(LC_ALL, NULL));
2417 + setlocale(LC_ALL, _M_name_timepunct);
2418 + const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2419 + setlocale(LC_ALL, __old);
2422 + // Make sure __s is null terminated.
2429 + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2432 + _M_data = new __timepunct_cache<wchar_t>;
2434 +#warning wide time stuff
2438 + _M_c_locale_timepunct = _S_get_c_locale();
2440 + _M_data->_M_date_format = L"%m/%d/%y";
2441 + _M_data->_M_date_era_format = L"%m/%d/%y";
2442 + _M_data->_M_time_format = L"%H:%M:%S";
2443 + _M_data->_M_time_era_format = L"%H:%M:%S";
2444 + _M_data->_M_date_time_format = L"";
2445 + _M_data->_M_date_time_era_format = L"";
2446 + _M_data->_M_am = L"AM";
2447 + _M_data->_M_pm = L"PM";
2448 + _M_data->_M_am_pm_format = L"";
2450 + // Day names, starting with "C"'s Sunday.
2451 + _M_data->_M_day1 = L"Sunday";
2452 + _M_data->_M_day2 = L"Monday";
2453 + _M_data->_M_day3 = L"Tuesday";
2454 + _M_data->_M_day4 = L"Wednesday";
2455 + _M_data->_M_day5 = L"Thursday";
2456 + _M_data->_M_day6 = L"Friday";
2457 + _M_data->_M_day7 = L"Saturday";
2459 + // Abbreviated day names, starting with "C"'s Sun.
2460 + _M_data->_M_aday1 = L"Sun";
2461 + _M_data->_M_aday2 = L"Mon";
2462 + _M_data->_M_aday3 = L"Tue";
2463 + _M_data->_M_aday4 = L"Wed";
2464 + _M_data->_M_aday5 = L"Thu";
2465 + _M_data->_M_aday6 = L"Fri";
2466 + _M_data->_M_aday7 = L"Sat";
2468 + // Month names, starting with "C"'s January.
2469 + _M_data->_M_month01 = L"January";
2470 + _M_data->_M_month02 = L"February";
2471 + _M_data->_M_month03 = L"March";
2472 + _M_data->_M_month04 = L"April";
2473 + _M_data->_M_month05 = L"May";
2474 + _M_data->_M_month06 = L"June";
2475 + _M_data->_M_month07 = L"July";
2476 + _M_data->_M_month08 = L"August";
2477 + _M_data->_M_month09 = L"September";
2478 + _M_data->_M_month10 = L"October";
2479 + _M_data->_M_month11 = L"November";
2480 + _M_data->_M_month12 = L"December";
2482 + // Abbreviated month names, starting with "C"'s Jan.
2483 + _M_data->_M_amonth01 = L"Jan";
2484 + _M_data->_M_amonth02 = L"Feb";
2485 + _M_data->_M_amonth03 = L"Mar";
2486 + _M_data->_M_amonth04 = L"Apr";
2487 + _M_data->_M_amonth05 = L"May";
2488 + _M_data->_M_amonth06 = L"Jun";
2489 + _M_data->_M_amonth07 = L"Jul";
2490 + _M_data->_M_amonth08 = L"Aug";
2491 + _M_data->_M_amonth09 = L"Sep";
2492 + _M_data->_M_amonth10 = L"Oct";
2493 + _M_data->_M_amonth11 = L"Nov";
2494 + _M_data->_M_amonth12 = L"Dec";
2499 + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2501 + union { char *__s; wchar_t *__w; } __u;
2503 + __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2504 + _M_data->_M_date_format = __u.__w;
2505 + __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2506 + _M_data->_M_date_era_format = __u.__w;
2507 + __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2508 + _M_data->_M_time_format = __u.__w;
2509 + __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2510 + _M_data->_M_time_era_format = __u.__w;
2511 + __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2512 + _M_data->_M_date_time_format = __u.__w;
2513 + __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2514 + _M_data->_M_date_time_era_format = __u.__w;
2515 + __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2516 + _M_data->_M_am = __u.__w;
2517 + __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2518 + _M_data->_M_pm = __u.__w;
2519 + __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2520 + _M_data->_M_am_pm_format = __u.__w;
2522 + // Day names, starting with "C"'s Sunday.
2523 + __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2524 + _M_data->_M_day1 = __u.__w;
2525 + __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2526 + _M_data->_M_day2 = __u.__w;
2527 + __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2528 + _M_data->_M_day3 = __u.__w;
2529 + __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2530 + _M_data->_M_day4 = __u.__w;
2531 + __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2532 + _M_data->_M_day5 = __u.__w;
2533 + __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2534 + _M_data->_M_day6 = __u.__w;
2535 + __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2536 + _M_data->_M_day7 = __u.__w;
2538 + // Abbreviated day names, starting with "C"'s Sun.
2539 + __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2540 + _M_data->_M_aday1 = __u.__w;
2541 + __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2542 + _M_data->_M_aday2 = __u.__w;
2543 + __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2544 + _M_data->_M_aday3 = __u.__w;
2545 + __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2546 + _M_data->_M_aday4 = __u.__w;
2547 + __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2548 + _M_data->_M_aday5 = __u.__w;
2549 + __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2550 + _M_data->_M_aday6 = __u.__w;
2551 + __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2552 + _M_data->_M_aday7 = __u.__w;
2554 + // Month names, starting with "C"'s January.
2555 + __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2556 + _M_data->_M_month01 = __u.__w;
2557 + __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2558 + _M_data->_M_month02 = __u.__w;
2559 + __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2560 + _M_data->_M_month03 = __u.__w;
2561 + __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2562 + _M_data->_M_month04 = __u.__w;
2563 + __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2564 + _M_data->_M_month05 = __u.__w;
2565 + __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2566 + _M_data->_M_month06 = __u.__w;
2567 + __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2568 + _M_data->_M_month07 = __u.__w;
2569 + __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2570 + _M_data->_M_month08 = __u.__w;
2571 + __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2572 + _M_data->_M_month09 = __u.__w;
2573 + __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2574 + _M_data->_M_month10 = __u.__w;
2575 + __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2576 + _M_data->_M_month11 = __u.__w;
2577 + __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2578 + _M_data->_M_month12 = __u.__w;
2580 + // Abbreviated month names, starting with "C"'s Jan.
2581 + __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2582 + _M_data->_M_amonth01 = __u.__w;
2583 + __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2584 + _M_data->_M_amonth02 = __u.__w;
2585 + __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2586 + _M_data->_M_amonth03 = __u.__w;
2587 + __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2588 + _M_data->_M_amonth04 = __u.__w;
2589 + __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2590 + _M_data->_M_amonth05 = __u.__w;
2591 + __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2592 + _M_data->_M_amonth06 = __u.__w;
2593 + __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2594 + _M_data->_M_amonth07 = __u.__w;
2595 + __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2596 + _M_data->_M_amonth08 = __u.__w;
2597 + __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2598 + _M_data->_M_amonth09 = __u.__w;
2599 + __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2600 + _M_data->_M_amonth10 = __u.__w;
2601 + __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2602 + _M_data->_M_amonth11 = __u.__w;
2603 + __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2604 + _M_data->_M_amonth12 = __u.__w;
2610 diff -durN gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h
2611 --- gcc-4.2.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100
2612 +++ gcc-4.2.1/libstdc++-v3/config/locale/uclibc/time_members.h 2007-08-03 20:30:21.000000000 +0200
2614 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2616 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2618 +// This file is part of the GNU ISO C++ Library. This library is free
2619 +// software; you can redistribute it and/or modify it under the
2620 +// terms of the GNU General Public License as published by the
2621 +// Free Software Foundation; either version 2, or (at your option)
2622 +// any later version.
2624 +// This library is distributed in the hope that it will be useful,
2625 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2626 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2627 +// GNU General Public License for more details.
2629 +// You should have received a copy of the GNU General Public License along
2630 +// with this library; see the file COPYING. If not, write to the Free
2631 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2634 +// As a special exception, you may use this file as part of a free software
2635 +// library without restriction. Specifically, if other files instantiate
2636 +// templates or use macros or inline functions from this file, or you compile
2637 +// this file and link it with other files to produce an executable, this
2638 +// file does not by itself cause the resulting executable to be covered by
2639 +// the GNU General Public License. This exception does not however
2640 +// invalidate any other reasons why the executable file might be covered by
2641 +// the GNU General Public License.
2644 +// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2645 +// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2648 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2650 + template<typename _CharT>
2651 + __timepunct<_CharT>::__timepunct(size_t __refs)
2652 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2653 + _M_name_timepunct(_S_get_c_name())
2654 + { _M_initialize_timepunct(); }
2656 + template<typename _CharT>
2657 + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2658 + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2659 + _M_name_timepunct(_S_get_c_name())
2660 + { _M_initialize_timepunct(); }
2662 + template<typename _CharT>
2663 + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2665 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2666 + _M_name_timepunct(__s)
2668 + char* __tmp = new char[std::strlen(__s) + 1];
2669 + std::strcpy(__tmp, __s);
2670 + _M_name_timepunct = __tmp;
2671 + _M_initialize_timepunct(__cloc);
2674 + template<typename _CharT>
2675 + __timepunct<_CharT>::~__timepunct()
2677 + if (_M_name_timepunct != _S_get_c_name())
2678 + delete [] _M_name_timepunct;
2680 + _S_destroy_c_locale(_M_c_locale_timepunct);
2682 diff -durN gcc-4.2.1.orig/libstdc++-v3/configure gcc-4.2.1/libstdc++-v3/configure
2683 --- gcc-4.2.1.orig/libstdc++-v3/configure 2007-08-03 20:29:22.000000000 +0200
2684 +++ gcc-4.2.1/libstdc++-v3/configure 2007-08-03 20:30:21.000000000 +0200
2685 @@ -5769,7 +5769,7 @@
2686 enableval="$enable_clocale"
2688 case "$enableval" in
2689 - generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
2690 + generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
2691 *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
2692 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
2693 { (exit 1); exit 1; }; } ;;
2694 @@ -5802,6 +5802,9 @@
2695 # Default to "generic".
2696 if test $enable_clocale_flag = auto; then
2697 case ${target_os} in
2699 + enable_clocale_flag=uclibc
2701 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2702 enable_clocale_flag=gnu
2704 @@ -6190,6 +6193,76 @@
2705 CTIME_CC=config/locale/generic/time_members.cc
2706 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2709 + echo "$as_me:$LINENO: result: uclibc" >&5
2710 +echo "${ECHO_T}uclibc" >&6
2712 + # Declare intention to use gettext, and add support for specific
2714 + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2715 + ALL_LINGUAS="de fr"
2717 + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2718 + # Extract the first word of "msgfmt", so it can be a program name with args.
2719 +set dummy msgfmt; ac_word=$2
2720 +echo "$as_me:$LINENO: checking for $ac_word" >&5
2721 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2722 +if test "${ac_cv_prog_check_msgfmt+set}" = set; then
2723 + echo $ECHO_N "(cached) $ECHO_C" >&6
2725 + if test -n "$check_msgfmt"; then
2726 + ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2728 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2729 +for as_dir in $PATH
2732 + test -z "$as_dir" && as_dir=.
2733 + for ac_exec_ext in '' $ac_executable_extensions; do
2734 + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2735 + ac_cv_prog_check_msgfmt="yes"
2736 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2742 + test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2745 +check_msgfmt=$ac_cv_prog_check_msgfmt
2746 +if test -n "$check_msgfmt"; then
2747 + echo "$as_me:$LINENO: result: $check_msgfmt" >&5
2748 +echo "${ECHO_T}$check_msgfmt" >&6
2750 + echo "$as_me:$LINENO: result: no" >&5
2751 +echo "${ECHO_T}no" >&6
2754 + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2757 + # Export the build objects.
2758 + for ling in $ALL_LINGUAS; do \
2759 + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2760 + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2765 + CLOCALE_H=config/locale/uclibc/c_locale.h
2766 + CLOCALE_CC=config/locale/uclibc/c_locale.cc
2767 + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2768 + CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2769 + CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2770 + CMESSAGES_H=config/locale/uclibc/messages_members.h
2771 + CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2772 + CMONEY_CC=config/locale/uclibc/monetary_members.cc
2773 + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2774 + CTIME_H=config/locale/uclibc/time_members.h
2775 + CTIME_CC=config/locale/uclibc/time_members.cc
2776 + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2780 # This is where the testsuite looks for locale catalogs, using the
2781 diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h
2782 --- gcc-4.2.1.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-17 04:28:44.000000000 +0200
2783 +++ gcc-4.2.1/libstdc++-v3/include/c_compatibility/wchar.h 2007-08-03 20:30:21.000000000 +0200
2786 using std::wmemmove;
2788 +#if _GLIBCXX_HAVE_WCSFTIME
2789 using std::wcsftime;
2792 #if _GLIBCXX_USE_C99
2794 diff -durN gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h
2795 --- gcc-4.2.1.orig/libstdc++-v3/include/c_std/std_cwchar.h 2006-12-07 10:33:51.000000000 +0100
2796 +++ gcc-4.2.1/libstdc++-v3/include/c_std/std_cwchar.h 2007-08-03 20:30:21.000000000 +0200
2801 +#if _GLIBCXX_HAVE_WCSFTIME