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