patches/gcc/4.0.4/200-uclibc-locale.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.0.4/200-uclibc-locale.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,3237 @@
     1.4 +diff -urN gcc-4.0.0-100/libstdc++-v3/acinclude.m4 gcc-4.0.0/libstdc++-v3/acinclude.m4
     1.5 +--- gcc-4.0.0-100/libstdc++-v3/acinclude.m4	2005-04-30 13:06:53.000000000 -0500
     1.6 ++++ gcc-4.0.0/libstdc++-v3/acinclude.m4	2005-04-28 20:19:01.000000000 -0500
     1.7 +@@ -1104,7 +1104,7 @@
     1.8 +   AC_MSG_CHECKING([for C locale to use])
     1.9 +   GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
    1.10 +     [use MODEL for target locale package],
    1.11 +-    [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
    1.12 ++    [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
    1.13 +   
    1.14 +   # If they didn't use this option switch, or if they specified --enable
    1.15 +   # with no specific model, we'll have to look for one.  If they
    1.16 +@@ -1120,6 +1120,9 @@
    1.17 +   # Default to "generic".
    1.18 +   if test $enable_clocale_flag = auto; then
    1.19 +     case ${target_os} in
    1.20 ++      *-uclibc*)
    1.21 ++        enable_clocale_flag=uclibc
    1.22 ++        ;;
    1.23 +       linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
    1.24 +         AC_EGREP_CPP([_GLIBCXX_ok], [
    1.25 +         #include <features.h>
    1.26 +@@ -1263,6 +1266,40 @@
    1.27 +       CTIME_CC=config/locale/generic/time_members.cc
    1.28 +       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
    1.29 +       ;;
    1.30 ++    uclibc)
    1.31 ++      AC_MSG_RESULT(uclibc)
    1.32 ++
    1.33 ++      # Declare intention to use gettext, and add support for specific
    1.34 ++      # languages.
    1.35 ++      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
    1.36 ++      ALL_LINGUAS="de fr"
    1.37 ++
    1.38 ++      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
    1.39 ++      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
    1.40 ++      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
    1.41 ++        USE_NLS=yes
    1.42 ++      fi
    1.43 ++      # Export the build objects.
    1.44 ++      for ling in $ALL_LINGUAS; do \
    1.45 ++        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
    1.46 ++        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
    1.47 ++      done
    1.48 ++      AC_SUBST(glibcxx_MOFILES)
    1.49 ++      AC_SUBST(glibcxx_POFILES)
    1.50 ++
    1.51 ++      CLOCALE_H=config/locale/uclibc/c_locale.h
    1.52 ++      CLOCALE_CC=config/locale/uclibc/c_locale.cc
    1.53 ++      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
    1.54 ++      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
    1.55 ++      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
    1.56 ++      CMESSAGES_H=config/locale/uclibc/messages_members.h
    1.57 ++      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
    1.58 ++      CMONEY_CC=config/locale/uclibc/monetary_members.cc
    1.59 ++      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
    1.60 ++      CTIME_H=config/locale/uclibc/time_members.h
    1.61 ++      CTIME_CC=config/locale/uclibc/time_members.cc
    1.62 ++      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
    1.63 ++      ;;
    1.64 +   esac
    1.65 + 
    1.66 +   # This is where the testsuite looks for locale catalogs, using the
    1.67 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
    1.68 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c++locale_internal.h	1969-12-31 18:00:00.000000000 -0600
    1.69 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h	2005-04-28 01:13:15.000000000 -0500
    1.70 +@@ -0,0 +1,59 @@
    1.71 ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
    1.72 ++
    1.73 ++// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
    1.74 ++//
    1.75 ++// This file is part of the GNU ISO C++ Library.  This library is free
    1.76 ++// software; you can redistribute it and/or modify it under the
    1.77 ++// terms of the GNU General Public License as published by the
    1.78 ++// Free Software Foundation; either version 2, or (at your option)
    1.79 ++// any later version.
    1.80 ++
    1.81 ++// This library is distributed in the hope that it will be useful,
    1.82 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.83 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.84 ++// GNU General Public License for more details.
    1.85 ++
    1.86 ++// You should have received a copy of the GNU General Public License along
    1.87 ++// with this library; see the file COPYING.  If not, write to the Free
    1.88 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    1.89 ++// USA.
    1.90 ++
    1.91 ++// As a special exception, you may use this file as part of a free software
    1.92 ++// library without restriction.  Specifically, if other files instantiate
    1.93 ++// templates or use macros or inline functions from this file, or you compile
    1.94 ++// this file and link it with other files to produce an executable, this
    1.95 ++// file does not by itself cause the resulting executable to be covered by
    1.96 ++// the GNU General Public License.  This exception does not however
    1.97 ++// invalidate any other reasons why the executable file might be covered by
    1.98 ++// the GNU General Public License.
    1.99 ++
   1.100 ++// Written by Jakub Jelinek <jakub@redhat.com>
   1.101 ++
   1.102 ++#include <clocale>
   1.103 ++
   1.104 ++#ifdef __UCLIBC_MJN3_ONLY__
   1.105 ++#warning clean this up
   1.106 ++#endif
   1.107 ++
   1.108 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.109 ++                                                  
   1.110 ++extern "C" __typeof(iswctype_l) __iswctype_l;
   1.111 ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
   1.112 ++extern "C" __typeof(strcoll_l) __strcoll_l;
   1.113 ++extern "C" __typeof(strftime_l) __strftime_l;
   1.114 ++extern "C" __typeof(strtod_l) __strtod_l;
   1.115 ++extern "C" __typeof(strtof_l) __strtof_l;
   1.116 ++extern "C" __typeof(strtold_l) __strtold_l;
   1.117 ++extern "C" __typeof(strxfrm_l) __strxfrm_l;
   1.118 ++extern "C" __typeof(towlower_l) __towlower_l;
   1.119 ++extern "C" __typeof(towupper_l) __towupper_l;
   1.120 ++extern "C" __typeof(wcscoll_l) __wcscoll_l;
   1.121 ++extern "C" __typeof(wcsftime_l) __wcsftime_l;
   1.122 ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
   1.123 ++extern "C" __typeof(wctype_l) __wctype_l;
   1.124 ++extern "C" __typeof(newlocale) __newlocale;
   1.125 ++extern "C" __typeof(freelocale) __freelocale;
   1.126 ++extern "C" __typeof(duplocale) __duplocale;
   1.127 ++extern "C" __typeof(uselocale) __uselocale;
   1.128 ++
   1.129 ++#endif // GLIBC 2.3 and later
   1.130 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc
   1.131 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.cc	1969-12-31 18:00:00.000000000 -0600
   1.132 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.cc	2005-04-28 01:13:15.000000000 -0500
   1.133 +@@ -0,0 +1,160 @@
   1.134 ++// Wrapper for underlying C-language localization -*- C++ -*-
   1.135 ++
   1.136 ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
   1.137 ++//
   1.138 ++// This file is part of the GNU ISO C++ Library.  This library is free
   1.139 ++// software; you can redistribute it and/or modify it under the
   1.140 ++// terms of the GNU General Public License as published by the
   1.141 ++// Free Software Foundation; either version 2, or (at your option)
   1.142 ++// any later version.
   1.143 ++
   1.144 ++// This library is distributed in the hope that it will be useful,
   1.145 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.146 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.147 ++// GNU General Public License for more details.
   1.148 ++
   1.149 ++// You should have received a copy of the GNU General Public License along
   1.150 ++// with this library; see the file COPYING.  If not, write to the Free
   1.151 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   1.152 ++// USA.
   1.153 ++
   1.154 ++// As a special exception, you may use this file as part of a free software
   1.155 ++// library without restriction.  Specifically, if other files instantiate
   1.156 ++// templates or use macros or inline functions from this file, or you compile
   1.157 ++// this file and link it with other files to produce an executable, this
   1.158 ++// file does not by itself cause the resulting executable to be covered by
   1.159 ++// the GNU General Public License.  This exception does not however
   1.160 ++// invalidate any other reasons why the executable file might be covered by
   1.161 ++// the GNU General Public License.
   1.162 ++
   1.163 ++//
   1.164 ++// ISO C++ 14882: 22.8  Standard locale categories.
   1.165 ++//
   1.166 ++
   1.167 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
   1.168 ++
   1.169 ++#include <cerrno>  // For errno
   1.170 ++#include <locale>
   1.171 ++#include <stdexcept>
   1.172 ++#include <langinfo.h>
   1.173 ++#include <bits/c++locale_internal.h>
   1.174 ++
   1.175 ++#ifndef __UCLIBC_HAS_XLOCALE__
   1.176 ++#define __strtol_l(S, E, B, L)      strtol((S), (E), (B))
   1.177 ++#define __strtoul_l(S, E, B, L)     strtoul((S), (E), (B))
   1.178 ++#define __strtoll_l(S, E, B, L)     strtoll((S), (E), (B))
   1.179 ++#define __strtoull_l(S, E, B, L)    strtoull((S), (E), (B))
   1.180 ++#define __strtof_l(S, E, L)         strtof((S), (E))
   1.181 ++#define __strtod_l(S, E, L)         strtod((S), (E))
   1.182 ++#define __strtold_l(S, E, L)        strtold((S), (E))
   1.183 ++#warning should dummy __newlocale check for C|POSIX ?
   1.184 ++#define __newlocale(a, b, c)        NULL
   1.185 ++#define __freelocale(a)             ((void)0)
   1.186 ++#define __duplocale(a)              __c_locale()
   1.187 ++#endif
   1.188 ++
   1.189 ++namespace std 
   1.190 ++{
   1.191 ++  template<>
   1.192 ++    void
   1.193 ++    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, 
   1.194 ++		   const __c_locale& __cloc)
   1.195 ++    {
   1.196 ++      if (!(__err & ios_base::failbit))
   1.197 ++	{
   1.198 ++	  char* __sanity;
   1.199 ++	  errno = 0;
   1.200 ++	  float __f = __strtof_l(__s, &__sanity, __cloc);
   1.201 ++          if (__sanity != __s && errno != ERANGE)
   1.202 ++	    __v = __f;
   1.203 ++	  else
   1.204 ++	    __err |= ios_base::failbit;
   1.205 ++	}
   1.206 ++    }
   1.207 ++
   1.208 ++  template<>
   1.209 ++    void
   1.210 ++    __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, 
   1.211 ++		   const __c_locale& __cloc)
   1.212 ++    {
   1.213 ++      if (!(__err & ios_base::failbit))
   1.214 ++	{
   1.215 ++	  char* __sanity;
   1.216 ++	  errno = 0;
   1.217 ++	  double __d = __strtod_l(__s, &__sanity, __cloc);
   1.218 ++          if (__sanity != __s && errno != ERANGE)
   1.219 ++	    __v = __d;
   1.220 ++	  else
   1.221 ++	    __err |= ios_base::failbit;
   1.222 ++	}
   1.223 ++    }
   1.224 ++
   1.225 ++  template<>
   1.226 ++    void
   1.227 ++    __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
   1.228 ++		   const __c_locale& __cloc)
   1.229 ++    {
   1.230 ++      if (!(__err & ios_base::failbit))
   1.231 ++	{
   1.232 ++	  char* __sanity;
   1.233 ++	  errno = 0;
   1.234 ++	  long double __ld = __strtold_l(__s, &__sanity, __cloc);
   1.235 ++          if (__sanity != __s && errno != ERANGE)
   1.236 ++	    __v = __ld;
   1.237 ++	  else
   1.238 ++	    __err |= ios_base::failbit;
   1.239 ++	}
   1.240 ++    }
   1.241 ++
   1.242 ++  void
   1.243 ++  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, 
   1.244 ++				    __c_locale __old)
   1.245 ++  {
   1.246 ++    __cloc = __newlocale(1 << LC_ALL, __s, __old);
   1.247 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.248 ++    if (!__cloc)
   1.249 ++      {
   1.250 ++	// This named locale is not supported by the underlying OS.
   1.251 ++	__throw_runtime_error(__N("locale::facet::_S_create_c_locale "
   1.252 ++			      "name not valid"));
   1.253 ++      }
   1.254 ++#endif
   1.255 ++  }
   1.256 ++  
   1.257 ++  void
   1.258 ++  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
   1.259 ++  {
   1.260 ++    if (_S_get_c_locale() != __cloc)
   1.261 ++      __freelocale(__cloc); 
   1.262 ++  }
   1.263 ++
   1.264 ++  __c_locale
   1.265 ++  locale::facet::_S_clone_c_locale(__c_locale& __cloc)
   1.266 ++  { return __duplocale(__cloc); }
   1.267 ++} // namespace std
   1.268 ++
   1.269 ++namespace __gnu_cxx
   1.270 ++{
   1.271 ++  const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
   1.272 ++    {
   1.273 ++      "LC_CTYPE", 
   1.274 ++      "LC_NUMERIC",
   1.275 ++      "LC_TIME", 
   1.276 ++      "LC_COLLATE", 
   1.277 ++      "LC_MONETARY",
   1.278 ++      "LC_MESSAGES", 
   1.279 ++#if _GLIBCXX_NUM_CATEGORIES != 0
   1.280 ++      "LC_PAPER", 
   1.281 ++      "LC_NAME", 
   1.282 ++      "LC_ADDRESS",
   1.283 ++      "LC_TELEPHONE", 
   1.284 ++      "LC_MEASUREMENT", 
   1.285 ++      "LC_IDENTIFICATION" 
   1.286 ++#endif
   1.287 ++    };
   1.288 ++}
   1.289 ++
   1.290 ++namespace std
   1.291 ++{
   1.292 ++  const char* const* const locale::_S_categories = __gnu_cxx::category_names;
   1.293 ++}  // namespace std
   1.294 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h
   1.295 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/c_locale.h	1969-12-31 18:00:00.000000000 -0600
   1.296 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/c_locale.h	2005-04-28 01:13:15.000000000 -0500
   1.297 +@@ -0,0 +1,115 @@
   1.298 ++// Wrapper for underlying C-language localization -*- C++ -*-
   1.299 ++
   1.300 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
   1.301 ++//
   1.302 ++// This file is part of the GNU ISO C++ Library.  This library is free
   1.303 ++// software; you can redistribute it and/or modify it under the
   1.304 ++// terms of the GNU General Public License as published by the
   1.305 ++// Free Software Foundation; either version 2, or (at your option)
   1.306 ++// any later version.
   1.307 ++
   1.308 ++// This library is distributed in the hope that it will be useful,
   1.309 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.310 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.311 ++// GNU General Public License for more details.
   1.312 ++
   1.313 ++// You should have received a copy of the GNU General Public License along
   1.314 ++// with this library; see the file COPYING.  If not, write to the Free
   1.315 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   1.316 ++// USA.
   1.317 ++
   1.318 ++// As a special exception, you may use this file as part of a free software
   1.319 ++// library without restriction.  Specifically, if other files instantiate
   1.320 ++// templates or use macros or inline functions from this file, or you compile
   1.321 ++// this file and link it with other files to produce an executable, this
   1.322 ++// file does not by itself cause the resulting executable to be covered by
   1.323 ++// the GNU General Public License.  This exception does not however
   1.324 ++// invalidate any other reasons why the executable file might be covered by
   1.325 ++// the GNU General Public License.
   1.326 ++
   1.327 ++//
   1.328 ++// ISO C++ 14882: 22.8  Standard locale categories.
   1.329 ++//
   1.330 ++
   1.331 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
   1.332 ++
   1.333 ++#ifndef _C_LOCALE_H
   1.334 ++#define _C_LOCALE_H 1
   1.335 ++
   1.336 ++#pragma GCC system_header
   1.337 ++
   1.338 ++#include <cstring>              // get std::strlen
   1.339 ++#include <cstdio>               // get std::snprintf or std::sprintf
   1.340 ++#include <clocale>
   1.341 ++#include <langinfo.h>		// For codecvt
   1.342 ++#ifdef __UCLIBC_MJN3_ONLY__
   1.343 ++#warning fix this
   1.344 ++#endif
   1.345 ++#ifdef __UCLIBC_HAS_LOCALE__
   1.346 ++#include <iconv.h>		// For codecvt using iconv, iconv_t
   1.347 ++#endif
   1.348 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
   1.349 ++#include <libintl.h> 		// For messages
   1.350 ++#endif
   1.351 ++
   1.352 ++#ifdef __UCLIBC_MJN3_ONLY__
   1.353 ++#warning what is _GLIBCXX_C_LOCALE_GNU for
   1.354 ++#endif
   1.355 ++#define _GLIBCXX_C_LOCALE_GNU 1
   1.356 ++
   1.357 ++#ifdef __UCLIBC_MJN3_ONLY__
   1.358 ++#warning fix categories
   1.359 ++#endif
   1.360 ++// #define _GLIBCXX_NUM_CATEGORIES 6
   1.361 ++#define _GLIBCXX_NUM_CATEGORIES 0
   1.362 ++ 
   1.363 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.364 ++namespace __gnu_cxx
   1.365 ++{
   1.366 ++  extern "C" __typeof(uselocale) __uselocale;
   1.367 ++}
   1.368 ++#endif
   1.369 ++
   1.370 ++namespace std
   1.371 ++{
   1.372 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.373 ++  typedef __locale_t		__c_locale;
   1.374 ++#else
   1.375 ++  typedef int*			__c_locale;
   1.376 ++#endif
   1.377 ++
   1.378 ++  // Convert numeric value of type _Tv to string and return length of
   1.379 ++  // string.  If snprintf is available use it, otherwise fall back to
   1.380 ++  // the unsafe sprintf which, in general, can be dangerous and should
   1.381 ++  // be avoided.
   1.382 ++  template<typename _Tv>
   1.383 ++    int
   1.384 ++    __convert_from_v(char* __out, const int __size, const char* __fmt,
   1.385 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.386 ++		     _Tv __v, const __c_locale& __cloc, int __prec)
   1.387 ++    {
   1.388 ++      __c_locale __old = __gnu_cxx::__uselocale(__cloc);
   1.389 ++#else
   1.390 ++		     _Tv __v, const __c_locale&, int __prec)
   1.391 ++    {
   1.392 ++# ifdef __UCLIBC_HAS_LOCALE__
   1.393 ++      char* __old = std::setlocale(LC_ALL, NULL);
   1.394 ++      char* __sav = new char[std::strlen(__old) + 1];
   1.395 ++      std::strcpy(__sav, __old);
   1.396 ++      std::setlocale(LC_ALL, "C");
   1.397 ++# endif
   1.398 ++#endif
   1.399 ++
   1.400 ++      const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
   1.401 ++
   1.402 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.403 ++      __gnu_cxx::__uselocale(__old);
   1.404 ++#elif defined __UCLIBC_HAS_LOCALE__
   1.405 ++      std::setlocale(LC_ALL, __sav);
   1.406 ++      delete [] __sav;
   1.407 ++#endif
   1.408 ++      return __ret;
   1.409 ++    }
   1.410 ++}
   1.411 ++
   1.412 ++#endif
   1.413 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
   1.414 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/codecvt_members.cc	1969-12-31 18:00:00.000000000 -0600
   1.415 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc	2005-04-28 01:13:15.000000000 -0500
   1.416 +@@ -0,0 +1,306 @@
   1.417 ++// std::codecvt implementation details, GNU version -*- C++ -*-
   1.418 ++
   1.419 ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
   1.420 ++//
   1.421 ++// This file is part of the GNU ISO C++ Library.  This library is free
   1.422 ++// software; you can redistribute it and/or modify it under the
   1.423 ++// terms of the GNU General Public License as published by the
   1.424 ++// Free Software Foundation; either version 2, or (at your option)
   1.425 ++// any later version.
   1.426 ++
   1.427 ++// This library is distributed in the hope that it will be useful,
   1.428 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.429 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.430 ++// GNU General Public License for more details.
   1.431 ++
   1.432 ++// You should have received a copy of the GNU General Public License along
   1.433 ++// with this library; see the file COPYING.  If not, write to the Free
   1.434 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   1.435 ++// USA.
   1.436 ++
   1.437 ++// As a special exception, you may use this file as part of a free software
   1.438 ++// library without restriction.  Specifically, if other files instantiate
   1.439 ++// templates or use macros or inline functions from this file, or you compile
   1.440 ++// this file and link it with other files to produce an executable, this
   1.441 ++// file does not by itself cause the resulting executable to be covered by
   1.442 ++// the GNU General Public License.  This exception does not however
   1.443 ++// invalidate any other reasons why the executable file might be covered by
   1.444 ++// the GNU General Public License.
   1.445 ++
   1.446 ++//
   1.447 ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
   1.448 ++//
   1.449 ++
   1.450 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
   1.451 ++
   1.452 ++#include <locale>
   1.453 ++#include <bits/c++locale_internal.h>
   1.454 ++
   1.455 ++namespace std
   1.456 ++{
   1.457 ++  // Specializations.
   1.458 ++#ifdef _GLIBCXX_USE_WCHAR_T
   1.459 ++  codecvt_base::result
   1.460 ++  codecvt<wchar_t, char, mbstate_t>::
   1.461 ++  do_out(state_type& __state, const intern_type* __from, 
   1.462 ++	 const intern_type* __from_end, const intern_type*& __from_next,
   1.463 ++	 extern_type* __to, extern_type* __to_end,
   1.464 ++	 extern_type*& __to_next) const
   1.465 ++  {
   1.466 ++    result __ret = ok;
   1.467 ++    state_type __tmp_state(__state);
   1.468 ++
   1.469 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.470 ++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
   1.471 ++#endif
   1.472 ++
   1.473 ++    // wcsnrtombs is *very* fast but stops if encounters NUL characters:
   1.474 ++    // in case we fall back to wcrtomb and then continue, in a loop.
   1.475 ++    // NB: wcsnrtombs is a GNU extension
   1.476 ++    for (__from_next = __from, __to_next = __to;
   1.477 ++	 __from_next < __from_end && __to_next < __to_end
   1.478 ++	 && __ret == ok;)
   1.479 ++      {
   1.480 ++	const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
   1.481 ++						      __from_end - __from_next);
   1.482 ++	if (!__from_chunk_end)
   1.483 ++	  __from_chunk_end = __from_end;
   1.484 ++
   1.485 ++	__from = __from_next;
   1.486 ++	const size_t __conv = wcsnrtombs(__to_next, &__from_next,
   1.487 ++					 __from_chunk_end - __from_next,
   1.488 ++					 __to_end - __to_next, &__state);
   1.489 ++	if (__conv == static_cast<size_t>(-1))
   1.490 ++	  {
   1.491 ++	    // In case of error, in order to stop at the exact place we
   1.492 ++	    // have to start again from the beginning with a series of
   1.493 ++	    // wcrtomb.
   1.494 ++	    for (; __from < __from_next; ++__from)
   1.495 ++	      __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
   1.496 ++	    __state = __tmp_state;
   1.497 ++	    __ret = error;
   1.498 ++	  }
   1.499 ++	else if (__from_next && __from_next < __from_chunk_end)
   1.500 ++	  {
   1.501 ++	    __to_next += __conv;
   1.502 ++	    __ret = partial;
   1.503 ++	  }
   1.504 ++	else
   1.505 ++	  {
   1.506 ++	    __from_next = __from_chunk_end;
   1.507 ++	    __to_next += __conv;
   1.508 ++	  }
   1.509 ++
   1.510 ++	if (__from_next < __from_end && __ret == ok)
   1.511 ++	  {
   1.512 ++	    extern_type __buf[MB_LEN_MAX];
   1.513 ++	    __tmp_state = __state;
   1.514 ++	    const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
   1.515 ++	    if (__conv > static_cast<size_t>(__to_end - __to_next))
   1.516 ++	      __ret = partial;
   1.517 ++	    else
   1.518 ++	      {
   1.519 ++		memcpy(__to_next, __buf, __conv);
   1.520 ++		__state = __tmp_state;
   1.521 ++		__to_next += __conv;
   1.522 ++		++__from_next;
   1.523 ++	      }
   1.524 ++	  }
   1.525 ++      }
   1.526 ++
   1.527 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.528 ++    __uselocale(__old);
   1.529 ++#endif
   1.530 ++
   1.531 ++    return __ret; 
   1.532 ++  }
   1.533 ++  
   1.534 ++  codecvt_base::result
   1.535 ++  codecvt<wchar_t, char, mbstate_t>::
   1.536 ++  do_in(state_type& __state, const extern_type* __from, 
   1.537 ++	const extern_type* __from_end, const extern_type*& __from_next,
   1.538 ++	intern_type* __to, intern_type* __to_end,
   1.539 ++	intern_type*& __to_next) const
   1.540 ++  {
   1.541 ++    result __ret = ok;
   1.542 ++    state_type __tmp_state(__state);
   1.543 ++
   1.544 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.545 ++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
   1.546 ++#endif
   1.547 ++
   1.548 ++    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
   1.549 ++    // in case we store a L'\0' and then continue, in a loop.
   1.550 ++    // NB: mbsnrtowcs is a GNU extension
   1.551 ++    for (__from_next = __from, __to_next = __to;
   1.552 ++	 __from_next < __from_end && __to_next < __to_end
   1.553 ++	 && __ret == ok;)
   1.554 ++      {
   1.555 ++	const extern_type* __from_chunk_end;
   1.556 ++	__from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
   1.557 ++								  __from_end
   1.558 ++								  - __from_next));
   1.559 ++	if (!__from_chunk_end)
   1.560 ++	  __from_chunk_end = __from_end;
   1.561 ++
   1.562 ++	__from = __from_next;
   1.563 ++	size_t __conv = mbsnrtowcs(__to_next, &__from_next,
   1.564 ++				   __from_chunk_end - __from_next,
   1.565 ++				   __to_end - __to_next, &__state);
   1.566 ++	if (__conv == static_cast<size_t>(-1))
   1.567 ++	  {
   1.568 ++	    // In case of error, in order to stop at the exact place we
   1.569 ++	    // have to start again from the beginning with a series of
   1.570 ++	    // mbrtowc.
   1.571 ++	    for (;; ++__to_next, __from += __conv)
   1.572 ++	      {
   1.573 ++		__conv = mbrtowc(__to_next, __from, __from_end - __from,
   1.574 ++				 &__tmp_state);
   1.575 ++		if (__conv == static_cast<size_t>(-1)
   1.576 ++		    || __conv == static_cast<size_t>(-2))
   1.577 ++		  break;
   1.578 ++	      }
   1.579 ++	    __from_next = __from;
   1.580 ++	    __state = __tmp_state;	    
   1.581 ++	    __ret = error;
   1.582 ++	  }
   1.583 ++	else if (__from_next && __from_next < __from_chunk_end)
   1.584 ++	  {
   1.585 ++	    // It is unclear what to return in this case (see DR 382). 
   1.586 ++	    __to_next += __conv;
   1.587 ++	    __ret = partial;
   1.588 ++	  }
   1.589 ++	else
   1.590 ++	  {
   1.591 ++	    __from_next = __from_chunk_end;
   1.592 ++	    __to_next += __conv;
   1.593 ++	  }
   1.594 ++
   1.595 ++	if (__from_next < __from_end && __ret == ok)
   1.596 ++	  {
   1.597 ++	    if (__to_next < __to_end)
   1.598 ++	      {
   1.599 ++		// XXX Probably wrong for stateful encodings
   1.600 ++		__tmp_state = __state;		
   1.601 ++		++__from_next;
   1.602 ++		*__to_next++ = L'\0';
   1.603 ++	      }
   1.604 ++	    else
   1.605 ++	      __ret = partial;
   1.606 ++	  }
   1.607 ++      }
   1.608 ++
   1.609 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.610 ++    __uselocale(__old);
   1.611 ++#endif
   1.612 ++
   1.613 ++    return __ret; 
   1.614 ++  }
   1.615 ++
   1.616 ++  int 
   1.617 ++  codecvt<wchar_t, char, mbstate_t>::
   1.618 ++  do_encoding() const throw()
   1.619 ++  {
   1.620 ++    // XXX This implementation assumes that the encoding is
   1.621 ++    // stateless and is either single-byte or variable-width.
   1.622 ++    int __ret = 0;
   1.623 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.624 ++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
   1.625 ++#endif
   1.626 ++    if (MB_CUR_MAX == 1)
   1.627 ++      __ret = 1;
   1.628 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.629 ++    __uselocale(__old);
   1.630 ++#endif
   1.631 ++    return __ret;
   1.632 ++  }  
   1.633 ++
   1.634 ++  int 
   1.635 ++  codecvt<wchar_t, char, mbstate_t>::
   1.636 ++  do_max_length() const throw()
   1.637 ++  {
   1.638 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.639 ++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
   1.640 ++#endif
   1.641 ++    // XXX Probably wrong for stateful encodings.
   1.642 ++    int __ret = MB_CUR_MAX;
   1.643 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.644 ++    __uselocale(__old);
   1.645 ++#endif
   1.646 ++    return __ret;
   1.647 ++  }
   1.648 ++  
   1.649 ++  int 
   1.650 ++  codecvt<wchar_t, char, mbstate_t>::
   1.651 ++  do_length(state_type& __state, const extern_type* __from,
   1.652 ++	    const extern_type* __end, size_t __max) const
   1.653 ++  {
   1.654 ++    int __ret = 0;
   1.655 ++    state_type __tmp_state(__state);
   1.656 ++
   1.657 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.658 ++    __c_locale __old = __uselocale(_M_c_locale_codecvt);
   1.659 ++#endif
   1.660 ++
   1.661 ++    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
   1.662 ++    // in case we advance past it and then continue, in a loop.
   1.663 ++    // NB: mbsnrtowcs is a GNU extension
   1.664 ++  
   1.665 ++    // A dummy internal buffer is needed in order for mbsnrtocws to consider
   1.666 ++    // its fourth parameter (it wouldn't with NULL as first parameter).
   1.667 ++    wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) 
   1.668 ++							   * __max));
   1.669 ++    while (__from < __end && __max)
   1.670 ++      {
   1.671 ++	const extern_type* __from_chunk_end;
   1.672 ++	__from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
   1.673 ++								  __end
   1.674 ++								  - __from));
   1.675 ++	if (!__from_chunk_end)
   1.676 ++	  __from_chunk_end = __end;
   1.677 ++
   1.678 ++	const extern_type* __tmp_from = __from;
   1.679 ++	size_t __conv = mbsnrtowcs(__to, &__from,
   1.680 ++				   __from_chunk_end - __from,
   1.681 ++				   __max, &__state);
   1.682 ++	if (__conv == static_cast<size_t>(-1))
   1.683 ++	  {
   1.684 ++	    // In case of error, in order to stop at the exact place we
   1.685 ++	    // have to start again from the beginning with a series of
   1.686 ++	    // mbrtowc.
   1.687 ++	    for (__from = __tmp_from;; __from += __conv)
   1.688 ++	      {
   1.689 ++		__conv = mbrtowc(NULL, __from, __end - __from,
   1.690 ++				 &__tmp_state);
   1.691 ++		if (__conv == static_cast<size_t>(-1)
   1.692 ++		    || __conv == static_cast<size_t>(-2))
   1.693 ++		  break;
   1.694 ++	      }
   1.695 ++	    __state = __tmp_state;
   1.696 ++	    __ret += __from - __tmp_from;
   1.697 ++	    break;
   1.698 ++	  }
   1.699 ++	if (!__from)
   1.700 ++	  __from = __from_chunk_end;
   1.701 ++	
   1.702 ++	__ret += __from - __tmp_from;
   1.703 ++	__max -= __conv;
   1.704 ++
   1.705 ++	if (__from < __end && __max)
   1.706 ++	  {
   1.707 ++	    // XXX Probably wrong for stateful encodings
   1.708 ++	    __tmp_state = __state;
   1.709 ++	    ++__from;
   1.710 ++	    ++__ret;
   1.711 ++	    --__max;
   1.712 ++	  }
   1.713 ++      }
   1.714 ++
   1.715 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.716 ++    __uselocale(__old);
   1.717 ++#endif
   1.718 ++
   1.719 ++    return __ret; 
   1.720 ++  }
   1.721 ++#endif
   1.722 ++}
   1.723 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc
   1.724 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/collate_members.cc	1969-12-31 18:00:00.000000000 -0600
   1.725 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/collate_members.cc	2005-04-28 01:13:15.000000000 -0500
   1.726 +@@ -0,0 +1,80 @@
   1.727 ++// std::collate implementation details, GNU version -*- C++ -*-
   1.728 ++
   1.729 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
   1.730 ++//
   1.731 ++// This file is part of the GNU ISO C++ Library.  This library is free
   1.732 ++// software; you can redistribute it and/or modify it under the
   1.733 ++// terms of the GNU General Public License as published by the
   1.734 ++// Free Software Foundation; either version 2, or (at your option)
   1.735 ++// any later version.
   1.736 ++
   1.737 ++// This library is distributed in the hope that it will be useful,
   1.738 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.739 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.740 ++// GNU General Public License for more details.
   1.741 ++
   1.742 ++// You should have received a copy of the GNU General Public License along
   1.743 ++// with this library; see the file COPYING.  If not, write to the Free
   1.744 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   1.745 ++// USA.
   1.746 ++
   1.747 ++// As a special exception, you may use this file as part of a free software
   1.748 ++// library without restriction.  Specifically, if other files instantiate
   1.749 ++// templates or use macros or inline functions from this file, or you compile
   1.750 ++// this file and link it with other files to produce an executable, this
   1.751 ++// file does not by itself cause the resulting executable to be covered by
   1.752 ++// the GNU General Public License.  This exception does not however
   1.753 ++// invalidate any other reasons why the executable file might be covered by
   1.754 ++// the GNU General Public License.
   1.755 ++
   1.756 ++//
   1.757 ++// ISO C++ 14882: 22.2.4.1.2  collate virtual functions
   1.758 ++//
   1.759 ++
   1.760 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
   1.761 ++
   1.762 ++#include <locale>
   1.763 ++#include <bits/c++locale_internal.h>
   1.764 ++
   1.765 ++#ifndef __UCLIBC_HAS_XLOCALE__
   1.766 ++#define __strcoll_l(S1, S2, L)      strcoll((S1), (S2))
   1.767 ++#define __strxfrm_l(S1, S2, N, L)   strxfrm((S1), (S2), (N))
   1.768 ++#define __wcscoll_l(S1, S2, L)      wcscoll((S1), (S2))
   1.769 ++#define __wcsxfrm_l(S1, S2, N, L)   wcsxfrm((S1), (S2), (N))
   1.770 ++#endif
   1.771 ++
   1.772 ++namespace std
   1.773 ++{
   1.774 ++  // These are basically extensions to char_traits, and perhaps should
   1.775 ++  // be put there instead of here.
   1.776 ++  template<>
   1.777 ++    int 
   1.778 ++    collate<char>::_M_compare(const char* __one, const char* __two) const
   1.779 ++    { 
   1.780 ++      int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
   1.781 ++      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
   1.782 ++    }
   1.783 ++  
   1.784 ++  template<>
   1.785 ++    size_t
   1.786 ++    collate<char>::_M_transform(char* __to, const char* __from, 
   1.787 ++				size_t __n) const 
   1.788 ++    { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
   1.789 ++
   1.790 ++#ifdef _GLIBCXX_USE_WCHAR_T
   1.791 ++  template<>
   1.792 ++    int 
   1.793 ++    collate<wchar_t>::_M_compare(const wchar_t* __one, 
   1.794 ++				 const wchar_t* __two) const
   1.795 ++    {
   1.796 ++      int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
   1.797 ++      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
   1.798 ++    }
   1.799 ++  
   1.800 ++  template<>
   1.801 ++    size_t
   1.802 ++    collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
   1.803 ++				   size_t __n) const
   1.804 ++    { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
   1.805 ++#endif
   1.806 ++}
   1.807 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc
   1.808 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/ctype_members.cc	1969-12-31 18:00:00.000000000 -0600
   1.809 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc	2005-04-28 01:13:15.000000000 -0500
   1.810 +@@ -0,0 +1,300 @@
   1.811 ++// std::ctype implementation details, GNU version -*- C++ -*-
   1.812 ++
   1.813 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
   1.814 ++//
   1.815 ++// This file is part of the GNU ISO C++ Library.  This library is free
   1.816 ++// software; you can redistribute it and/or modify it under the
   1.817 ++// terms of the GNU General Public License as published by the
   1.818 ++// Free Software Foundation; either version 2, or (at your option)
   1.819 ++// any later version.
   1.820 ++
   1.821 ++// This library is distributed in the hope that it will be useful,
   1.822 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.823 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1.824 ++// GNU General Public License for more details.
   1.825 ++
   1.826 ++// You should have received a copy of the GNU General Public License along
   1.827 ++// with this library; see the file COPYING.  If not, write to the Free
   1.828 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
   1.829 ++// USA.
   1.830 ++
   1.831 ++// As a special exception, you may use this file as part of a free software
   1.832 ++// library without restriction.  Specifically, if other files instantiate
   1.833 ++// templates or use macros or inline functions from this file, or you compile
   1.834 ++// this file and link it with other files to produce an executable, this
   1.835 ++// file does not by itself cause the resulting executable to be covered by
   1.836 ++// the GNU General Public License.  This exception does not however
   1.837 ++// invalidate any other reasons why the executable file might be covered by
   1.838 ++// the GNU General Public License.
   1.839 ++
   1.840 ++//
   1.841 ++// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
   1.842 ++//
   1.843 ++
   1.844 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
   1.845 ++
   1.846 ++#define _LIBC
   1.847 ++#include <locale>
   1.848 ++#undef _LIBC
   1.849 ++#include <bits/c++locale_internal.h>
   1.850 ++
   1.851 ++#ifndef __UCLIBC_HAS_XLOCALE__
   1.852 ++#define __wctype_l(S, L)           wctype((S))
   1.853 ++#define __towupper_l(C, L)         towupper((C))
   1.854 ++#define __towlower_l(C, L)         towlower((C))
   1.855 ++#define __iswctype_l(C, M, L)      iswctype((C), (M))
   1.856 ++#endif
   1.857 ++
   1.858 ++namespace std
   1.859 ++{
   1.860 ++  // NB: The other ctype<char> specializations are in src/locale.cc and
   1.861 ++  // various /config/os/* files.
   1.862 ++  template<>
   1.863 ++    ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
   1.864 ++    : ctype<char>(0, false, __refs) 
   1.865 ++    { 		
   1.866 ++      if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
   1.867 ++	{
   1.868 ++	  this->_S_destroy_c_locale(this->_M_c_locale_ctype);
   1.869 ++	  this->_S_create_c_locale(this->_M_c_locale_ctype, __s); 
   1.870 ++#ifdef __UCLIBC_HAS_XLOCALE__
   1.871 ++	  this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
   1.872 ++	  this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
   1.873 ++	  this->_M_table = this->_M_c_locale_ctype->__ctype_b;
   1.874 ++#endif
   1.875 ++	}
   1.876 ++    }
   1.877 ++
   1.878 ++#ifdef _GLIBCXX_USE_WCHAR_T  
   1.879 ++  ctype<wchar_t>::__wmask_type
   1.880 ++  ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
   1.881 ++  {
   1.882 ++    __wmask_type __ret;
   1.883 ++    switch (__m)
   1.884 ++      {
   1.885 ++      case space:
   1.886 ++	__ret = __wctype_l("space", _M_c_locale_ctype);
   1.887 ++	break;
   1.888 ++      case print:
   1.889 ++	__ret = __wctype_l("print", _M_c_locale_ctype);
   1.890 ++	break;
   1.891 ++      case cntrl:
   1.892 ++	__ret = __wctype_l("cntrl", _M_c_locale_ctype);
   1.893 ++	break;
   1.894 ++      case upper:
   1.895 ++	__ret = __wctype_l("upper", _M_c_locale_ctype);
   1.896 ++	break;
   1.897 ++      case lower:
   1.898 ++	__ret = __wctype_l("lower", _M_c_locale_ctype);
   1.899 ++	break;
   1.900 ++      case alpha:
   1.901 ++	__ret = __wctype_l("alpha", _M_c_locale_ctype);
   1.902 ++	break;
   1.903 ++      case digit:
   1.904 ++	__ret = __wctype_l("digit", _M_c_locale_ctype);
   1.905 ++	break;
   1.906 ++      case punct:
   1.907 ++	__ret = __wctype_l("punct", _M_c_locale_ctype);
   1.908 ++	break;
   1.909 ++      case xdigit:
   1.910 ++	__ret = __wctype_l("xdigit", _M_c_locale_ctype);
   1.911 ++	break;
   1.912 ++      case alnum:
   1.913 ++	__ret = __wctype_l("alnum", _M_c_locale_ctype);
   1.914 ++	break;
   1.915 ++      case graph:
   1.916 ++	__ret = __wctype_l("graph", _M_c_locale_ctype);
   1.917 ++	break;
   1.918 ++      default:
   1.919 ++	__ret = __wmask_type();
   1.920 ++      }
   1.921 ++    return __ret;
   1.922 ++  }
   1.923 ++  
   1.924 ++  wchar_t
   1.925 ++  ctype<wchar_t>::do_toupper(wchar_t __c) const
   1.926 ++  { return __towupper_l(__c, _M_c_locale_ctype); }
   1.927 ++
   1.928 ++  const wchar_t*
   1.929 ++  ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
   1.930 ++  {
   1.931 ++    while (__lo < __hi)
   1.932 ++      {
   1.933 ++        *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
   1.934 ++        ++__lo;
   1.935 ++      }
   1.936 ++    return __hi;
   1.937 ++  }
   1.938 ++  
   1.939 ++  wchar_t
   1.940 ++  ctype<wchar_t>::do_tolower(wchar_t __c) const
   1.941 ++  { return __towlower_l(__c, _M_c_locale_ctype); }
   1.942 ++  
   1.943 ++  const wchar_t*
   1.944 ++  ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
   1.945 ++  {
   1.946 ++    while (__lo < __hi)
   1.947 ++      {
   1.948 ++        *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
   1.949 ++        ++__lo;
   1.950 ++      }
   1.951 ++    return __hi;
   1.952 ++  }
   1.953 ++
   1.954 ++  bool
   1.955 ++  ctype<wchar_t>::
   1.956 ++  do_is(mask __m, wchar_t __c) const
   1.957 ++  { 
   1.958 ++    // Highest bitmask in ctype_base == 10, but extra in "C"
   1.959 ++    // library for blank.
   1.960 ++    bool __ret = false;
   1.961 ++    const size_t __bitmasksize = 11; 
   1.962 ++    for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
   1.963 ++      if (__m & _M_bit[__bitcur]
   1.964 ++	  && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
   1.965 ++	{
   1.966 ++	  __ret = true;
   1.967 ++	  break;
   1.968 ++	}
   1.969 ++    return __ret;    
   1.970 ++  }
   1.971 ++  
   1.972 ++  const wchar_t* 
   1.973 ++  ctype<wchar_t>::
   1.974 ++  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
   1.975 ++  {
   1.976 ++    for (; __lo < __hi; ++__vec, ++__lo)
   1.977 ++      {
   1.978 ++	// Highest bitmask in ctype_base == 10, but extra in "C"
   1.979 ++	// library for blank.
   1.980 ++	const size_t __bitmasksize = 11; 
   1.981 ++	mask __m = 0;
   1.982 ++	for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
   1.983 ++	  if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
   1.984 ++	    __m |= _M_bit[__bitcur];
   1.985 ++	*__vec = __m;
   1.986 ++      }
   1.987 ++    return __hi;
   1.988 ++  }
   1.989 ++  
   1.990 ++  const wchar_t* 
   1.991 ++  ctype<wchar_t>::
   1.992 ++  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
   1.993 ++  {
   1.994 ++    while (__lo < __hi && !this->do_is(__m, *__lo))
   1.995 ++      ++__lo;
   1.996 ++    return __lo;
   1.997 ++  }
   1.998 ++
   1.999 ++  const wchar_t*
  1.1000 ++  ctype<wchar_t>::
  1.1001 ++  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
  1.1002 ++  {
  1.1003 ++    while (__lo < __hi && this->do_is(__m, *__lo) != 0)
  1.1004 ++      ++__lo;
  1.1005 ++    return __lo;
  1.1006 ++  }
  1.1007 ++
  1.1008 ++  wchar_t
  1.1009 ++  ctype<wchar_t>::
  1.1010 ++  do_widen(char __c) const
  1.1011 ++  { return _M_widen[static_cast<unsigned char>(__c)]; }
  1.1012 ++
  1.1013 ++  const char* 
  1.1014 ++  ctype<wchar_t>::
  1.1015 ++  do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
  1.1016 ++  {
  1.1017 ++    while (__lo < __hi)
  1.1018 ++      {
  1.1019 ++	*__dest = _M_widen[static_cast<unsigned char>(*__lo)];
  1.1020 ++	++__lo;
  1.1021 ++	++__dest;
  1.1022 ++      }
  1.1023 ++    return __hi;
  1.1024 ++  }
  1.1025 ++
  1.1026 ++  char
  1.1027 ++  ctype<wchar_t>::
  1.1028 ++  do_narrow(wchar_t __wc, char __dfault) const
  1.1029 ++  {
  1.1030 ++    if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
  1.1031 ++      return _M_narrow[__wc];
  1.1032 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1033 ++    __c_locale __old = __uselocale(_M_c_locale_ctype);
  1.1034 ++#endif
  1.1035 ++    const int __c = wctob(__wc);
  1.1036 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1037 ++    __uselocale(__old);
  1.1038 ++#endif
  1.1039 ++    return (__c == EOF ? __dfault : static_cast<char>(__c)); 
  1.1040 ++  }
  1.1041 ++
  1.1042 ++  const wchar_t*
  1.1043 ++  ctype<wchar_t>::
  1.1044 ++  do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, 
  1.1045 ++	    char* __dest) const
  1.1046 ++  {
  1.1047 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1048 ++    __c_locale __old = __uselocale(_M_c_locale_ctype);
  1.1049 ++#endif
  1.1050 ++    if (_M_narrow_ok)
  1.1051 ++      while (__lo < __hi)
  1.1052 ++	{
  1.1053 ++	  if (*__lo >= 0 && *__lo < 128)
  1.1054 ++	    *__dest = _M_narrow[*__lo];
  1.1055 ++	  else
  1.1056 ++	    {
  1.1057 ++	      const int __c = wctob(*__lo);
  1.1058 ++	      *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
  1.1059 ++	    }
  1.1060 ++	  ++__lo;
  1.1061 ++	  ++__dest;
  1.1062 ++	}
  1.1063 ++    else
  1.1064 ++      while (__lo < __hi)
  1.1065 ++	{
  1.1066 ++	  const int __c = wctob(*__lo);
  1.1067 ++	  *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
  1.1068 ++	  ++__lo;
  1.1069 ++	  ++__dest;
  1.1070 ++	}
  1.1071 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1072 ++    __uselocale(__old);
  1.1073 ++#endif
  1.1074 ++    return __hi;
  1.1075 ++  }
  1.1076 ++
  1.1077 ++  void
  1.1078 ++  ctype<wchar_t>::_M_initialize_ctype()
  1.1079 ++  {
  1.1080 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1081 ++    __c_locale __old = __uselocale(_M_c_locale_ctype);
  1.1082 ++#endif
  1.1083 ++    wint_t __i;
  1.1084 ++    for (__i = 0; __i < 128; ++__i)
  1.1085 ++      {
  1.1086 ++	const int __c = wctob(__i);
  1.1087 ++	if (__c == EOF)
  1.1088 ++	  break;
  1.1089 ++	else
  1.1090 ++	  _M_narrow[__i] = static_cast<char>(__c);
  1.1091 ++      }
  1.1092 ++    if (__i == 128)
  1.1093 ++      _M_narrow_ok = true;
  1.1094 ++    else
  1.1095 ++      _M_narrow_ok = false;
  1.1096 ++    for (size_t __j = 0;
  1.1097 ++	 __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
  1.1098 ++      _M_widen[__j] = btowc(__j);
  1.1099 ++
  1.1100 ++    for (size_t __k = 0; __k <= 11; ++__k)
  1.1101 ++      { 
  1.1102 ++	_M_bit[__k] = static_cast<mask>(_ISbit(__k));
  1.1103 ++	_M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
  1.1104 ++      }
  1.1105 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1106 ++    __uselocale(__old);
  1.1107 ++#endif
  1.1108 ++  }
  1.1109 ++#endif //  _GLIBCXX_USE_WCHAR_T
  1.1110 ++}
  1.1111 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc
  1.1112 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.cc	1969-12-31 18:00:00.000000000 -0600
  1.1113 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.cc	2005-04-28 01:13:15.000000000 -0500
  1.1114 +@@ -0,0 +1,100 @@
  1.1115 ++// std::messages implementation details, GNU version -*- C++ -*-
  1.1116 ++
  1.1117 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
  1.1118 ++//
  1.1119 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.1120 ++// software; you can redistribute it and/or modify it under the
  1.1121 ++// terms of the GNU General Public License as published by the
  1.1122 ++// Free Software Foundation; either version 2, or (at your option)
  1.1123 ++// any later version.
  1.1124 ++
  1.1125 ++// This library is distributed in the hope that it will be useful,
  1.1126 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.1127 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.1128 ++// GNU General Public License for more details.
  1.1129 ++
  1.1130 ++// You should have received a copy of the GNU General Public License along
  1.1131 ++// with this library; see the file COPYING.  If not, write to the Free
  1.1132 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.1133 ++// USA.
  1.1134 ++
  1.1135 ++// As a special exception, you may use this file as part of a free software
  1.1136 ++// library without restriction.  Specifically, if other files instantiate
  1.1137 ++// templates or use macros or inline functions from this file, or you compile
  1.1138 ++// this file and link it with other files to produce an executable, this
  1.1139 ++// file does not by itself cause the resulting executable to be covered by
  1.1140 ++// the GNU General Public License.  This exception does not however
  1.1141 ++// invalidate any other reasons why the executable file might be covered by
  1.1142 ++// the GNU General Public License.
  1.1143 ++
  1.1144 ++//
  1.1145 ++// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
  1.1146 ++//
  1.1147 ++
  1.1148 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
  1.1149 ++
  1.1150 ++#include <locale>
  1.1151 ++#include <bits/c++locale_internal.h>
  1.1152 ++
  1.1153 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.1154 ++#warning fix gettext stuff
  1.1155 ++#endif
  1.1156 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
  1.1157 ++extern "C" char *__dcgettext(const char *domainname,
  1.1158 ++			     const char *msgid, int category);
  1.1159 ++#undef gettext
  1.1160 ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
  1.1161 ++#else
  1.1162 ++#undef gettext
  1.1163 ++#define gettext(msgid) (msgid)
  1.1164 ++#endif
  1.1165 ++
  1.1166 ++namespace std
  1.1167 ++{
  1.1168 ++  // Specializations.
  1.1169 ++  template<>
  1.1170 ++    string
  1.1171 ++    messages<char>::do_get(catalog, int, int, const string& __dfault) const
  1.1172 ++    {
  1.1173 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1174 ++      __c_locale __old = __uselocale(_M_c_locale_messages);
  1.1175 ++      const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
  1.1176 ++      __uselocale(__old);
  1.1177 ++      return string(__msg);
  1.1178 ++#elif defined __UCLIBC_HAS_LOCALE__
  1.1179 ++      char* __old = strdup(setlocale(LC_ALL, NULL));
  1.1180 ++      setlocale(LC_ALL, _M_name_messages);
  1.1181 ++      const char* __msg = gettext(__dfault.c_str());
  1.1182 ++      setlocale(LC_ALL, __old);
  1.1183 ++      free(__old);
  1.1184 ++      return string(__msg);
  1.1185 ++#else
  1.1186 ++      const char* __msg = gettext(__dfault.c_str());
  1.1187 ++      return string(__msg);
  1.1188 ++#endif
  1.1189 ++    }
  1.1190 ++
  1.1191 ++#ifdef _GLIBCXX_USE_WCHAR_T
  1.1192 ++  template<>
  1.1193 ++    wstring
  1.1194 ++    messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
  1.1195 ++    {
  1.1196 ++# ifdef __UCLIBC_HAS_XLOCALE__
  1.1197 ++      __c_locale __old = __uselocale(_M_c_locale_messages);
  1.1198 ++      char* __msg = gettext(_M_convert_to_char(__dfault));
  1.1199 ++      __uselocale(__old);
  1.1200 ++      return _M_convert_from_char(__msg);
  1.1201 ++# elif defined __UCLIBC_HAS_LOCALE__
  1.1202 ++      char* __old = strdup(setlocale(LC_ALL, NULL));
  1.1203 ++      setlocale(LC_ALL, _M_name_messages);
  1.1204 ++      char* __msg = gettext(_M_convert_to_char(__dfault));
  1.1205 ++      setlocale(LC_ALL, __old);
  1.1206 ++      free(__old);
  1.1207 ++      return _M_convert_from_char(__msg);
  1.1208 ++# else
  1.1209 ++      char* __msg = gettext(_M_convert_to_char(__dfault));
  1.1210 ++      return _M_convert_from_char(__msg);
  1.1211 ++# endif
  1.1212 ++    }
  1.1213 ++#endif
  1.1214 ++}
  1.1215 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h
  1.1216 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/messages_members.h	1969-12-31 18:00:00.000000000 -0600
  1.1217 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/messages_members.h	2005-04-28 01:13:15.000000000 -0500
  1.1218 +@@ -0,0 +1,118 @@
  1.1219 ++// std::messages implementation details, GNU version -*- C++ -*-
  1.1220 ++
  1.1221 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  1.1222 ++//
  1.1223 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.1224 ++// software; you can redistribute it and/or modify it under the
  1.1225 ++// terms of the GNU General Public License as published by the
  1.1226 ++// Free Software Foundation; either version 2, or (at your option)
  1.1227 ++// any later version.
  1.1228 ++
  1.1229 ++// This library is distributed in the hope that it will be useful,
  1.1230 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.1231 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.1232 ++// GNU General Public License for more details.
  1.1233 ++
  1.1234 ++// You should have received a copy of the GNU General Public License along
  1.1235 ++// with this library; see the file COPYING.  If not, write to the Free
  1.1236 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.1237 ++// USA.
  1.1238 ++
  1.1239 ++// As a special exception, you may use this file as part of a free software
  1.1240 ++// library without restriction.  Specifically, if other files instantiate
  1.1241 ++// templates or use macros or inline functions from this file, or you compile
  1.1242 ++// this file and link it with other files to produce an executable, this
  1.1243 ++// file does not by itself cause the resulting executable to be covered by
  1.1244 ++// the GNU General Public License.  This exception does not however
  1.1245 ++// invalidate any other reasons why the executable file might be covered by
  1.1246 ++// the GNU General Public License.
  1.1247 ++
  1.1248 ++//
  1.1249 ++// ISO C++ 14882: 22.2.7.1.2  messages functions
  1.1250 ++//
  1.1251 ++
  1.1252 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
  1.1253 ++
  1.1254 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.1255 ++#warning fix prototypes for *textdomain funcs
  1.1256 ++#endif
  1.1257 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
  1.1258 ++extern "C" char *__textdomain(const char *domainname);
  1.1259 ++extern "C" char *__bindtextdomain(const char *domainname,
  1.1260 ++				  const char *dirname);
  1.1261 ++#else
  1.1262 ++#undef __textdomain
  1.1263 ++#undef __bindtextdomain
  1.1264 ++#define __textdomain(D)           ((void)0)
  1.1265 ++#define __bindtextdomain(D,P)     ((void)0)
  1.1266 ++#endif
  1.1267 ++
  1.1268 ++  // Non-virtual member functions.
  1.1269 ++  template<typename _CharT>
  1.1270 ++     messages<_CharT>::messages(size_t __refs)
  1.1271 ++     : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), 
  1.1272 ++     _M_name_messages(_S_get_c_name())
  1.1273 ++     { }
  1.1274 ++
  1.1275 ++  template<typename _CharT>
  1.1276 ++     messages<_CharT>::messages(__c_locale __cloc, const char* __s, 
  1.1277 ++				size_t __refs) 
  1.1278 ++     : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
  1.1279 ++     _M_name_messages(__s)
  1.1280 ++     {
  1.1281 ++       char* __tmp = new char[std::strlen(__s) + 1];
  1.1282 ++       std::strcpy(__tmp, __s);
  1.1283 ++       _M_name_messages = __tmp;
  1.1284 ++     }
  1.1285 ++
  1.1286 ++  template<typename _CharT>
  1.1287 ++    typename messages<_CharT>::catalog 
  1.1288 ++    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
  1.1289 ++			   const char* __dir) const
  1.1290 ++    { 
  1.1291 ++      __bindtextdomain(__s.c_str(), __dir);
  1.1292 ++      return this->do_open(__s, __loc); 
  1.1293 ++    }
  1.1294 ++
  1.1295 ++  // Virtual member functions.
  1.1296 ++  template<typename _CharT>
  1.1297 ++    messages<_CharT>::~messages()
  1.1298 ++    { 
  1.1299 ++      if (_M_name_messages != _S_get_c_name())
  1.1300 ++	delete [] _M_name_messages;
  1.1301 ++      _S_destroy_c_locale(_M_c_locale_messages); 
  1.1302 ++    }
  1.1303 ++
  1.1304 ++  template<typename _CharT>
  1.1305 ++    typename messages<_CharT>::catalog 
  1.1306 ++    messages<_CharT>::do_open(const basic_string<char>& __s, 
  1.1307 ++			      const locale&) const
  1.1308 ++    { 
  1.1309 ++      // No error checking is done, assume the catalog exists and can
  1.1310 ++      // be used.
  1.1311 ++      __textdomain(__s.c_str());
  1.1312 ++      return 0;
  1.1313 ++    }
  1.1314 ++
  1.1315 ++  template<typename _CharT>
  1.1316 ++    void    
  1.1317 ++    messages<_CharT>::do_close(catalog) const 
  1.1318 ++    { }
  1.1319 ++
  1.1320 ++   // messages_byname
  1.1321 ++   template<typename _CharT>
  1.1322 ++     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
  1.1323 ++     : messages<_CharT>(__refs) 
  1.1324 ++     { 
  1.1325 ++       if (this->_M_name_messages != locale::facet::_S_get_c_name())
  1.1326 ++	 delete [] this->_M_name_messages;
  1.1327 ++       char* __tmp = new char[std::strlen(__s) + 1];
  1.1328 ++       std::strcpy(__tmp, __s);
  1.1329 ++       this->_M_name_messages = __tmp;
  1.1330 ++
  1.1331 ++       if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
  1.1332 ++	 {
  1.1333 ++	   this->_S_destroy_c_locale(this->_M_c_locale_messages);
  1.1334 ++	   this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
  1.1335 ++	 }
  1.1336 ++     }
  1.1337 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc
  1.1338 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/monetary_members.cc	1969-12-31 18:00:00.000000000 -0600
  1.1339 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc	2005-04-28 01:23:02.000000000 -0500
  1.1340 +@@ -0,0 +1,692 @@
  1.1341 ++// std::moneypunct implementation details, GNU version -*- C++ -*-
  1.1342 ++
  1.1343 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  1.1344 ++//
  1.1345 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.1346 ++// software; you can redistribute it and/or modify it under the
  1.1347 ++// terms of the GNU General Public License as published by the
  1.1348 ++// Free Software Foundation; either version 2, or (at your option)
  1.1349 ++// any later version.
  1.1350 ++
  1.1351 ++// This library is distributed in the hope that it will be useful,
  1.1352 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.1353 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.1354 ++// GNU General Public License for more details.
  1.1355 ++
  1.1356 ++// You should have received a copy of the GNU General Public License along
  1.1357 ++// with this library; see the file COPYING.  If not, write to the Free
  1.1358 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.1359 ++// USA.
  1.1360 ++
  1.1361 ++// As a special exception, you may use this file as part of a free software
  1.1362 ++// library without restriction.  Specifically, if other files instantiate
  1.1363 ++// templates or use macros or inline functions from this file, or you compile
  1.1364 ++// this file and link it with other files to produce an executable, this
  1.1365 ++// file does not by itself cause the resulting executable to be covered by
  1.1366 ++// the GNU General Public License.  This exception does not however
  1.1367 ++// invalidate any other reasons why the executable file might be covered by
  1.1368 ++// the GNU General Public License.
  1.1369 ++
  1.1370 ++//
  1.1371 ++// ISO C++ 14882: 22.2.6.3.2  moneypunct virtual functions
  1.1372 ++//
  1.1373 ++
  1.1374 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
  1.1375 ++
  1.1376 ++#define _LIBC
  1.1377 ++#include <locale>
  1.1378 ++#undef _LIBC
  1.1379 ++#include <bits/c++locale_internal.h>
  1.1380 ++
  1.1381 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.1382 ++#warning optimize this for uclibc
  1.1383 ++#warning tailor for stub locale support
  1.1384 ++#endif
  1.1385 ++
  1.1386 ++#ifndef __UCLIBC_HAS_XLOCALE__
  1.1387 ++#define __nl_langinfo_l(N, L)         nl_langinfo((N))
  1.1388 ++#endif
  1.1389 ++
  1.1390 ++namespace std
  1.1391 ++{
  1.1392 ++  // Construct and return valid pattern consisting of some combination of:
  1.1393 ++  // space none symbol sign value
  1.1394 ++  money_base::pattern
  1.1395 ++  money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
  1.1396 ++  { 
  1.1397 ++    pattern __ret;
  1.1398 ++
  1.1399 ++    // This insanely complicated routine attempts to construct a valid
  1.1400 ++    // pattern for use with monyepunct. A couple of invariants:
  1.1401 ++
  1.1402 ++    // if (__precedes) symbol -> value
  1.1403 ++    // else value -> symbol
  1.1404 ++    
  1.1405 ++    // if (__space) space
  1.1406 ++    // else none
  1.1407 ++
  1.1408 ++    // none == never first
  1.1409 ++    // space never first or last
  1.1410 ++
  1.1411 ++    // Any elegant implementations of this are welcome.
  1.1412 ++    switch (__posn)
  1.1413 ++      {
  1.1414 ++      case 0:
  1.1415 ++      case 1:
  1.1416 ++	// 1 The sign precedes the value and symbol.
  1.1417 ++	__ret.field[0] = sign;
  1.1418 ++	if (__space)
  1.1419 ++	  {
  1.1420 ++	    // Pattern starts with sign.
  1.1421 ++	    if (__precedes)
  1.1422 ++	      {
  1.1423 ++		__ret.field[1] = symbol;
  1.1424 ++		__ret.field[3] = value;
  1.1425 ++	      }
  1.1426 ++	    else
  1.1427 ++	      {
  1.1428 ++		__ret.field[1] = value;
  1.1429 ++		__ret.field[3] = symbol;
  1.1430 ++	      }
  1.1431 ++	    __ret.field[2] = space;
  1.1432 ++	  }
  1.1433 ++	else
  1.1434 ++	  {
  1.1435 ++	    // Pattern starts with sign and ends with none.
  1.1436 ++	    if (__precedes)
  1.1437 ++	      {
  1.1438 ++		__ret.field[1] = symbol;
  1.1439 ++		__ret.field[2] = value;
  1.1440 ++	      }
  1.1441 ++	    else
  1.1442 ++	      {
  1.1443 ++		__ret.field[1] = value;
  1.1444 ++		__ret.field[2] = symbol;
  1.1445 ++	      }
  1.1446 ++	    __ret.field[3] = none;
  1.1447 ++	  }
  1.1448 ++	break;
  1.1449 ++      case 2:
  1.1450 ++	// 2 The sign follows the value and symbol.
  1.1451 ++	if (__space)
  1.1452 ++	  {
  1.1453 ++	    // Pattern either ends with sign.
  1.1454 ++	    if (__precedes)
  1.1455 ++	      {
  1.1456 ++		__ret.field[0] = symbol;
  1.1457 ++		__ret.field[2] = value;
  1.1458 ++	      }
  1.1459 ++	    else
  1.1460 ++	      {
  1.1461 ++		__ret.field[0] = value;
  1.1462 ++		__ret.field[2] = symbol;
  1.1463 ++	      }
  1.1464 ++	    __ret.field[1] = space;
  1.1465 ++	    __ret.field[3] = sign;
  1.1466 ++	  }
  1.1467 ++	else
  1.1468 ++	  {
  1.1469 ++	    // Pattern ends with sign then none.
  1.1470 ++	    if (__precedes)
  1.1471 ++	      {
  1.1472 ++		__ret.field[0] = symbol;
  1.1473 ++		__ret.field[1] = value;
  1.1474 ++	      }
  1.1475 ++	    else
  1.1476 ++	      {
  1.1477 ++		__ret.field[0] = value;
  1.1478 ++		__ret.field[1] = symbol;
  1.1479 ++	      }
  1.1480 ++	    __ret.field[2] = sign;
  1.1481 ++	    __ret.field[3] = none;
  1.1482 ++	  }
  1.1483 ++	break;
  1.1484 ++      case 3:
  1.1485 ++	// 3 The sign immediately precedes the symbol.
  1.1486 ++	if (__precedes)
  1.1487 ++	  {
  1.1488 ++	    __ret.field[0] = sign;
  1.1489 ++	    __ret.field[1] = symbol;	    
  1.1490 ++	    if (__space)
  1.1491 ++	      {
  1.1492 ++		__ret.field[2] = space;
  1.1493 ++		__ret.field[3] = value;
  1.1494 ++	      }
  1.1495 ++	    else
  1.1496 ++	      {
  1.1497 ++		__ret.field[2] = value;		
  1.1498 ++		__ret.field[3] = none;
  1.1499 ++	      }
  1.1500 ++	  }
  1.1501 ++	else
  1.1502 ++	  {
  1.1503 ++	    __ret.field[0] = value;
  1.1504 ++	    if (__space)
  1.1505 ++	      {
  1.1506 ++		__ret.field[1] = space;
  1.1507 ++		__ret.field[2] = sign;
  1.1508 ++		__ret.field[3] = symbol;
  1.1509 ++	      }
  1.1510 ++	    else
  1.1511 ++	      {
  1.1512 ++		__ret.field[1] = sign;
  1.1513 ++		__ret.field[2] = symbol;
  1.1514 ++		__ret.field[3] = none;
  1.1515 ++	      }
  1.1516 ++	  }
  1.1517 ++	break;
  1.1518 ++      case 4:
  1.1519 ++	// 4 The sign immediately follows the symbol.
  1.1520 ++	if (__precedes)
  1.1521 ++	  {
  1.1522 ++	    __ret.field[0] = symbol;
  1.1523 ++	    __ret.field[1] = sign;
  1.1524 ++	    if (__space)
  1.1525 ++	      {
  1.1526 ++		__ret.field[2] = space;
  1.1527 ++		__ret.field[3] = value;
  1.1528 ++	      }
  1.1529 ++	    else
  1.1530 ++	      {
  1.1531 ++		__ret.field[2] = value;
  1.1532 ++		__ret.field[3] = none;
  1.1533 ++	      }
  1.1534 ++	  }
  1.1535 ++	else
  1.1536 ++	  {
  1.1537 ++	    __ret.field[0] = value;
  1.1538 ++	    if (__space)
  1.1539 ++	      {
  1.1540 ++		__ret.field[1] = space;
  1.1541 ++		__ret.field[2] = symbol;
  1.1542 ++		__ret.field[3] = sign;
  1.1543 ++	      }
  1.1544 ++	    else
  1.1545 ++	      {
  1.1546 ++		__ret.field[1] = symbol;
  1.1547 ++		__ret.field[2] = sign;
  1.1548 ++		__ret.field[3] = none;
  1.1549 ++	      }
  1.1550 ++	  }
  1.1551 ++	break;
  1.1552 ++      default:
  1.1553 ++	__ret = pattern();
  1.1554 ++      }
  1.1555 ++    return __ret;
  1.1556 ++  }
  1.1557 ++
  1.1558 ++  template<> 
  1.1559 ++    void
  1.1560 ++    moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, 
  1.1561 ++						     const char*)
  1.1562 ++    {
  1.1563 ++      if (!_M_data)
  1.1564 ++	_M_data = new __moneypunct_cache<char, true>;
  1.1565 ++
  1.1566 ++      if (!__cloc)
  1.1567 ++	{
  1.1568 ++	  // "C" locale
  1.1569 ++	  _M_data->_M_decimal_point = '.';
  1.1570 ++	  _M_data->_M_thousands_sep = ',';
  1.1571 ++	  _M_data->_M_grouping = "";
  1.1572 ++	  _M_data->_M_grouping_size = 0;
  1.1573 ++	  _M_data->_M_curr_symbol = "";
  1.1574 ++	  _M_data->_M_curr_symbol_size = 0;
  1.1575 ++	  _M_data->_M_positive_sign = "";
  1.1576 ++	  _M_data->_M_positive_sign_size = 0;
  1.1577 ++	  _M_data->_M_negative_sign = "";
  1.1578 ++	  _M_data->_M_negative_sign_size = 0;
  1.1579 ++	  _M_data->_M_frac_digits = 0;
  1.1580 ++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
  1.1581 ++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
  1.1582 ++
  1.1583 ++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1.1584 ++	    _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
  1.1585 ++	}
  1.1586 ++      else
  1.1587 ++	{
  1.1588 ++	  // Named locale.
  1.1589 ++	  _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, 
  1.1590 ++							__cloc));
  1.1591 ++	  _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, 
  1.1592 ++							__cloc));
  1.1593 ++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1.1594 ++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1.1595 ++	  _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1.1596 ++	  _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
  1.1597 ++
  1.1598 ++	  char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
  1.1599 ++	  if (!__nposn)
  1.1600 ++	    _M_data->_M_negative_sign = "()";
  1.1601 ++	  else
  1.1602 ++	    _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, 
  1.1603 ++							__cloc);
  1.1604 ++	  _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
  1.1605 ++
  1.1606 ++	  // _Intl == true
  1.1607 ++	  _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
  1.1608 ++	  _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
  1.1609 ++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, 
  1.1610 ++						      __cloc));
  1.1611 ++	  char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
  1.1612 ++	  char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
  1.1613 ++	  char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
  1.1614 ++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
  1.1615 ++							__pposn);
  1.1616 ++	  char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
  1.1617 ++	  char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
  1.1618 ++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
  1.1619 ++							__nposn);
  1.1620 ++	}
  1.1621 ++    }
  1.1622 ++
  1.1623 ++  template<> 
  1.1624 ++    void
  1.1625 ++    moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, 
  1.1626 ++						      const char*)
  1.1627 ++    {
  1.1628 ++      if (!_M_data)
  1.1629 ++	_M_data = new __moneypunct_cache<char, false>;
  1.1630 ++
  1.1631 ++      if (!__cloc)
  1.1632 ++	{
  1.1633 ++	  // "C" locale
  1.1634 ++	  _M_data->_M_decimal_point = '.';
  1.1635 ++	  _M_data->_M_thousands_sep = ',';
  1.1636 ++	  _M_data->_M_grouping = "";
  1.1637 ++	  _M_data->_M_grouping_size = 0;
  1.1638 ++	  _M_data->_M_curr_symbol = "";
  1.1639 ++	  _M_data->_M_curr_symbol_size = 0;
  1.1640 ++	  _M_data->_M_positive_sign = "";
  1.1641 ++	  _M_data->_M_positive_sign_size = 0;
  1.1642 ++	  _M_data->_M_negative_sign = "";
  1.1643 ++	  _M_data->_M_negative_sign_size = 0;
  1.1644 ++	  _M_data->_M_frac_digits = 0;
  1.1645 ++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
  1.1646 ++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
  1.1647 ++
  1.1648 ++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1.1649 ++	    _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
  1.1650 ++	}
  1.1651 ++      else
  1.1652 ++	{
  1.1653 ++	  // Named locale.
  1.1654 ++	  _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, 
  1.1655 ++							__cloc));
  1.1656 ++	  _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, 
  1.1657 ++							__cloc));
  1.1658 ++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1.1659 ++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1.1660 ++	  _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1.1661 ++	  _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
  1.1662 ++
  1.1663 ++	  char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
  1.1664 ++	  if (!__nposn)
  1.1665 ++	    _M_data->_M_negative_sign = "()";
  1.1666 ++	  else
  1.1667 ++	    _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
  1.1668 ++							__cloc);
  1.1669 ++	  _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
  1.1670 ++
  1.1671 ++	  // _Intl == false
  1.1672 ++	  _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
  1.1673 ++	  _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
  1.1674 ++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
  1.1675 ++	  char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
  1.1676 ++	  char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
  1.1677 ++	  char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
  1.1678 ++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
  1.1679 ++							__pposn);
  1.1680 ++	  char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
  1.1681 ++	  char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
  1.1682 ++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
  1.1683 ++							__nposn);
  1.1684 ++	}
  1.1685 ++    }
  1.1686 ++
  1.1687 ++  template<> 
  1.1688 ++    moneypunct<char, true>::~moneypunct()
  1.1689 ++    { delete _M_data; }
  1.1690 ++
  1.1691 ++  template<> 
  1.1692 ++    moneypunct<char, false>::~moneypunct()
  1.1693 ++    { delete _M_data; }
  1.1694 ++
  1.1695 ++#ifdef _GLIBCXX_USE_WCHAR_T
  1.1696 ++  template<> 
  1.1697 ++    void
  1.1698 ++    moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, 
  1.1699 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1700 ++							const char*)
  1.1701 ++#else
  1.1702 ++							const char* __name)
  1.1703 ++#endif
  1.1704 ++    {
  1.1705 ++      if (!_M_data)
  1.1706 ++	_M_data = new __moneypunct_cache<wchar_t, true>;
  1.1707 ++
  1.1708 ++      if (!__cloc)
  1.1709 ++	{
  1.1710 ++	  // "C" locale
  1.1711 ++	  _M_data->_M_decimal_point = L'.';
  1.1712 ++	  _M_data->_M_thousands_sep = L',';
  1.1713 ++	  _M_data->_M_grouping = "";
  1.1714 ++	  _M_data->_M_grouping_size = 0;
  1.1715 ++	  _M_data->_M_curr_symbol = L"";
  1.1716 ++	  _M_data->_M_curr_symbol_size = 0;
  1.1717 ++	  _M_data->_M_positive_sign = L"";
  1.1718 ++	  _M_data->_M_positive_sign_size = 0;
  1.1719 ++	  _M_data->_M_negative_sign = L"";
  1.1720 ++	  _M_data->_M_negative_sign_size = 0;
  1.1721 ++	  _M_data->_M_frac_digits = 0;
  1.1722 ++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
  1.1723 ++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
  1.1724 ++
  1.1725 ++	  // Use ctype::widen code without the facet...
  1.1726 ++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1.1727 ++	    _M_data->_M_atoms[__i] =
  1.1728 ++	      static_cast<wchar_t>(money_base::_S_atoms[__i]);
  1.1729 ++	}
  1.1730 ++      else
  1.1731 ++	{
  1.1732 ++	  // Named locale.
  1.1733 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1734 ++	  __c_locale __old = __uselocale(__cloc);
  1.1735 ++#else
  1.1736 ++	  // Switch to named locale so that mbsrtowcs will work.
  1.1737 ++	  char* __old = strdup(setlocale(LC_ALL, NULL));
  1.1738 ++	  setlocale(LC_ALL, __name);
  1.1739 ++#endif
  1.1740 ++
  1.1741 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.1742 ++#warning fix this... should be monetary
  1.1743 ++#endif
  1.1744 ++#ifdef __UCLIBC__
  1.1745 ++# ifdef __UCLIBC_HAS_XLOCALE__
  1.1746 ++	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
  1.1747 ++	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
  1.1748 ++# else
  1.1749 ++	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
  1.1750 ++	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
  1.1751 ++# endif
  1.1752 ++#else
  1.1753 ++	  union { char *__s; wchar_t __w; } __u;
  1.1754 ++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
  1.1755 ++	  _M_data->_M_decimal_point = __u.__w;
  1.1756 ++
  1.1757 ++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
  1.1758 ++	  _M_data->_M_thousands_sep = __u.__w;
  1.1759 ++#endif
  1.1760 ++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1.1761 ++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1.1762 ++
  1.1763 ++	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1.1764 ++	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  1.1765 ++	  const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
  1.1766 ++
  1.1767 ++	  wchar_t* __wcs_ps = 0;
  1.1768 ++	  wchar_t* __wcs_ns = 0;
  1.1769 ++	  const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
  1.1770 ++	  try
  1.1771 ++	    {
  1.1772 ++	      mbstate_t __state;
  1.1773 ++	      size_t __len = strlen(__cpossign);
  1.1774 ++	      if (__len)
  1.1775 ++		{
  1.1776 ++		  ++__len;
  1.1777 ++		  memset(&__state, 0, sizeof(mbstate_t));
  1.1778 ++		  __wcs_ps = new wchar_t[__len];
  1.1779 ++		  mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
  1.1780 ++		  _M_data->_M_positive_sign = __wcs_ps;
  1.1781 ++		}
  1.1782 ++	      else
  1.1783 ++		_M_data->_M_positive_sign = L"";
  1.1784 ++	      _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
  1.1785 ++	      
  1.1786 ++	      __len = strlen(__cnegsign);
  1.1787 ++	      if (!__nposn)
  1.1788 ++		_M_data->_M_negative_sign = L"()";
  1.1789 ++	      else if (__len)
  1.1790 ++		{ 
  1.1791 ++		  ++__len;
  1.1792 ++		  memset(&__state, 0, sizeof(mbstate_t));
  1.1793 ++		  __wcs_ns = new wchar_t[__len];
  1.1794 ++		  mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
  1.1795 ++		  _M_data->_M_negative_sign = __wcs_ns;
  1.1796 ++		}
  1.1797 ++	      else
  1.1798 ++		_M_data->_M_negative_sign = L"";
  1.1799 ++	      _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
  1.1800 ++	      
  1.1801 ++	      // _Intl == true.
  1.1802 ++	      __len = strlen(__ccurr);
  1.1803 ++	      if (__len)
  1.1804 ++		{
  1.1805 ++		  ++__len;
  1.1806 ++		  memset(&__state, 0, sizeof(mbstate_t));
  1.1807 ++		  wchar_t* __wcs = new wchar_t[__len];
  1.1808 ++		  mbsrtowcs(__wcs, &__ccurr, __len, &__state);
  1.1809 ++		  _M_data->_M_curr_symbol = __wcs;
  1.1810 ++		}
  1.1811 ++	      else
  1.1812 ++		_M_data->_M_curr_symbol = L"";
  1.1813 ++	      _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
  1.1814 ++	    }
  1.1815 ++	  catch (...)
  1.1816 ++	    {
  1.1817 ++	      delete _M_data;
  1.1818 ++	      _M_data = 0;
  1.1819 ++	      delete __wcs_ps;
  1.1820 ++	      delete __wcs_ns;	      
  1.1821 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1822 ++	      __uselocale(__old);
  1.1823 ++#else
  1.1824 ++	      setlocale(LC_ALL, __old);
  1.1825 ++	      free(__old);
  1.1826 ++#endif
  1.1827 ++	      __throw_exception_again;
  1.1828 ++	    } 
  1.1829 ++	  
  1.1830 ++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, 
  1.1831 ++						      __cloc));
  1.1832 ++	  char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
  1.1833 ++	  char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
  1.1834 ++	  char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
  1.1835 ++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
  1.1836 ++							__pposn);
  1.1837 ++	  char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
  1.1838 ++	  char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
  1.1839 ++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
  1.1840 ++							__nposn);
  1.1841 ++
  1.1842 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1843 ++	  __uselocale(__old);
  1.1844 ++#else
  1.1845 ++	  setlocale(LC_ALL, __old);
  1.1846 ++	  free(__old);
  1.1847 ++#endif
  1.1848 ++	}
  1.1849 ++    }
  1.1850 ++
  1.1851 ++  template<> 
  1.1852 ++  void
  1.1853 ++  moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
  1.1854 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1855 ++						       const char*)
  1.1856 ++#else
  1.1857 ++                                                       const char* __name)
  1.1858 ++#endif
  1.1859 ++  {
  1.1860 ++    if (!_M_data)
  1.1861 ++      _M_data = new __moneypunct_cache<wchar_t, false>;
  1.1862 ++
  1.1863 ++    if (!__cloc)
  1.1864 ++	{
  1.1865 ++	  // "C" locale
  1.1866 ++	  _M_data->_M_decimal_point = L'.';
  1.1867 ++	  _M_data->_M_thousands_sep = L',';
  1.1868 ++	  _M_data->_M_grouping = "";
  1.1869 ++          _M_data->_M_grouping_size = 0;
  1.1870 ++	  _M_data->_M_curr_symbol = L"";
  1.1871 ++	  _M_data->_M_curr_symbol_size = 0;
  1.1872 ++	  _M_data->_M_positive_sign = L"";
  1.1873 ++	  _M_data->_M_positive_sign_size = 0;
  1.1874 ++	  _M_data->_M_negative_sign = L"";
  1.1875 ++	  _M_data->_M_negative_sign_size = 0;
  1.1876 ++	  _M_data->_M_frac_digits = 0;
  1.1877 ++	  _M_data->_M_pos_format = money_base::_S_default_pattern;
  1.1878 ++	  _M_data->_M_neg_format = money_base::_S_default_pattern;
  1.1879 ++
  1.1880 ++	  // Use ctype::widen code without the facet...
  1.1881 ++	  for (size_t __i = 0; __i < money_base::_S_end; ++__i)
  1.1882 ++	    _M_data->_M_atoms[__i] =
  1.1883 ++	      static_cast<wchar_t>(money_base::_S_atoms[__i]);
  1.1884 ++	}
  1.1885 ++      else
  1.1886 ++	{
  1.1887 ++	  // Named locale.
  1.1888 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1889 ++	  __c_locale __old = __uselocale(__cloc);
  1.1890 ++#else
  1.1891 ++	  // Switch to named locale so that mbsrtowcs will work.
  1.1892 ++	  char* __old = strdup(setlocale(LC_ALL, NULL));
  1.1893 ++	  setlocale(LC_ALL, __name);
  1.1894 ++#endif
  1.1895 ++
  1.1896 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.1897 ++#warning fix this... should be monetary
  1.1898 ++#endif
  1.1899 ++#ifdef __UCLIBC__
  1.1900 ++# ifdef __UCLIBC_HAS_XLOCALE__
  1.1901 ++	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
  1.1902 ++	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
  1.1903 ++# else
  1.1904 ++	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
  1.1905 ++	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
  1.1906 ++# endif
  1.1907 ++#else
  1.1908 ++          union { char *__s; wchar_t __w; } __u;
  1.1909 ++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
  1.1910 ++	  _M_data->_M_decimal_point = __u.__w;
  1.1911 ++
  1.1912 ++	  __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
  1.1913 ++	  _M_data->_M_thousands_sep = __u.__w;
  1.1914 ++#endif
  1.1915 ++	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
  1.1916 ++          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1.1917 ++
  1.1918 ++	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  1.1919 ++	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  1.1920 ++	  const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
  1.1921 ++
  1.1922 ++	  wchar_t* __wcs_ps = 0;
  1.1923 ++	  wchar_t* __wcs_ns = 0;
  1.1924 ++	  const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
  1.1925 ++	  try
  1.1926 ++            {
  1.1927 ++              mbstate_t __state;
  1.1928 ++              size_t __len;
  1.1929 ++              __len = strlen(__cpossign);
  1.1930 ++              if (__len)
  1.1931 ++                {
  1.1932 ++		  ++__len;
  1.1933 ++		  memset(&__state, 0, sizeof(mbstate_t));
  1.1934 ++		  __wcs_ps = new wchar_t[__len];
  1.1935 ++		  mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
  1.1936 ++		  _M_data->_M_positive_sign = __wcs_ps;
  1.1937 ++		}
  1.1938 ++	      else
  1.1939 ++		_M_data->_M_positive_sign = L"";
  1.1940 ++              _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
  1.1941 ++	      
  1.1942 ++	      __len = strlen(__cnegsign);
  1.1943 ++	      if (!__nposn)
  1.1944 ++		_M_data->_M_negative_sign = L"()";
  1.1945 ++	      else if (__len)
  1.1946 ++		{ 
  1.1947 ++		  ++__len;
  1.1948 ++		  memset(&__state, 0, sizeof(mbstate_t));
  1.1949 ++		  __wcs_ns = new wchar_t[__len];
  1.1950 ++		  mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
  1.1951 ++		  _M_data->_M_negative_sign = __wcs_ns;
  1.1952 ++		}
  1.1953 ++	      else
  1.1954 ++		_M_data->_M_negative_sign = L"";
  1.1955 ++              _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
  1.1956 ++
  1.1957 ++	      // _Intl == true.
  1.1958 ++	      __len = strlen(__ccurr);
  1.1959 ++	      if (__len)
  1.1960 ++		{
  1.1961 ++		  ++__len;
  1.1962 ++		  memset(&__state, 0, sizeof(mbstate_t));
  1.1963 ++		  wchar_t* __wcs = new wchar_t[__len];
  1.1964 ++		  mbsrtowcs(__wcs, &__ccurr, __len, &__state);
  1.1965 ++		  _M_data->_M_curr_symbol = __wcs;
  1.1966 ++		}
  1.1967 ++	      else
  1.1968 ++		_M_data->_M_curr_symbol = L"";
  1.1969 ++              _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
  1.1970 ++	    }
  1.1971 ++          catch (...)
  1.1972 ++	    {
  1.1973 ++	      delete _M_data;
  1.1974 ++              _M_data = 0;
  1.1975 ++	      delete __wcs_ps;
  1.1976 ++	      delete __wcs_ns;	      
  1.1977 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1978 ++	      __uselocale(__old);
  1.1979 ++#else
  1.1980 ++	      setlocale(LC_ALL, __old);
  1.1981 ++	      free(__old);
  1.1982 ++#endif
  1.1983 ++              __throw_exception_again;
  1.1984 ++	    }
  1.1985 ++
  1.1986 ++	  _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
  1.1987 ++	  char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
  1.1988 ++	  char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
  1.1989 ++	  char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
  1.1990 ++	  _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
  1.1991 ++	                                                __pposn);
  1.1992 ++	  char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
  1.1993 ++	  char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
  1.1994 ++	  _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
  1.1995 ++	                                                __nposn);
  1.1996 ++
  1.1997 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.1998 ++	  __uselocale(__old);
  1.1999 ++#else
  1.2000 ++	  setlocale(LC_ALL, __old);
  1.2001 ++	  free(__old);
  1.2002 ++#endif
  1.2003 ++	}
  1.2004 ++    }
  1.2005 ++
  1.2006 ++  template<> 
  1.2007 ++    moneypunct<wchar_t, true>::~moneypunct()
  1.2008 ++    {
  1.2009 ++      if (_M_data->_M_positive_sign_size)
  1.2010 ++	delete [] _M_data->_M_positive_sign;
  1.2011 ++      if (_M_data->_M_negative_sign_size
  1.2012 ++          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
  1.2013 ++	delete [] _M_data->_M_negative_sign;
  1.2014 ++      if (_M_data->_M_curr_symbol_size)
  1.2015 ++	delete [] _M_data->_M_curr_symbol;
  1.2016 ++      delete _M_data;
  1.2017 ++    }
  1.2018 ++
  1.2019 ++  template<> 
  1.2020 ++    moneypunct<wchar_t, false>::~moneypunct()
  1.2021 ++    {
  1.2022 ++      if (_M_data->_M_positive_sign_size)
  1.2023 ++	delete [] _M_data->_M_positive_sign;
  1.2024 ++      if (_M_data->_M_negative_sign_size
  1.2025 ++          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
  1.2026 ++	delete [] _M_data->_M_negative_sign;
  1.2027 ++      if (_M_data->_M_curr_symbol_size)
  1.2028 ++	delete [] _M_data->_M_curr_symbol;
  1.2029 ++      delete _M_data;
  1.2030 ++    }
  1.2031 ++#endif
  1.2032 ++}
  1.2033 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc
  1.2034 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/numeric_members.cc	1969-12-31 18:00:00.000000000 -0600
  1.2035 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc	2005-04-28 01:20:20.000000000 -0500
  1.2036 +@@ -0,0 +1,173 @@
  1.2037 ++// std::numpunct implementation details, GNU version -*- C++ -*-
  1.2038 ++
  1.2039 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  1.2040 ++//
  1.2041 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.2042 ++// software; you can redistribute it and/or modify it under the
  1.2043 ++// terms of the GNU General Public License as published by the
  1.2044 ++// Free Software Foundation; either version 2, or (at your option)
  1.2045 ++// any later version.
  1.2046 ++
  1.2047 ++// This library is distributed in the hope that it will be useful,
  1.2048 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.2049 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.2050 ++// GNU General Public License for more details.
  1.2051 ++
  1.2052 ++// You should have received a copy of the GNU General Public License along
  1.2053 ++// with this library; see the file COPYING.  If not, write to the Free
  1.2054 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.2055 ++// USA.
  1.2056 ++
  1.2057 ++// As a special exception, you may use this file as part of a free software
  1.2058 ++// library without restriction.  Specifically, if other files instantiate
  1.2059 ++// templates or use macros or inline functions from this file, or you compile
  1.2060 ++// this file and link it with other files to produce an executable, this
  1.2061 ++// file does not by itself cause the resulting executable to be covered by
  1.2062 ++// the GNU General Public License.  This exception does not however
  1.2063 ++// invalidate any other reasons why the executable file might be covered by
  1.2064 ++// the GNU General Public License.
  1.2065 ++
  1.2066 ++//
  1.2067 ++// ISO C++ 14882: 22.2.3.1.2  numpunct virtual functions
  1.2068 ++//
  1.2069 ++
  1.2070 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
  1.2071 ++
  1.2072 ++#define _LIBC
  1.2073 ++#include <locale>
  1.2074 ++#undef _LIBC
  1.2075 ++#include <bits/c++locale_internal.h>
  1.2076 ++
  1.2077 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.2078 ++#warning tailor for stub locale support
  1.2079 ++#endif
  1.2080 ++#ifndef __UCLIBC_HAS_XLOCALE__
  1.2081 ++#define __nl_langinfo_l(N, L)         nl_langinfo((N))
  1.2082 ++#endif
  1.2083 ++
  1.2084 ++namespace std
  1.2085 ++{
  1.2086 ++  template<> 
  1.2087 ++    void
  1.2088 ++    numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
  1.2089 ++    {
  1.2090 ++      if (!_M_data)
  1.2091 ++	_M_data = new __numpunct_cache<char>;
  1.2092 ++
  1.2093 ++      if (!__cloc)
  1.2094 ++	{
  1.2095 ++	  // "C" locale
  1.2096 ++	  _M_data->_M_grouping = "";
  1.2097 ++	  _M_data->_M_grouping_size = 0;
  1.2098 ++	  _M_data->_M_use_grouping = false;
  1.2099 ++
  1.2100 ++	  _M_data->_M_decimal_point = '.';
  1.2101 ++	  _M_data->_M_thousands_sep = ',';
  1.2102 ++
  1.2103 ++	  for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
  1.2104 ++	    _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
  1.2105 ++
  1.2106 ++	  for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
  1.2107 ++	    _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
  1.2108 ++	}
  1.2109 ++      else
  1.2110 ++	{
  1.2111 ++	  // Named locale.
  1.2112 ++	  _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, 
  1.2113 ++							__cloc));
  1.2114 ++	  _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, 
  1.2115 ++							__cloc));
  1.2116 ++
  1.2117 ++	  // Check for NULL, which implies no grouping.
  1.2118 ++	  if (_M_data->_M_thousands_sep == '\0')
  1.2119 ++	    _M_data->_M_grouping = "";
  1.2120 ++	  else
  1.2121 ++	    _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  1.2122 ++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1.2123 ++	}
  1.2124 ++
  1.2125 ++      // NB: There is no way to extact this info from posix locales.
  1.2126 ++      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
  1.2127 ++      _M_data->_M_truename = "true";
  1.2128 ++      _M_data->_M_truename_size = 4;
  1.2129 ++      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
  1.2130 ++      _M_data->_M_falsename = "false";
  1.2131 ++      _M_data->_M_falsename_size = 5;
  1.2132 ++    }
  1.2133 ++ 
  1.2134 ++  template<> 
  1.2135 ++    numpunct<char>::~numpunct()
  1.2136 ++    { delete _M_data; }
  1.2137 ++   
  1.2138 ++#ifdef _GLIBCXX_USE_WCHAR_T
  1.2139 ++  template<> 
  1.2140 ++    void
  1.2141 ++    numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
  1.2142 ++    {
  1.2143 ++      if (!_M_data)
  1.2144 ++	_M_data = new __numpunct_cache<wchar_t>;
  1.2145 ++
  1.2146 ++      if (!__cloc)
  1.2147 ++	{
  1.2148 ++	  // "C" locale
  1.2149 ++	  _M_data->_M_grouping = "";
  1.2150 ++	  _M_data->_M_grouping_size = 0;
  1.2151 ++	  _M_data->_M_use_grouping = false;
  1.2152 ++
  1.2153 ++	  _M_data->_M_decimal_point = L'.';
  1.2154 ++	  _M_data->_M_thousands_sep = L',';
  1.2155 ++
  1.2156 ++	  // Use ctype::widen code without the facet...
  1.2157 ++	  for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
  1.2158 ++	    _M_data->_M_atoms_out[__i] =
  1.2159 ++	      static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
  1.2160 ++
  1.2161 ++	  for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
  1.2162 ++	    _M_data->_M_atoms_in[__j] =
  1.2163 ++	      static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
  1.2164 ++	}
  1.2165 ++      else
  1.2166 ++	{
  1.2167 ++	  // Named locale.
  1.2168 ++	  // NB: In the GNU model wchar_t is always 32 bit wide.
  1.2169 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.2170 ++#warning fix this
  1.2171 ++#endif
  1.2172 ++#ifdef __UCLIBC__
  1.2173 ++# ifdef __UCLIBC_HAS_XLOCALE__
  1.2174 ++	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
  1.2175 ++	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
  1.2176 ++# else
  1.2177 ++	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
  1.2178 ++	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
  1.2179 ++# endif
  1.2180 ++#else
  1.2181 ++	  union { char *__s; wchar_t __w; } __u;
  1.2182 ++	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
  1.2183 ++	  _M_data->_M_decimal_point = __u.__w;
  1.2184 ++
  1.2185 ++	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
  1.2186 ++	  _M_data->_M_thousands_sep = __u.__w;
  1.2187 ++#endif
  1.2188 ++
  1.2189 ++	  if (_M_data->_M_thousands_sep == L'\0')
  1.2190 ++	    _M_data->_M_grouping = "";
  1.2191 ++	  else
  1.2192 ++	    _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  1.2193 ++	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
  1.2194 ++	}
  1.2195 ++
  1.2196 ++      // NB: There is no way to extact this info from posix locales.
  1.2197 ++      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
  1.2198 ++      _M_data->_M_truename = L"true";
  1.2199 ++      _M_data->_M_truename_size = 4;
  1.2200 ++      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
  1.2201 ++      _M_data->_M_falsename = L"false";
  1.2202 ++      _M_data->_M_falsename_size = 5;
  1.2203 ++    }
  1.2204 ++
  1.2205 ++  template<> 
  1.2206 ++    numpunct<wchar_t>::~numpunct()
  1.2207 ++    { delete _M_data; }
  1.2208 ++ #endif
  1.2209 ++}
  1.2210 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc
  1.2211 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.cc	1969-12-31 18:00:00.000000000 -0600
  1.2212 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.cc	2005-04-28 01:13:15.000000000 -0500
  1.2213 +@@ -0,0 +1,406 @@
  1.2214 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
  1.2215 ++
  1.2216 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  1.2217 ++//
  1.2218 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.2219 ++// software; you can redistribute it and/or modify it under the
  1.2220 ++// terms of the GNU General Public License as published by the
  1.2221 ++// Free Software Foundation; either version 2, or (at your option)
  1.2222 ++// any later version.
  1.2223 ++
  1.2224 ++// This library is distributed in the hope that it will be useful,
  1.2225 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.2226 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.2227 ++// GNU General Public License for more details.
  1.2228 ++
  1.2229 ++// You should have received a copy of the GNU General Public License along
  1.2230 ++// with this library; see the file COPYING.  If not, write to the Free
  1.2231 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.2232 ++// USA.
  1.2233 ++
  1.2234 ++// As a special exception, you may use this file as part of a free software
  1.2235 ++// library without restriction.  Specifically, if other files instantiate
  1.2236 ++// templates or use macros or inline functions from this file, or you compile
  1.2237 ++// this file and link it with other files to produce an executable, this
  1.2238 ++// file does not by itself cause the resulting executable to be covered by
  1.2239 ++// the GNU General Public License.  This exception does not however
  1.2240 ++// invalidate any other reasons why the executable file might be covered by
  1.2241 ++// the GNU General Public License.
  1.2242 ++
  1.2243 ++//
  1.2244 ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
  1.2245 ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
  1.2246 ++//
  1.2247 ++
  1.2248 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
  1.2249 ++
  1.2250 ++#include <locale>
  1.2251 ++#include <bits/c++locale_internal.h>
  1.2252 ++
  1.2253 ++#ifdef __UCLIBC_MJN3_ONLY__
  1.2254 ++#warning tailor for stub locale support
  1.2255 ++#endif
  1.2256 ++#ifndef __UCLIBC_HAS_XLOCALE__
  1.2257 ++#define __nl_langinfo_l(N, L)         nl_langinfo((N))
  1.2258 ++#endif
  1.2259 ++
  1.2260 ++namespace std
  1.2261 ++{
  1.2262 ++  template<>
  1.2263 ++    void
  1.2264 ++    __timepunct<char>::
  1.2265 ++    _M_put(char* __s, size_t __maxlen, const char* __format, 
  1.2266 ++	   const tm* __tm) const
  1.2267 ++    {
  1.2268 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.2269 ++      const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
  1.2270 ++					_M_c_locale_timepunct);
  1.2271 ++#else
  1.2272 ++      char* __old = strdup(setlocale(LC_ALL, NULL));
  1.2273 ++      setlocale(LC_ALL, _M_name_timepunct);
  1.2274 ++      const size_t __len = strftime(__s, __maxlen, __format, __tm);
  1.2275 ++      setlocale(LC_ALL, __old);
  1.2276 ++      free(__old);
  1.2277 ++#endif
  1.2278 ++      // Make sure __s is null terminated.
  1.2279 ++      if (__len == 0)
  1.2280 ++	__s[0] = '\0';
  1.2281 ++    }
  1.2282 ++
  1.2283 ++  template<> 
  1.2284 ++    void
  1.2285 ++    __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
  1.2286 ++    {
  1.2287 ++      if (!_M_data)
  1.2288 ++	_M_data = new __timepunct_cache<char>;
  1.2289 ++
  1.2290 ++      if (!__cloc)
  1.2291 ++	{
  1.2292 ++	  // "C" locale
  1.2293 ++	  _M_c_locale_timepunct = _S_get_c_locale();
  1.2294 ++
  1.2295 ++	  _M_data->_M_date_format = "%m/%d/%y";
  1.2296 ++	  _M_data->_M_date_era_format = "%m/%d/%y";
  1.2297 ++	  _M_data->_M_time_format = "%H:%M:%S";
  1.2298 ++	  _M_data->_M_time_era_format = "%H:%M:%S";
  1.2299 ++	  _M_data->_M_date_time_format = "";
  1.2300 ++	  _M_data->_M_date_time_era_format = "";
  1.2301 ++	  _M_data->_M_am = "AM";
  1.2302 ++	  _M_data->_M_pm = "PM";
  1.2303 ++	  _M_data->_M_am_pm_format = "";
  1.2304 ++
  1.2305 ++	  // Day names, starting with "C"'s Sunday.
  1.2306 ++	  _M_data->_M_day1 = "Sunday";
  1.2307 ++	  _M_data->_M_day2 = "Monday";
  1.2308 ++	  _M_data->_M_day3 = "Tuesday";
  1.2309 ++	  _M_data->_M_day4 = "Wednesday";
  1.2310 ++	  _M_data->_M_day5 = "Thursday";
  1.2311 ++	  _M_data->_M_day6 = "Friday";
  1.2312 ++	  _M_data->_M_day7 = "Saturday";
  1.2313 ++
  1.2314 ++	  // Abbreviated day names, starting with "C"'s Sun.
  1.2315 ++	  _M_data->_M_aday1 = "Sun";
  1.2316 ++	  _M_data->_M_aday2 = "Mon";
  1.2317 ++	  _M_data->_M_aday3 = "Tue";
  1.2318 ++	  _M_data->_M_aday4 = "Wed";
  1.2319 ++	  _M_data->_M_aday5 = "Thu";
  1.2320 ++	  _M_data->_M_aday6 = "Fri";
  1.2321 ++	  _M_data->_M_aday7 = "Sat";
  1.2322 ++
  1.2323 ++	  // Month names, starting with "C"'s January.
  1.2324 ++	  _M_data->_M_month01 = "January";
  1.2325 ++	  _M_data->_M_month02 = "February";
  1.2326 ++	  _M_data->_M_month03 = "March";
  1.2327 ++	  _M_data->_M_month04 = "April";
  1.2328 ++	  _M_data->_M_month05 = "May";
  1.2329 ++	  _M_data->_M_month06 = "June";
  1.2330 ++	  _M_data->_M_month07 = "July";
  1.2331 ++	  _M_data->_M_month08 = "August";
  1.2332 ++	  _M_data->_M_month09 = "September";
  1.2333 ++	  _M_data->_M_month10 = "October";
  1.2334 ++	  _M_data->_M_month11 = "November";
  1.2335 ++	  _M_data->_M_month12 = "December";
  1.2336 ++
  1.2337 ++	  // Abbreviated month names, starting with "C"'s Jan.
  1.2338 ++	  _M_data->_M_amonth01 = "Jan";
  1.2339 ++	  _M_data->_M_amonth02 = "Feb";
  1.2340 ++	  _M_data->_M_amonth03 = "Mar";
  1.2341 ++	  _M_data->_M_amonth04 = "Apr";
  1.2342 ++	  _M_data->_M_amonth05 = "May";
  1.2343 ++	  _M_data->_M_amonth06 = "Jun";
  1.2344 ++	  _M_data->_M_amonth07 = "Jul";
  1.2345 ++	  _M_data->_M_amonth08 = "Aug";
  1.2346 ++	  _M_data->_M_amonth09 = "Sep";
  1.2347 ++	  _M_data->_M_amonth10 = "Oct";
  1.2348 ++	  _M_data->_M_amonth11 = "Nov";
  1.2349 ++	  _M_data->_M_amonth12 = "Dec";
  1.2350 ++	}
  1.2351 ++      else
  1.2352 ++	{
  1.2353 ++	  _M_c_locale_timepunct = _S_clone_c_locale(__cloc); 
  1.2354 ++
  1.2355 ++	  _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
  1.2356 ++	  _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
  1.2357 ++	  _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
  1.2358 ++	  _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
  1.2359 ++	  _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
  1.2360 ++	  _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
  1.2361 ++							     __cloc);
  1.2362 ++	  _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
  1.2363 ++	  _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
  1.2364 ++	  _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
  1.2365 ++
  1.2366 ++	  // Day names, starting with "C"'s Sunday.
  1.2367 ++	  _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
  1.2368 ++	  _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
  1.2369 ++	  _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
  1.2370 ++	  _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
  1.2371 ++	  _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
  1.2372 ++	  _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
  1.2373 ++	  _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
  1.2374 ++
  1.2375 ++	  // Abbreviated day names, starting with "C"'s Sun.
  1.2376 ++	  _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
  1.2377 ++	  _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
  1.2378 ++	  _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
  1.2379 ++	  _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
  1.2380 ++	  _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
  1.2381 ++	  _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
  1.2382 ++	  _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
  1.2383 ++
  1.2384 ++	  // Month names, starting with "C"'s January.
  1.2385 ++	  _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
  1.2386 ++	  _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
  1.2387 ++	  _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
  1.2388 ++	  _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
  1.2389 ++	  _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
  1.2390 ++	  _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
  1.2391 ++	  _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
  1.2392 ++	  _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
  1.2393 ++	  _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
  1.2394 ++	  _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
  1.2395 ++	  _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
  1.2396 ++	  _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
  1.2397 ++
  1.2398 ++	  // Abbreviated month names, starting with "C"'s Jan.
  1.2399 ++	  _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
  1.2400 ++	  _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
  1.2401 ++	  _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
  1.2402 ++	  _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
  1.2403 ++	  _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
  1.2404 ++	  _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
  1.2405 ++	  _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
  1.2406 ++	  _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
  1.2407 ++	  _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
  1.2408 ++	  _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
  1.2409 ++	  _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
  1.2410 ++	  _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
  1.2411 ++	}
  1.2412 ++    }
  1.2413 ++
  1.2414 ++#ifdef _GLIBCXX_USE_WCHAR_T
  1.2415 ++  template<>
  1.2416 ++    void
  1.2417 ++    __timepunct<wchar_t>::
  1.2418 ++    _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, 
  1.2419 ++	   const tm* __tm) const
  1.2420 ++    {
  1.2421 ++#ifdef __UCLIBC_HAS_XLOCALE__
  1.2422 ++      __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
  1.2423 ++      const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
  1.2424 ++					_M_c_locale_timepunct);
  1.2425 ++#else
  1.2426 ++      char* __old = strdup(setlocale(LC_ALL, NULL));
  1.2427 ++      setlocale(LC_ALL, _M_name_timepunct);
  1.2428 ++      const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
  1.2429 ++      setlocale(LC_ALL, __old);
  1.2430 ++      free(__old);
  1.2431 ++#endif
  1.2432 ++      // Make sure __s is null terminated.
  1.2433 ++      if (__len == 0)
  1.2434 ++	__s[0] = L'\0';
  1.2435 ++    }
  1.2436 ++
  1.2437 ++  template<> 
  1.2438 ++    void
  1.2439 ++    __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
  1.2440 ++    {
  1.2441 ++      if (!_M_data)
  1.2442 ++	_M_data = new __timepunct_cache<wchar_t>;
  1.2443 ++
  1.2444 ++#warning wide time stuff
  1.2445 ++//       if (!__cloc)
  1.2446 ++	{
  1.2447 ++	  // "C" locale
  1.2448 ++	  _M_c_locale_timepunct = _S_get_c_locale();
  1.2449 ++
  1.2450 ++	  _M_data->_M_date_format = L"%m/%d/%y";
  1.2451 ++	  _M_data->_M_date_era_format = L"%m/%d/%y";
  1.2452 ++	  _M_data->_M_time_format = L"%H:%M:%S";
  1.2453 ++	  _M_data->_M_time_era_format = L"%H:%M:%S";
  1.2454 ++	  _M_data->_M_date_time_format = L"";
  1.2455 ++	  _M_data->_M_date_time_era_format = L"";
  1.2456 ++	  _M_data->_M_am = L"AM";
  1.2457 ++	  _M_data->_M_pm = L"PM";
  1.2458 ++	  _M_data->_M_am_pm_format = L"";
  1.2459 ++
  1.2460 ++	  // Day names, starting with "C"'s Sunday.
  1.2461 ++	  _M_data->_M_day1 = L"Sunday";
  1.2462 ++	  _M_data->_M_day2 = L"Monday";
  1.2463 ++	  _M_data->_M_day3 = L"Tuesday";
  1.2464 ++	  _M_data->_M_day4 = L"Wednesday";
  1.2465 ++	  _M_data->_M_day5 = L"Thursday";
  1.2466 ++	  _M_data->_M_day6 = L"Friday";
  1.2467 ++	  _M_data->_M_day7 = L"Saturday";
  1.2468 ++
  1.2469 ++	  // Abbreviated day names, starting with "C"'s Sun.
  1.2470 ++	  _M_data->_M_aday1 = L"Sun";
  1.2471 ++	  _M_data->_M_aday2 = L"Mon";
  1.2472 ++	  _M_data->_M_aday3 = L"Tue";
  1.2473 ++	  _M_data->_M_aday4 = L"Wed";
  1.2474 ++	  _M_data->_M_aday5 = L"Thu";
  1.2475 ++	  _M_data->_M_aday6 = L"Fri";
  1.2476 ++	  _M_data->_M_aday7 = L"Sat";
  1.2477 ++
  1.2478 ++	  // Month names, starting with "C"'s January.
  1.2479 ++	  _M_data->_M_month01 = L"January";
  1.2480 ++	  _M_data->_M_month02 = L"February";
  1.2481 ++	  _M_data->_M_month03 = L"March";
  1.2482 ++	  _M_data->_M_month04 = L"April";
  1.2483 ++	  _M_data->_M_month05 = L"May";
  1.2484 ++	  _M_data->_M_month06 = L"June";
  1.2485 ++	  _M_data->_M_month07 = L"July";
  1.2486 ++	  _M_data->_M_month08 = L"August";
  1.2487 ++	  _M_data->_M_month09 = L"September";
  1.2488 ++	  _M_data->_M_month10 = L"October";
  1.2489 ++	  _M_data->_M_month11 = L"November";
  1.2490 ++	  _M_data->_M_month12 = L"December";
  1.2491 ++
  1.2492 ++	  // Abbreviated month names, starting with "C"'s Jan.
  1.2493 ++	  _M_data->_M_amonth01 = L"Jan";
  1.2494 ++	  _M_data->_M_amonth02 = L"Feb";
  1.2495 ++	  _M_data->_M_amonth03 = L"Mar";
  1.2496 ++	  _M_data->_M_amonth04 = L"Apr";
  1.2497 ++	  _M_data->_M_amonth05 = L"May";
  1.2498 ++	  _M_data->_M_amonth06 = L"Jun";
  1.2499 ++	  _M_data->_M_amonth07 = L"Jul";
  1.2500 ++	  _M_data->_M_amonth08 = L"Aug";
  1.2501 ++	  _M_data->_M_amonth09 = L"Sep";
  1.2502 ++	  _M_data->_M_amonth10 = L"Oct";
  1.2503 ++	  _M_data->_M_amonth11 = L"Nov";
  1.2504 ++	  _M_data->_M_amonth12 = L"Dec";
  1.2505 ++	}
  1.2506 ++#if 0
  1.2507 ++      else
  1.2508 ++	{
  1.2509 ++	  _M_c_locale_timepunct = _S_clone_c_locale(__cloc); 
  1.2510 ++
  1.2511 ++	  union { char *__s; wchar_t *__w; } __u;
  1.2512 ++
  1.2513 ++	  __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
  1.2514 ++	  _M_data->_M_date_format = __u.__w;
  1.2515 ++	  __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
  1.2516 ++	  _M_data->_M_date_era_format = __u.__w;
  1.2517 ++	  __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
  1.2518 ++	  _M_data->_M_time_format = __u.__w;
  1.2519 ++	  __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
  1.2520 ++	  _M_data->_M_time_era_format = __u.__w;
  1.2521 ++	  __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
  1.2522 ++	  _M_data->_M_date_time_format = __u.__w;
  1.2523 ++	  __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
  1.2524 ++	  _M_data->_M_date_time_era_format = __u.__w;
  1.2525 ++	  __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
  1.2526 ++	  _M_data->_M_am = __u.__w;
  1.2527 ++	  __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
  1.2528 ++	  _M_data->_M_pm = __u.__w;
  1.2529 ++	  __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
  1.2530 ++	  _M_data->_M_am_pm_format = __u.__w;
  1.2531 ++
  1.2532 ++	  // Day names, starting with "C"'s Sunday.
  1.2533 ++	  __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
  1.2534 ++	  _M_data->_M_day1 = __u.__w;
  1.2535 ++	  __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
  1.2536 ++	  _M_data->_M_day2 = __u.__w;
  1.2537 ++	  __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
  1.2538 ++	  _M_data->_M_day3 = __u.__w;
  1.2539 ++	  __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
  1.2540 ++	  _M_data->_M_day4 = __u.__w;
  1.2541 ++	  __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
  1.2542 ++	  _M_data->_M_day5 = __u.__w;
  1.2543 ++	  __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
  1.2544 ++	  _M_data->_M_day6 = __u.__w;
  1.2545 ++	  __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
  1.2546 ++	  _M_data->_M_day7 = __u.__w;
  1.2547 ++
  1.2548 ++	  // Abbreviated day names, starting with "C"'s Sun.
  1.2549 ++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
  1.2550 ++	  _M_data->_M_aday1 = __u.__w;
  1.2551 ++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
  1.2552 ++	  _M_data->_M_aday2 = __u.__w;
  1.2553 ++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
  1.2554 ++	  _M_data->_M_aday3 = __u.__w;
  1.2555 ++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
  1.2556 ++	  _M_data->_M_aday4 = __u.__w;
  1.2557 ++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
  1.2558 ++	  _M_data->_M_aday5 = __u.__w;
  1.2559 ++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
  1.2560 ++	  _M_data->_M_aday6 = __u.__w;
  1.2561 ++	  __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
  1.2562 ++	  _M_data->_M_aday7 = __u.__w;
  1.2563 ++
  1.2564 ++	  // Month names, starting with "C"'s January.
  1.2565 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
  1.2566 ++	  _M_data->_M_month01 = __u.__w;
  1.2567 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
  1.2568 ++	  _M_data->_M_month02 = __u.__w;
  1.2569 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
  1.2570 ++	  _M_data->_M_month03 = __u.__w;
  1.2571 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
  1.2572 ++	  _M_data->_M_month04 = __u.__w;
  1.2573 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
  1.2574 ++	  _M_data->_M_month05 = __u.__w;
  1.2575 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
  1.2576 ++	  _M_data->_M_month06 = __u.__w;
  1.2577 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
  1.2578 ++	  _M_data->_M_month07 = __u.__w;
  1.2579 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
  1.2580 ++	  _M_data->_M_month08 = __u.__w;
  1.2581 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
  1.2582 ++	  _M_data->_M_month09 = __u.__w;
  1.2583 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
  1.2584 ++	  _M_data->_M_month10 = __u.__w;
  1.2585 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
  1.2586 ++	  _M_data->_M_month11 = __u.__w;
  1.2587 ++	  __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
  1.2588 ++	  _M_data->_M_month12 = __u.__w;
  1.2589 ++
  1.2590 ++	  // Abbreviated month names, starting with "C"'s Jan.
  1.2591 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
  1.2592 ++	  _M_data->_M_amonth01 = __u.__w;
  1.2593 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
  1.2594 ++	  _M_data->_M_amonth02 = __u.__w;
  1.2595 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
  1.2596 ++	  _M_data->_M_amonth03 = __u.__w;
  1.2597 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
  1.2598 ++	  _M_data->_M_amonth04 = __u.__w;
  1.2599 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
  1.2600 ++	  _M_data->_M_amonth05 = __u.__w;
  1.2601 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
  1.2602 ++	  _M_data->_M_amonth06 = __u.__w;
  1.2603 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
  1.2604 ++	  _M_data->_M_amonth07 = __u.__w;
  1.2605 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
  1.2606 ++	  _M_data->_M_amonth08 = __u.__w;
  1.2607 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
  1.2608 ++	  _M_data->_M_amonth09 = __u.__w;
  1.2609 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
  1.2610 ++	  _M_data->_M_amonth10 = __u.__w;
  1.2611 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
  1.2612 ++	  _M_data->_M_amonth11 = __u.__w;
  1.2613 ++	  __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
  1.2614 ++	  _M_data->_M_amonth12 = __u.__w;
  1.2615 ++	}
  1.2616 ++#endif // 0
  1.2617 ++    }
  1.2618 ++#endif
  1.2619 ++}
  1.2620 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h
  1.2621 +--- gcc-4.0.0-100/libstdc++-v3/config/locale/uclibc/time_members.h	1969-12-31 18:00:00.000000000 -0600
  1.2622 ++++ gcc-4.0.0/libstdc++-v3/config/locale/uclibc/time_members.h	2004-05-22 18:46:31.000000000 -0500
  1.2623 +@@ -0,0 +1,68 @@
  1.2624 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
  1.2625 ++
  1.2626 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  1.2627 ++//
  1.2628 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.2629 ++// software; you can redistribute it and/or modify it under the
  1.2630 ++// terms of the GNU General Public License as published by the
  1.2631 ++// Free Software Foundation; either version 2, or (at your option)
  1.2632 ++// any later version.
  1.2633 ++
  1.2634 ++// This library is distributed in the hope that it will be useful,
  1.2635 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.2636 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.2637 ++// GNU General Public License for more details.
  1.2638 ++
  1.2639 ++// You should have received a copy of the GNU General Public License along
  1.2640 ++// with this library; see the file COPYING.  If not, write to the Free
  1.2641 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.2642 ++// USA.
  1.2643 ++
  1.2644 ++// As a special exception, you may use this file as part of a free software
  1.2645 ++// library without restriction.  Specifically, if other files instantiate
  1.2646 ++// templates or use macros or inline functions from this file, or you compile
  1.2647 ++// this file and link it with other files to produce an executable, this
  1.2648 ++// file does not by itself cause the resulting executable to be covered by
  1.2649 ++// the GNU General Public License.  This exception does not however
  1.2650 ++// invalidate any other reasons why the executable file might be covered by
  1.2651 ++// the GNU General Public License.
  1.2652 ++
  1.2653 ++//
  1.2654 ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
  1.2655 ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
  1.2656 ++//
  1.2657 ++
  1.2658 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
  1.2659 ++
  1.2660 ++  template<typename _CharT>
  1.2661 ++    __timepunct<_CharT>::__timepunct(size_t __refs) 
  1.2662 ++    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), 
  1.2663 ++    _M_name_timepunct(_S_get_c_name())
  1.2664 ++    { _M_initialize_timepunct(); }
  1.2665 ++
  1.2666 ++  template<typename _CharT>
  1.2667 ++    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) 
  1.2668 ++    : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), 
  1.2669 ++    _M_name_timepunct(_S_get_c_name())
  1.2670 ++    { _M_initialize_timepunct(); }
  1.2671 ++
  1.2672 ++  template<typename _CharT>
  1.2673 ++    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
  1.2674 ++				     size_t __refs) 
  1.2675 ++    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), 
  1.2676 ++    _M_name_timepunct(__s)
  1.2677 ++    { 
  1.2678 ++      char* __tmp = new char[std::strlen(__s) + 1];
  1.2679 ++      std::strcpy(__tmp, __s);
  1.2680 ++      _M_name_timepunct = __tmp;
  1.2681 ++      _M_initialize_timepunct(__cloc); 
  1.2682 ++    }
  1.2683 ++
  1.2684 ++  template<typename _CharT>
  1.2685 ++    __timepunct<_CharT>::~__timepunct()
  1.2686 ++    { 
  1.2687 ++      if (_M_name_timepunct != _S_get_c_name())
  1.2688 ++	delete [] _M_name_timepunct;
  1.2689 ++      delete _M_data; 
  1.2690 ++      _S_destroy_c_locale(_M_c_locale_timepunct); 
  1.2691 ++    }
  1.2692 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h
  1.2693 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_base.h	1969-12-31 18:00:00.000000000 -0600
  1.2694 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_base.h	2005-04-28 01:10:27.000000000 -0500
  1.2695 +@@ -0,0 +1,64 @@
  1.2696 ++// Locale support -*- C++ -*-
  1.2697 ++
  1.2698 ++// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
  1.2699 ++// Free Software Foundation, Inc.
  1.2700 ++//
  1.2701 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.2702 ++// software; you can redistribute it and/or modify it under the
  1.2703 ++// terms of the GNU General Public License as published by the
  1.2704 ++// Free Software Foundation; either version 2, or (at your option)
  1.2705 ++// any later version.
  1.2706 ++
  1.2707 ++// This library is distributed in the hope that it will be useful,
  1.2708 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.2709 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.2710 ++// GNU General Public License for more details.
  1.2711 ++
  1.2712 ++// You should have received a copy of the GNU General Public License along
  1.2713 ++// with this library; see the file COPYING.  If not, write to the Free
  1.2714 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.2715 ++// USA.
  1.2716 ++
  1.2717 ++// As a special exception, you may use this file as part of a free software
  1.2718 ++// library without restriction.  Specifically, if other files instantiate
  1.2719 ++// templates or use macros or inline functions from this file, or you compile
  1.2720 ++// this file and link it with other files to produce an executable, this
  1.2721 ++// file does not by itself cause the resulting executable to be covered by
  1.2722 ++// the GNU General Public License.  This exception does not however
  1.2723 ++// invalidate any other reasons why the executable file might be covered by
  1.2724 ++// the GNU General Public License.
  1.2725 ++
  1.2726 ++//
  1.2727 ++// ISO C++ 14882: 22.1  Locales
  1.2728 ++//
  1.2729 ++  
  1.2730 ++/** @file ctype_base.h
  1.2731 ++ *  This is an internal header file, included by other library headers.
  1.2732 ++ *  You should not attempt to use it directly.
  1.2733 ++ */
  1.2734 ++
  1.2735 ++// Information as gleaned from /usr/include/ctype.h
  1.2736 ++  
  1.2737 ++  /// @brief  Base class for ctype.
  1.2738 ++  struct ctype_base
  1.2739 ++  {
  1.2740 ++    // Note: In uClibc, the following two types depend on configuration.
  1.2741 ++ 
  1.2742 ++    // Non-standard typedefs.
  1.2743 ++    typedef const __ctype_touplow_t* __to_type;
  1.2744 ++
  1.2745 ++    // NB: Offsets into ctype<char>::_M_table force a particular size
  1.2746 ++    // on the mask type. Because of this, we don't use an enum.
  1.2747 ++    typedef __ctype_mask_t	mask;   
  1.2748 ++    static const mask upper    	= _ISupper;
  1.2749 ++    static const mask lower 	= _ISlower;
  1.2750 ++    static const mask alpha 	= _ISalpha;
  1.2751 ++    static const mask digit 	= _ISdigit;
  1.2752 ++    static const mask xdigit 	= _ISxdigit;
  1.2753 ++    static const mask space 	= _ISspace;
  1.2754 ++    static const mask print 	= _ISprint;
  1.2755 ++    static const mask graph 	= _ISalpha | _ISdigit | _ISpunct;
  1.2756 ++    static const mask cntrl 	= _IScntrl;
  1.2757 ++    static const mask punct 	= _ISpunct;
  1.2758 ++    static const mask alnum 	= _ISalpha | _ISdigit;
  1.2759 ++  };
  1.2760 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h
  1.2761 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_inline.h	1969-12-31 18:00:00.000000000 -0600
  1.2762 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_inline.h	2002-06-24 00:49:19.000000000 -0500
  1.2763 +@@ -0,0 +1,69 @@
  1.2764 ++// Locale support -*- C++ -*-
  1.2765 ++
  1.2766 ++// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
  1.2767 ++//
  1.2768 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.2769 ++// software; you can redistribute it and/or modify it under the
  1.2770 ++// terms of the GNU General Public License as published by the
  1.2771 ++// Free Software Foundation; either version 2, or (at your option)
  1.2772 ++// any later version.
  1.2773 ++
  1.2774 ++// This library is distributed in the hope that it will be useful,
  1.2775 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.2776 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.2777 ++// GNU General Public License for more details.
  1.2778 ++
  1.2779 ++// You should have received a copy of the GNU General Public License along
  1.2780 ++// with this library; see the file COPYING.  If not, write to the Free
  1.2781 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.2782 ++// USA.
  1.2783 ++
  1.2784 ++// As a special exception, you may use this file as part of a free software
  1.2785 ++// library without restriction.  Specifically, if other files instantiate
  1.2786 ++// templates or use macros or inline functions from this file, or you compile
  1.2787 ++// this file and link it with other files to produce an executable, this
  1.2788 ++// file does not by itself cause the resulting executable to be covered by
  1.2789 ++// the GNU General Public License.  This exception does not however
  1.2790 ++// invalidate any other reasons why the executable file might be covered by
  1.2791 ++// the GNU General Public License.
  1.2792 ++
  1.2793 ++//
  1.2794 ++// ISO C++ 14882: 22.1  Locales
  1.2795 ++//
  1.2796 ++  
  1.2797 ++// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
  1.2798 ++// functions go in ctype.cc
  1.2799 ++  
  1.2800 ++  bool
  1.2801 ++  ctype<char>::
  1.2802 ++  is(mask __m, char __c) const
  1.2803 ++  { return _M_table[static_cast<unsigned char>(__c)] & __m; }
  1.2804 ++
  1.2805 ++  const char*
  1.2806 ++  ctype<char>::
  1.2807 ++  is(const char* __low, const char* __high, mask* __vec) const
  1.2808 ++  {
  1.2809 ++    while (__low < __high)
  1.2810 ++      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
  1.2811 ++    return __high;
  1.2812 ++  }
  1.2813 ++
  1.2814 ++  const char*
  1.2815 ++  ctype<char>::
  1.2816 ++  scan_is(mask __m, const char* __low, const char* __high) const
  1.2817 ++  {
  1.2818 ++    while (__low < __high 
  1.2819 ++	   && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
  1.2820 ++      ++__low;
  1.2821 ++    return __low;
  1.2822 ++  }
  1.2823 ++
  1.2824 ++  const char*
  1.2825 ++  ctype<char>::
  1.2826 ++  scan_not(mask __m, const char* __low, const char* __high) const
  1.2827 ++  {
  1.2828 ++    while (__low < __high 
  1.2829 ++	   && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
  1.2830 ++      ++__low;
  1.2831 ++    return __low;
  1.2832 ++  }
  1.2833 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h
  1.2834 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/ctype_noninline.h	1969-12-31 18:00:00.000000000 -0600
  1.2835 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/ctype_noninline.h	2005-04-28 01:10:27.000000000 -0500
  1.2836 +@@ -0,0 +1,92 @@
  1.2837 ++// Locale support -*- C++ -*-
  1.2838 ++
  1.2839 ++// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
  1.2840 ++// Free Software Foundation, Inc.
  1.2841 ++//
  1.2842 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.2843 ++// software; you can redistribute it and/or modify it under the
  1.2844 ++// terms of the GNU General Public License as published by the
  1.2845 ++// Free Software Foundation; either version 2, or (at your option)
  1.2846 ++// any later version.
  1.2847 ++
  1.2848 ++// This library is distributed in the hope that it will be useful,
  1.2849 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.2850 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.2851 ++// GNU General Public License for more details.
  1.2852 ++
  1.2853 ++// You should have received a copy of the GNU General Public License along
  1.2854 ++// with this library; see the file COPYING.  If not, write to the Free
  1.2855 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.2856 ++// USA.
  1.2857 ++
  1.2858 ++// As a special exception, you may use this file as part of a free software
  1.2859 ++// library without restriction.  Specifically, if other files instantiate
  1.2860 ++// templates or use macros or inline functions from this file, or you compile
  1.2861 ++// this file and link it with other files to produce an executable, this
  1.2862 ++// file does not by itself cause the resulting executable to be covered by
  1.2863 ++// the GNU General Public License.  This exception does not however
  1.2864 ++// invalidate any other reasons why the executable file might be covered by
  1.2865 ++// the GNU General Public License.
  1.2866 ++
  1.2867 ++//
  1.2868 ++// ISO C++ 14882: 22.1  Locales
  1.2869 ++//
  1.2870 ++  
  1.2871 ++// Information as gleaned from /usr/include/ctype.h
  1.2872 ++
  1.2873 ++  const ctype_base::mask*
  1.2874 ++  ctype<char>::classic_table() throw()
  1.2875 ++  { return __C_ctype_b; }
  1.2876 ++
  1.2877 ++  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
  1.2878 ++		     size_t __refs) 
  1.2879 ++  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
  1.2880 ++  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
  1.2881 ++  {
  1.2882 ++    _M_toupper = __C_ctype_toupper;
  1.2883 ++    _M_tolower = __C_ctype_tolower;
  1.2884 ++    _M_table = __table ? __table : __C_ctype_b;
  1.2885 ++    memset(_M_widen, 0, sizeof(_M_widen));
  1.2886 ++    memset(_M_narrow, 0, sizeof(_M_narrow));
  1.2887 ++  }
  1.2888 ++
  1.2889 ++  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
  1.2890 ++  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
  1.2891 ++  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
  1.2892 ++  {
  1.2893 ++    _M_toupper = __C_ctype_toupper;
  1.2894 ++    _M_tolower = __C_ctype_tolower;
  1.2895 ++    _M_table = __table ? __table : __C_ctype_b;
  1.2896 ++    memset(_M_widen, 0, sizeof(_M_widen));
  1.2897 ++    memset(_M_narrow, 0, sizeof(_M_narrow));
  1.2898 ++  }
  1.2899 ++
  1.2900 ++  char
  1.2901 ++  ctype<char>::do_toupper(char __c) const
  1.2902 ++  { return _M_toupper[static_cast<unsigned char>(__c)]; }
  1.2903 ++
  1.2904 ++  const char*
  1.2905 ++  ctype<char>::do_toupper(char* __low, const char* __high) const
  1.2906 ++  {
  1.2907 ++    while (__low < __high)
  1.2908 ++      {
  1.2909 ++	*__low = _M_toupper[static_cast<unsigned char>(*__low)];
  1.2910 ++	++__low;
  1.2911 ++      }
  1.2912 ++    return __high;
  1.2913 ++  }
  1.2914 ++
  1.2915 ++  char
  1.2916 ++  ctype<char>::do_tolower(char __c) const
  1.2917 ++  { return _M_tolower[static_cast<unsigned char>(__c)]; }
  1.2918 ++
  1.2919 ++  const char* 
  1.2920 ++  ctype<char>::do_tolower(char* __low, const char* __high) const
  1.2921 ++  {
  1.2922 ++    while (__low < __high)
  1.2923 ++      {
  1.2924 ++	*__low = _M_tolower[static_cast<unsigned char>(*__low)];
  1.2925 ++	++__low;
  1.2926 ++      }
  1.2927 ++    return __high;
  1.2928 ++  }
  1.2929 +diff -urN gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h
  1.2930 +--- gcc-4.0.0-100/libstdc++-v3/config/os/uclibc/os_defines.h	1969-12-31 18:00:00.000000000 -0600
  1.2931 ++++ gcc-4.0.0/libstdc++-v3/config/os/uclibc/os_defines.h	2005-04-28 01:10:27.000000000 -0500
  1.2932 +@@ -0,0 +1,44 @@
  1.2933 ++// Specific definitions for GNU/Linux  -*- C++ -*-
  1.2934 ++
  1.2935 ++// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
  1.2936 ++//
  1.2937 ++// This file is part of the GNU ISO C++ Library.  This library is free
  1.2938 ++// software; you can redistribute it and/or modify it under the
  1.2939 ++// terms of the GNU General Public License as published by the
  1.2940 ++// Free Software Foundation; either version 2, or (at your option)
  1.2941 ++// any later version.
  1.2942 ++
  1.2943 ++// This library is distributed in the hope that it will be useful,
  1.2944 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
  1.2945 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1.2946 ++// GNU General Public License for more details.
  1.2947 ++
  1.2948 ++// You should have received a copy of the GNU General Public License along
  1.2949 ++// with this library; see the file COPYING.  If not, write to the Free
  1.2950 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  1.2951 ++// USA.
  1.2952 ++
  1.2953 ++// As a special exception, you may use this file as part of a free software
  1.2954 ++// library without restriction.  Specifically, if other files instantiate
  1.2955 ++// templates or use macros or inline functions from this file, or you compile
  1.2956 ++// this file and link it with other files to produce an executable, this
  1.2957 ++// file does not by itself cause the resulting executable to be covered by
  1.2958 ++// the GNU General Public License.  This exception does not however
  1.2959 ++// invalidate any other reasons why the executable file might be covered by
  1.2960 ++// the GNU General Public License.
  1.2961 ++
  1.2962 ++#ifndef _GLIBCXX_OS_DEFINES
  1.2963 ++#define _GLIBCXX_OS_DEFINES 1
  1.2964 ++
  1.2965 ++// System-specific #define, typedefs, corrections, etc, go here.  This
  1.2966 ++// file will come before all others.
  1.2967 ++
  1.2968 ++// This keeps isanum, et al from being propagated as macros.
  1.2969 ++#define __NO_CTYPE 1
  1.2970 ++
  1.2971 ++#include <features.h>
  1.2972 ++
  1.2973 ++// We must not see the optimized string functions GNU libc defines.
  1.2974 ++#define __NO_STRING_INLINES
  1.2975 ++
  1.2976 ++#endif
  1.2977 +diff -urN gcc-4.0.0-100/libstdc++-v3/configure gcc-4.0.0/libstdc++-v3/configure
  1.2978 +--- gcc-4.0.0-100/libstdc++-v3/configure	2005-04-30 13:06:53.683055232 -0500
  1.2979 ++++ gcc-4.0.0/libstdc++-v3/configure	2005-04-30 12:24:24.000000000 -0500
  1.2980 +@@ -3998,6 +3998,11 @@
  1.2981 +   lt_cv_deplibs_check_method=pass_all
  1.2982 +   ;;
  1.2983 + 
  1.2984 ++linux-uclibc*)
  1.2985 ++  lt_cv_deplibs_check_method=pass_all
  1.2986 ++  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
  1.2987 ++  ;;
  1.2988 ++
  1.2989 + netbsd* | knetbsd*-gnu)
  1.2990 +   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
  1.2991 +     lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  1.2992 +@@ -5672,7 +5677,7 @@
  1.2993 +   enableval="$enable_clocale"
  1.2994 + 
  1.2995 +       case "$enableval" in
  1.2996 +-       generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
  1.2997 ++       generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
  1.2998 +        *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
  1.2999 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
  1.3000 +    { (exit 1); exit 1; }; } ;;
  1.3001 +@@ -5697,6 +5702,9 @@
  1.3002 +   # Default to "generic".
  1.3003 +   if test $enable_clocale_flag = auto; then
  1.3004 +     case ${target_os} in
  1.3005 ++      linux-uclibc*)
  1.3006 ++	enable_clocale_flag=uclibc
  1.3007 ++	;;
  1.3008 +       linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
  1.3009 +         cat >conftest.$ac_ext <<_ACEOF
  1.3010 + /* confdefs.h.  */
  1.3011 +@@ -5927,6 +5935,76 @@
  1.3012 +       CTIME_CC=config/locale/generic/time_members.cc
  1.3013 +       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
  1.3014 +       ;;
  1.3015 ++    uclibc)
  1.3016 ++      echo "$as_me:$LINENO: result: uclibc" >&5
  1.3017 ++echo "${ECHO_T}uclibc" >&6
  1.3018 ++
  1.3019 ++      # Declare intention to use gettext, and add support for specific
  1.3020 ++      # languages.
  1.3021 ++      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
  1.3022 ++      ALL_LINGUAS="de fr"
  1.3023 ++
  1.3024 ++      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
  1.3025 ++      # Extract the first word of "msgfmt", so it can be a program name with args.
  1.3026 ++set dummy msgfmt; ac_word=$2
  1.3027 ++echo "$as_me:$LINENO: checking for $ac_word" >&5
  1.3028 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
  1.3029 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then
  1.3030 ++  echo $ECHO_N "(cached) $ECHO_C" >&6
  1.3031 ++else
  1.3032 ++  if test -n "$check_msgfmt"; then
  1.3033 ++  ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
  1.3034 ++else
  1.3035 ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  1.3036 ++for as_dir in $PATH
  1.3037 ++do
  1.3038 ++  IFS=$as_save_IFS
  1.3039 ++  test -z "$as_dir" && as_dir=.
  1.3040 ++  for ac_exec_ext in '' $ac_executable_extensions; do
  1.3041 ++  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  1.3042 ++    ac_cv_prog_check_msgfmt="yes"
  1.3043 ++    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
  1.3044 ++    break 2
  1.3045 ++  fi
  1.3046 ++done
  1.3047 ++done
  1.3048 ++
  1.3049 ++  test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
  1.3050 ++fi
  1.3051 ++fi
  1.3052 ++check_msgfmt=$ac_cv_prog_check_msgfmt
  1.3053 ++if test -n "$check_msgfmt"; then
  1.3054 ++  echo "$as_me:$LINENO: result: $check_msgfmt" >&5
  1.3055 ++echo "${ECHO_T}$check_msgfmt" >&6
  1.3056 ++else
  1.3057 ++  echo "$as_me:$LINENO: result: no" >&5
  1.3058 ++echo "${ECHO_T}no" >&6
  1.3059 ++fi
  1.3060 ++
  1.3061 ++      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
  1.3062 ++        USE_NLS=yes
  1.3063 ++      fi
  1.3064 ++      # Export the build objects.
  1.3065 ++      for ling in $ALL_LINGUAS; do \
  1.3066 ++        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
  1.3067 ++        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
  1.3068 ++      done
  1.3069 ++
  1.3070 ++
  1.3071 ++
  1.3072 ++      CLOCALE_H=config/locale/uclibc/c_locale.h
  1.3073 ++      CLOCALE_CC=config/locale/uclibc/c_locale.cc
  1.3074 ++      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
  1.3075 ++      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
  1.3076 ++      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
  1.3077 ++      CMESSAGES_H=config/locale/uclibc/messages_members.h
  1.3078 ++      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
  1.3079 ++      CMONEY_CC=config/locale/uclibc/monetary_members.cc
  1.3080 ++      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
  1.3081 ++      CTIME_H=config/locale/uclibc/time_members.h
  1.3082 ++      CTIME_CC=config/locale/uclibc/time_members.cc
  1.3083 ++      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
  1.3084 ++      ;;
  1.3085 +   esac
  1.3086 + 
  1.3087 +   # This is where the testsuite looks for locale catalogs, using the
  1.3088 +diff -urN gcc-4.0.0-100/libstdc++-v3/configure.host gcc-4.0.0/libstdc++-v3/configure.host
  1.3089 +--- gcc-4.0.0-100/libstdc++-v3/configure.host	2005-04-30 13:06:53.688054472 -0500
  1.3090 ++++ gcc-4.0.0/libstdc++-v3/configure.host	2005-04-28 20:20:32.000000000 -0500
  1.3091 +@@ -249,6 +249,12 @@
  1.3092 +     ;;
  1.3093 + esac
  1.3094 + 
  1.3095 ++# Override for uClibc since linux-uclibc gets mishandled above.
  1.3096 ++case "${host_os}" in
  1.3097 ++  *-uclibc*)
  1.3098 ++    os_include_dir="os/uclibc"
  1.3099 ++    ;;
  1.3100 ++esac
  1.3101 + 
  1.3102 + # Set any OS-dependent and CPU-dependent bits.
  1.3103 + # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
  1.3104 +diff -urN gcc-4.0.0-100/libstdc++-v3/crossconfig.m4 gcc-4.0.0/libstdc++-v3/crossconfig.m4
  1.3105 +--- gcc-4.0.0-100/libstdc++-v3/crossconfig.m4	2005-04-30 13:06:53.689054320 -0500
  1.3106 ++++ gcc-4.0.0/libstdc++-v3/crossconfig.m4	2005-04-28 20:27:15.000000000 -0500
  1.3107 +@@ -142,6 +142,98 @@
  1.3108 + 	;;
  1.3109 +     esac
  1.3110 +     ;;
  1.3111 ++  *-uclibc*)
  1.3112 ++# Temporary hack until we implement the float versions of the libm funcs
  1.3113 ++    AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
  1.3114 ++      machine/endian.h machine/param.h sys/machine.h sys/types.h \
  1.3115 ++      fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
  1.3116 ++    SECTION_FLAGS='-ffunction-sections -fdata-sections'
  1.3117 ++    AC_SUBST(SECTION_FLAGS)
  1.3118 ++    GLIBCXX_CHECK_LINKER_FEATURES
  1.3119 ++    GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
  1.3120 ++    GLIBCXX_CHECK_WCHAR_T_SUPPORT
  1.3121 ++
  1.3122 ++    # For LFS.
  1.3123 ++    AC_DEFINE(HAVE_INT64_T)
  1.3124 ++    case "$target" in
  1.3125 ++      *-uclinux*)
  1.3126 ++        # Don't enable LFS with uClinux
  1.3127 ++        ;;
  1.3128 ++      *)
  1.3129 ++        AC_DEFINE(_GLIBCXX_USE_LFS)
  1.3130 ++    esac
  1.3131 ++
  1.3132 ++    # For showmanyc_helper().
  1.3133 ++    AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
  1.3134 ++    GLIBCXX_CHECK_POLL
  1.3135 ++    GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
  1.3136 ++
  1.3137 ++    # For xsputn_2().
  1.3138 ++    AC_CHECK_HEADERS(sys/uio.h)
  1.3139 ++    GLIBCXX_CHECK_WRITEV
  1.3140 ++
  1.3141 ++#     AC_DEFINE(HAVE_ACOSF)
  1.3142 ++#     AC_DEFINE(HAVE_ASINF)
  1.3143 ++#     AC_DEFINE(HAVE_ATANF)
  1.3144 ++#     AC_DEFINE(HAVE_ATAN2F)
  1.3145 ++    AC_DEFINE(HAVE_CEILF)
  1.3146 ++    AC_DEFINE(HAVE_COPYSIGN)
  1.3147 ++#     AC_DEFINE(HAVE_COPYSIGNF)
  1.3148 ++#     AC_DEFINE(HAVE_COSF)
  1.3149 ++#     AC_DEFINE(HAVE_COSHF)
  1.3150 ++#     AC_DEFINE(HAVE_EXPF)
  1.3151 ++#     AC_DEFINE(HAVE_FABSF)
  1.3152 ++    AC_DEFINE(HAVE_FINITE)
  1.3153 ++    AC_DEFINE(HAVE_FINITEF)
  1.3154 ++    AC_DEFINE(HAVE_FLOORF)
  1.3155 ++#     AC_DEFINE(HAVE_FMODF)
  1.3156 ++#     AC_DEFINE(HAVE_FREXPF)
  1.3157 ++    AC_DEFINE(HAVE_HYPOT)
  1.3158 ++#     AC_DEFINE(HAVE_HYPOTF)
  1.3159 ++    AC_DEFINE(HAVE_ISINF)
  1.3160 ++    AC_DEFINE(HAVE_ISINFF)
  1.3161 ++    AC_DEFINE(HAVE_ISNAN)
  1.3162 ++    AC_DEFINE(HAVE_ISNANF)
  1.3163 ++#     AC_DEFINE(HAVE_LOGF)
  1.3164 ++#     AC_DEFINE(HAVE_LOG10F)
  1.3165 ++#     AC_DEFINE(HAVE_MODFF)
  1.3166 ++#     AC_DEFINE(HAVE_SINF)
  1.3167 ++#     AC_DEFINE(HAVE_SINHF)
  1.3168 ++#     AC_DEFINE(HAVE_SINCOS)
  1.3169 ++#     AC_DEFINE(HAVE_SINCOSF)
  1.3170 ++    AC_DEFINE(HAVE_SQRTF)
  1.3171 ++#     AC_DEFINE(HAVE_TANF)
  1.3172 ++#     AC_DEFINE(HAVE_TANHF)
  1.3173 ++    if test x"long_double_math_on_this_cpu" = x"yes"; then
  1.3174 ++#       AC_DEFINE(HAVE_ACOSL)
  1.3175 ++#       AC_DEFINE(HAVE_ASINL)
  1.3176 ++#       AC_DEFINE(HAVE_ATANL)
  1.3177 ++#       AC_DEFINE(HAVE_ATAN2L)
  1.3178 ++#       AC_DEFINE(HAVE_CEILL)
  1.3179 ++#       AC_DEFINE(HAVE_COPYSIGNL)
  1.3180 ++#       AC_DEFINE(HAVE_COSL)
  1.3181 ++#       AC_DEFINE(HAVE_COSHL)
  1.3182 ++#       AC_DEFINE(HAVE_EXPL)
  1.3183 ++#       AC_DEFINE(HAVE_FABSL)
  1.3184 ++#       AC_DEFINE(HAVE_FINITEL)
  1.3185 ++#       AC_DEFINE(HAVE_FLOORL)
  1.3186 ++#       AC_DEFINE(HAVE_FMODL)
  1.3187 ++#       AC_DEFINE(HAVE_FREXPL)
  1.3188 ++#       AC_DEFINE(HAVE_HYPOTL)
  1.3189 ++#       AC_DEFINE(HAVE_ISINFL)
  1.3190 ++#       AC_DEFINE(HAVE_ISNANL)
  1.3191 ++#       AC_DEFINE(HAVE_LOGL)
  1.3192 ++#       AC_DEFINE(HAVE_LOG10L)
  1.3193 ++#       AC_DEFINE(HAVE_MODFL)
  1.3194 ++#       AC_DEFINE(HAVE_POWL)
  1.3195 ++#       AC_DEFINE(HAVE_SINL)
  1.3196 ++#       AC_DEFINE(HAVE_SINHL)
  1.3197 ++#       AC_DEFINE(HAVE_SINCOSL)
  1.3198 ++#       AC_DEFINE(HAVE_SQRTL)
  1.3199 ++#       AC_DEFINE(HAVE_TANL)
  1.3200 ++#       AC_DEFINE(HAVE_TANHL)
  1.3201 ++    fi
  1.3202 ++    ;;
  1.3203 +   *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
  1.3204 +     AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
  1.3205 +       machine/endian.h machine/param.h sys/machine.h sys/types.h \
  1.3206 +@@ -156,7 +248,7 @@
  1.3207 +     AC_DEFINE(HAVE_INT64_T)
  1.3208 +     case "$target" in
  1.3209 +       *-uclinux*)
  1.3210 +-        # Don't enable LFS with uClibc
  1.3211 ++        # Don't enable LFS with uClinux
  1.3212 +         ;;
  1.3213 +       *)
  1.3214 +         AC_DEFINE(_GLIBCXX_USE_LFS)
  1.3215 +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h
  1.3216 +--- gcc-4.0.0-100/libstdc++-v3/include/c_compatibility/wchar.h	2005-04-30 13:06:53.690054168 -0500
  1.3217 ++++ gcc-4.0.0/libstdc++-v3/include/c_compatibility/wchar.h	2005-04-28 20:15:56.000000000 -0500
  1.3218 +@@ -101,7 +101,9 @@
  1.3219 + using std::wmemcpy;
  1.3220 + using std::wmemmove;
  1.3221 + using std::wmemset;
  1.3222 ++#if _GLIBCXX_HAVE_WCSFTIME
  1.3223 + using std::wcsftime;
  1.3224 ++#endif
  1.3225 + 
  1.3226 + #if _GLIBCXX_USE_C99
  1.3227 + using std::wcstold;
  1.3228 +diff -urN gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h
  1.3229 +--- gcc-4.0.0-100/libstdc++-v3/include/c_std/std_cwchar.h	2005-04-30 13:06:53.691054016 -0500
  1.3230 ++++ gcc-4.0.0/libstdc++-v3/include/c_std/std_cwchar.h	2005-04-28 20:15:56.000000000 -0500
  1.3231 +@@ -179,7 +179,9 @@
  1.3232 +   using ::wcscoll;
  1.3233 +   using ::wcscpy;
  1.3234 +   using ::wcscspn;
  1.3235 ++#if _GLIBCXX_HAVE_WCSFTIME
  1.3236 +   using ::wcsftime;
  1.3237 ++#endif
  1.3238 +   using ::wcslen;
  1.3239 +   using ::wcsncat;
  1.3240 +   using ::wcsncmp;