patches/gcc/4.2.3/200-uclibc-locale.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Feb 17 22:08:06 2008 +0000 (2008-02-17)
changeset 431 8bde4c6ea47a
parent 313 patches/gcc/4.2.1/200-uclibc-locale.patch@2f223aafc7cb
permissions -rw-r--r--
Robert P. J. DAY says:

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