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