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

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