patches/gcc/4.2.4/120-uclibc-locale.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Mon Apr 16 15:25:36 2012 +0200 (2012-04-16)
changeset 2941 13e40098fffc
parent 687 b2b6b1d46aa1
permissions -rw-r--r--
cc/gcc: update Linaro GCC revisions to 2012.04

Update Linaro GCC with the latest available revisions.

The 4.7 revision is also released, but the infrastructure is not yet ready for
it in CT-NG.

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