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