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