1 --- gcc/libstdc++-v3/acinclude.m4
2 +++ gcc/libstdc++-v3/acinclude.m4
4 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
5 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
6 [use MODEL for target locale package],
7 - [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
8 + [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
10 # Deal with gettext issues. Default to not using it (=no) until we detect
11 # support for it later. Let the user turn it off via --e/d, but let that
13 # Default to "generic".
14 if test $enable_clocale_flag = auto; then
17 + enable_clocale_flag=uclibc
19 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
20 AC_EGREP_CPP([_GLIBCXX_ok], [
22 @@ -1528,6 +1531,40 @@
23 CTIME_CC=config/locale/generic/time_members.cc
24 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
27 + AC_MSG_RESULT(uclibc)
29 + # Declare intention to use gettext, and add support for specific
31 + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
34 + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
35 + AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
36 + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
39 + # Export the build objects.
40 + for ling in $ALL_LINGUAS; do \
41 + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
42 + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
44 + AC_SUBST(glibcxx_MOFILES)
45 + AC_SUBST(glibcxx_POFILES)
47 + CLOCALE_H=config/locale/uclibc/c_locale.h
48 + CLOCALE_CC=config/locale/uclibc/c_locale.cc
49 + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
50 + CCOLLATE_CC=config/locale/uclibc/collate_members.cc
51 + CCTYPE_CC=config/locale/uclibc/ctype_members.cc
52 + CMESSAGES_H=config/locale/uclibc/messages_members.h
53 + CMESSAGES_CC=config/locale/uclibc/messages_members.cc
54 + CMONEY_CC=config/locale/uclibc/monetary_members.cc
55 + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
56 + CTIME_H=config/locale/uclibc/time_members.h
57 + CTIME_CC=config/locale/uclibc/time_members.cc
58 + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
62 # This is where the testsuite looks for locale catalogs, using the
63 --- gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
64 +++ gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
66 +// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
68 +// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
70 +// This file is part of the GNU ISO C++ Library. This library is free
71 +// software; you can redistribute it and/or modify it under the
72 +// terms of the GNU General Public License as published by the
73 +// Free Software Foundation; either version 2, or (at your option)
74 +// any later version.
76 +// This library is distributed in the hope that it will be useful,
77 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
78 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79 +// GNU General Public License for more details.
81 +// You should have received a copy of the GNU General Public License along
82 +// with this library; see the file COPYING. If not, write to the Free
83 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
86 +// As a special exception, you may use this file as part of a free software
87 +// library without restriction. Specifically, if other files instantiate
88 +// templates or use macros or inline functions from this file, or you compile
89 +// this file and link it with other files to produce an executable, this
90 +// file does not by itself cause the resulting executable to be covered by
91 +// the GNU General Public License. This exception does not however
92 +// invalidate any other reasons why the executable file might be covered by
93 +// the GNU General Public License.
95 +// Written by Jakub Jelinek <jakub@redhat.com>
97 +#include <bits/c++config.h>
100 +#ifdef __UCLIBC_MJN3_ONLY__
101 +#warning clean this up
104 +#ifdef __UCLIBC_HAS_XLOCALE__
106 +extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
107 +extern "C" __typeof(strcoll_l) __strcoll_l;
108 +extern "C" __typeof(strftime_l) __strftime_l;
109 +extern "C" __typeof(strtod_l) __strtod_l;
110 +extern "C" __typeof(strtof_l) __strtof_l;
111 +extern "C" __typeof(strtold_l) __strtold_l;
112 +extern "C" __typeof(strxfrm_l) __strxfrm_l;
113 +extern "C" __typeof(newlocale) __newlocale;
114 +extern "C" __typeof(freelocale) __freelocale;
115 +extern "C" __typeof(duplocale) __duplocale;
116 +extern "C" __typeof(uselocale) __uselocale;
118 +#ifdef _GLIBCXX_USE_WCHAR_T
119 +extern "C" __typeof(iswctype_l) __iswctype_l;
120 +extern "C" __typeof(towlower_l) __towlower_l;
121 +extern "C" __typeof(towupper_l) __towupper_l;
122 +extern "C" __typeof(wcscoll_l) __wcscoll_l;
123 +extern "C" __typeof(wcsftime_l) __wcsftime_l;
124 +extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
125 +extern "C" __typeof(wctype_l) __wctype_l;
128 +#endif // GLIBC 2.3 and later
129 --- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc
130 +++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc
132 +// Wrapper for underlying C-language localization -*- C++ -*-
134 +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
136 +// This file is part of the GNU ISO C++ Library. This library is free
137 +// software; you can redistribute it and/or modify it under the
138 +// terms of the GNU General Public License as published by the
139 +// Free Software Foundation; either version 2, or (at your option)
140 +// any later version.
142 +// This library is distributed in the hope that it will be useful,
143 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
144 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145 +// GNU General Public License for more details.
147 +// You should have received a copy of the GNU General Public License along
148 +// with this library; see the file COPYING. If not, write to the Free
149 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
152 +// As a special exception, you may use this file as part of a free software
153 +// library without restriction. Specifically, if other files instantiate
154 +// templates or use macros or inline functions from this file, or you compile
155 +// this file and link it with other files to produce an executable, this
156 +// file does not by itself cause the resulting executable to be covered by
157 +// the GNU General Public License. This exception does not however
158 +// invalidate any other reasons why the executable file might be covered by
159 +// the GNU General Public License.
162 +// ISO C++ 14882: 22.8 Standard locale categories.
165 +// Written by Benjamin Kosnik <bkoz@redhat.com>
167 +#include <cerrno> // For errno
169 +#include <stdexcept>
170 +#include <langinfo.h>
171 +#include <bits/c++locale_internal.h>
173 +#ifndef __UCLIBC_HAS_XLOCALE__
174 +#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
175 +#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
176 +#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
177 +#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
178 +#define __strtof_l(S, E, L) strtof((S), (E))
179 +#define __strtod_l(S, E, L) strtod((S), (E))
180 +#define __strtold_l(S, E, L) strtold((S), (E))
181 +#warning should dummy __newlocale check for C|POSIX ?
182 +#define __newlocale(a, b, c) NULL
183 +#define __freelocale(a) ((void)0)
184 +#define __duplocale(a) __c_locale()
191 + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
192 + const __c_locale& __cloc)
194 + if (!(__err & ios_base::failbit))
198 + float __f = __strtof_l(__s, &__sanity, __cloc);
199 + if (__sanity != __s && errno != ERANGE)
202 + __err |= ios_base::failbit;
208 + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
209 + const __c_locale& __cloc)
211 + if (!(__err & ios_base::failbit))
215 + double __d = __strtod_l(__s, &__sanity, __cloc);
216 + if (__sanity != __s && errno != ERANGE)
219 + __err |= ios_base::failbit;
225 + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
226 + const __c_locale& __cloc)
228 + if (!(__err & ios_base::failbit))
232 + long double __ld = __strtold_l(__s, &__sanity, __cloc);
233 + if (__sanity != __s && errno != ERANGE)
236 + __err |= ios_base::failbit;
241 + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
244 + __cloc = __newlocale(1 << LC_ALL, __s, __old);
245 +#ifdef __UCLIBC_HAS_XLOCALE__
248 + // This named locale is not supported by the underlying OS.
249 + __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
250 + "name not valid"));
256 + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
258 + if (_S_get_c_locale() != __cloc)
259 + __freelocale(__cloc);
263 + locale::facet::_S_clone_c_locale(__c_locale& __cloc)
264 + { return __duplocale(__cloc); }
269 + const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
277 +#if _GLIBCXX_NUM_CATEGORIES != 0
283 + "LC_IDENTIFICATION"
290 + const char* const* const locale::_S_categories = __gnu_cxx::category_names;
292 --- gcc/libstdc++-v3/config/locale/uclibc/c_locale.h
293 +++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.h
295 +// Wrapper for underlying C-language localization -*- C++ -*-
297 +// Copyright (C) 2001, 2002, 2003, 2004, 2005 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,
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>
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
338 +#include <langinfo.h> // For codecvt
339 +#ifdef __UCLIBC_MJN3_ONLY__
342 +#ifdef __UCLIBC_HAS_LOCALE__
343 +#include <iconv.h> // For codecvt using iconv, iconv_t
345 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
346 +#include <libintl.h> // For messages
349 +#ifdef __UCLIBC_MJN3_ONLY__
350 +#warning what is _GLIBCXX_C_LOCALE_GNU for
352 +#define _GLIBCXX_C_LOCALE_GNU 1
354 +#ifdef __UCLIBC_MJN3_ONLY__
355 +#warning fix categories
357 +// #define _GLIBCXX_NUM_CATEGORIES 6
358 +#define _GLIBCXX_NUM_CATEGORIES 0
360 +#ifdef __UCLIBC_HAS_XLOCALE__
363 + extern "C" __typeof(uselocale) __uselocale;
369 +#ifdef __UCLIBC_HAS_XLOCALE__
370 + typedef __locale_t __c_locale;
372 + typedef int* __c_locale;
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
379 + template<typename _Tv>
381 + __convert_from_v(char* __out,
382 + const int __size __attribute__ ((__unused__)),
384 +#ifdef __UCLIBC_HAS_XCLOCALE__
385 + _Tv __v, const __c_locale& __cloc, int __prec)
387 + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
389 + _Tv __v, const __c_locale&, int __prec)
391 +# ifdef __UCLIBC_HAS_LOCALE__
392 + char* __old = std::setlocale(LC_ALL, NULL);
393 + char* __sav = new char[std::strlen(__old) + 1];
394 + std::strcpy(__sav, __old);
395 + std::setlocale(LC_ALL, "C");
399 + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
401 +#ifdef __UCLIBC_HAS_XCLOCALE__
402 + __gnu_cxx::__uselocale(__old);
403 +#elif defined __UCLIBC_HAS_LOCALE__
404 + std::setlocale(LC_ALL, __sav);
412 --- gcc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
413 +++ gcc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
415 +// std::codecvt implementation details, GNU version -*- C++ -*-
417 +// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
419 +// This file is part of the GNU ISO C++ Library. This library is free
420 +// software; you can redistribute it and/or modify it under the
421 +// terms of the GNU General Public License as published by the
422 +// Free Software Foundation; either version 2, or (at your option)
423 +// any later version.
425 +// This library is distributed in the hope that it will be useful,
426 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
427 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
428 +// GNU General Public License for more details.
430 +// You should have received a copy of the GNU General Public License along
431 +// with this library; see the file COPYING. If not, write to the Free
432 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
435 +// As a special exception, you may use this file as part of a free software
436 +// library without restriction. Specifically, if other files instantiate
437 +// templates or use macros or inline functions from this file, or you compile
438 +// this file and link it with other files to produce an executable, this
439 +// file does not by itself cause the resulting executable to be covered by
440 +// the GNU General Public License. This exception does not however
441 +// invalidate any other reasons why the executable file might be covered by
442 +// the GNU General Public License.
445 +// ISO C++ 14882: 22.2.1.5 - Template class codecvt
448 +// Written by Benjamin Kosnik <bkoz@redhat.com>
451 +#include <bits/c++locale_internal.h>
455 + // Specializations.
456 +#ifdef _GLIBCXX_USE_WCHAR_T
457 + codecvt_base::result
458 + codecvt<wchar_t, char, mbstate_t>::
459 + do_out(state_type& __state, const intern_type* __from,
460 + const intern_type* __from_end, const intern_type*& __from_next,
461 + extern_type* __to, extern_type* __to_end,
462 + extern_type*& __to_next) const
465 + state_type __tmp_state(__state);
467 +#ifdef __UCLIBC_HAS_XLOCALE__
468 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
471 + // wcsnrtombs is *very* fast but stops if encounters NUL characters:
472 + // in case we fall back to wcrtomb and then continue, in a loop.
473 + // NB: wcsnrtombs is a GNU extension
474 + for (__from_next = __from, __to_next = __to;
475 + __from_next < __from_end && __to_next < __to_end
478 + const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
479 + __from_end - __from_next);
480 + if (!__from_chunk_end)
481 + __from_chunk_end = __from_end;
483 + __from = __from_next;
484 + const size_t __conv = wcsnrtombs(__to_next, &__from_next,
485 + __from_chunk_end - __from_next,
486 + __to_end - __to_next, &__state);
487 + if (__conv == static_cast<size_t>(-1))
489 + // In case of error, in order to stop at the exact place we
490 + // have to start again from the beginning with a series of
492 + for (; __from < __from_next; ++__from)
493 + __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
494 + __state = __tmp_state;
497 + else if (__from_next && __from_next < __from_chunk_end)
499 + __to_next += __conv;
504 + __from_next = __from_chunk_end;
505 + __to_next += __conv;
508 + if (__from_next < __from_end && __ret == ok)
510 + extern_type __buf[MB_LEN_MAX];
511 + __tmp_state = __state;
512 + const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
513 + if (__conv > static_cast<size_t>(__to_end - __to_next))
517 + memcpy(__to_next, __buf, __conv);
518 + __state = __tmp_state;
519 + __to_next += __conv;
525 +#ifdef __UCLIBC_HAS_XLOCALE__
526 + __uselocale(__old);
532 + codecvt_base::result
533 + codecvt<wchar_t, char, mbstate_t>::
534 + do_in(state_type& __state, const extern_type* __from,
535 + const extern_type* __from_end, const extern_type*& __from_next,
536 + intern_type* __to, intern_type* __to_end,
537 + intern_type*& __to_next) const
540 + state_type __tmp_state(__state);
542 +#ifdef __UCLIBC_HAS_XLOCALE__
543 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
546 + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
547 + // in case we store a L'\0' and then continue, in a loop.
548 + // NB: mbsnrtowcs is a GNU extension
549 + for (__from_next = __from, __to_next = __to;
550 + __from_next < __from_end && __to_next < __to_end
553 + const extern_type* __from_chunk_end;
554 + __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
557 + if (!__from_chunk_end)
558 + __from_chunk_end = __from_end;
560 + __from = __from_next;
561 + size_t __conv = mbsnrtowcs(__to_next, &__from_next,
562 + __from_chunk_end - __from_next,
563 + __to_end - __to_next, &__state);
564 + if (__conv == static_cast<size_t>(-1))
566 + // In case of error, in order to stop at the exact place we
567 + // have to start again from the beginning with a series of
569 + for (;; ++__to_next, __from += __conv)
571 + __conv = mbrtowc(__to_next, __from, __from_end - __from,
573 + if (__conv == static_cast<size_t>(-1)
574 + || __conv == static_cast<size_t>(-2))
577 + __from_next = __from;
578 + __state = __tmp_state;
581 + else if (__from_next && __from_next < __from_chunk_end)
583 + // It is unclear what to return in this case (see DR 382).
584 + __to_next += __conv;
589 + __from_next = __from_chunk_end;
590 + __to_next += __conv;
593 + if (__from_next < __from_end && __ret == ok)
595 + if (__to_next < __to_end)
597 + // XXX Probably wrong for stateful encodings
598 + __tmp_state = __state;
600 + *__to_next++ = L'\0';
607 +#ifdef __UCLIBC_HAS_XLOCALE__
608 + __uselocale(__old);
615 + codecvt<wchar_t, char, mbstate_t>::
616 + do_encoding() const throw()
618 + // XXX This implementation assumes that the encoding is
619 + // stateless and is either single-byte or variable-width.
621 +#ifdef __UCLIBC_HAS_XLOCALE__
622 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
624 + if (MB_CUR_MAX == 1)
626 +#ifdef __UCLIBC_HAS_XLOCALE__
627 + __uselocale(__old);
633 + codecvt<wchar_t, char, mbstate_t>::
634 + do_max_length() const throw()
636 +#ifdef __UCLIBC_HAS_XLOCALE__
637 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
639 + // XXX Probably wrong for stateful encodings.
640 + int __ret = MB_CUR_MAX;
641 +#ifdef __UCLIBC_HAS_XLOCALE__
642 + __uselocale(__old);
648 + codecvt<wchar_t, char, mbstate_t>::
649 + do_length(state_type& __state, const extern_type* __from,
650 + const extern_type* __end, size_t __max) const
653 + state_type __tmp_state(__state);
655 +#ifdef __UCLIBC_HAS_XLOCALE__
656 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
659 + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
660 + // in case we advance past it and then continue, in a loop.
661 + // NB: mbsnrtowcs is a GNU extension
663 + // A dummy internal buffer is needed in order for mbsnrtocws to consider
664 + // its fourth parameter (it wouldn't with NULL as first parameter).
665 + wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
667 + while (__from < __end && __max)
669 + const extern_type* __from_chunk_end;
670 + __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
673 + if (!__from_chunk_end)
674 + __from_chunk_end = __end;
676 + const extern_type* __tmp_from = __from;
677 + size_t __conv = mbsnrtowcs(__to, &__from,
678 + __from_chunk_end - __from,
680 + if (__conv == static_cast<size_t>(-1))
682 + // In case of error, in order to stop at the exact place we
683 + // have to start again from the beginning with a series of
685 + for (__from = __tmp_from;; __from += __conv)
687 + __conv = mbrtowc(NULL, __from, __end - __from,
689 + if (__conv == static_cast<size_t>(-1)
690 + || __conv == static_cast<size_t>(-2))
693 + __state = __tmp_state;
694 + __ret += __from - __tmp_from;
698 + __from = __from_chunk_end;
700 + __ret += __from - __tmp_from;
703 + if (__from < __end && __max)
705 + // XXX Probably wrong for stateful encodings
706 + __tmp_state = __state;
713 +#ifdef __UCLIBC_HAS_XLOCALE__
714 + __uselocale(__old);
721 --- gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc
722 +++ gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc
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,
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>
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))
771 + // These are basically extensions to char_traits, and perhaps should
772 + // be put there instead of here.
775 + collate<char>::_M_compare(const char* __one, const char* __two) const
777 + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
778 + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
783 + collate<char>::_M_transform(char* __to, const char* __from,
785 + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
787 +#ifdef _GLIBCXX_USE_WCHAR_T
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);
799 + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
801 + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
804 --- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc
805 +++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc
807 +// std::ctype implementation details, GNU version -*- C++ -*-
809 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
811 +// This file is part of the GNU ISO C++ Library. This library is free
812 +// software; you can redistribute it and/or modify it under the
813 +// terms of the GNU General Public License as published by the
814 +// Free Software Foundation; either version 2, or (at your option)
815 +// any later version.
817 +// This library is distributed in the hope that it will be useful,
818 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
819 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
820 +// GNU General Public License for more details.
822 +// You should have received a copy of the GNU General Public License along
823 +// with this library; see the file COPYING. If not, write to the Free
824 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
827 +// As a special exception, you may use this file as part of a free software
828 +// library without restriction. Specifically, if other files instantiate
829 +// templates or use macros or inline functions from this file, or you compile
830 +// this file and link it with other files to produce an executable, this
831 +// file does not by itself cause the resulting executable to be covered by
832 +// the GNU General Public License. This exception does not however
833 +// invalidate any other reasons why the executable file might be covered by
834 +// the GNU General Public License.
837 +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
840 +// Written by Benjamin Kosnik <bkoz@redhat.com>
845 +#include <bits/c++locale_internal.h>
847 +#ifndef __UCLIBC_HAS_XLOCALE__
848 +#define __wctype_l(S, L) wctype((S))
849 +#define __towupper_l(C, L) towupper((C))
850 +#define __towlower_l(C, L) towlower((C))
851 +#define __iswctype_l(C, M, L) iswctype((C), (M))
856 + // NB: The other ctype<char> specializations are in src/locale.cc and
857 + // various /config/os/* files.
859 + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
860 + : ctype<char>(0, false, __refs)
862 + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
864 + this->_S_destroy_c_locale(this->_M_c_locale_ctype);
865 + this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
866 +#ifdef __UCLIBC_HAS_XLOCALE__
867 + this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
868 + this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
869 + this->_M_table = this->_M_c_locale_ctype->__ctype_b;
874 +#ifdef _GLIBCXX_USE_WCHAR_T
875 + ctype<wchar_t>::__wmask_type
876 + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
878 + __wmask_type __ret;
882 + __ret = __wctype_l("space", _M_c_locale_ctype);
885 + __ret = __wctype_l("print", _M_c_locale_ctype);
888 + __ret = __wctype_l("cntrl", _M_c_locale_ctype);
891 + __ret = __wctype_l("upper", _M_c_locale_ctype);
894 + __ret = __wctype_l("lower", _M_c_locale_ctype);
897 + __ret = __wctype_l("alpha", _M_c_locale_ctype);
900 + __ret = __wctype_l("digit", _M_c_locale_ctype);
903 + __ret = __wctype_l("punct", _M_c_locale_ctype);
906 + __ret = __wctype_l("xdigit", _M_c_locale_ctype);
909 + __ret = __wctype_l("alnum", _M_c_locale_ctype);
912 + __ret = __wctype_l("graph", _M_c_locale_ctype);
915 + __ret = __wmask_type();
921 + ctype<wchar_t>::do_toupper(wchar_t __c) const
922 + { return __towupper_l(__c, _M_c_locale_ctype); }
925 + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
927 + while (__lo < __hi)
929 + *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
936 + ctype<wchar_t>::do_tolower(wchar_t __c) const
937 + { return __towlower_l(__c, _M_c_locale_ctype); }
940 + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
942 + while (__lo < __hi)
944 + *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
952 + do_is(mask __m, wchar_t __c) const
954 + // Highest bitmask in ctype_base == 10, but extra in "C"
955 + // library for blank.
956 + bool __ret = false;
957 + const size_t __bitmasksize = 11;
958 + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
959 + if (__m & _M_bit[__bitcur]
960 + && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
970 + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
972 + for (; __lo < __hi; ++__vec, ++__lo)
974 + // Highest bitmask in ctype_base == 10, but extra in "C"
975 + // library for blank.
976 + const size_t __bitmasksize = 11;
978 + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
979 + if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
980 + __m |= _M_bit[__bitcur];
988 + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
990 + while (__lo < __hi && !this->do_is(__m, *__lo))
997 + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
999 + while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1006 + do_widen(char __c) const
1007 + { return _M_widen[static_cast<unsigned char>(__c)]; }
1011 + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1013 + while (__lo < __hi)
1015 + *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1024 + do_narrow(wchar_t __wc, char __dfault) const
1026 + if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1027 + return _M_narrow[__wc];
1028 +#ifdef __UCLIBC_HAS_XLOCALE__
1029 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1031 + const int __c = wctob(__wc);
1032 +#ifdef __UCLIBC_HAS_XLOCALE__
1033 + __uselocale(__old);
1035 + return (__c == EOF ? __dfault : static_cast<char>(__c));
1040 + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1041 + char* __dest) const
1043 +#ifdef __UCLIBC_HAS_XLOCALE__
1044 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1047 + while (__lo < __hi)
1049 + if (*__lo >= 0 && *__lo < 128)
1050 + *__dest = _M_narrow[*__lo];
1053 + const int __c = wctob(*__lo);
1054 + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1060 + while (__lo < __hi)
1062 + const int __c = wctob(*__lo);
1063 + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1067 +#ifdef __UCLIBC_HAS_XLOCALE__
1068 + __uselocale(__old);
1074 + ctype<wchar_t>::_M_initialize_ctype()
1076 +#ifdef __UCLIBC_HAS_XLOCALE__
1077 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1080 + for (__i = 0; __i < 128; ++__i)
1082 + const int __c = wctob(__i);
1086 + _M_narrow[__i] = static_cast<char>(__c);
1089 + _M_narrow_ok = true;
1091 + _M_narrow_ok = false;
1092 + for (size_t __j = 0;
1093 + __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1094 + _M_widen[__j] = btowc(__j);
1096 + for (size_t __k = 0; __k <= 11; ++__k)
1098 + _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1099 + _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1101 +#ifdef __UCLIBC_HAS_XLOCALE__
1102 + __uselocale(__old);
1105 +#endif // _GLIBCXX_USE_WCHAR_T
1107 --- gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc
1108 +++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc
1110 +// std::messages implementation details, GNU version -*- C++ -*-
1112 +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1114 +// This file is part of the GNU ISO C++ Library. This library is free
1115 +// software; you can redistribute it and/or modify it under the
1116 +// terms of the GNU General Public License as published by the
1117 +// Free Software Foundation; either version 2, or (at your option)
1118 +// any later version.
1120 +// This library is distributed in the hope that it will be useful,
1121 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1122 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1123 +// GNU General Public License for more details.
1125 +// You should have received a copy of the GNU General Public License along
1126 +// with this library; see the file COPYING. If not, write to the Free
1127 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1130 +// As a special exception, you may use this file as part of a free software
1131 +// library without restriction. Specifically, if other files instantiate
1132 +// templates or use macros or inline functions from this file, or you compile
1133 +// this file and link it with other files to produce an executable, this
1134 +// file does not by itself cause the resulting executable to be covered by
1135 +// the GNU General Public License. This exception does not however
1136 +// invalidate any other reasons why the executable file might be covered by
1137 +// the GNU General Public License.
1140 +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1143 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1146 +#include <bits/c++locale_internal.h>
1148 +#ifdef __UCLIBC_MJN3_ONLY__
1149 +#warning fix gettext stuff
1151 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1152 +extern "C" char *__dcgettext(const char *domainname,
1153 + const char *msgid, int category);
1155 +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1158 +#define gettext(msgid) (msgid)
1163 + // Specializations.
1166 + messages<char>::do_get(catalog, int, int, const string& __dfault) const
1168 +#ifdef __UCLIBC_HAS_XLOCALE__
1169 + __c_locale __old = __uselocale(_M_c_locale_messages);
1170 + const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1171 + __uselocale(__old);
1172 + return string(__msg);
1173 +#elif defined __UCLIBC_HAS_LOCALE__
1174 + char* __old = strdup(setlocale(LC_ALL, NULL));
1175 + setlocale(LC_ALL, _M_name_messages);
1176 + const char* __msg = gettext(__dfault.c_str());
1177 + setlocale(LC_ALL, __old);
1179 + return string(__msg);
1181 + const char* __msg = gettext(__dfault.c_str());
1182 + return string(__msg);
1186 +#ifdef _GLIBCXX_USE_WCHAR_T
1189 + messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1191 +# ifdef __UCLIBC_HAS_XLOCALE__
1192 + __c_locale __old = __uselocale(_M_c_locale_messages);
1193 + char* __msg = gettext(_M_convert_to_char(__dfault));
1194 + __uselocale(__old);
1195 + return _M_convert_from_char(__msg);
1196 +# elif defined __UCLIBC_HAS_LOCALE__
1197 + char* __old = strdup(setlocale(LC_ALL, NULL));
1198 + setlocale(LC_ALL, _M_name_messages);
1199 + char* __msg = gettext(_M_convert_to_char(__dfault));
1200 + setlocale(LC_ALL, __old);
1202 + return _M_convert_from_char(__msg);
1204 + char* __msg = gettext(_M_convert_to_char(__dfault));
1205 + return _M_convert_from_char(__msg);
1210 --- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h
1211 +++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h
1213 +// std::messages implementation details, GNU version -*- C++ -*-
1215 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1217 +// This file is part of the GNU ISO C++ Library. This library is free
1218 +// software; you can redistribute it and/or modify it under the
1219 +// terms of the GNU General Public License as published by the
1220 +// Free Software Foundation; either version 2, or (at your option)
1221 +// any later version.
1223 +// This library is distributed in the hope that it will be useful,
1224 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1225 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1226 +// GNU General Public License for more details.
1228 +// You should have received a copy of the GNU General Public License along
1229 +// with this library; see the file COPYING. If not, write to the Free
1230 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1233 +// As a special exception, you may use this file as part of a free software
1234 +// library without restriction. Specifically, if other files instantiate
1235 +// templates or use macros or inline functions from this file, or you compile
1236 +// this file and link it with other files to produce an executable, this
1237 +// file does not by itself cause the resulting executable to be covered by
1238 +// the GNU General Public License. This exception does not however
1239 +// invalidate any other reasons why the executable file might be covered by
1240 +// the GNU General Public License.
1243 +// ISO C++ 14882: 22.2.7.1.2 messages functions
1246 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1248 +#ifdef __UCLIBC_MJN3_ONLY__
1249 +#warning fix prototypes for *textdomain funcs
1251 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1252 +extern "C" char *__textdomain(const char *domainname);
1253 +extern "C" char *__bindtextdomain(const char *domainname,
1254 + const char *dirname);
1256 +#undef __textdomain
1257 +#undef __bindtextdomain
1258 +#define __textdomain(D) ((void)0)
1259 +#define __bindtextdomain(D,P) ((void)0)
1262 + // Non-virtual member functions.
1263 + template<typename _CharT>
1264 + messages<_CharT>::messages(size_t __refs)
1265 + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1266 + _M_name_messages(_S_get_c_name())
1269 + template<typename _CharT>
1270 + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1272 + : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1273 + _M_name_messages(__s)
1275 + char* __tmp = new char[std::strlen(__s) + 1];
1276 + std::strcpy(__tmp, __s);
1277 + _M_name_messages = __tmp;
1280 + template<typename _CharT>
1281 + typename messages<_CharT>::catalog
1282 + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1283 + const char* __dir) const
1285 + __bindtextdomain(__s.c_str(), __dir);
1286 + return this->do_open(__s, __loc);
1289 + // Virtual member functions.
1290 + template<typename _CharT>
1291 + messages<_CharT>::~messages()
1293 + if (_M_name_messages != _S_get_c_name())
1294 + delete [] _M_name_messages;
1295 + _S_destroy_c_locale(_M_c_locale_messages);
1298 + template<typename _CharT>
1299 + typename messages<_CharT>::catalog
1300 + messages<_CharT>::do_open(const basic_string<char>& __s,
1301 + const locale&) const
1303 + // No error checking is done, assume the catalog exists and can
1305 + __textdomain(__s.c_str());
1309 + template<typename _CharT>
1311 + messages<_CharT>::do_close(catalog) const
1314 + // messages_byname
1315 + template<typename _CharT>
1316 + messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1317 + : messages<_CharT>(__refs)
1319 + if (this->_M_name_messages != locale::facet::_S_get_c_name())
1320 + delete [] this->_M_name_messages;
1321 + char* __tmp = new char[std::strlen(__s) + 1];
1322 + std::strcpy(__tmp, __s);
1323 + this->_M_name_messages = __tmp;
1325 + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1327 + this->_S_destroy_c_locale(this->_M_c_locale_messages);
1328 + this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1331 --- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1332 +++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1334 +// std::moneypunct implementation details, GNU version -*- C++ -*-
1336 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1338 +// This file is part of the GNU ISO C++ Library. This library is free
1339 +// software; you can redistribute it and/or modify it under the
1340 +// terms of the GNU General Public License as published by the
1341 +// Free Software Foundation; either version 2, or (at your option)
1342 +// any later version.
1344 +// This library is distributed in the hope that it will be useful,
1345 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1346 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1347 +// GNU General Public License for more details.
1349 +// You should have received a copy of the GNU General Public License along
1350 +// with this library; see the file COPYING. If not, write to the Free
1351 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1354 +// As a special exception, you may use this file as part of a free software
1355 +// library without restriction. Specifically, if other files instantiate
1356 +// templates or use macros or inline functions from this file, or you compile
1357 +// this file and link it with other files to produce an executable, this
1358 +// file does not by itself cause the resulting executable to be covered by
1359 +// the GNU General Public License. This exception does not however
1360 +// invalidate any other reasons why the executable file might be covered by
1361 +// the GNU General Public License.
1364 +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1367 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1372 +#include <bits/c++locale_internal.h>
1374 +#ifdef __UCLIBC_MJN3_ONLY__
1375 +#warning optimize this for uclibc
1376 +#warning tailor for stub locale support
1379 +#ifndef __UCLIBC_HAS_XLOCALE__
1380 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
1385 + // Construct and return valid pattern consisting of some combination of:
1386 + // space none symbol sign value
1387 + money_base::pattern
1388 + money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1392 + // This insanely complicated routine attempts to construct a valid
1393 + // pattern for use with monyepunct. A couple of invariants:
1395 + // if (__precedes) symbol -> value
1396 + // else value -> symbol
1398 + // if (__space) space
1401 + // none == never first
1402 + // space never first or last
1404 + // Any elegant implementations of this are welcome.
1409 + // 1 The sign precedes the value and symbol.
1410 + __ret.field[0] = sign;
1413 + // Pattern starts with sign.
1416 + __ret.field[1] = symbol;
1417 + __ret.field[3] = value;
1421 + __ret.field[1] = value;
1422 + __ret.field[3] = symbol;
1424 + __ret.field[2] = space;
1428 + // Pattern starts with sign and ends with none.
1431 + __ret.field[1] = symbol;
1432 + __ret.field[2] = value;
1436 + __ret.field[1] = value;
1437 + __ret.field[2] = symbol;
1439 + __ret.field[3] = none;
1443 + // 2 The sign follows the value and symbol.
1446 + // Pattern either ends with sign.
1449 + __ret.field[0] = symbol;
1450 + __ret.field[2] = value;
1454 + __ret.field[0] = value;
1455 + __ret.field[2] = symbol;
1457 + __ret.field[1] = space;
1458 + __ret.field[3] = sign;
1462 + // Pattern ends with sign then none.
1465 + __ret.field[0] = symbol;
1466 + __ret.field[1] = value;
1470 + __ret.field[0] = value;
1471 + __ret.field[1] = symbol;
1473 + __ret.field[2] = sign;
1474 + __ret.field[3] = none;
1478 + // 3 The sign immediately precedes the symbol.
1481 + __ret.field[0] = sign;
1482 + __ret.field[1] = symbol;
1485 + __ret.field[2] = space;
1486 + __ret.field[3] = value;
1490 + __ret.field[2] = value;
1491 + __ret.field[3] = none;
1496 + __ret.field[0] = value;
1499 + __ret.field[1] = space;
1500 + __ret.field[2] = sign;
1501 + __ret.field[3] = symbol;
1505 + __ret.field[1] = sign;
1506 + __ret.field[2] = symbol;
1507 + __ret.field[3] = none;
1512 + // 4 The sign immediately follows the symbol.
1515 + __ret.field[0] = symbol;
1516 + __ret.field[1] = sign;
1519 + __ret.field[2] = space;
1520 + __ret.field[3] = value;
1524 + __ret.field[2] = value;
1525 + __ret.field[3] = none;
1530 + __ret.field[0] = value;
1533 + __ret.field[1] = space;
1534 + __ret.field[2] = symbol;
1535 + __ret.field[3] = sign;
1539 + __ret.field[1] = symbol;
1540 + __ret.field[2] = sign;
1541 + __ret.field[3] = none;
1553 + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1557 + _M_data = new __moneypunct_cache<char, true>;
1562 + _M_data->_M_decimal_point = '.';
1563 + _M_data->_M_thousands_sep = ',';
1564 + _M_data->_M_grouping = "";
1565 + _M_data->_M_grouping_size = 0;
1566 + _M_data->_M_curr_symbol = "";
1567 + _M_data->_M_curr_symbol_size = 0;
1568 + _M_data->_M_positive_sign = "";
1569 + _M_data->_M_positive_sign_size = 0;
1570 + _M_data->_M_negative_sign = "";
1571 + _M_data->_M_negative_sign_size = 0;
1572 + _M_data->_M_frac_digits = 0;
1573 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1574 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1576 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1577 + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1582 + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1584 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1586 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1587 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1588 + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1589 + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1591 + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1593 + _M_data->_M_negative_sign = "()";
1595 + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1597 + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1600 + _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1601 + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1602 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1604 + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1605 + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1606 + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1607 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1609 + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1610 + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1611 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1618 + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1622 + _M_data = new __moneypunct_cache<char, false>;
1627 + _M_data->_M_decimal_point = '.';
1628 + _M_data->_M_thousands_sep = ',';
1629 + _M_data->_M_grouping = "";
1630 + _M_data->_M_grouping_size = 0;
1631 + _M_data->_M_curr_symbol = "";
1632 + _M_data->_M_curr_symbol_size = 0;
1633 + _M_data->_M_positive_sign = "";
1634 + _M_data->_M_positive_sign_size = 0;
1635 + _M_data->_M_negative_sign = "";
1636 + _M_data->_M_negative_sign_size = 0;
1637 + _M_data->_M_frac_digits = 0;
1638 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1639 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1641 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1642 + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1647 + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1649 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1651 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1652 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1653 + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1654 + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1656 + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1658 + _M_data->_M_negative_sign = "()";
1660 + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1662 + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1665 + _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1666 + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1667 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1668 + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1669 + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1670 + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1671 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1673 + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1674 + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1675 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1681 + moneypunct<char, true>::~moneypunct()
1682 + { delete _M_data; }
1685 + moneypunct<char, false>::~moneypunct()
1686 + { delete _M_data; }
1688 +#ifdef _GLIBCXX_USE_WCHAR_T
1691 + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1692 +#ifdef __UCLIBC_HAS_XLOCALE__
1695 + const char* __name)
1699 + _M_data = new __moneypunct_cache<wchar_t, true>;
1704 + _M_data->_M_decimal_point = L'.';
1705 + _M_data->_M_thousands_sep = L',';
1706 + _M_data->_M_grouping = "";
1707 + _M_data->_M_grouping_size = 0;
1708 + _M_data->_M_curr_symbol = L"";
1709 + _M_data->_M_curr_symbol_size = 0;
1710 + _M_data->_M_positive_sign = L"";
1711 + _M_data->_M_positive_sign_size = 0;
1712 + _M_data->_M_negative_sign = L"";
1713 + _M_data->_M_negative_sign_size = 0;
1714 + _M_data->_M_frac_digits = 0;
1715 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1716 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1718 + // Use ctype::widen code without the facet...
1719 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1720 + _M_data->_M_atoms[__i] =
1721 + static_cast<wchar_t>(money_base::_S_atoms[__i]);
1726 +#ifdef __UCLIBC_HAS_XLOCALE__
1727 + __c_locale __old = __uselocale(__cloc);
1729 + // Switch to named locale so that mbsrtowcs will work.
1730 + char* __old = strdup(setlocale(LC_ALL, NULL));
1731 + setlocale(LC_ALL, __name);
1734 +#ifdef __UCLIBC_MJN3_ONLY__
1735 +#warning fix this... should be monetary
1738 +# ifdef __UCLIBC_HAS_XLOCALE__
1739 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1740 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1742 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1743 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1746 + union { char *__s; wchar_t __w; } __u;
1747 + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1748 + _M_data->_M_decimal_point = __u.__w;
1750 + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1751 + _M_data->_M_thousands_sep = __u.__w;
1753 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1754 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1756 + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1757 + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1758 + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1760 + wchar_t* __wcs_ps = 0;
1761 + wchar_t* __wcs_ns = 0;
1762 + const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1765 + mbstate_t __state;
1766 + size_t __len = strlen(__cpossign);
1770 + memset(&__state, 0, sizeof(mbstate_t));
1771 + __wcs_ps = new wchar_t[__len];
1772 + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1773 + _M_data->_M_positive_sign = __wcs_ps;
1776 + _M_data->_M_positive_sign = L"";
1777 + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1779 + __len = strlen(__cnegsign);
1781 + _M_data->_M_negative_sign = L"()";
1785 + memset(&__state, 0, sizeof(mbstate_t));
1786 + __wcs_ns = new wchar_t[__len];
1787 + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1788 + _M_data->_M_negative_sign = __wcs_ns;
1791 + _M_data->_M_negative_sign = L"";
1792 + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1795 + __len = strlen(__ccurr);
1799 + memset(&__state, 0, sizeof(mbstate_t));
1800 + wchar_t* __wcs = new wchar_t[__len];
1801 + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1802 + _M_data->_M_curr_symbol = __wcs;
1805 + _M_data->_M_curr_symbol = L"";
1806 + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1814 +#ifdef __UCLIBC_HAS_XLOCALE__
1815 + __uselocale(__old);
1817 + setlocale(LC_ALL, __old);
1820 + __throw_exception_again;
1823 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1825 + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1826 + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1827 + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1828 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1830 + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1831 + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1832 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1835 +#ifdef __UCLIBC_HAS_XLOCALE__
1836 + __uselocale(__old);
1838 + setlocale(LC_ALL, __old);
1846 + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1847 +#ifdef __UCLIBC_HAS_XLOCALE__
1850 + const char* __name)
1854 + _M_data = new __moneypunct_cache<wchar_t, false>;
1859 + _M_data->_M_decimal_point = L'.';
1860 + _M_data->_M_thousands_sep = L',';
1861 + _M_data->_M_grouping = "";
1862 + _M_data->_M_grouping_size = 0;
1863 + _M_data->_M_curr_symbol = L"";
1864 + _M_data->_M_curr_symbol_size = 0;
1865 + _M_data->_M_positive_sign = L"";
1866 + _M_data->_M_positive_sign_size = 0;
1867 + _M_data->_M_negative_sign = L"";
1868 + _M_data->_M_negative_sign_size = 0;
1869 + _M_data->_M_frac_digits = 0;
1870 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1871 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1873 + // Use ctype::widen code without the facet...
1874 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1875 + _M_data->_M_atoms[__i] =
1876 + static_cast<wchar_t>(money_base::_S_atoms[__i]);
1881 +#ifdef __UCLIBC_HAS_XLOCALE__
1882 + __c_locale __old = __uselocale(__cloc);
1884 + // Switch to named locale so that mbsrtowcs will work.
1885 + char* __old = strdup(setlocale(LC_ALL, NULL));
1886 + setlocale(LC_ALL, __name);
1889 +#ifdef __UCLIBC_MJN3_ONLY__
1890 +#warning fix this... should be monetary
1893 +# ifdef __UCLIBC_HAS_XLOCALE__
1894 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1895 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1897 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1898 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1901 + union { char *__s; wchar_t __w; } __u;
1902 + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1903 + _M_data->_M_decimal_point = __u.__w;
1905 + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1906 + _M_data->_M_thousands_sep = __u.__w;
1908 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1909 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1911 + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1912 + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1913 + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1915 + wchar_t* __wcs_ps = 0;
1916 + wchar_t* __wcs_ns = 0;
1917 + const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1920 + mbstate_t __state;
1922 + __len = strlen(__cpossign);
1926 + memset(&__state, 0, sizeof(mbstate_t));
1927 + __wcs_ps = new wchar_t[__len];
1928 + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1929 + _M_data->_M_positive_sign = __wcs_ps;
1932 + _M_data->_M_positive_sign = L"";
1933 + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1935 + __len = strlen(__cnegsign);
1937 + _M_data->_M_negative_sign = L"()";
1941 + memset(&__state, 0, sizeof(mbstate_t));
1942 + __wcs_ns = new wchar_t[__len];
1943 + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1944 + _M_data->_M_negative_sign = __wcs_ns;
1947 + _M_data->_M_negative_sign = L"";
1948 + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1951 + __len = strlen(__ccurr);
1955 + memset(&__state, 0, sizeof(mbstate_t));
1956 + wchar_t* __wcs = new wchar_t[__len];
1957 + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1958 + _M_data->_M_curr_symbol = __wcs;
1961 + _M_data->_M_curr_symbol = L"";
1962 + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1970 +#ifdef __UCLIBC_HAS_XLOCALE__
1971 + __uselocale(__old);
1973 + setlocale(LC_ALL, __old);
1976 + __throw_exception_again;
1979 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1980 + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1981 + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1982 + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1983 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1985 + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1986 + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1987 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1990 +#ifdef __UCLIBC_HAS_XLOCALE__
1991 + __uselocale(__old);
1993 + setlocale(LC_ALL, __old);
2000 + moneypunct<wchar_t, true>::~moneypunct()
2002 + if (_M_data->_M_positive_sign_size)
2003 + delete [] _M_data->_M_positive_sign;
2004 + if (_M_data->_M_negative_sign_size
2005 + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2006 + delete [] _M_data->_M_negative_sign;
2007 + if (_M_data->_M_curr_symbol_size)
2008 + delete [] _M_data->_M_curr_symbol;
2013 + moneypunct<wchar_t, false>::~moneypunct()
2015 + if (_M_data->_M_positive_sign_size)
2016 + delete [] _M_data->_M_positive_sign;
2017 + if (_M_data->_M_negative_sign_size
2018 + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2019 + delete [] _M_data->_M_negative_sign;
2020 + if (_M_data->_M_curr_symbol_size)
2021 + delete [] _M_data->_M_curr_symbol;
2026 --- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2027 +++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2029 +// std::numpunct implementation details, GNU version -*- C++ -*-
2031 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2033 +// This file is part of the GNU ISO C++ Library. This library is free
2034 +// software; you can redistribute it and/or modify it under the
2035 +// terms of the GNU General Public License as published by the
2036 +// Free Software Foundation; either version 2, or (at your option)
2037 +// any later version.
2039 +// This library is distributed in the hope that it will be useful,
2040 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2041 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2042 +// GNU General Public License for more details.
2044 +// You should have received a copy of the GNU General Public License along
2045 +// with this library; see the file COPYING. If not, write to the Free
2046 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2049 +// As a special exception, you may use this file as part of a free software
2050 +// library without restriction. Specifically, if other files instantiate
2051 +// templates or use macros or inline functions from this file, or you compile
2052 +// this file and link it with other files to produce an executable, this
2053 +// file does not by itself cause the resulting executable to be covered by
2054 +// the GNU General Public License. This exception does not however
2055 +// invalidate any other reasons why the executable file might be covered by
2056 +// the GNU General Public License.
2059 +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2062 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2067 +#include <bits/c++locale_internal.h>
2069 +#ifdef __UCLIBC_MJN3_ONLY__
2070 +#warning tailor for stub locale support
2072 +#ifndef __UCLIBC_HAS_XLOCALE__
2073 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
2080 + numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2083 + _M_data = new __numpunct_cache<char>;
2088 + _M_data->_M_grouping = "";
2089 + _M_data->_M_grouping_size = 0;
2090 + _M_data->_M_use_grouping = false;
2092 + _M_data->_M_decimal_point = '.';
2093 + _M_data->_M_thousands_sep = ',';
2095 + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2096 + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2098 + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2099 + _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2104 + _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2106 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2109 + // Check for NULL, which implies no grouping.
2110 + if (_M_data->_M_thousands_sep == '\0')
2111 + _M_data->_M_grouping = "";
2113 + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2114 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2117 + // NB: There is no way to extact this info from posix locales.
2118 + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2119 + _M_data->_M_truename = "true";
2120 + _M_data->_M_truename_size = 4;
2121 + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2122 + _M_data->_M_falsename = "false";
2123 + _M_data->_M_falsename_size = 5;
2127 + numpunct<char>::~numpunct()
2128 + { delete _M_data; }
2130 +#ifdef _GLIBCXX_USE_WCHAR_T
2133 + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2136 + _M_data = new __numpunct_cache<wchar_t>;
2141 + _M_data->_M_grouping = "";
2142 + _M_data->_M_grouping_size = 0;
2143 + _M_data->_M_use_grouping = false;
2145 + _M_data->_M_decimal_point = L'.';
2146 + _M_data->_M_thousands_sep = L',';
2148 + // Use ctype::widen code without the facet...
2149 + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2150 + _M_data->_M_atoms_out[__i] =
2151 + static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2153 + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2154 + _M_data->_M_atoms_in[__j] =
2155 + static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2160 + // NB: In the GNU model wchar_t is always 32 bit wide.
2161 + union { char *__s; wchar_t __w; } __u;
2162 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2163 + _M_data->_M_decimal_point = __u.__w;
2165 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2166 + _M_data->_M_thousands_sep = __u.__w;
2168 + if (_M_data->_M_thousands_sep == L'\0')
2169 + _M_data->_M_grouping = "";
2171 + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2172 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2175 + // NB: There is no way to extact this info from posix locales.
2176 + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2177 + _M_data->_M_truename = L"true";
2178 + _M_data->_M_truename_size = 4;
2179 + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2180 + _M_data->_M_falsename = L"false";
2181 + _M_data->_M_falsename_size = 5;
2185 + numpunct<wchar_t>::~numpunct()
2186 + { delete _M_data; }
2189 --- gcc/libstdc++-v3/config/locale/uclibc/time_members.cc
2190 +++ gcc/libstdc++-v3/config/locale/uclibc/time_members.cc
2192 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2194 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2196 +// This file is part of the GNU ISO C++ Library. This library is free
2197 +// software; you can redistribute it and/or modify it under the
2198 +// terms of the GNU General Public License as published by the
2199 +// Free Software Foundation; either version 2, or (at your option)
2200 +// any later version.
2202 +// This library is distributed in the hope that it will be useful,
2203 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2204 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2205 +// GNU General Public License for more details.
2207 +// You should have received a copy of the GNU General Public License along
2208 +// with this library; see the file COPYING. If not, write to the Free
2209 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2212 +// As a special exception, you may use this file as part of a free software
2213 +// library without restriction. Specifically, if other files instantiate
2214 +// templates or use macros or inline functions from this file, or you compile
2215 +// this file and link it with other files to produce an executable, this
2216 +// file does not by itself cause the resulting executable to be covered by
2217 +// the GNU General Public License. This exception does not however
2218 +// invalidate any other reasons why the executable file might be covered by
2219 +// the GNU General Public License.
2222 +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2223 +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2226 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2229 +#include <bits/c++locale_internal.h>
2231 +#ifdef __UCLIBC_MJN3_ONLY__
2232 +#warning tailor for stub locale support
2234 +#ifndef __UCLIBC_HAS_XLOCALE__
2235 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
2242 + __timepunct<char>::
2243 + _M_put(char* __s, size_t __maxlen, const char* __format,
2244 + const tm* __tm) const
2246 +#ifdef __UCLIBC_HAS_XLOCALE__
2247 + const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2248 + _M_c_locale_timepunct);
2250 + char* __old = strdup(setlocale(LC_ALL, NULL));
2251 + setlocale(LC_ALL, _M_name_timepunct);
2252 + const size_t __len = strftime(__s, __maxlen, __format, __tm);
2253 + setlocale(LC_ALL, __old);
2256 + // Make sure __s is null terminated.
2263 + __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2266 + _M_data = new __timepunct_cache<char>;
2271 + _M_c_locale_timepunct = _S_get_c_locale();
2273 + _M_data->_M_date_format = "%m/%d/%y";
2274 + _M_data->_M_date_era_format = "%m/%d/%y";
2275 + _M_data->_M_time_format = "%H:%M:%S";
2276 + _M_data->_M_time_era_format = "%H:%M:%S";
2277 + _M_data->_M_date_time_format = "";
2278 + _M_data->_M_date_time_era_format = "";
2279 + _M_data->_M_am = "AM";
2280 + _M_data->_M_pm = "PM";
2281 + _M_data->_M_am_pm_format = "";
2283 + // Day names, starting with "C"'s Sunday.
2284 + _M_data->_M_day1 = "Sunday";
2285 + _M_data->_M_day2 = "Monday";
2286 + _M_data->_M_day3 = "Tuesday";
2287 + _M_data->_M_day4 = "Wednesday";
2288 + _M_data->_M_day5 = "Thursday";
2289 + _M_data->_M_day6 = "Friday";
2290 + _M_data->_M_day7 = "Saturday";
2292 + // Abbreviated day names, starting with "C"'s Sun.
2293 + _M_data->_M_aday1 = "Sun";
2294 + _M_data->_M_aday2 = "Mon";
2295 + _M_data->_M_aday3 = "Tue";
2296 + _M_data->_M_aday4 = "Wed";
2297 + _M_data->_M_aday5 = "Thu";
2298 + _M_data->_M_aday6 = "Fri";
2299 + _M_data->_M_aday7 = "Sat";
2301 + // Month names, starting with "C"'s January.
2302 + _M_data->_M_month01 = "January";
2303 + _M_data->_M_month02 = "February";
2304 + _M_data->_M_month03 = "March";
2305 + _M_data->_M_month04 = "April";
2306 + _M_data->_M_month05 = "May";
2307 + _M_data->_M_month06 = "June";
2308 + _M_data->_M_month07 = "July";
2309 + _M_data->_M_month08 = "August";
2310 + _M_data->_M_month09 = "September";
2311 + _M_data->_M_month10 = "October";
2312 + _M_data->_M_month11 = "November";
2313 + _M_data->_M_month12 = "December";
2315 + // Abbreviated month names, starting with "C"'s Jan.
2316 + _M_data->_M_amonth01 = "Jan";
2317 + _M_data->_M_amonth02 = "Feb";
2318 + _M_data->_M_amonth03 = "Mar";
2319 + _M_data->_M_amonth04 = "Apr";
2320 + _M_data->_M_amonth05 = "May";
2321 + _M_data->_M_amonth06 = "Jun";
2322 + _M_data->_M_amonth07 = "Jul";
2323 + _M_data->_M_amonth08 = "Aug";
2324 + _M_data->_M_amonth09 = "Sep";
2325 + _M_data->_M_amonth10 = "Oct";
2326 + _M_data->_M_amonth11 = "Nov";
2327 + _M_data->_M_amonth12 = "Dec";
2331 + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2333 + _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2334 + _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2335 + _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2336 + _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2337 + _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2338 + _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2340 + _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2341 + _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2342 + _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2344 + // Day names, starting with "C"'s Sunday.
2345 + _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2346 + _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2347 + _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2348 + _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2349 + _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2350 + _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2351 + _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2353 + // Abbreviated day names, starting with "C"'s Sun.
2354 + _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2355 + _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2356 + _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2357 + _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2358 + _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2359 + _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2360 + _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2362 + // Month names, starting with "C"'s January.
2363 + _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2364 + _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2365 + _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2366 + _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2367 + _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2368 + _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2369 + _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2370 + _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2371 + _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2372 + _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2373 + _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2374 + _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2376 + // Abbreviated month names, starting with "C"'s Jan.
2377 + _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2378 + _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2379 + _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2380 + _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2381 + _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2382 + _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2383 + _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2384 + _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2385 + _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2386 + _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2387 + _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2388 + _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2392 +#ifdef _GLIBCXX_USE_WCHAR_T
2395 + __timepunct<wchar_t>::
2396 + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2397 + const tm* __tm) const
2399 +#ifdef __UCLIBC_HAS_XLOCALE__
2400 + __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2401 + const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2402 + _M_c_locale_timepunct);
2404 + char* __old = strdup(setlocale(LC_ALL, NULL));
2405 + setlocale(LC_ALL, _M_name_timepunct);
2406 + const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2407 + setlocale(LC_ALL, __old);
2410 + // Make sure __s is null terminated.
2417 + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2420 + _M_data = new __timepunct_cache<wchar_t>;
2422 +#warning wide time stuff
2426 + _M_c_locale_timepunct = _S_get_c_locale();
2428 + _M_data->_M_date_format = L"%m/%d/%y";
2429 + _M_data->_M_date_era_format = L"%m/%d/%y";
2430 + _M_data->_M_time_format = L"%H:%M:%S";
2431 + _M_data->_M_time_era_format = L"%H:%M:%S";
2432 + _M_data->_M_date_time_format = L"";
2433 + _M_data->_M_date_time_era_format = L"";
2434 + _M_data->_M_am = L"AM";
2435 + _M_data->_M_pm = L"PM";
2436 + _M_data->_M_am_pm_format = L"";
2438 + // Day names, starting with "C"'s Sunday.
2439 + _M_data->_M_day1 = L"Sunday";
2440 + _M_data->_M_day2 = L"Monday";
2441 + _M_data->_M_day3 = L"Tuesday";
2442 + _M_data->_M_day4 = L"Wednesday";
2443 + _M_data->_M_day5 = L"Thursday";
2444 + _M_data->_M_day6 = L"Friday";
2445 + _M_data->_M_day7 = L"Saturday";
2447 + // Abbreviated day names, starting with "C"'s Sun.
2448 + _M_data->_M_aday1 = L"Sun";
2449 + _M_data->_M_aday2 = L"Mon";
2450 + _M_data->_M_aday3 = L"Tue";
2451 + _M_data->_M_aday4 = L"Wed";
2452 + _M_data->_M_aday5 = L"Thu";
2453 + _M_data->_M_aday6 = L"Fri";
2454 + _M_data->_M_aday7 = L"Sat";
2456 + // Month names, starting with "C"'s January.
2457 + _M_data->_M_month01 = L"January";
2458 + _M_data->_M_month02 = L"February";
2459 + _M_data->_M_month03 = L"March";
2460 + _M_data->_M_month04 = L"April";
2461 + _M_data->_M_month05 = L"May";
2462 + _M_data->_M_month06 = L"June";
2463 + _M_data->_M_month07 = L"July";
2464 + _M_data->_M_month08 = L"August";
2465 + _M_data->_M_month09 = L"September";
2466 + _M_data->_M_month10 = L"October";
2467 + _M_data->_M_month11 = L"November";
2468 + _M_data->_M_month12 = L"December";
2470 + // Abbreviated month names, starting with "C"'s Jan.
2471 + _M_data->_M_amonth01 = L"Jan";
2472 + _M_data->_M_amonth02 = L"Feb";
2473 + _M_data->_M_amonth03 = L"Mar";
2474 + _M_data->_M_amonth04 = L"Apr";
2475 + _M_data->_M_amonth05 = L"May";
2476 + _M_data->_M_amonth06 = L"Jun";
2477 + _M_data->_M_amonth07 = L"Jul";
2478 + _M_data->_M_amonth08 = L"Aug";
2479 + _M_data->_M_amonth09 = L"Sep";
2480 + _M_data->_M_amonth10 = L"Oct";
2481 + _M_data->_M_amonth11 = L"Nov";
2482 + _M_data->_M_amonth12 = L"Dec";
2487 + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2489 + union { char *__s; wchar_t *__w; } __u;
2491 + __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2492 + _M_data->_M_date_format = __u.__w;
2493 + __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2494 + _M_data->_M_date_era_format = __u.__w;
2495 + __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2496 + _M_data->_M_time_format = __u.__w;
2497 + __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2498 + _M_data->_M_time_era_format = __u.__w;
2499 + __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2500 + _M_data->_M_date_time_format = __u.__w;
2501 + __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2502 + _M_data->_M_date_time_era_format = __u.__w;
2503 + __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2504 + _M_data->_M_am = __u.__w;
2505 + __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2506 + _M_data->_M_pm = __u.__w;
2507 + __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2508 + _M_data->_M_am_pm_format = __u.__w;
2510 + // Day names, starting with "C"'s Sunday.
2511 + __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2512 + _M_data->_M_day1 = __u.__w;
2513 + __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2514 + _M_data->_M_day2 = __u.__w;
2515 + __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2516 + _M_data->_M_day3 = __u.__w;
2517 + __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2518 + _M_data->_M_day4 = __u.__w;
2519 + __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2520 + _M_data->_M_day5 = __u.__w;
2521 + __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2522 + _M_data->_M_day6 = __u.__w;
2523 + __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2524 + _M_data->_M_day7 = __u.__w;
2526 + // Abbreviated day names, starting with "C"'s Sun.
2527 + __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2528 + _M_data->_M_aday1 = __u.__w;
2529 + __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2530 + _M_data->_M_aday2 = __u.__w;
2531 + __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2532 + _M_data->_M_aday3 = __u.__w;
2533 + __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2534 + _M_data->_M_aday4 = __u.__w;
2535 + __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2536 + _M_data->_M_aday5 = __u.__w;
2537 + __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2538 + _M_data->_M_aday6 = __u.__w;
2539 + __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2540 + _M_data->_M_aday7 = __u.__w;
2542 + // Month names, starting with "C"'s January.
2543 + __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2544 + _M_data->_M_month01 = __u.__w;
2545 + __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2546 + _M_data->_M_month02 = __u.__w;
2547 + __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2548 + _M_data->_M_month03 = __u.__w;
2549 + __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2550 + _M_data->_M_month04 = __u.__w;
2551 + __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2552 + _M_data->_M_month05 = __u.__w;
2553 + __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2554 + _M_data->_M_month06 = __u.__w;
2555 + __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2556 + _M_data->_M_month07 = __u.__w;
2557 + __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2558 + _M_data->_M_month08 = __u.__w;
2559 + __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2560 + _M_data->_M_month09 = __u.__w;
2561 + __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2562 + _M_data->_M_month10 = __u.__w;
2563 + __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2564 + _M_data->_M_month11 = __u.__w;
2565 + __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2566 + _M_data->_M_month12 = __u.__w;
2568 + // Abbreviated month names, starting with "C"'s Jan.
2569 + __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2570 + _M_data->_M_amonth01 = __u.__w;
2571 + __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2572 + _M_data->_M_amonth02 = __u.__w;
2573 + __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2574 + _M_data->_M_amonth03 = __u.__w;
2575 + __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2576 + _M_data->_M_amonth04 = __u.__w;
2577 + __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2578 + _M_data->_M_amonth05 = __u.__w;
2579 + __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2580 + _M_data->_M_amonth06 = __u.__w;
2581 + __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2582 + _M_data->_M_amonth07 = __u.__w;
2583 + __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2584 + _M_data->_M_amonth08 = __u.__w;
2585 + __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2586 + _M_data->_M_amonth09 = __u.__w;
2587 + __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2588 + _M_data->_M_amonth10 = __u.__w;
2589 + __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2590 + _M_data->_M_amonth11 = __u.__w;
2591 + __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2592 + _M_data->_M_amonth12 = __u.__w;
2598 --- gcc/libstdc++-v3/config/locale/uclibc/time_members.h
2599 +++ gcc/libstdc++-v3/config/locale/uclibc/time_members.h
2601 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2603 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2605 +// This file is part of the GNU ISO C++ Library. This library is free
2606 +// software; you can redistribute it and/or modify it under the
2607 +// terms of the GNU General Public License as published by the
2608 +// Free Software Foundation; either version 2, or (at your option)
2609 +// any later version.
2611 +// This library is distributed in the hope that it will be useful,
2612 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2613 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2614 +// GNU General Public License for more details.
2616 +// You should have received a copy of the GNU General Public License along
2617 +// with this library; see the file COPYING. If not, write to the Free
2618 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2621 +// As a special exception, you may use this file as part of a free software
2622 +// library without restriction. Specifically, if other files instantiate
2623 +// templates or use macros or inline functions from this file, or you compile
2624 +// this file and link it with other files to produce an executable, this
2625 +// file does not by itself cause the resulting executable to be covered by
2626 +// the GNU General Public License. This exception does not however
2627 +// invalidate any other reasons why the executable file might be covered by
2628 +// the GNU General Public License.
2631 +// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2632 +// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2635 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2637 + template<typename _CharT>
2638 + __timepunct<_CharT>::__timepunct(size_t __refs)
2639 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2640 + _M_name_timepunct(_S_get_c_name())
2641 + { _M_initialize_timepunct(); }
2643 + template<typename _CharT>
2644 + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2645 + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2646 + _M_name_timepunct(_S_get_c_name())
2647 + { _M_initialize_timepunct(); }
2649 + template<typename _CharT>
2650 + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2652 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2653 + _M_name_timepunct(__s)
2655 + char* __tmp = new char[std::strlen(__s) + 1];
2656 + std::strcpy(__tmp, __s);
2657 + _M_name_timepunct = __tmp;
2658 + _M_initialize_timepunct(__cloc);
2661 + template<typename _CharT>
2662 + __timepunct<_CharT>::~__timepunct()
2664 + if (_M_name_timepunct != _S_get_c_name())
2665 + delete [] _M_name_timepunct;
2667 + _S_destroy_c_locale(_M_c_locale_timepunct);
2669 --- gcc/libstdc++-v3/configure
2670 +++ gcc/libstdc++-v3/configure
2671 @@ -5764,7 +5764,7 @@
2672 enableval="$enable_clocale"
2674 case "$enableval" in
2675 - generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
2676 + generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
2677 *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
2678 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
2679 { (exit 1); exit 1; }; } ;;
2680 @@ -5789,6 +5789,9 @@
2681 # Default to "generic".
2682 if test $enable_clocale_flag = auto; then
2683 case ${target_os} in
2685 + enable_clocale_flag=uclibc
2687 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2688 cat >conftest.$ac_ext <<_ACEOF
2690 @@ -6019,6 +6022,76 @@
2691 CTIME_CC=config/locale/generic/time_members.cc
2692 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2695 + echo "$as_me:$LINENO: result: uclibc" >&5
2696 +echo "${ECHO_T}uclibc" >&6
2698 + # Declare intention to use gettext, and add support for specific
2700 + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
2701 + ALL_LINGUAS="de fr"
2703 + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
2704 + # Extract the first word of "msgfmt", so it can be a program name with args.
2705 +set dummy msgfmt; ac_word=$2
2706 +echo "$as_me:$LINENO: checking for $ac_word" >&5
2707 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2708 +if test "${ac_cv_prog_check_msgfmt+set}" = set; then
2709 + echo $ECHO_N "(cached) $ECHO_C" >&6
2711 + if test -n "$check_msgfmt"; then
2712 + ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
2714 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2715 +for as_dir in $PATH
2718 + test -z "$as_dir" && as_dir=.
2719 + for ac_exec_ext in '' $ac_executable_extensions; do
2720 + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2721 + ac_cv_prog_check_msgfmt="yes"
2722 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2728 + test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
2731 +check_msgfmt=$ac_cv_prog_check_msgfmt
2732 +if test -n "$check_msgfmt"; then
2733 + echo "$as_me:$LINENO: result: $check_msgfmt" >&5
2734 +echo "${ECHO_T}$check_msgfmt" >&6
2736 + echo "$as_me:$LINENO: result: no" >&5
2737 +echo "${ECHO_T}no" >&6
2740 + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
2743 + # Export the build objects.
2744 + for ling in $ALL_LINGUAS; do \
2745 + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
2746 + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
2751 + CLOCALE_H=config/locale/uclibc/c_locale.h
2752 + CLOCALE_CC=config/locale/uclibc/c_locale.cc
2753 + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
2754 + CCOLLATE_CC=config/locale/uclibc/collate_members.cc
2755 + CCTYPE_CC=config/locale/uclibc/ctype_members.cc
2756 + CMESSAGES_H=config/locale/uclibc/messages_members.h
2757 + CMESSAGES_CC=config/locale/uclibc/messages_members.cc
2758 + CMONEY_CC=config/locale/uclibc/monetary_members.cc
2759 + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
2760 + CTIME_H=config/locale/uclibc/time_members.h
2761 + CTIME_CC=config/locale/uclibc/time_members.cc
2762 + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
2766 # This is where the testsuite looks for locale catalogs, using the
2767 --- gcc/libstdc++-v3/include/c_compatibility/wchar.h
2768 +++ gcc/libstdc++-v3/include/c_compatibility/wchar.h
2771 using std::wmemmove;
2773 +#if _GLIBCXX_HAVE_WCSFTIME
2774 using std::wcsftime;
2777 #if _GLIBCXX_USE_C99
2779 --- gcc/libstdc++-v3/include/c_std/std_cwchar.h
2780 +++ gcc/libstdc++-v3/include/c_std/std_cwchar.h
2785 +#if _GLIBCXX_HAVE_WCSFTIME