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