1 --- a/libstdc++-v3/acinclude.m4
2 +++ b/libstdc++-v3/acinclude.m4
3 @@ -1003,7 +1003,7 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
4 AC_MSG_CHECKING([for C locale to use])
5 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
6 [use MODEL for target locale package],
7 - [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
8 + [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
10 # If they didn't use this option switch, or if they specified --enable
11 # with no specific model, we'll have to look for one. If they
12 @@ -1019,6 +1019,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
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 @@ -1162,6 +1165,40 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
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
64 +++ b/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
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
130 +++ b/libstdc++-v3/config/locale/uclibc/c_locale.cc
132 +// Wrapper for underlying C-language localization -*- C++ -*-
134 +// Copyright (C) 2001, 2002, 2003, 2004, 2005
135 +// Free Software Foundation, Inc.
137 +// This file is part of the GNU ISO C++ Library. This library is free
138 +// software; you can redistribute it and/or modify it under the
139 +// terms of the GNU General Public License as published by the
140 +// Free Software Foundation; either version 2, or (at your option)
141 +// any later version.
143 +// This library is distributed in the hope that it will be useful,
144 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
145 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
146 +// GNU General Public License for more details.
148 +// You should have received a copy of the GNU General Public License along
149 +// with this library; see the file COPYING. If not, write to the Free
150 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
153 +// As a special exception, you may use this file as part of a free software
154 +// library without restriction. Specifically, if other files instantiate
155 +// templates or use macros or inline functions from this file, or you compile
156 +// this file and link it with other files to produce an executable, this
157 +// file does not by itself cause the resulting executable to be covered by
158 +// the GNU General Public License. This exception does not however
159 +// invalidate any other reasons why the executable file might be covered by
160 +// the GNU General Public License.
163 +// ISO C++ 14882: 22.8 Standard locale categories.
166 +// Written by Benjamin Kosnik <bkoz@redhat.com>
168 +#include <cerrno> // For errno
170 +#include <stdexcept>
171 +#include <langinfo.h>
172 +#include <bits/c++locale_internal.h>
174 +#ifndef __UCLIBC_HAS_XLOCALE__
175 +#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
176 +#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
177 +#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
178 +#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
179 +#define __strtof_l(S, E, L) strtof((S), (E))
180 +#define __strtod_l(S, E, L) strtod((S), (E))
181 +#define __strtold_l(S, E, L) strtold((S), (E))
182 +#warning should dummy __newlocale check for C|POSIX ?
183 +#define __newlocale(a, b, c) NULL
184 +#define __freelocale(a) ((void)0)
185 +#define __duplocale(a) __c_locale()
192 + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
193 + const __c_locale& __cloc)
197 + float __f = __strtof_l(__s, &__sanity, __cloc);
198 + if (__sanity != __s && errno != ERANGE)
201 + __err |= ios_base::failbit;
206 + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
207 + const __c_locale& __cloc)
211 + double __d = __strtod_l(__s, &__sanity, __cloc);
212 + if (__sanity != __s && errno != ERANGE)
215 + __err |= ios_base::failbit;
220 + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
221 + const __c_locale& __cloc)
225 + long double __ld = __strtold_l(__s, &__sanity, __cloc);
226 + if (__sanity != __s && errno != ERANGE)
229 + __err |= ios_base::failbit;
233 + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
236 + __cloc = __newlocale(1 << LC_ALL, __s, __old);
237 +#ifdef __UCLIBC_HAS_XLOCALE__
240 + // This named locale is not supported by the underlying OS.
241 + __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
242 + "name not valid"));
248 + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
250 + if (__cloc && _S_get_c_locale() != __cloc)
251 + __freelocale(__cloc);
255 + locale::facet::_S_clone_c_locale(__c_locale& __cloc)
256 + { return __duplocale(__cloc); }
261 + const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
269 +#if _GLIBCXX_NUM_CATEGORIES != 0
275 + "LC_IDENTIFICATION"
282 + const char* const* const locale::_S_categories = __gnu_cxx::category_names;
285 +++ b/libstdc++-v3/config/locale/uclibc/c_locale.h
287 +// Wrapper for underlying C-language localization -*- C++ -*-
289 +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
291 +// This file is part of the GNU ISO C++ Library. This library is free
292 +// software; you can redistribute it and/or modify it under the
293 +// terms of the GNU General Public License as published by the
294 +// Free Software Foundation; either version 2, or (at your option)
295 +// any later version.
297 +// This library is distributed in the hope that it will be useful,
298 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
299 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
300 +// GNU General Public License for more details.
302 +// You should have received a copy of the GNU General Public License along
303 +// with this library; see the file COPYING. If not, write to the Free
304 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
307 +// As a special exception, you may use this file as part of a free software
308 +// library without restriction. Specifically, if other files instantiate
309 +// templates or use macros or inline functions from this file, or you compile
310 +// this file and link it with other files to produce an executable, this
311 +// file does not by itself cause the resulting executable to be covered by
312 +// the GNU General Public License. This exception does not however
313 +// invalidate any other reasons why the executable file might be covered by
314 +// the GNU General Public License.
317 +// ISO C++ 14882: 22.8 Standard locale categories.
320 +// Written by Benjamin Kosnik <bkoz@redhat.com>
323 +#define _C_LOCALE_H 1
325 +#pragma GCC system_header
327 +#include <cstring> // get std::strlen
328 +#include <cstdio> // get std::snprintf or std::sprintf
330 +#include <langinfo.h> // For codecvt
331 +#ifdef __UCLIBC_MJN3_ONLY__
334 +#ifdef __UCLIBC_HAS_LOCALE__
335 +#include <iconv.h> // For codecvt using iconv, iconv_t
337 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
338 +#include <libintl.h> // For messages
341 +#ifdef __UCLIBC_MJN3_ONLY__
342 +#warning what is _GLIBCXX_C_LOCALE_GNU for
344 +#define _GLIBCXX_C_LOCALE_GNU 1
346 +#ifdef __UCLIBC_MJN3_ONLY__
347 +#warning fix categories
349 +// #define _GLIBCXX_NUM_CATEGORIES 6
350 +#define _GLIBCXX_NUM_CATEGORIES 0
352 +#ifdef __UCLIBC_HAS_XLOCALE__
355 + extern "C" __typeof(uselocale) __uselocale;
361 +#ifdef __UCLIBC_HAS_XLOCALE__
362 + typedef __locale_t __c_locale;
364 + typedef int* __c_locale;
367 + // Convert numeric value of type _Tv to string and return length of
368 + // string. If snprintf is available use it, otherwise fall back to
369 + // the unsafe sprintf which, in general, can be dangerous and should
371 + template<typename _Tv>
373 + __convert_from_v(char* __out,
374 + const int __size __attribute__ ((__unused__)),
376 +#ifdef __UCLIBC_HAS_XLOCALE__
377 + _Tv __v, const __c_locale& __cloc, int __prec)
379 + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
381 + _Tv __v, const __c_locale&, int __prec)
383 +# ifdef __UCLIBC_HAS_LOCALE__
384 + char* __old = std::setlocale(LC_ALL, NULL);
385 + char* __sav = new char[std::strlen(__old) + 1];
386 + std::strcpy(__sav, __old);
387 + std::setlocale(LC_ALL, "C");
391 + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
393 +#ifdef __UCLIBC_HAS_XLOCALE__
394 + __gnu_cxx::__uselocale(__old);
395 +#elif defined __UCLIBC_HAS_LOCALE__
396 + std::setlocale(LC_ALL, __sav);
405 +++ b/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
407 +// std::codecvt implementation details, GNU version -*- C++ -*-
409 +// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
411 +// This file is part of the GNU ISO C++ Library. This library is free
412 +// software; you can redistribute it and/or modify it under the
413 +// terms of the GNU General Public License as published by the
414 +// Free Software Foundation; either version 2, or (at your option)
415 +// any later version.
417 +// This library is distributed in the hope that it will be useful,
418 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
419 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
420 +// GNU General Public License for more details.
422 +// You should have received a copy of the GNU General Public License along
423 +// with this library; see the file COPYING. If not, write to the Free
424 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
427 +// As a special exception, you may use this file as part of a free software
428 +// library without restriction. Specifically, if other files instantiate
429 +// templates or use macros or inline functions from this file, or you compile
430 +// this file and link it with other files to produce an executable, this
431 +// file does not by itself cause the resulting executable to be covered by
432 +// the GNU General Public License. This exception does not however
433 +// invalidate any other reasons why the executable file might be covered by
434 +// the GNU General Public License.
437 +// ISO C++ 14882: 22.2.1.5 - Template class codecvt
440 +// Written by Benjamin Kosnik <bkoz@redhat.com>
443 +#include <bits/c++locale_internal.h>
447 + // Specializations.
448 +#ifdef _GLIBCXX_USE_WCHAR_T
449 + codecvt_base::result
450 + codecvt<wchar_t, char, mbstate_t>::
451 + do_out(state_type& __state, const intern_type* __from,
452 + const intern_type* __from_end, const intern_type*& __from_next,
453 + extern_type* __to, extern_type* __to_end,
454 + extern_type*& __to_next) const
457 + state_type __tmp_state(__state);
459 +#ifdef __UCLIBC_HAS_XLOCALE__
460 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
463 + // wcsnrtombs is *very* fast but stops if encounters NUL characters:
464 + // in case we fall back to wcrtomb and then continue, in a loop.
465 + // NB: wcsnrtombs is a GNU extension
466 + for (__from_next = __from, __to_next = __to;
467 + __from_next < __from_end && __to_next < __to_end
470 + const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
471 + __from_end - __from_next);
472 + if (!__from_chunk_end)
473 + __from_chunk_end = __from_end;
475 + __from = __from_next;
476 + const size_t __conv = wcsnrtombs(__to_next, &__from_next,
477 + __from_chunk_end - __from_next,
478 + __to_end - __to_next, &__state);
479 + if (__conv == static_cast<size_t>(-1))
481 + // In case of error, in order to stop at the exact place we
482 + // have to start again from the beginning with a series of
484 + for (; __from < __from_next; ++__from)
485 + __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
486 + __state = __tmp_state;
489 + else if (__from_next && __from_next < __from_chunk_end)
491 + __to_next += __conv;
496 + __from_next = __from_chunk_end;
497 + __to_next += __conv;
500 + if (__from_next < __from_end && __ret == ok)
502 + extern_type __buf[MB_LEN_MAX];
503 + __tmp_state = __state;
504 + const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
505 + if (__conv > static_cast<size_t>(__to_end - __to_next))
509 + memcpy(__to_next, __buf, __conv);
510 + __state = __tmp_state;
511 + __to_next += __conv;
517 +#ifdef __UCLIBC_HAS_XLOCALE__
518 + __uselocale(__old);
524 + codecvt_base::result
525 + codecvt<wchar_t, char, mbstate_t>::
526 + do_in(state_type& __state, const extern_type* __from,
527 + const extern_type* __from_end, const extern_type*& __from_next,
528 + intern_type* __to, intern_type* __to_end,
529 + intern_type*& __to_next) const
532 + state_type __tmp_state(__state);
534 +#ifdef __UCLIBC_HAS_XLOCALE__
535 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
538 + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
539 + // in case we store a L'\0' and then continue, in a loop.
540 + // NB: mbsnrtowcs is a GNU extension
541 + for (__from_next = __from, __to_next = __to;
542 + __from_next < __from_end && __to_next < __to_end
545 + const extern_type* __from_chunk_end;
546 + __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
549 + if (!__from_chunk_end)
550 + __from_chunk_end = __from_end;
552 + __from = __from_next;
553 + size_t __conv = mbsnrtowcs(__to_next, &__from_next,
554 + __from_chunk_end - __from_next,
555 + __to_end - __to_next, &__state);
556 + if (__conv == static_cast<size_t>(-1))
558 + // In case of error, in order to stop at the exact place we
559 + // have to start again from the beginning with a series of
561 + for (;; ++__to_next, __from += __conv)
563 + __conv = mbrtowc(__to_next, __from, __from_end - __from,
565 + if (__conv == static_cast<size_t>(-1)
566 + || __conv == static_cast<size_t>(-2))
569 + __from_next = __from;
570 + __state = __tmp_state;
573 + else if (__from_next && __from_next < __from_chunk_end)
575 + // It is unclear what to return in this case (see DR 382).
576 + __to_next += __conv;
581 + __from_next = __from_chunk_end;
582 + __to_next += __conv;
585 + if (__from_next < __from_end && __ret == ok)
587 + if (__to_next < __to_end)
589 + // XXX Probably wrong for stateful encodings
590 + __tmp_state = __state;
592 + *__to_next++ = L'\0';
599 +#ifdef __UCLIBC_HAS_XLOCALE__
600 + __uselocale(__old);
607 + codecvt<wchar_t, char, mbstate_t>::
608 + do_encoding() const throw()
610 + // XXX This implementation assumes that the encoding is
611 + // stateless and is either single-byte or variable-width.
613 +#ifdef __UCLIBC_HAS_XLOCALE__
614 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
616 + if (MB_CUR_MAX == 1)
618 +#ifdef __UCLIBC_HAS_XLOCALE__
619 + __uselocale(__old);
625 + codecvt<wchar_t, char, mbstate_t>::
626 + do_max_length() const throw()
628 +#ifdef __UCLIBC_HAS_XLOCALE__
629 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
631 + // XXX Probably wrong for stateful encodings.
632 + int __ret = MB_CUR_MAX;
633 +#ifdef __UCLIBC_HAS_XLOCALE__
634 + __uselocale(__old);
640 + codecvt<wchar_t, char, mbstate_t>::
641 + do_length(state_type& __state, const extern_type* __from,
642 + const extern_type* __end, size_t __max) const
645 + state_type __tmp_state(__state);
647 +#ifdef __UCLIBC_HAS_XLOCALE__
648 + __c_locale __old = __uselocale(_M_c_locale_codecvt);
651 + // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
652 + // in case we advance past it and then continue, in a loop.
653 + // NB: mbsnrtowcs is a GNU extension
655 + // A dummy internal buffer is needed in order for mbsnrtocws to consider
656 + // its fourth parameter (it wouldn't with NULL as first parameter).
657 + wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
659 + while (__from < __end && __max)
661 + const extern_type* __from_chunk_end;
662 + __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
665 + if (!__from_chunk_end)
666 + __from_chunk_end = __end;
668 + const extern_type* __tmp_from = __from;
669 + size_t __conv = mbsnrtowcs(__to, &__from,
670 + __from_chunk_end - __from,
672 + if (__conv == static_cast<size_t>(-1))
674 + // In case of error, in order to stop at the exact place we
675 + // have to start again from the beginning with a series of
677 + for (__from = __tmp_from;; __from += __conv)
679 + __conv = mbrtowc(NULL, __from, __end - __from,
681 + if (__conv == static_cast<size_t>(-1)
682 + || __conv == static_cast<size_t>(-2))
685 + __state = __tmp_state;
686 + __ret += __from - __tmp_from;
690 + __from = __from_chunk_end;
692 + __ret += __from - __tmp_from;
695 + if (__from < __end && __max)
697 + // XXX Probably wrong for stateful encodings
698 + __tmp_state = __state;
705 +#ifdef __UCLIBC_HAS_XLOCALE__
706 + __uselocale(__old);
714 +++ b/libstdc++-v3/config/locale/uclibc/collate_members.cc
716 +// std::collate implementation details, GNU version -*- C++ -*-
718 +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
720 +// This file is part of the GNU ISO C++ Library. This library is free
721 +// software; you can redistribute it and/or modify it under the
722 +// terms of the GNU General Public License as published by the
723 +// Free Software Foundation; either version 2, or (at your option)
724 +// any later version.
726 +// This library is distributed in the hope that it will be useful,
727 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
728 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
729 +// GNU General Public License for more details.
731 +// You should have received a copy of the GNU General Public License along
732 +// with this library; see the file COPYING. If not, write to the Free
733 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
736 +// As a special exception, you may use this file as part of a free software
737 +// library without restriction. Specifically, if other files instantiate
738 +// templates or use macros or inline functions from this file, or you compile
739 +// this file and link it with other files to produce an executable, this
740 +// file does not by itself cause the resulting executable to be covered by
741 +// the GNU General Public License. This exception does not however
742 +// invalidate any other reasons why the executable file might be covered by
743 +// the GNU General Public License.
746 +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
749 +// Written by Benjamin Kosnik <bkoz@redhat.com>
752 +#include <bits/c++locale_internal.h>
754 +#ifndef __UCLIBC_HAS_XLOCALE__
755 +#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
756 +#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
757 +#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
758 +#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
763 + // These are basically extensions to char_traits, and perhaps should
764 + // be put there instead of here.
767 + collate<char>::_M_compare(const char* __one, const char* __two) const
769 + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
770 + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
775 + collate<char>::_M_transform(char* __to, const char* __from,
777 + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
779 +#ifdef _GLIBCXX_USE_WCHAR_T
782 + collate<wchar_t>::_M_compare(const wchar_t* __one,
783 + const wchar_t* __two) const
785 + int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
786 + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
791 + collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
793 + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
797 +++ b/libstdc++-v3/config/locale/uclibc/ctype_members.cc
799 +// std::ctype implementation details, GNU version -*- C++ -*-
801 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
803 +// This file is part of the GNU ISO C++ Library. This library is free
804 +// software; you can redistribute it and/or modify it under the
805 +// terms of the GNU General Public License as published by the
806 +// Free Software Foundation; either version 2, or (at your option)
807 +// any later version.
809 +// This library is distributed in the hope that it will be useful,
810 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
811 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
812 +// GNU General Public License for more details.
814 +// You should have received a copy of the GNU General Public License along
815 +// with this library; see the file COPYING. If not, write to the Free
816 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
819 +// As a special exception, you may use this file as part of a free software
820 +// library without restriction. Specifically, if other files instantiate
821 +// templates or use macros or inline functions from this file, or you compile
822 +// this file and link it with other files to produce an executable, this
823 +// file does not by itself cause the resulting executable to be covered by
824 +// the GNU General Public License. This exception does not however
825 +// invalidate any other reasons why the executable file might be covered by
826 +// the GNU General Public License.
829 +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
832 +// Written by Benjamin Kosnik <bkoz@redhat.com>
837 +#include <bits/c++locale_internal.h>
839 +#ifndef __UCLIBC_HAS_XLOCALE__
840 +#define __wctype_l(S, L) wctype((S))
841 +#define __towupper_l(C, L) towupper((C))
842 +#define __towlower_l(C, L) towlower((C))
843 +#define __iswctype_l(C, M, L) iswctype((C), (M))
848 + // NB: The other ctype<char> specializations are in src/locale.cc and
849 + // various /config/os/* files.
851 + ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
852 + : ctype<char>(0, false, __refs)
854 + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
856 + this->_S_destroy_c_locale(this->_M_c_locale_ctype);
857 + this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
858 +#ifdef __UCLIBC_HAS_XLOCALE__
859 + this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
860 + this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
861 + this->_M_table = this->_M_c_locale_ctype->__ctype_b;
866 +#ifdef _GLIBCXX_USE_WCHAR_T
867 + ctype<wchar_t>::__wmask_type
868 + ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
870 + __wmask_type __ret;
874 + __ret = __wctype_l("space", _M_c_locale_ctype);
877 + __ret = __wctype_l("print", _M_c_locale_ctype);
880 + __ret = __wctype_l("cntrl", _M_c_locale_ctype);
883 + __ret = __wctype_l("upper", _M_c_locale_ctype);
886 + __ret = __wctype_l("lower", _M_c_locale_ctype);
889 + __ret = __wctype_l("alpha", _M_c_locale_ctype);
892 + __ret = __wctype_l("digit", _M_c_locale_ctype);
895 + __ret = __wctype_l("punct", _M_c_locale_ctype);
898 + __ret = __wctype_l("xdigit", _M_c_locale_ctype);
901 + __ret = __wctype_l("alnum", _M_c_locale_ctype);
904 + __ret = __wctype_l("graph", _M_c_locale_ctype);
907 + __ret = __wmask_type();
913 + ctype<wchar_t>::do_toupper(wchar_t __c) const
914 + { return __towupper_l(__c, _M_c_locale_ctype); }
917 + ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
919 + while (__lo < __hi)
921 + *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
928 + ctype<wchar_t>::do_tolower(wchar_t __c) const
929 + { return __towlower_l(__c, _M_c_locale_ctype); }
932 + ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
934 + while (__lo < __hi)
936 + *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
944 + do_is(mask __m, wchar_t __c) const
946 + // The case of __m == ctype_base::space is particularly important,
947 + // due to its use in many istream functions. Therefore we deal with
948 + // it first, exploiting the knowledge that on GNU systems _M_bit[5]
949 + // is the mask corresponding to ctype_base::space. NB: an encoding
950 + // change would not affect correctness!
951 + bool __ret = false;
952 + if (__m == _M_bit[5])
953 + __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
956 + // Highest bitmask in ctype_base == 10, but extra in "C"
957 + // library for blank.
958 + const size_t __bitmasksize = 11;
959 + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
960 + if (__m & _M_bit[__bitcur])
962 + if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
967 + else if (__m == _M_bit[__bitcur])
976 + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
978 + for (; __lo < __hi; ++__vec, ++__lo)
980 + // Highest bitmask in ctype_base == 10, but extra in "C"
981 + // library for blank.
982 + const size_t __bitmasksize = 11;
984 + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
985 + if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
986 + __m |= _M_bit[__bitcur];
994 + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
996 + while (__lo < __hi && !this->do_is(__m, *__lo))
1003 + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1005 + while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1012 + do_widen(char __c) const
1013 + { return _M_widen[static_cast<unsigned char>(__c)]; }
1017 + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1019 + while (__lo < __hi)
1021 + *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1030 + do_narrow(wchar_t __wc, char __dfault) const
1032 + if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1033 + return _M_narrow[__wc];
1034 +#ifdef __UCLIBC_HAS_XLOCALE__
1035 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1037 + const int __c = wctob(__wc);
1038 +#ifdef __UCLIBC_HAS_XLOCALE__
1039 + __uselocale(__old);
1041 + return (__c == EOF ? __dfault : static_cast<char>(__c));
1046 + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1047 + char* __dest) const
1049 +#ifdef __UCLIBC_HAS_XLOCALE__
1050 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1053 + while (__lo < __hi)
1055 + if (*__lo >= 0 && *__lo < 128)
1056 + *__dest = _M_narrow[*__lo];
1059 + const int __c = wctob(*__lo);
1060 + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1066 + while (__lo < __hi)
1068 + const int __c = wctob(*__lo);
1069 + *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1073 +#ifdef __UCLIBC_HAS_XLOCALE__
1074 + __uselocale(__old);
1080 + ctype<wchar_t>::_M_initialize_ctype()
1082 +#ifdef __UCLIBC_HAS_XLOCALE__
1083 + __c_locale __old = __uselocale(_M_c_locale_ctype);
1086 + for (__i = 0; __i < 128; ++__i)
1088 + const int __c = wctob(__i);
1092 + _M_narrow[__i] = static_cast<char>(__c);
1095 + _M_narrow_ok = true;
1097 + _M_narrow_ok = false;
1098 + for (size_t __j = 0;
1099 + __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1100 + _M_widen[__j] = btowc(__j);
1102 + for (size_t __k = 0; __k <= 11; ++__k)
1104 + _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1105 + _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1107 +#ifdef __UCLIBC_HAS_XLOCALE__
1108 + __uselocale(__old);
1111 +#endif // _GLIBCXX_USE_WCHAR_T
1114 +++ b/libstdc++-v3/config/locale/uclibc/messages_members.cc
1116 +// std::messages implementation details, GNU version -*- C++ -*-
1118 +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1120 +// This file is part of the GNU ISO C++ Library. This library is free
1121 +// software; you can redistribute it and/or modify it under the
1122 +// terms of the GNU General Public License as published by the
1123 +// Free Software Foundation; either version 2, or (at your option)
1124 +// any later version.
1126 +// This library is distributed in the hope that it will be useful,
1127 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1128 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1129 +// GNU General Public License for more details.
1131 +// You should have received a copy of the GNU General Public License along
1132 +// with this library; see the file COPYING. If not, write to the Free
1133 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1136 +// As a special exception, you may use this file as part of a free software
1137 +// library without restriction. Specifically, if other files instantiate
1138 +// templates or use macros or inline functions from this file, or you compile
1139 +// this file and link it with other files to produce an executable, this
1140 +// file does not by itself cause the resulting executable to be covered by
1141 +// the GNU General Public License. This exception does not however
1142 +// invalidate any other reasons why the executable file might be covered by
1143 +// the GNU General Public License.
1146 +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1149 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1152 +#include <bits/c++locale_internal.h>
1154 +#ifdef __UCLIBC_MJN3_ONLY__
1155 +#warning fix gettext stuff
1157 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1158 +extern "C" char *__dcgettext(const char *domainname,
1159 + const char *msgid, int category);
1161 +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1164 +#define gettext(msgid) (msgid)
1169 + // Specializations.
1172 + messages<char>::do_get(catalog, int, int, const string& __dfault) const
1174 +#ifdef __UCLIBC_HAS_XLOCALE__
1175 + __c_locale __old = __uselocale(_M_c_locale_messages);
1176 + const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1177 + __uselocale(__old);
1178 + return string(__msg);
1179 +#elif defined __UCLIBC_HAS_LOCALE__
1180 + char* __old = strdup(setlocale(LC_ALL, NULL));
1181 + setlocale(LC_ALL, _M_name_messages);
1182 + const char* __msg = gettext(__dfault.c_str());
1183 + setlocale(LC_ALL, __old);
1185 + return string(__msg);
1187 + const char* __msg = gettext(__dfault.c_str());
1188 + return string(__msg);
1192 +#ifdef _GLIBCXX_USE_WCHAR_T
1195 + messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1197 +# ifdef __UCLIBC_HAS_XLOCALE__
1198 + __c_locale __old = __uselocale(_M_c_locale_messages);
1199 + char* __msg = gettext(_M_convert_to_char(__dfault));
1200 + __uselocale(__old);
1201 + return _M_convert_from_char(__msg);
1202 +# elif defined __UCLIBC_HAS_LOCALE__
1203 + char* __old = strdup(setlocale(LC_ALL, NULL));
1204 + setlocale(LC_ALL, _M_name_messages);
1205 + char* __msg = gettext(_M_convert_to_char(__dfault));
1206 + setlocale(LC_ALL, __old);
1208 + return _M_convert_from_char(__msg);
1210 + char* __msg = gettext(_M_convert_to_char(__dfault));
1211 + return _M_convert_from_char(__msg);
1217 +++ b/libstdc++-v3/config/locale/uclibc/messages_members.h
1219 +// std::messages implementation details, GNU version -*- C++ -*-
1221 +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
1223 +// This file is part of the GNU ISO C++ Library. This library is free
1224 +// software; you can redistribute it and/or modify it under the
1225 +// terms of the GNU General Public License as published by the
1226 +// Free Software Foundation; either version 2, or (at your option)
1227 +// any later version.
1229 +// This library is distributed in the hope that it will be useful,
1230 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1231 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1232 +// GNU General Public License for more details.
1234 +// You should have received a copy of the GNU General Public License along
1235 +// with this library; see the file COPYING. If not, write to the Free
1236 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1239 +// As a special exception, you may use this file as part of a free software
1240 +// library without restriction. Specifically, if other files instantiate
1241 +// templates or use macros or inline functions from this file, or you compile
1242 +// this file and link it with other files to produce an executable, this
1243 +// file does not by itself cause the resulting executable to be covered by
1244 +// the GNU General Public License. This exception does not however
1245 +// invalidate any other reasons why the executable file might be covered by
1246 +// the GNU General Public License.
1249 +// ISO C++ 14882: 22.2.7.1.2 messages functions
1252 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1254 +#ifdef __UCLIBC_MJN3_ONLY__
1255 +#warning fix prototypes for *textdomain funcs
1257 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1258 +extern "C" char *__textdomain(const char *domainname);
1259 +extern "C" char *__bindtextdomain(const char *domainname,
1260 + const char *dirname);
1262 +#undef __textdomain
1263 +#undef __bindtextdomain
1264 +#define __textdomain(D) ((void)0)
1265 +#define __bindtextdomain(D,P) ((void)0)
1268 + // Non-virtual member functions.
1269 + template<typename _CharT>
1270 + messages<_CharT>::messages(size_t __refs)
1271 + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1272 + _M_name_messages(_S_get_c_name())
1275 + template<typename _CharT>
1276 + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1278 + : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
1280 + const size_t __len = std::strlen(__s) + 1;
1281 + char* __tmp = new char[__len];
1282 + std::memcpy(__tmp, __s, __len);
1283 + _M_name_messages = __tmp;
1285 + // Last to avoid leaking memory if new throws.
1286 + _M_c_locale_messages = _S_clone_c_locale(__cloc);
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);
1341 +++ b/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1343 +// std::moneypunct implementation details, GNU version -*- C++ -*-
1345 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1347 +// This file is part of the GNU ISO C++ Library. This library is free
1348 +// software; you can redistribute it and/or modify it under the
1349 +// terms of the GNU General Public License as published by the
1350 +// Free Software Foundation; either version 2, or (at your option)
1351 +// any later version.
1353 +// This library is distributed in the hope that it will be useful,
1354 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1355 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1356 +// GNU General Public License for more details.
1358 +// You should have received a copy of the GNU General Public License along
1359 +// with this library; see the file COPYING. If not, write to the Free
1360 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1363 +// As a special exception, you may use this file as part of a free software
1364 +// library without restriction. Specifically, if other files instantiate
1365 +// templates or use macros or inline functions from this file, or you compile
1366 +// this file and link it with other files to produce an executable, this
1367 +// file does not by itself cause the resulting executable to be covered by
1368 +// the GNU General Public License. This exception does not however
1369 +// invalidate any other reasons why the executable file might be covered by
1370 +// the GNU General Public License.
1373 +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
1376 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1381 +#include <bits/c++locale_internal.h>
1383 +#ifdef __UCLIBC_MJN3_ONLY__
1384 +#warning optimize this for uclibc
1385 +#warning tailor for stub locale support
1388 +#ifndef __UCLIBC_HAS_XLOCALE__
1389 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
1394 + // Construct and return valid pattern consisting of some combination of:
1395 + // space none symbol sign value
1396 + money_base::pattern
1397 + money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1401 + // This insanely complicated routine attempts to construct a valid
1402 + // pattern for use with monyepunct. A couple of invariants:
1404 + // if (__precedes) symbol -> value
1405 + // else value -> symbol
1407 + // if (__space) space
1410 + // none == never first
1411 + // space never first or last
1413 + // Any elegant implementations of this are welcome.
1418 + // 1 The sign precedes the value and symbol.
1419 + __ret.field[0] = sign;
1422 + // Pattern starts with sign.
1425 + __ret.field[1] = symbol;
1426 + __ret.field[3] = value;
1430 + __ret.field[1] = value;
1431 + __ret.field[3] = symbol;
1433 + __ret.field[2] = space;
1437 + // Pattern starts with sign and ends with none.
1440 + __ret.field[1] = symbol;
1441 + __ret.field[2] = value;
1445 + __ret.field[1] = value;
1446 + __ret.field[2] = symbol;
1448 + __ret.field[3] = none;
1452 + // 2 The sign follows the value and symbol.
1455 + // Pattern either ends with sign.
1458 + __ret.field[0] = symbol;
1459 + __ret.field[2] = value;
1463 + __ret.field[0] = value;
1464 + __ret.field[2] = symbol;
1466 + __ret.field[1] = space;
1467 + __ret.field[3] = sign;
1471 + // Pattern ends with sign then none.
1474 + __ret.field[0] = symbol;
1475 + __ret.field[1] = value;
1479 + __ret.field[0] = value;
1480 + __ret.field[1] = symbol;
1482 + __ret.field[2] = sign;
1483 + __ret.field[3] = none;
1487 + // 3 The sign immediately precedes the symbol.
1490 + __ret.field[0] = sign;
1491 + __ret.field[1] = symbol;
1494 + __ret.field[2] = space;
1495 + __ret.field[3] = value;
1499 + __ret.field[2] = value;
1500 + __ret.field[3] = none;
1505 + __ret.field[0] = value;
1508 + __ret.field[1] = space;
1509 + __ret.field[2] = sign;
1510 + __ret.field[3] = symbol;
1514 + __ret.field[1] = sign;
1515 + __ret.field[2] = symbol;
1516 + __ret.field[3] = none;
1521 + // 4 The sign immediately follows the symbol.
1524 + __ret.field[0] = symbol;
1525 + __ret.field[1] = sign;
1528 + __ret.field[2] = space;
1529 + __ret.field[3] = value;
1533 + __ret.field[2] = value;
1534 + __ret.field[3] = none;
1539 + __ret.field[0] = value;
1542 + __ret.field[1] = space;
1543 + __ret.field[2] = symbol;
1544 + __ret.field[3] = sign;
1548 + __ret.field[1] = symbol;
1549 + __ret.field[2] = sign;
1550 + __ret.field[3] = none;
1555 + __ret = pattern();
1562 + moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
1566 + _M_data = new __moneypunct_cache<char, true>;
1571 + _M_data->_M_decimal_point = '.';
1572 + _M_data->_M_thousands_sep = ',';
1573 + _M_data->_M_grouping = "";
1574 + _M_data->_M_grouping_size = 0;
1575 + _M_data->_M_curr_symbol = "";
1576 + _M_data->_M_curr_symbol_size = 0;
1577 + _M_data->_M_positive_sign = "";
1578 + _M_data->_M_positive_sign_size = 0;
1579 + _M_data->_M_negative_sign = "";
1580 + _M_data->_M_negative_sign_size = 0;
1581 + _M_data->_M_frac_digits = 0;
1582 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1583 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1585 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1586 + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1591 + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1593 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1595 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1596 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1597 + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1598 + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1600 + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1602 + _M_data->_M_negative_sign = "()";
1604 + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1606 + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1609 + _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1610 + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1611 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1613 + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1614 + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1615 + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1616 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1618 + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1619 + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1620 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1627 + moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
1631 + _M_data = new __moneypunct_cache<char, false>;
1636 + _M_data->_M_decimal_point = '.';
1637 + _M_data->_M_thousands_sep = ',';
1638 + _M_data->_M_grouping = "";
1639 + _M_data->_M_grouping_size = 0;
1640 + _M_data->_M_curr_symbol = "";
1641 + _M_data->_M_curr_symbol_size = 0;
1642 + _M_data->_M_positive_sign = "";
1643 + _M_data->_M_positive_sign_size = 0;
1644 + _M_data->_M_negative_sign = "";
1645 + _M_data->_M_negative_sign_size = 0;
1646 + _M_data->_M_frac_digits = 0;
1647 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1648 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1650 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1651 + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1656 + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
1658 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
1660 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1661 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1662 + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1663 + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1665 + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1667 + _M_data->_M_negative_sign = "()";
1669 + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1671 + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1674 + _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1675 + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1676 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1677 + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1678 + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1679 + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1680 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1682 + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1683 + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1684 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1690 + moneypunct<char, true>::~moneypunct()
1691 + { delete _M_data; }
1694 + moneypunct<char, false>::~moneypunct()
1695 + { delete _M_data; }
1697 +#ifdef _GLIBCXX_USE_WCHAR_T
1700 + moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
1701 +#ifdef __UCLIBC_HAS_XLOCALE__
1704 + const char* __name)
1708 + _M_data = new __moneypunct_cache<wchar_t, true>;
1713 + _M_data->_M_decimal_point = L'.';
1714 + _M_data->_M_thousands_sep = L',';
1715 + _M_data->_M_grouping = "";
1716 + _M_data->_M_grouping_size = 0;
1717 + _M_data->_M_curr_symbol = L"";
1718 + _M_data->_M_curr_symbol_size = 0;
1719 + _M_data->_M_positive_sign = L"";
1720 + _M_data->_M_positive_sign_size = 0;
1721 + _M_data->_M_negative_sign = L"";
1722 + _M_data->_M_negative_sign_size = 0;
1723 + _M_data->_M_frac_digits = 0;
1724 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1725 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1727 + // Use ctype::widen code without the facet...
1728 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1729 + _M_data->_M_atoms[__i] =
1730 + static_cast<wchar_t>(money_base::_S_atoms[__i]);
1735 +#ifdef __UCLIBC_HAS_XLOCALE__
1736 + __c_locale __old = __uselocale(__cloc);
1738 + // Switch to named locale so that mbsrtowcs will work.
1739 + char* __old = strdup(setlocale(LC_ALL, NULL));
1740 + setlocale(LC_ALL, __name);
1743 +#ifdef __UCLIBC_MJN3_ONLY__
1744 +#warning fix this... should be monetary
1747 +# ifdef __UCLIBC_HAS_XLOCALE__
1748 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1749 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1750 +# elif defined __UCLIBC_HAS_LOCALE__
1751 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1752 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1755 + union { char *__s; wchar_t __w; } __u;
1756 + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1757 + _M_data->_M_decimal_point = __u.__w;
1759 + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1760 + _M_data->_M_thousands_sep = __u.__w;
1762 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1763 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1765 + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1766 + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1767 + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1769 + wchar_t* __wcs_ps = 0;
1770 + wchar_t* __wcs_ns = 0;
1771 + const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1774 + mbstate_t __state;
1775 + size_t __len = strlen(__cpossign);
1779 + memset(&__state, 0, sizeof(mbstate_t));
1780 + __wcs_ps = new wchar_t[__len];
1781 + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1782 + _M_data->_M_positive_sign = __wcs_ps;
1785 + _M_data->_M_positive_sign = L"";
1786 + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1788 + __len = strlen(__cnegsign);
1790 + _M_data->_M_negative_sign = L"()";
1794 + memset(&__state, 0, sizeof(mbstate_t));
1795 + __wcs_ns = new wchar_t[__len];
1796 + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1797 + _M_data->_M_negative_sign = __wcs_ns;
1800 + _M_data->_M_negative_sign = L"";
1801 + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1804 + __len = strlen(__ccurr);
1808 + memset(&__state, 0, sizeof(mbstate_t));
1809 + wchar_t* __wcs = new wchar_t[__len];
1810 + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1811 + _M_data->_M_curr_symbol = __wcs;
1814 + _M_data->_M_curr_symbol = L"";
1815 + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1823 +#ifdef __UCLIBC_HAS_XLOCALE__
1824 + __uselocale(__old);
1826 + setlocale(LC_ALL, __old);
1829 + __throw_exception_again;
1832 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
1834 + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1835 + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1836 + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1837 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1839 + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1840 + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1841 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1844 +#ifdef __UCLIBC_HAS_XLOCALE__
1845 + __uselocale(__old);
1847 + setlocale(LC_ALL, __old);
1855 + moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1856 +#ifdef __UCLIBC_HAS_XLOCALE__
1859 + const char* __name)
1863 + _M_data = new __moneypunct_cache<wchar_t, false>;
1868 + _M_data->_M_decimal_point = L'.';
1869 + _M_data->_M_thousands_sep = L',';
1870 + _M_data->_M_grouping = "";
1871 + _M_data->_M_grouping_size = 0;
1872 + _M_data->_M_curr_symbol = L"";
1873 + _M_data->_M_curr_symbol_size = 0;
1874 + _M_data->_M_positive_sign = L"";
1875 + _M_data->_M_positive_sign_size = 0;
1876 + _M_data->_M_negative_sign = L"";
1877 + _M_data->_M_negative_sign_size = 0;
1878 + _M_data->_M_frac_digits = 0;
1879 + _M_data->_M_pos_format = money_base::_S_default_pattern;
1880 + _M_data->_M_neg_format = money_base::_S_default_pattern;
1882 + // Use ctype::widen code without the facet...
1883 + for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1884 + _M_data->_M_atoms[__i] =
1885 + static_cast<wchar_t>(money_base::_S_atoms[__i]);
1890 +#ifdef __UCLIBC_HAS_XLOCALE__
1891 + __c_locale __old = __uselocale(__cloc);
1893 + // Switch to named locale so that mbsrtowcs will work.
1894 + char* __old = strdup(setlocale(LC_ALL, NULL));
1895 + setlocale(LC_ALL, __name);
1898 +#ifdef __UCLIBC_MJN3_ONLY__
1899 +#warning fix this... should be monetary
1902 +# ifdef __UCLIBC_HAS_XLOCALE__
1903 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1904 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1905 +# elif defined __UCLIBC_HAS_LOCALE__
1906 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1907 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1910 + union { char *__s; wchar_t __w; } __u;
1911 + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1912 + _M_data->_M_decimal_point = __u.__w;
1914 + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1915 + _M_data->_M_thousands_sep = __u.__w;
1917 + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1918 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1920 + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1921 + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1922 + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1924 + wchar_t* __wcs_ps = 0;
1925 + wchar_t* __wcs_ns = 0;
1926 + const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1929 + mbstate_t __state;
1931 + __len = strlen(__cpossign);
1935 + memset(&__state, 0, sizeof(mbstate_t));
1936 + __wcs_ps = new wchar_t[__len];
1937 + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1938 + _M_data->_M_positive_sign = __wcs_ps;
1941 + _M_data->_M_positive_sign = L"";
1942 + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1944 + __len = strlen(__cnegsign);
1946 + _M_data->_M_negative_sign = L"()";
1950 + memset(&__state, 0, sizeof(mbstate_t));
1951 + __wcs_ns = new wchar_t[__len];
1952 + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1953 + _M_data->_M_negative_sign = __wcs_ns;
1956 + _M_data->_M_negative_sign = L"";
1957 + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1960 + __len = strlen(__ccurr);
1964 + memset(&__state, 0, sizeof(mbstate_t));
1965 + wchar_t* __wcs = new wchar_t[__len];
1966 + mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1967 + _M_data->_M_curr_symbol = __wcs;
1970 + _M_data->_M_curr_symbol = L"";
1971 + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1979 +#ifdef __UCLIBC_HAS_XLOCALE__
1980 + __uselocale(__old);
1982 + setlocale(LC_ALL, __old);
1985 + __throw_exception_again;
1988 + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1989 + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1990 + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1991 + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1992 + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
1994 + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1995 + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1996 + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
1999 +#ifdef __UCLIBC_HAS_XLOCALE__
2000 + __uselocale(__old);
2002 + setlocale(LC_ALL, __old);
2009 + moneypunct<wchar_t, true>::~moneypunct()
2011 + if (_M_data->_M_positive_sign_size)
2012 + delete [] _M_data->_M_positive_sign;
2013 + if (_M_data->_M_negative_sign_size
2014 + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2015 + delete [] _M_data->_M_negative_sign;
2016 + if (_M_data->_M_curr_symbol_size)
2017 + delete [] _M_data->_M_curr_symbol;
2022 + moneypunct<wchar_t, false>::~moneypunct()
2024 + if (_M_data->_M_positive_sign_size)
2025 + delete [] _M_data->_M_positive_sign;
2026 + if (_M_data->_M_negative_sign_size
2027 + && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2028 + delete [] _M_data->_M_negative_sign;
2029 + if (_M_data->_M_curr_symbol_size)
2030 + delete [] _M_data->_M_curr_symbol;
2036 +++ b/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2038 +// std::numpunct implementation details, GNU version -*- C++ -*-
2040 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2042 +// This file is part of the GNU ISO C++ Library. This library is free
2043 +// software; you can redistribute it and/or modify it under the
2044 +// terms of the GNU General Public License as published by the
2045 +// Free Software Foundation; either version 2, or (at your option)
2046 +// any later version.
2048 +// This library is distributed in the hope that it will be useful,
2049 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2050 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2051 +// GNU General Public License for more details.
2053 +// You should have received a copy of the GNU General Public License along
2054 +// with this library; see the file COPYING. If not, write to the Free
2055 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2058 +// As a special exception, you may use this file as part of a free software
2059 +// library without restriction. Specifically, if other files instantiate
2060 +// templates or use macros or inline functions from this file, or you compile
2061 +// this file and link it with other files to produce an executable, this
2062 +// file does not by itself cause the resulting executable to be covered by
2063 +// the GNU General Public License. This exception does not however
2064 +// invalidate any other reasons why the executable file might be covered by
2065 +// the GNU General Public License.
2068 +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2071 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2076 +#include <bits/c++locale_internal.h>
2078 +#ifdef __UCLIBC_MJN3_ONLY__
2079 +#warning tailor for stub locale support
2081 +#ifndef __UCLIBC_HAS_XLOCALE__
2082 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
2089 + numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2092 + _M_data = new __numpunct_cache<char>;
2097 + _M_data->_M_grouping = "";
2098 + _M_data->_M_grouping_size = 0;
2099 + _M_data->_M_use_grouping = false;
2101 + _M_data->_M_decimal_point = '.';
2102 + _M_data->_M_thousands_sep = ',';
2104 + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2105 + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2107 + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2108 + _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2113 + _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2115 + _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2118 + // Check for NULL, which implies no grouping.
2119 + if (_M_data->_M_thousands_sep == '\0')
2120 + _M_data->_M_grouping = "";
2122 + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2123 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2126 + // NB: There is no way to extact this info from posix locales.
2127 + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2128 + _M_data->_M_truename = "true";
2129 + _M_data->_M_truename_size = 4;
2130 + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2131 + _M_data->_M_falsename = "false";
2132 + _M_data->_M_falsename_size = 5;
2136 + numpunct<char>::~numpunct()
2137 + { delete _M_data; }
2139 +#ifdef _GLIBCXX_USE_WCHAR_T
2142 + numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2145 + _M_data = new __numpunct_cache<wchar_t>;
2150 + _M_data->_M_grouping = "";
2151 + _M_data->_M_grouping_size = 0;
2152 + _M_data->_M_use_grouping = false;
2154 + _M_data->_M_decimal_point = L'.';
2155 + _M_data->_M_thousands_sep = L',';
2157 + // Use ctype::widen code without the facet...
2158 + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2159 + _M_data->_M_atoms_out[__i] =
2160 + static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2162 + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2163 + _M_data->_M_atoms_in[__j] =
2164 + static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2169 + // NB: In the GNU model wchar_t is always 32 bit wide.
2170 +#ifdef __UCLIBC_MJN3_ONLY__
2174 +# ifdef __UCLIBC_HAS_XLOCALE__
2175 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2176 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2177 +# elif defined __UCLIBC_HAS_LOCALE__
2178 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2179 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2182 + union { char *__s; wchar_t __w; } __u;
2183 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2184 + _M_data->_M_decimal_point = __u.__w;
2186 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2187 + _M_data->_M_thousands_sep = __u.__w;
2190 + if (_M_data->_M_thousands_sep == L'\0')
2191 + _M_data->_M_grouping = "";
2193 + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2194 + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2197 + // NB: There is no way to extact this info from posix locales.
2198 + // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2199 + _M_data->_M_truename = L"true";
2200 + _M_data->_M_truename_size = 4;
2201 + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2202 + _M_data->_M_falsename = L"false";
2203 + _M_data->_M_falsename_size = 5;
2207 + numpunct<wchar_t>::~numpunct()
2208 + { delete _M_data; }
2212 +++ b/libstdc++-v3/config/locale/uclibc/time_members.cc
2214 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2216 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2218 +// This file is part of the GNU ISO C++ Library. This library is free
2219 +// software; you can redistribute it and/or modify it under the
2220 +// terms of the GNU General Public License as published by the
2221 +// Free Software Foundation; either version 2, or (at your option)
2222 +// any later version.
2224 +// This library is distributed in the hope that it will be useful,
2225 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2226 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2227 +// GNU General Public License for more details.
2229 +// You should have received a copy of the GNU General Public License along
2230 +// with this library; see the file COPYING. If not, write to the Free
2231 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2234 +// As a special exception, you may use this file as part of a free software
2235 +// library without restriction. Specifically, if other files instantiate
2236 +// templates or use macros or inline functions from this file, or you compile
2237 +// this file and link it with other files to produce an executable, this
2238 +// file does not by itself cause the resulting executable to be covered by
2239 +// the GNU General Public License. This exception does not however
2240 +// invalidate any other reasons why the executable file might be covered by
2241 +// the GNU General Public License.
2244 +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2245 +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2248 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2251 +#include <bits/c++locale_internal.h>
2253 +#ifdef __UCLIBC_MJN3_ONLY__
2254 +#warning tailor for stub locale support
2256 +#ifndef __UCLIBC_HAS_XLOCALE__
2257 +#define __nl_langinfo_l(N, L) nl_langinfo((N))
2264 + __timepunct<char>::
2265 + _M_put(char* __s, size_t __maxlen, const char* __format,
2266 + const tm* __tm) const
2268 +#ifdef __UCLIBC_HAS_XLOCALE__
2269 + const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2270 + _M_c_locale_timepunct);
2272 + char* __old = strdup(setlocale(LC_ALL, NULL));
2273 + setlocale(LC_ALL, _M_name_timepunct);
2274 + const size_t __len = strftime(__s, __maxlen, __format, __tm);
2275 + setlocale(LC_ALL, __old);
2278 + // Make sure __s is null terminated.
2285 + __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2288 + _M_data = new __timepunct_cache<char>;
2293 + _M_c_locale_timepunct = _S_get_c_locale();
2295 + _M_data->_M_date_format = "%m/%d/%y";
2296 + _M_data->_M_date_era_format = "%m/%d/%y";
2297 + _M_data->_M_time_format = "%H:%M:%S";
2298 + _M_data->_M_time_era_format = "%H:%M:%S";
2299 + _M_data->_M_date_time_format = "";
2300 + _M_data->_M_date_time_era_format = "";
2301 + _M_data->_M_am = "AM";
2302 + _M_data->_M_pm = "PM";
2303 + _M_data->_M_am_pm_format = "";
2305 + // Day names, starting with "C"'s Sunday.
2306 + _M_data->_M_day1 = "Sunday";
2307 + _M_data->_M_day2 = "Monday";
2308 + _M_data->_M_day3 = "Tuesday";
2309 + _M_data->_M_day4 = "Wednesday";
2310 + _M_data->_M_day5 = "Thursday";
2311 + _M_data->_M_day6 = "Friday";
2312 + _M_data->_M_day7 = "Saturday";
2314 + // Abbreviated day names, starting with "C"'s Sun.
2315 + _M_data->_M_aday1 = "Sun";
2316 + _M_data->_M_aday2 = "Mon";
2317 + _M_data->_M_aday3 = "Tue";
2318 + _M_data->_M_aday4 = "Wed";
2319 + _M_data->_M_aday5 = "Thu";
2320 + _M_data->_M_aday6 = "Fri";
2321 + _M_data->_M_aday7 = "Sat";
2323 + // Month names, starting with "C"'s January.
2324 + _M_data->_M_month01 = "January";
2325 + _M_data->_M_month02 = "February";
2326 + _M_data->_M_month03 = "March";
2327 + _M_data->_M_month04 = "April";
2328 + _M_data->_M_month05 = "May";
2329 + _M_data->_M_month06 = "June";
2330 + _M_data->_M_month07 = "July";
2331 + _M_data->_M_month08 = "August";
2332 + _M_data->_M_month09 = "September";
2333 + _M_data->_M_month10 = "October";
2334 + _M_data->_M_month11 = "November";
2335 + _M_data->_M_month12 = "December";
2337 + // Abbreviated month names, starting with "C"'s Jan.
2338 + _M_data->_M_amonth01 = "Jan";
2339 + _M_data->_M_amonth02 = "Feb";
2340 + _M_data->_M_amonth03 = "Mar";
2341 + _M_data->_M_amonth04 = "Apr";
2342 + _M_data->_M_amonth05 = "May";
2343 + _M_data->_M_amonth06 = "Jun";
2344 + _M_data->_M_amonth07 = "Jul";
2345 + _M_data->_M_amonth08 = "Aug";
2346 + _M_data->_M_amonth09 = "Sep";
2347 + _M_data->_M_amonth10 = "Oct";
2348 + _M_data->_M_amonth11 = "Nov";
2349 + _M_data->_M_amonth12 = "Dec";
2353 + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2355 + _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2356 + _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2357 + _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2358 + _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2359 + _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2360 + _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
2362 + _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2363 + _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2364 + _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2366 + // Day names, starting with "C"'s Sunday.
2367 + _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2368 + _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2369 + _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2370 + _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2371 + _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2372 + _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2373 + _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2375 + // Abbreviated day names, starting with "C"'s Sun.
2376 + _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2377 + _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2378 + _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2379 + _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2380 + _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2381 + _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2382 + _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2384 + // Month names, starting with "C"'s January.
2385 + _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2386 + _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2387 + _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2388 + _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2389 + _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2390 + _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2391 + _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2392 + _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2393 + _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2394 + _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2395 + _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2396 + _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2398 + // Abbreviated month names, starting with "C"'s Jan.
2399 + _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2400 + _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2401 + _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2402 + _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2403 + _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2404 + _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2405 + _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2406 + _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2407 + _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2408 + _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2409 + _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2410 + _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2414 +#ifdef _GLIBCXX_USE_WCHAR_T
2417 + __timepunct<wchar_t>::
2418 + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
2419 + const tm* __tm) const
2421 +#ifdef __UCLIBC_HAS_XLOCALE__
2422 + __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2423 + const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
2424 + _M_c_locale_timepunct);
2426 + char* __old = strdup(setlocale(LC_ALL, NULL));
2427 + setlocale(LC_ALL, _M_name_timepunct);
2428 + const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
2429 + setlocale(LC_ALL, __old);
2432 + // Make sure __s is null terminated.
2439 + __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2442 + _M_data = new __timepunct_cache<wchar_t>;
2444 +#warning wide time stuff
2448 + _M_c_locale_timepunct = _S_get_c_locale();
2450 + _M_data->_M_date_format = L"%m/%d/%y";
2451 + _M_data->_M_date_era_format = L"%m/%d/%y";
2452 + _M_data->_M_time_format = L"%H:%M:%S";
2453 + _M_data->_M_time_era_format = L"%H:%M:%S";
2454 + _M_data->_M_date_time_format = L"";
2455 + _M_data->_M_date_time_era_format = L"";
2456 + _M_data->_M_am = L"AM";
2457 + _M_data->_M_pm = L"PM";
2458 + _M_data->_M_am_pm_format = L"";
2460 + // Day names, starting with "C"'s Sunday.
2461 + _M_data->_M_day1 = L"Sunday";
2462 + _M_data->_M_day2 = L"Monday";
2463 + _M_data->_M_day3 = L"Tuesday";
2464 + _M_data->_M_day4 = L"Wednesday";
2465 + _M_data->_M_day5 = L"Thursday";
2466 + _M_data->_M_day6 = L"Friday";
2467 + _M_data->_M_day7 = L"Saturday";
2469 + // Abbreviated day names, starting with "C"'s Sun.
2470 + _M_data->_M_aday1 = L"Sun";
2471 + _M_data->_M_aday2 = L"Mon";
2472 + _M_data->_M_aday3 = L"Tue";
2473 + _M_data->_M_aday4 = L"Wed";
2474 + _M_data->_M_aday5 = L"Thu";
2475 + _M_data->_M_aday6 = L"Fri";
2476 + _M_data->_M_aday7 = L"Sat";
2478 + // Month names, starting with "C"'s January.
2479 + _M_data->_M_month01 = L"January";
2480 + _M_data->_M_month02 = L"February";
2481 + _M_data->_M_month03 = L"March";
2482 + _M_data->_M_month04 = L"April";
2483 + _M_data->_M_month05 = L"May";
2484 + _M_data->_M_month06 = L"June";
2485 + _M_data->_M_month07 = L"July";
2486 + _M_data->_M_month08 = L"August";
2487 + _M_data->_M_month09 = L"September";
2488 + _M_data->_M_month10 = L"October";
2489 + _M_data->_M_month11 = L"November";
2490 + _M_data->_M_month12 = L"December";
2492 + // Abbreviated month names, starting with "C"'s Jan.
2493 + _M_data->_M_amonth01 = L"Jan";
2494 + _M_data->_M_amonth02 = L"Feb";
2495 + _M_data->_M_amonth03 = L"Mar";
2496 + _M_data->_M_amonth04 = L"Apr";
2497 + _M_data->_M_amonth05 = L"May";
2498 + _M_data->_M_amonth06 = L"Jun";
2499 + _M_data->_M_amonth07 = L"Jul";
2500 + _M_data->_M_amonth08 = L"Aug";
2501 + _M_data->_M_amonth09 = L"Sep";
2502 + _M_data->_M_amonth10 = L"Oct";
2503 + _M_data->_M_amonth11 = L"Nov";
2504 + _M_data->_M_amonth12 = L"Dec";
2509 + _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2511 + union { char *__s; wchar_t *__w; } __u;
2513 + __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
2514 + _M_data->_M_date_format = __u.__w;
2515 + __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
2516 + _M_data->_M_date_era_format = __u.__w;
2517 + __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
2518 + _M_data->_M_time_format = __u.__w;
2519 + __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
2520 + _M_data->_M_time_era_format = __u.__w;
2521 + __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
2522 + _M_data->_M_date_time_format = __u.__w;
2523 + __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
2524 + _M_data->_M_date_time_era_format = __u.__w;
2525 + __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
2526 + _M_data->_M_am = __u.__w;
2527 + __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
2528 + _M_data->_M_pm = __u.__w;
2529 + __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
2530 + _M_data->_M_am_pm_format = __u.__w;
2532 + // Day names, starting with "C"'s Sunday.
2533 + __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
2534 + _M_data->_M_day1 = __u.__w;
2535 + __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
2536 + _M_data->_M_day2 = __u.__w;
2537 + __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
2538 + _M_data->_M_day3 = __u.__w;
2539 + __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
2540 + _M_data->_M_day4 = __u.__w;
2541 + __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
2542 + _M_data->_M_day5 = __u.__w;
2543 + __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
2544 + _M_data->_M_day6 = __u.__w;
2545 + __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
2546 + _M_data->_M_day7 = __u.__w;
2548 + // Abbreviated day names, starting with "C"'s Sun.
2549 + __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
2550 + _M_data->_M_aday1 = __u.__w;
2551 + __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
2552 + _M_data->_M_aday2 = __u.__w;
2553 + __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
2554 + _M_data->_M_aday3 = __u.__w;
2555 + __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
2556 + _M_data->_M_aday4 = __u.__w;
2557 + __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
2558 + _M_data->_M_aday5 = __u.__w;
2559 + __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
2560 + _M_data->_M_aday6 = __u.__w;
2561 + __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
2562 + _M_data->_M_aday7 = __u.__w;
2564 + // Month names, starting with "C"'s January.
2565 + __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
2566 + _M_data->_M_month01 = __u.__w;
2567 + __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
2568 + _M_data->_M_month02 = __u.__w;
2569 + __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
2570 + _M_data->_M_month03 = __u.__w;
2571 + __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
2572 + _M_data->_M_month04 = __u.__w;
2573 + __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
2574 + _M_data->_M_month05 = __u.__w;
2575 + __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
2576 + _M_data->_M_month06 = __u.__w;
2577 + __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
2578 + _M_data->_M_month07 = __u.__w;
2579 + __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
2580 + _M_data->_M_month08 = __u.__w;
2581 + __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
2582 + _M_data->_M_month09 = __u.__w;
2583 + __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
2584 + _M_data->_M_month10 = __u.__w;
2585 + __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
2586 + _M_data->_M_month11 = __u.__w;
2587 + __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
2588 + _M_data->_M_month12 = __u.__w;
2590 + // Abbreviated month names, starting with "C"'s Jan.
2591 + __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
2592 + _M_data->_M_amonth01 = __u.__w;
2593 + __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
2594 + _M_data->_M_amonth02 = __u.__w;
2595 + __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
2596 + _M_data->_M_amonth03 = __u.__w;
2597 + __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
2598 + _M_data->_M_amonth04 = __u.__w;
2599 + __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
2600 + _M_data->_M_amonth05 = __u.__w;
2601 + __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
2602 + _M_data->_M_amonth06 = __u.__w;
2603 + __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
2604 + _M_data->_M_amonth07 = __u.__w;
2605 + __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
2606 + _M_data->_M_amonth08 = __u.__w;
2607 + __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
2608 + _M_data->_M_amonth09 = __u.__w;
2609 + __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
2610 + _M_data->_M_amonth10 = __u.__w;
2611 + __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
2612 + _M_data->_M_amonth11 = __u.__w;
2613 + __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
2614 + _M_data->_M_amonth12 = __u.__w;
2621 +++ b/libstdc++-v3/config/locale/uclibc/time_members.h
2623 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2625 +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
2627 +// This file is part of the GNU ISO C++ Library. This library is free
2628 +// software; you can redistribute it and/or modify it under the
2629 +// terms of the GNU General Public License as published by the
2630 +// Free Software Foundation; either version 2, or (at your option)
2631 +// any later version.
2633 +// This library is distributed in the hope that it will be useful,
2634 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2635 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2636 +// GNU General Public License for more details.
2638 +// You should have received a copy of the GNU General Public License along
2639 +// with this library; see the file COPYING. If not, write to the Free
2640 +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2643 +// As a special exception, you may use this file as part of a free software
2644 +// library without restriction. Specifically, if other files instantiate
2645 +// templates or use macros or inline functions from this file, or you compile
2646 +// this file and link it with other files to produce an executable, this
2647 +// file does not by itself cause the resulting executable to be covered by
2648 +// the GNU General Public License. This exception does not however
2649 +// invalidate any other reasons why the executable file might be covered by
2650 +// the GNU General Public License.
2653 +// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2654 +// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2657 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2659 + template<typename _CharT>
2660 + __timepunct<_CharT>::__timepunct(size_t __refs)
2661 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2662 + _M_name_timepunct(_S_get_c_name())
2663 + { _M_initialize_timepunct(); }
2665 + template<typename _CharT>
2666 + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
2667 + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
2668 + _M_name_timepunct(_S_get_c_name())
2669 + { _M_initialize_timepunct(); }
2671 + template<typename _CharT>
2672 + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2674 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
2675 + _M_name_timepunct(NULL)
2677 + const size_t __len = std::strlen(__s) + 1;
2678 + char* __tmp = new char[__len];
2679 + std::memcpy(__tmp, __s, __len);
2680 + _M_name_timepunct = __tmp;
2683 + { _M_initialize_timepunct(__cloc); }
2686 + delete [] _M_name_timepunct;
2687 + __throw_exception_again;
2691 + template<typename _CharT>
2692 + __timepunct<_CharT>::~__timepunct()
2694 + if (_M_name_timepunct != _S_get_c_name())
2695 + delete [] _M_name_timepunct;
2697 + _S_destroy_c_locale(_M_c_locale_timepunct);
2700 +++ b/libstdc++-v3/config/os/uclibc/ctype_base.h
2702 +// Locale support -*- C++ -*-
2704 +// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
2705 +// Free Software Foundation, Inc.
2707 +// This file is part of the GNU ISO C++ Library. This library is free
2708 +// software; you can redistribute it and/or modify it under the
2709 +// terms of the GNU General Public License as published by the
2710 +// Free Software Foundation; either version 2, or (at your option)
2711 +// any later version.
2713 +// This library is distributed in the hope that it will be useful,
2714 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2715 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2716 +// GNU General Public License for more details.
2718 +// You should have received a copy of the GNU General Public License along
2719 +// with this library; see the file COPYING. If not, write to the Free
2720 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2723 +// As a special exception, you may use this file as part of a free software
2724 +// library without restriction. Specifically, if other files instantiate
2725 +// templates or use macros or inline functions from this file, or you compile
2726 +// this file and link it with other files to produce an executable, this
2727 +// file does not by itself cause the resulting executable to be covered by
2728 +// the GNU General Public License. This exception does not however
2729 +// invalidate any other reasons why the executable file might be covered by
2730 +// the GNU General Public License.
2733 +// ISO C++ 14882: 22.1 Locales
2736 +/** @file ctype_base.h
2737 + * This is an internal header file, included by other library headers.
2738 + * You should not attempt to use it directly.
2741 +// Information as gleaned from /usr/include/ctype.h
2743 + /// @brief Base class for ctype.
2746 + // Note: In uClibc, the following two types depend on configuration.
2748 + // Non-standard typedefs.
2749 + typedef const __ctype_touplow_t* __to_type;
2751 + // NB: Offsets into ctype<char>::_M_table force a particular size
2752 + // on the mask type. Because of this, we don't use an enum.
2753 + typedef __ctype_mask_t mask;
2754 + static const mask upper = _ISupper;
2755 + static const mask lower = _ISlower;
2756 + static const mask alpha = _ISalpha;
2757 + static const mask digit = _ISdigit;
2758 + static const mask xdigit = _ISxdigit;
2759 + static const mask space = _ISspace;
2760 + static const mask print = _ISprint;
2761 + static const mask graph = _ISalpha | _ISdigit | _ISpunct;
2762 + static const mask cntrl = _IScntrl;
2763 + static const mask punct = _ISpunct;
2764 + static const mask alnum = _ISalpha | _ISdigit;
2767 +++ b/libstdc++-v3/config/os/uclibc/ctype_inline.h
2769 +// Locale support -*- C++ -*-
2771 +// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
2773 +// This file is part of the GNU ISO C++ Library. This library is free
2774 +// software; you can redistribute it and/or modify it under the
2775 +// terms of the GNU General Public License as published by the
2776 +// Free Software Foundation; either version 2, or (at your option)
2777 +// any later version.
2779 +// This library is distributed in the hope that it will be useful,
2780 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2781 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2782 +// GNU General Public License for more details.
2784 +// You should have received a copy of the GNU General Public License along
2785 +// with this library; see the file COPYING. If not, write to the Free
2786 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2789 +// As a special exception, you may use this file as part of a free software
2790 +// library without restriction. Specifically, if other files instantiate
2791 +// templates or use macros or inline functions from this file, or you compile
2792 +// this file and link it with other files to produce an executable, this
2793 +// file does not by itself cause the resulting executable to be covered by
2794 +// the GNU General Public License. This exception does not however
2795 +// invalidate any other reasons why the executable file might be covered by
2796 +// the GNU General Public License.
2799 +// ISO C++ 14882: 22.1 Locales
2802 +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
2803 +// functions go in ctype.cc
2807 + is(mask __m, char __c) const
2808 + { return _M_table[static_cast<unsigned char>(__c)] & __m; }
2812 + is(const char* __low, const char* __high, mask* __vec) const
2814 + while (__low < __high)
2815 + *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
2821 + scan_is(mask __m, const char* __low, const char* __high) const
2823 + while (__low < __high
2824 + && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
2831 + scan_not(mask __m, const char* __low, const char* __high) const
2833 + while (__low < __high
2834 + && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
2839 +++ b/libstdc++-v3/config/os/uclibc/ctype_noninline.h
2841 +// Locale support -*- C++ -*-
2843 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
2844 +// Free Software Foundation, Inc.
2846 +// This file is part of the GNU ISO C++ Library. This library is free
2847 +// software; you can redistribute it and/or modify it under the
2848 +// terms of the GNU General Public License as published by the
2849 +// Free Software Foundation; either version 2, or (at your option)
2850 +// any later version.
2852 +// This library is distributed in the hope that it will be useful,
2853 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2854 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2855 +// GNU General Public License for more details.
2857 +// You should have received a copy of the GNU General Public License along
2858 +// with this library; see the file COPYING. If not, write to the Free
2859 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2862 +// As a special exception, you may use this file as part of a free software
2863 +// library without restriction. Specifically, if other files instantiate
2864 +// templates or use macros or inline functions from this file, or you compile
2865 +// this file and link it with other files to produce an executable, this
2866 +// file does not by itself cause the resulting executable to be covered by
2867 +// the GNU General Public License. This exception does not however
2868 +// invalidate any other reasons why the executable file might be covered by
2869 +// the GNU General Public License.
2872 +// ISO C++ 14882: 22.1 Locales
2875 +// Information as gleaned from /usr/include/ctype.h
2877 + const ctype_base::mask*
2878 + ctype<char>::classic_table() throw()
2879 + { return __C_ctype_b; }
2881 + ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
2883 + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2884 + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2886 + _M_toupper = __C_ctype_toupper;
2887 + _M_tolower = __C_ctype_tolower;
2888 + _M_table = __table ? __table : __C_ctype_b;
2889 + memset(_M_widen, 0, sizeof(_M_widen));
2890 + memset(_M_narrow, 0, sizeof(_M_narrow));
2893 + ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
2894 + : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
2895 + _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2897 + _M_toupper = __C_ctype_toupper;
2898 + _M_tolower = __C_ctype_tolower;
2899 + _M_table = __table ? __table : __C_ctype_b;
2900 + memset(_M_widen, 0, sizeof(_M_widen));
2901 + memset(_M_narrow, 0, sizeof(_M_narrow));
2905 + ctype<char>::do_toupper(char __c) const
2906 + { return _M_toupper[static_cast<unsigned char>(__c)]; }
2909 + ctype<char>::do_toupper(char* __low, const char* __high) const
2911 + while (__low < __high)
2913 + *__low = _M_toupper[static_cast<unsigned char>(*__low)];
2920 + ctype<char>::do_tolower(char __c) const
2921 + { return _M_tolower[static_cast<unsigned char>(__c)]; }
2924 + ctype<char>::do_tolower(char* __low, const char* __high) const
2926 + while (__low < __high)
2928 + *__low = _M_tolower[static_cast<unsigned char>(*__low)];
2934 +++ b/libstdc++-v3/config/os/uclibc/os_defines.h
2936 +// Specific definitions for GNU/Linux -*- C++ -*-
2938 +// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2940 +// This file is part of the GNU ISO C++ Library. This library is free
2941 +// software; you can redistribute it and/or modify it under the
2942 +// terms of the GNU General Public License as published by the
2943 +// Free Software Foundation; either version 2, or (at your option)
2944 +// any later version.
2946 +// This library is distributed in the hope that it will be useful,
2947 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2948 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2949 +// GNU General Public License for more details.
2951 +// You should have received a copy of the GNU General Public License along
2952 +// with this library; see the file COPYING. If not, write to the Free
2953 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2956 +// As a special exception, you may use this file as part of a free software
2957 +// library without restriction. Specifically, if other files instantiate
2958 +// templates or use macros or inline functions from this file, or you compile
2959 +// this file and link it with other files to produce an executable, this
2960 +// file does not by itself cause the resulting executable to be covered by
2961 +// the GNU General Public License. This exception does not however
2962 +// invalidate any other reasons why the executable file might be covered by
2963 +// the GNU General Public License.
2965 +#ifndef _GLIBCXX_OS_DEFINES
2966 +#define _GLIBCXX_OS_DEFINES 1
2968 +// System-specific #define, typedefs, corrections, etc, go here. This
2969 +// file will come before all others.
2971 +// This keeps isanum, et al from being propagated as macros.
2972 +#define __NO_CTYPE 1
2974 +#include <features.h>
2976 +// We must not see the optimized string functions GNU libc defines.
2977 +#define __NO_STRING_INLINES
2980 --- a/libstdc++-v3/configure
2981 +++ b/libstdc++-v3/configure
2982 @@ -4005,6 +4005,11 @@ linux-gnu*)
2983 lt_cv_deplibs_check_method=pass_all
2987 + lt_cv_deplibs_check_method=pass_all
2988 + lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
2991 netbsd* | knetbsd*-gnu)
2992 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
2993 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
2994 @@ -5740,7 +5745,7 @@ if test "${enable_clocale+set}" = set; t
2995 enableval="$enable_clocale"
2997 case "$enableval" in
2998 - generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
2999 + generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
3000 *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
3001 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
3002 { (exit 1); exit 1; }; } ;;
3003 @@ -5765,6 +5770,9 @@ fi;
3004 # Default to "generic".
3005 if test $enable_clocale_flag = auto; then
3006 case ${target_os} in
3008 + enable_clocale_flag=uclibc
3010 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3011 cat >conftest.$ac_ext <<_ACEOF
3013 @@ -5995,6 +6003,76 @@ echo "${ECHO_T}IEEE 1003.1" >&6
3014 CTIME_CC=config/locale/generic/time_members.cc
3015 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3018 + echo "$as_me:$LINENO: result: uclibc" >&5
3019 +echo "${ECHO_T}uclibc" >&6
3021 + # Declare intention to use gettext, and add support for specific
3023 + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3024 + ALL_LINGUAS="de fr"
3026 + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3027 + # Extract the first word of "msgfmt", so it can be a program name with args.
3028 +set dummy msgfmt; ac_word=$2
3029 +echo "$as_me:$LINENO: checking for $ac_word" >&5
3030 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3031 +if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3032 + echo $ECHO_N "(cached) $ECHO_C" >&6
3034 + if test -n "$check_msgfmt"; then
3035 + ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3037 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3038 +for as_dir in $PATH
3041 + test -z "$as_dir" && as_dir=.
3042 + for ac_exec_ext in '' $ac_executable_extensions; do
3043 + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3044 + ac_cv_prog_check_msgfmt="yes"
3045 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3051 + test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3054 +check_msgfmt=$ac_cv_prog_check_msgfmt
3055 +if test -n "$check_msgfmt"; then
3056 + echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3057 +echo "${ECHO_T}$check_msgfmt" >&6
3059 + echo "$as_me:$LINENO: result: no" >&5
3060 +echo "${ECHO_T}no" >&6
3063 + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3066 + # Export the build objects.
3067 + for ling in $ALL_LINGUAS; do \
3068 + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3069 + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3074 + CLOCALE_H=config/locale/uclibc/c_locale.h
3075 + CLOCALE_CC=config/locale/uclibc/c_locale.cc
3076 + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3077 + CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3078 + CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3079 + CMESSAGES_H=config/locale/uclibc/messages_members.h
3080 + CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3081 + CMONEY_CC=config/locale/uclibc/monetary_members.cc
3082 + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3083 + CTIME_H=config/locale/uclibc/time_members.h
3084 + CTIME_CC=config/locale/uclibc/time_members.cc
3085 + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3089 # This is where the testsuite looks for locale catalogs, using the
3090 --- a/libstdc++-v3/configure.host
3091 +++ b/libstdc++-v3/configure.host
3092 @@ -270,6 +270,12 @@ case "${host_os}" in
3096 +# Override for uClibc since linux-uclibc gets mishandled above.
3097 +case "${host_os}" in
3099 + os_include_dir="os/uclibc"
3103 # Set any OS-dependent and CPU-dependent bits.
3104 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
3105 --- a/libstdc++-v3/crossconfig.m4
3106 +++ b/libstdc++-v3/crossconfig.m4
3107 @@ -143,6 +143,99 @@ case "${host}" in
3112 +# Temporary hack until we implement the float versions of the libm funcs
3113 + AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3114 + machine/endian.h machine/param.h sys/machine.h sys/types.h \
3115 + fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
3116 + SECTION_FLAGS='-ffunction-sections -fdata-sections'
3117 + AC_SUBST(SECTION_FLAGS)
3118 + GLIBCXX_CHECK_LINKER_FEATURES
3119 + GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
3120 + GLIBCXX_CHECK_WCHAR_T_SUPPORT
3123 + AC_DEFINE(HAVE_INT64_T)
3126 + # Don't enable LFS with uClinux
3129 + AC_DEFINE(_GLIBCXX_USE_LFS)
3132 + # For showmanyc_helper().
3133 + AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
3134 + GLIBCXX_CHECK_POLL
3135 + GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
3138 + AC_CHECK_HEADERS(sys/uio.h)
3139 + GLIBCXX_CHECK_WRITEV
3141 +# AC_DEFINE(HAVE_ACOSF)
3142 +# AC_DEFINE(HAVE_ASINF)
3143 +# AC_DEFINE(HAVE_ATANF)
3144 +# AC_DEFINE(HAVE_ATAN2F)
3145 + AC_DEFINE(HAVE_CEILF)
3146 + AC_DEFINE(HAVE_COPYSIGN)
3147 +# AC_DEFINE(HAVE_COPYSIGNF)
3148 +# AC_DEFINE(HAVE_COSF)
3149 +# AC_DEFINE(HAVE_COSHF)
3150 +# AC_DEFINE(HAVE_EXPF)
3151 +# AC_DEFINE(HAVE_FABSF)
3152 + AC_DEFINE(HAVE_FINITE)
3153 + AC_DEFINE(HAVE_FINITEF)
3154 + AC_DEFINE(HAVE_FLOORF)
3155 +# AC_DEFINE(HAVE_FMODF)
3156 +# AC_DEFINE(HAVE_FREXPF)
3157 + AC_DEFINE(HAVE_HYPOT)
3158 +# AC_DEFINE(HAVE_HYPOTF)
3159 + AC_DEFINE(HAVE_ISINF)
3160 + AC_DEFINE(HAVE_ISINFF)
3161 + AC_DEFINE(HAVE_ISNAN)
3162 + AC_DEFINE(HAVE_ISNANF)
3163 +# AC_DEFINE(HAVE_LOGF)
3164 +# AC_DEFINE(HAVE_LOG10F)
3165 +# AC_DEFINE(HAVE_MODFF)
3166 +# AC_DEFINE(HAVE_SINF)
3167 +# AC_DEFINE(HAVE_SINHF)
3168 +# AC_DEFINE(HAVE_SINCOS)
3169 +# AC_DEFINE(HAVE_SINCOSF)
3170 + AC_DEFINE(HAVE_SQRTF)
3171 +# AC_DEFINE(HAVE_TANF)
3172 +# AC_DEFINE(HAVE_TANHF)
3173 + if test x"long_double_math_on_this_cpu" = x"yes"; then
3174 + AC_MSG_ERROR([long_double_math_on_this_cpu is yes!])
3175 +# AC_DEFINE(HAVE_ACOSL)
3176 +# AC_DEFINE(HAVE_ASINL)
3177 +# AC_DEFINE(HAVE_ATANL)
3178 +# AC_DEFINE(HAVE_ATAN2L)
3179 +# AC_DEFINE(HAVE_CEILL)
3180 +# AC_DEFINE(HAVE_COPYSIGNL)
3181 +# AC_DEFINE(HAVE_COSL)
3182 +# AC_DEFINE(HAVE_COSHL)
3183 +# AC_DEFINE(HAVE_EXPL)
3184 +# AC_DEFINE(HAVE_FABSL)
3185 +# AC_DEFINE(HAVE_FINITEL)
3186 +# AC_DEFINE(HAVE_FLOORL)
3187 +# AC_DEFINE(HAVE_FMODL)
3188 +# AC_DEFINE(HAVE_FREXPL)
3189 +# AC_DEFINE(HAVE_HYPOTL)
3190 +# AC_DEFINE(HAVE_ISINFL)
3191 +# AC_DEFINE(HAVE_ISNANL)
3192 +# AC_DEFINE(HAVE_LOGL)
3193 +# AC_DEFINE(HAVE_LOG10L)
3194 +# AC_DEFINE(HAVE_MODFL)
3195 +# AC_DEFINE(HAVE_POWL)
3196 +# AC_DEFINE(HAVE_SINL)
3197 +# AC_DEFINE(HAVE_SINHL)
3198 +# AC_DEFINE(HAVE_SINCOSL)
3199 +# AC_DEFINE(HAVE_SQRTL)
3200 +# AC_DEFINE(HAVE_TANL)
3201 +# AC_DEFINE(HAVE_TANHL)
3204 *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
3205 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3206 machine/endian.h machine/param.h sys/machine.h sys/types.h \
3207 @@ -157,7 +250,7 @@ case "${host}" in
3208 AC_DEFINE(HAVE_INT64_T)
3211 - # Don't enable LFS with uClibc
3212 + # Don't enable LFS with uClinux
3215 AC_DEFINE(_GLIBCXX_USE_LFS)
3216 --- a/libstdc++-v3/include/c_compatibility/wchar.h
3217 +++ b/libstdc++-v3/include/c_compatibility/wchar.h
3218 @@ -101,7 +101,9 @@ using std::wmemcmp;
3220 using std::wmemmove;
3222 +#if _GLIBCXX_HAVE_WCSFTIME
3223 using std::wcsftime;
3226 #if _GLIBCXX_USE_C99
3228 --- a/libstdc++-v3/include/c_std/std_cwchar.h
3229 +++ b/libstdc++-v3/include/c_std/std_cwchar.h
3230 @@ -180,7 +180,9 @@ namespace std
3234 +#if _GLIBCXX_HAVE_WCSFTIME