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