Forgot to svn add...
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/gcc/4.2.0/100-uclibc-conf.patch Sun May 20 09:28:16 2007 +0000
1.3 @@ -0,0 +1,200 @@
1.4 +--- gcc/libgomp/configure
1.5 ++++ gcc/libgomp/configure
1.6 +@@ -3771,7 +3771,7 @@
1.7 + ;;
1.8 +
1.9 + # This must be Linux ELF.
1.10 +-linux-gnu*)
1.11 ++linux*)
1.12 + lt_cv_deplibs_check_method=pass_all
1.13 + ;;
1.14 +
1.15 +--- gcc/gcc/config/cris/linux.h
1.16 ++++ gcc/gcc/config/cris/linux.h
1.17 +@@ -74,7 +74,11 @@
1.18 + #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
1.19 +
1.20 + #undef CRIS_SUBTARGET_VERSION
1.21 +-#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
1.22 ++#if UCLIBC_DEFAULT
1.23 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
1.24 ++#else
1.25 ++# define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
1.26 ++#endif
1.27 +
1.28 + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
1.29 +
1.30 +--- gcc/libstdc++-v3/configure
1.31 ++++ gcc/libstdc++-v3/configure
1.32 +@@ -4276,7 +4276,7 @@
1.33 + ;;
1.34 +
1.35 + # This must be Linux ELF.
1.36 +-linux-gnu*)
1.37 ++linux*)
1.38 + lt_cv_deplibs_check_method=pass_all
1.39 + ;;
1.40 +
1.41 +--- gcc/zlib/configure
1.42 ++++ gcc/zlib/configure
1.43 +@@ -3422,7 +3422,7 @@
1.44 + ;;
1.45 +
1.46 + # This must be Linux ELF.
1.47 +-linux-gnu*)
1.48 ++linux*)
1.49 + lt_cv_deplibs_check_method=pass_all
1.50 + ;;
1.51 +
1.52 +--- gcc/libobjc/configure
1.53 ++++ gcc/libobjc/configure
1.54 +@@ -3309,7 +3309,7 @@
1.55 + ;;
1.56 +
1.57 + # This must be Linux ELF.
1.58 +-linux-gnu*)
1.59 ++linux*)
1.60 + lt_cv_deplibs_check_method=pass_all
1.61 + ;;
1.62 +
1.63 +--- gcc/libgfortran/configure
1.64 ++++ gcc/libgfortran/configure
1.65 +@@ -3695,7 +3695,7 @@
1.66 + ;;
1.67 +
1.68 + # This must be Linux ELF.
1.69 +-linux-gnu*)
1.70 ++linux*)
1.71 + lt_cv_deplibs_check_method=pass_all
1.72 + ;;
1.73 +
1.74 +--- gcc/libmudflap/configure
1.75 ++++ gcc/libmudflap/configure
1.76 +@@ -5378,7 +5378,7 @@
1.77 + ;;
1.78 +
1.79 + # This must be Linux ELF.
1.80 +-linux-gnu*)
1.81 ++linux*)
1.82 + lt_cv_deplibs_check_method=pass_all
1.83 + ;;
1.84 +
1.85 +--- gcc/boehm-gc/configure
1.86 ++++ gcc/boehm-gc/configure
1.87 +@@ -4316,7 +4316,7 @@
1.88 + ;;
1.89 +
1.90 + # This must be Linux ELF.
1.91 +-linux-gnu*)
1.92 ++linux*)
1.93 + lt_cv_deplibs_check_method=pass_all
1.94 + ;;
1.95 +
1.96 +--- gcc/libffi/configure
1.97 ++++ gcc/libffi/configure
1.98 +@@ -3453,7 +3453,7 @@
1.99 + ;;
1.100 +
1.101 + # This must be Linux ELF.
1.102 +-linux-gnu*)
1.103 ++linux*)
1.104 + lt_cv_deplibs_check_method=pass_all
1.105 + ;;
1.106 +
1.107 +--- gcc/libssp/configure
1.108 ++++ gcc/libssp/configure
1.109 +@@ -4409,7 +4409,7 @@
1.110 + ;;
1.111 +
1.112 + # This must be Linux ELF.
1.113 +-linux-gnu*)
1.114 ++linux*)
1.115 + lt_cv_deplibs_check_method=pass_all
1.116 + ;;
1.117 +
1.118 +--- gcc/contrib/regression/objs-gcc.sh
1.119 ++++ gcc/contrib/regression/objs-gcc.sh
1.120 +@@ -105,6 +105,10 @@
1.121 + then
1.122 + make all-gdb all-dejagnu all-ld || exit 1
1.123 + make install-gdb install-dejagnu install-ld || exit 1
1.124 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
1.125 ++ then
1.126 ++ make all-gdb all-dejagnu all-ld || exit 1
1.127 ++ make install-gdb install-dejagnu install-ld || exit 1
1.128 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
1.129 + make bootstrap || exit 1
1.130 + make install || exit 1
1.131 +--- gcc/libjava/classpath/ltconfig
1.132 ++++ gcc/libjava/classpath/ltconfig
1.133 +@@ -603,7 +603,7 @@
1.134 +
1.135 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
1.136 + case $host_os in
1.137 +-linux-gnu*) ;;
1.138 ++linux-gnu*|linux-uclibc*) ;;
1.139 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
1.140 + esac
1.141 +
1.142 +@@ -1251,7 +1251,7 @@
1.143 + ;;
1.144 +
1.145 + # This must be Linux ELF.
1.146 +-linux-gnu*)
1.147 ++linux*)
1.148 + version_type=linux
1.149 + need_lib_prefix=no
1.150 + need_version=no
1.151 +--- gcc/libjava/classpath/configure
1.152 ++++ gcc/libjava/classpath/configure
1.153 +@@ -4665,7 +4665,7 @@
1.154 + ;;
1.155 +
1.156 + # This must be Linux ELF.
1.157 +-linux-gnu*)
1.158 ++linux*)
1.159 + lt_cv_deplibs_check_method=pass_all
1.160 + ;;
1.161 +
1.162 +--- gcc/libjava/configure
1.163 ++++ gcc/libjava/configure
1.164 +@@ -5212,7 +5212,7 @@
1.165 + ;;
1.166 +
1.167 + # This must be Linux ELF.
1.168 +-linux-gnu*)
1.169 ++linux*)
1.170 + lt_cv_deplibs_check_method=pass_all
1.171 + ;;
1.172 +
1.173 +--- gcc/libtool.m4
1.174 ++++ gcc/libtool.m4
1.175 +@@ -739,7 +739,7 @@
1.176 + ;;
1.177 +
1.178 + # This must be Linux ELF.
1.179 +-linux-gnu*)
1.180 ++linux*)
1.181 + lt_cv_deplibs_check_method=pass_all
1.182 + ;;
1.183 +
1.184 +--- gcc/ltconfig
1.185 ++++ gcc/ltconfig
1.186 +@@ -603,7 +603,7 @@
1.187 +
1.188 + # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
1.189 + case $host_os in
1.190 +-linux-gnu*) ;;
1.191 ++linux-gnu*|linux-uclibc*) ;;
1.192 + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
1.193 + esac
1.194 +
1.195 +@@ -1251,7 +1251,7 @@
1.196 + ;;
1.197 +
1.198 + # This must be Linux ELF.
1.199 +-linux-gnu*)
1.200 ++linux*)
1.201 + version_type=linux
1.202 + need_lib_prefix=no
1.203 + need_version=no
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/patches/gcc/4.2.0/103-uclibc-conf-noupstream.patch Sun May 20 09:28:16 2007 +0000
2.3 @@ -0,0 +1,11 @@
2.4 +--- gcc/gcc/config.gcc.uclibc100-sh~ 2006-03-06 20:46:56 +0100
2.5 ++++ gcc/gcc/config.gcc 2006-03-10 15:02:41 +0100
2.6 +@@ -1905,7 +1905,7 @@
2.7 + ;;
2.8 + sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
2.9 + sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
2.10 +- sh-*-linux* | sh[346lbe]*-*-linux* | \
2.11 ++ sh*-*-linux* | sh[346lbe]*-*-linux* | \
2.12 + sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
2.13 + sh64-*-netbsd* | sh64l*-*-netbsd*)
2.14 + tmake_file="${tmake_file} sh/t-sh sh/t-elf"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/patches/gcc/4.2.0/200-uclibc-locale.patch Sun May 20 09:28:16 2007 +0000
3.3 @@ -0,0 +1,2790 @@
3.4 +--- gcc/libstdc++-v3/acinclude.m4
3.5 ++++ gcc/libstdc++-v3/acinclude.m4
3.6 +@@ -1369,7 +1369,7 @@
3.7 + AC_MSG_CHECKING([for C locale to use])
3.8 + GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
3.9 + [use MODEL for target locale package],
3.10 +- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
3.11 ++ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
3.12 +
3.13 + # If they didn't use this option switch, or if they specified --enable
3.14 + # with no specific model, we'll have to look for one. If they
3.15 +@@ -1385,6 +1385,9 @@
3.16 + # Default to "generic".
3.17 + if test $enable_clocale_flag = auto; then
3.18 + case ${target_os} in
3.19 ++ *-uclibc*)
3.20 ++ enable_clocale_flag=uclibc
3.21 ++ ;;
3.22 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3.23 + AC_EGREP_CPP([_GLIBCXX_ok], [
3.24 + #include <features.h>
3.25 +@@ -1528,6 +1531,40 @@
3.26 + CTIME_CC=config/locale/generic/time_members.cc
3.27 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3.28 + ;;
3.29 ++ uclibc)
3.30 ++ AC_MSG_RESULT(uclibc)
3.31 ++
3.32 ++ # Declare intention to use gettext, and add support for specific
3.33 ++ # languages.
3.34 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3.35 ++ ALL_LINGUAS="de fr"
3.36 ++
3.37 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3.38 ++ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
3.39 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3.40 ++ USE_NLS=yes
3.41 ++ fi
3.42 ++ # Export the build objects.
3.43 ++ for ling in $ALL_LINGUAS; do \
3.44 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3.45 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3.46 ++ done
3.47 ++ AC_SUBST(glibcxx_MOFILES)
3.48 ++ AC_SUBST(glibcxx_POFILES)
3.49 ++
3.50 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
3.51 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3.52 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3.53 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3.54 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3.55 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
3.56 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3.57 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3.58 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3.59 ++ CTIME_H=config/locale/uclibc/time_members.h
3.60 ++ CTIME_CC=config/locale/uclibc/time_members.cc
3.61 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3.62 ++ ;;
3.63 + esac
3.64 +
3.65 + # This is where the testsuite looks for locale catalogs, using the
3.66 +--- gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
3.67 ++++ gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
3.68 +@@ -0,0 +1,63 @@
3.69 ++// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
3.70 ++
3.71 ++// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
3.72 ++//
3.73 ++// This file is part of the GNU ISO C++ Library. This library is free
3.74 ++// software; you can redistribute it and/or modify it under the
3.75 ++// terms of the GNU General Public License as published by the
3.76 ++// Free Software Foundation; either version 2, or (at your option)
3.77 ++// any later version.
3.78 ++
3.79 ++// This library is distributed in the hope that it will be useful,
3.80 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.81 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.82 ++// GNU General Public License for more details.
3.83 ++
3.84 ++// You should have received a copy of the GNU General Public License along
3.85 ++// with this library; see the file COPYING. If not, write to the Free
3.86 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.87 ++// USA.
3.88 ++
3.89 ++// As a special exception, you may use this file as part of a free software
3.90 ++// library without restriction. Specifically, if other files instantiate
3.91 ++// templates or use macros or inline functions from this file, or you compile
3.92 ++// this file and link it with other files to produce an executable, this
3.93 ++// file does not by itself cause the resulting executable to be covered by
3.94 ++// the GNU General Public License. This exception does not however
3.95 ++// invalidate any other reasons why the executable file might be covered by
3.96 ++// the GNU General Public License.
3.97 ++
3.98 ++// Written by Jakub Jelinek <jakub@redhat.com>
3.99 ++
3.100 ++#include <bits/c++config.h>
3.101 ++#include <clocale>
3.102 ++
3.103 ++#ifdef __UCLIBC_MJN3_ONLY__
3.104 ++#warning clean this up
3.105 ++#endif
3.106 ++
3.107 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.108 ++
3.109 ++extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
3.110 ++extern "C" __typeof(strcoll_l) __strcoll_l;
3.111 ++extern "C" __typeof(strftime_l) __strftime_l;
3.112 ++extern "C" __typeof(strtod_l) __strtod_l;
3.113 ++extern "C" __typeof(strtof_l) __strtof_l;
3.114 ++extern "C" __typeof(strtold_l) __strtold_l;
3.115 ++extern "C" __typeof(strxfrm_l) __strxfrm_l;
3.116 ++extern "C" __typeof(newlocale) __newlocale;
3.117 ++extern "C" __typeof(freelocale) __freelocale;
3.118 ++extern "C" __typeof(duplocale) __duplocale;
3.119 ++extern "C" __typeof(uselocale) __uselocale;
3.120 ++
3.121 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.122 ++extern "C" __typeof(iswctype_l) __iswctype_l;
3.123 ++extern "C" __typeof(towlower_l) __towlower_l;
3.124 ++extern "C" __typeof(towupper_l) __towupper_l;
3.125 ++extern "C" __typeof(wcscoll_l) __wcscoll_l;
3.126 ++extern "C" __typeof(wcsftime_l) __wcsftime_l;
3.127 ++extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
3.128 ++extern "C" __typeof(wctype_l) __wctype_l;
3.129 ++#endif
3.130 ++
3.131 ++#endif // GLIBC 2.3 and later
3.132 +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc
3.133 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc
3.134 +@@ -0,0 +1,160 @@
3.135 ++// Wrapper for underlying C-language localization -*- C++ -*-
3.136 ++
3.137 ++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
3.138 ++//
3.139 ++// This file is part of the GNU ISO C++ Library. This library is free
3.140 ++// software; you can redistribute it and/or modify it under the
3.141 ++// terms of the GNU General Public License as published by the
3.142 ++// Free Software Foundation; either version 2, or (at your option)
3.143 ++// any later version.
3.144 ++
3.145 ++// This library is distributed in the hope that it will be useful,
3.146 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.147 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.148 ++// GNU General Public License for more details.
3.149 ++
3.150 ++// You should have received a copy of the GNU General Public License along
3.151 ++// with this library; see the file COPYING. If not, write to the Free
3.152 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.153 ++// USA.
3.154 ++
3.155 ++// As a special exception, you may use this file as part of a free software
3.156 ++// library without restriction. Specifically, if other files instantiate
3.157 ++// templates or use macros or inline functions from this file, or you compile
3.158 ++// this file and link it with other files to produce an executable, this
3.159 ++// file does not by itself cause the resulting executable to be covered by
3.160 ++// the GNU General Public License. This exception does not however
3.161 ++// invalidate any other reasons why the executable file might be covered by
3.162 ++// the GNU General Public License.
3.163 ++
3.164 ++//
3.165 ++// ISO C++ 14882: 22.8 Standard locale categories.
3.166 ++//
3.167 ++
3.168 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.169 ++
3.170 ++#include <cerrno> // For errno
3.171 ++#include <locale>
3.172 ++#include <stdexcept>
3.173 ++#include <langinfo.h>
3.174 ++#include <bits/c++locale_internal.h>
3.175 ++
3.176 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.177 ++#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
3.178 ++#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
3.179 ++#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
3.180 ++#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
3.181 ++#define __strtof_l(S, E, L) strtof((S), (E))
3.182 ++#define __strtod_l(S, E, L) strtod((S), (E))
3.183 ++#define __strtold_l(S, E, L) strtold((S), (E))
3.184 ++#warning should dummy __newlocale check for C|POSIX ?
3.185 ++#define __newlocale(a, b, c) NULL
3.186 ++#define __freelocale(a) ((void)0)
3.187 ++#define __duplocale(a) __c_locale()
3.188 ++#endif
3.189 ++
3.190 ++namespace std
3.191 ++{
3.192 ++ template<>
3.193 ++ void
3.194 ++ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
3.195 ++ const __c_locale& __cloc)
3.196 ++ {
3.197 ++ if (!(__err & ios_base::failbit))
3.198 ++ {
3.199 ++ char* __sanity;
3.200 ++ errno = 0;
3.201 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
3.202 ++ if (__sanity != __s && errno != ERANGE)
3.203 ++ __v = __f;
3.204 ++ else
3.205 ++ __err |= ios_base::failbit;
3.206 ++ }
3.207 ++ }
3.208 ++
3.209 ++ template<>
3.210 ++ void
3.211 ++ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
3.212 ++ const __c_locale& __cloc)
3.213 ++ {
3.214 ++ if (!(__err & ios_base::failbit))
3.215 ++ {
3.216 ++ char* __sanity;
3.217 ++ errno = 0;
3.218 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
3.219 ++ if (__sanity != __s && errno != ERANGE)
3.220 ++ __v = __d;
3.221 ++ else
3.222 ++ __err |= ios_base::failbit;
3.223 ++ }
3.224 ++ }
3.225 ++
3.226 ++ template<>
3.227 ++ void
3.228 ++ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
3.229 ++ const __c_locale& __cloc)
3.230 ++ {
3.231 ++ if (!(__err & ios_base::failbit))
3.232 ++ {
3.233 ++ char* __sanity;
3.234 ++ errno = 0;
3.235 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
3.236 ++ if (__sanity != __s && errno != ERANGE)
3.237 ++ __v = __ld;
3.238 ++ else
3.239 ++ __err |= ios_base::failbit;
3.240 ++ }
3.241 ++ }
3.242 ++
3.243 ++ void
3.244 ++ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
3.245 ++ __c_locale __old)
3.246 ++ {
3.247 ++ __cloc = __newlocale(1 << LC_ALL, __s, __old);
3.248 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.249 ++ if (!__cloc)
3.250 ++ {
3.251 ++ // This named locale is not supported by the underlying OS.
3.252 ++ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
3.253 ++ "name not valid"));
3.254 ++ }
3.255 ++#endif
3.256 ++ }
3.257 ++
3.258 ++ void
3.259 ++ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
3.260 ++ {
3.261 ++ if (_S_get_c_locale() != __cloc)
3.262 ++ __freelocale(__cloc);
3.263 ++ }
3.264 ++
3.265 ++ __c_locale
3.266 ++ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
3.267 ++ { return __duplocale(__cloc); }
3.268 ++} // namespace std
3.269 ++
3.270 ++namespace __gnu_cxx
3.271 ++{
3.272 ++ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
3.273 ++ {
3.274 ++ "LC_CTYPE",
3.275 ++ "LC_NUMERIC",
3.276 ++ "LC_TIME",
3.277 ++ "LC_COLLATE",
3.278 ++ "LC_MONETARY",
3.279 ++ "LC_MESSAGES",
3.280 ++#if _GLIBCXX_NUM_CATEGORIES != 0
3.281 ++ "LC_PAPER",
3.282 ++ "LC_NAME",
3.283 ++ "LC_ADDRESS",
3.284 ++ "LC_TELEPHONE",
3.285 ++ "LC_MEASUREMENT",
3.286 ++ "LC_IDENTIFICATION"
3.287 ++#endif
3.288 ++ };
3.289 ++}
3.290 ++
3.291 ++namespace std
3.292 ++{
3.293 ++ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
3.294 ++} // namespace std
3.295 +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.h
3.296 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.h
3.297 +@@ -0,0 +1,117 @@
3.298 ++// Wrapper for underlying C-language localization -*- C++ -*-
3.299 ++
3.300 ++// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3.301 ++//
3.302 ++// This file is part of the GNU ISO C++ Library. This library is free
3.303 ++// software; you can redistribute it and/or modify it under the
3.304 ++// terms of the GNU General Public License as published by the
3.305 ++// Free Software Foundation; either version 2, or (at your option)
3.306 ++// any later version.
3.307 ++
3.308 ++// This library is distributed in the hope that it will be useful,
3.309 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.310 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.311 ++// GNU General Public License for more details.
3.312 ++
3.313 ++// You should have received a copy of the GNU General Public License along
3.314 ++// with this library; see the file COPYING. If not, write to the Free
3.315 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.316 ++// USA.
3.317 ++
3.318 ++// As a special exception, you may use this file as part of a free software
3.319 ++// library without restriction. Specifically, if other files instantiate
3.320 ++// templates or use macros or inline functions from this file, or you compile
3.321 ++// this file and link it with other files to produce an executable, this
3.322 ++// file does not by itself cause the resulting executable to be covered by
3.323 ++// the GNU General Public License. This exception does not however
3.324 ++// invalidate any other reasons why the executable file might be covered by
3.325 ++// the GNU General Public License.
3.326 ++
3.327 ++//
3.328 ++// ISO C++ 14882: 22.8 Standard locale categories.
3.329 ++//
3.330 ++
3.331 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.332 ++
3.333 ++#ifndef _C_LOCALE_H
3.334 ++#define _C_LOCALE_H 1
3.335 ++
3.336 ++#pragma GCC system_header
3.337 ++
3.338 ++#include <cstring> // get std::strlen
3.339 ++#include <cstdio> // get std::snprintf or std::sprintf
3.340 ++#include <clocale>
3.341 ++#include <langinfo.h> // For codecvt
3.342 ++#ifdef __UCLIBC_MJN3_ONLY__
3.343 ++#warning fix this
3.344 ++#endif
3.345 ++#ifdef __UCLIBC_HAS_LOCALE__
3.346 ++#include <iconv.h> // For codecvt using iconv, iconv_t
3.347 ++#endif
3.348 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
3.349 ++#include <libintl.h> // For messages
3.350 ++#endif
3.351 ++
3.352 ++#ifdef __UCLIBC_MJN3_ONLY__
3.353 ++#warning what is _GLIBCXX_C_LOCALE_GNU for
3.354 ++#endif
3.355 ++#define _GLIBCXX_C_LOCALE_GNU 1
3.356 ++
3.357 ++#ifdef __UCLIBC_MJN3_ONLY__
3.358 ++#warning fix categories
3.359 ++#endif
3.360 ++// #define _GLIBCXX_NUM_CATEGORIES 6
3.361 ++#define _GLIBCXX_NUM_CATEGORIES 0
3.362 ++
3.363 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.364 ++namespace __gnu_cxx
3.365 ++{
3.366 ++ extern "C" __typeof(uselocale) __uselocale;
3.367 ++}
3.368 ++#endif
3.369 ++
3.370 ++namespace std
3.371 ++{
3.372 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.373 ++ typedef __locale_t __c_locale;
3.374 ++#else
3.375 ++ typedef int* __c_locale;
3.376 ++#endif
3.377 ++
3.378 ++ // Convert numeric value of type _Tv to string and return length of
3.379 ++ // string. If snprintf is available use it, otherwise fall back to
3.380 ++ // the unsafe sprintf which, in general, can be dangerous and should
3.381 ++ // be avoided.
3.382 ++ template<typename _Tv>
3.383 ++ int
3.384 ++ __convert_from_v(char* __out,
3.385 ++ const int __size __attribute__ ((__unused__)),
3.386 ++ const char* __fmt,
3.387 ++#ifdef __UCLIBC_HAS_XCLOCALE__
3.388 ++ _Tv __v, const __c_locale& __cloc, int __prec)
3.389 ++ {
3.390 ++ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
3.391 ++#else
3.392 ++ _Tv __v, const __c_locale&, int __prec)
3.393 ++ {
3.394 ++# ifdef __UCLIBC_HAS_LOCALE__
3.395 ++ char* __old = std::setlocale(LC_ALL, NULL);
3.396 ++ char* __sav = new char[std::strlen(__old) + 1];
3.397 ++ std::strcpy(__sav, __old);
3.398 ++ std::setlocale(LC_ALL, "C");
3.399 ++# endif
3.400 ++#endif
3.401 ++
3.402 ++ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
3.403 ++
3.404 ++#ifdef __UCLIBC_HAS_XCLOCALE__
3.405 ++ __gnu_cxx::__uselocale(__old);
3.406 ++#elif defined __UCLIBC_HAS_LOCALE__
3.407 ++ std::setlocale(LC_ALL, __sav);
3.408 ++ delete [] __sav;
3.409 ++#endif
3.410 ++ return __ret;
3.411 ++ }
3.412 ++}
3.413 ++
3.414 ++#endif
3.415 +--- gcc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
3.416 ++++ gcc/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
3.417 +@@ -0,0 +1,306 @@
3.418 ++// std::codecvt implementation details, GNU version -*- C++ -*-
3.419 ++
3.420 ++// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3.421 ++//
3.422 ++// This file is part of the GNU ISO C++ Library. This library is free
3.423 ++// software; you can redistribute it and/or modify it under the
3.424 ++// terms of the GNU General Public License as published by the
3.425 ++// Free Software Foundation; either version 2, or (at your option)
3.426 ++// any later version.
3.427 ++
3.428 ++// This library is distributed in the hope that it will be useful,
3.429 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.430 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.431 ++// GNU General Public License for more details.
3.432 ++
3.433 ++// You should have received a copy of the GNU General Public License along
3.434 ++// with this library; see the file COPYING. If not, write to the Free
3.435 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.436 ++// USA.
3.437 ++
3.438 ++// As a special exception, you may use this file as part of a free software
3.439 ++// library without restriction. Specifically, if other files instantiate
3.440 ++// templates or use macros or inline functions from this file, or you compile
3.441 ++// this file and link it with other files to produce an executable, this
3.442 ++// file does not by itself cause the resulting executable to be covered by
3.443 ++// the GNU General Public License. This exception does not however
3.444 ++// invalidate any other reasons why the executable file might be covered by
3.445 ++// the GNU General Public License.
3.446 ++
3.447 ++//
3.448 ++// ISO C++ 14882: 22.2.1.5 - Template class codecvt
3.449 ++//
3.450 ++
3.451 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.452 ++
3.453 ++#include <locale>
3.454 ++#include <bits/c++locale_internal.h>
3.455 ++
3.456 ++namespace std
3.457 ++{
3.458 ++ // Specializations.
3.459 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.460 ++ codecvt_base::result
3.461 ++ codecvt<wchar_t, char, mbstate_t>::
3.462 ++ do_out(state_type& __state, const intern_type* __from,
3.463 ++ const intern_type* __from_end, const intern_type*& __from_next,
3.464 ++ extern_type* __to, extern_type* __to_end,
3.465 ++ extern_type*& __to_next) const
3.466 ++ {
3.467 ++ result __ret = ok;
3.468 ++ state_type __tmp_state(__state);
3.469 ++
3.470 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.471 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.472 ++#endif
3.473 ++
3.474 ++ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
3.475 ++ // in case we fall back to wcrtomb and then continue, in a loop.
3.476 ++ // NB: wcsnrtombs is a GNU extension
3.477 ++ for (__from_next = __from, __to_next = __to;
3.478 ++ __from_next < __from_end && __to_next < __to_end
3.479 ++ && __ret == ok;)
3.480 ++ {
3.481 ++ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
3.482 ++ __from_end - __from_next);
3.483 ++ if (!__from_chunk_end)
3.484 ++ __from_chunk_end = __from_end;
3.485 ++
3.486 ++ __from = __from_next;
3.487 ++ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
3.488 ++ __from_chunk_end - __from_next,
3.489 ++ __to_end - __to_next, &__state);
3.490 ++ if (__conv == static_cast<size_t>(-1))
3.491 ++ {
3.492 ++ // In case of error, in order to stop at the exact place we
3.493 ++ // have to start again from the beginning with a series of
3.494 ++ // wcrtomb.
3.495 ++ for (; __from < __from_next; ++__from)
3.496 ++ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
3.497 ++ __state = __tmp_state;
3.498 ++ __ret = error;
3.499 ++ }
3.500 ++ else if (__from_next && __from_next < __from_chunk_end)
3.501 ++ {
3.502 ++ __to_next += __conv;
3.503 ++ __ret = partial;
3.504 ++ }
3.505 ++ else
3.506 ++ {
3.507 ++ __from_next = __from_chunk_end;
3.508 ++ __to_next += __conv;
3.509 ++ }
3.510 ++
3.511 ++ if (__from_next < __from_end && __ret == ok)
3.512 ++ {
3.513 ++ extern_type __buf[MB_LEN_MAX];
3.514 ++ __tmp_state = __state;
3.515 ++ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
3.516 ++ if (__conv > static_cast<size_t>(__to_end - __to_next))
3.517 ++ __ret = partial;
3.518 ++ else
3.519 ++ {
3.520 ++ memcpy(__to_next, __buf, __conv);
3.521 ++ __state = __tmp_state;
3.522 ++ __to_next += __conv;
3.523 ++ ++__from_next;
3.524 ++ }
3.525 ++ }
3.526 ++ }
3.527 ++
3.528 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.529 ++ __uselocale(__old);
3.530 ++#endif
3.531 ++
3.532 ++ return __ret;
3.533 ++ }
3.534 ++
3.535 ++ codecvt_base::result
3.536 ++ codecvt<wchar_t, char, mbstate_t>::
3.537 ++ do_in(state_type& __state, const extern_type* __from,
3.538 ++ const extern_type* __from_end, const extern_type*& __from_next,
3.539 ++ intern_type* __to, intern_type* __to_end,
3.540 ++ intern_type*& __to_next) const
3.541 ++ {
3.542 ++ result __ret = ok;
3.543 ++ state_type __tmp_state(__state);
3.544 ++
3.545 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.546 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.547 ++#endif
3.548 ++
3.549 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
3.550 ++ // in case we store a L'\0' and then continue, in a loop.
3.551 ++ // NB: mbsnrtowcs is a GNU extension
3.552 ++ for (__from_next = __from, __to_next = __to;
3.553 ++ __from_next < __from_end && __to_next < __to_end
3.554 ++ && __ret == ok;)
3.555 ++ {
3.556 ++ const extern_type* __from_chunk_end;
3.557 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
3.558 ++ __from_end
3.559 ++ - __from_next));
3.560 ++ if (!__from_chunk_end)
3.561 ++ __from_chunk_end = __from_end;
3.562 ++
3.563 ++ __from = __from_next;
3.564 ++ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
3.565 ++ __from_chunk_end - __from_next,
3.566 ++ __to_end - __to_next, &__state);
3.567 ++ if (__conv == static_cast<size_t>(-1))
3.568 ++ {
3.569 ++ // In case of error, in order to stop at the exact place we
3.570 ++ // have to start again from the beginning with a series of
3.571 ++ // mbrtowc.
3.572 ++ for (;; ++__to_next, __from += __conv)
3.573 ++ {
3.574 ++ __conv = mbrtowc(__to_next, __from, __from_end - __from,
3.575 ++ &__tmp_state);
3.576 ++ if (__conv == static_cast<size_t>(-1)
3.577 ++ || __conv == static_cast<size_t>(-2))
3.578 ++ break;
3.579 ++ }
3.580 ++ __from_next = __from;
3.581 ++ __state = __tmp_state;
3.582 ++ __ret = error;
3.583 ++ }
3.584 ++ else if (__from_next && __from_next < __from_chunk_end)
3.585 ++ {
3.586 ++ // It is unclear what to return in this case (see DR 382).
3.587 ++ __to_next += __conv;
3.588 ++ __ret = partial;
3.589 ++ }
3.590 ++ else
3.591 ++ {
3.592 ++ __from_next = __from_chunk_end;
3.593 ++ __to_next += __conv;
3.594 ++ }
3.595 ++
3.596 ++ if (__from_next < __from_end && __ret == ok)
3.597 ++ {
3.598 ++ if (__to_next < __to_end)
3.599 ++ {
3.600 ++ // XXX Probably wrong for stateful encodings
3.601 ++ __tmp_state = __state;
3.602 ++ ++__from_next;
3.603 ++ *__to_next++ = L'\0';
3.604 ++ }
3.605 ++ else
3.606 ++ __ret = partial;
3.607 ++ }
3.608 ++ }
3.609 ++
3.610 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.611 ++ __uselocale(__old);
3.612 ++#endif
3.613 ++
3.614 ++ return __ret;
3.615 ++ }
3.616 ++
3.617 ++ int
3.618 ++ codecvt<wchar_t, char, mbstate_t>::
3.619 ++ do_encoding() const throw()
3.620 ++ {
3.621 ++ // XXX This implementation assumes that the encoding is
3.622 ++ // stateless and is either single-byte or variable-width.
3.623 ++ int __ret = 0;
3.624 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.625 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.626 ++#endif
3.627 ++ if (MB_CUR_MAX == 1)
3.628 ++ __ret = 1;
3.629 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.630 ++ __uselocale(__old);
3.631 ++#endif
3.632 ++ return __ret;
3.633 ++ }
3.634 ++
3.635 ++ int
3.636 ++ codecvt<wchar_t, char, mbstate_t>::
3.637 ++ do_max_length() const throw()
3.638 ++ {
3.639 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.640 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.641 ++#endif
3.642 ++ // XXX Probably wrong for stateful encodings.
3.643 ++ int __ret = MB_CUR_MAX;
3.644 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.645 ++ __uselocale(__old);
3.646 ++#endif
3.647 ++ return __ret;
3.648 ++ }
3.649 ++
3.650 ++ int
3.651 ++ codecvt<wchar_t, char, mbstate_t>::
3.652 ++ do_length(state_type& __state, const extern_type* __from,
3.653 ++ const extern_type* __end, size_t __max) const
3.654 ++ {
3.655 ++ int __ret = 0;
3.656 ++ state_type __tmp_state(__state);
3.657 ++
3.658 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.659 ++ __c_locale __old = __uselocale(_M_c_locale_codecvt);
3.660 ++#endif
3.661 ++
3.662 ++ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
3.663 ++ // in case we advance past it and then continue, in a loop.
3.664 ++ // NB: mbsnrtowcs is a GNU extension
3.665 ++
3.666 ++ // A dummy internal buffer is needed in order for mbsnrtocws to consider
3.667 ++ // its fourth parameter (it wouldn't with NULL as first parameter).
3.668 ++ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
3.669 ++ * __max));
3.670 ++ while (__from < __end && __max)
3.671 ++ {
3.672 ++ const extern_type* __from_chunk_end;
3.673 ++ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
3.674 ++ __end
3.675 ++ - __from));
3.676 ++ if (!__from_chunk_end)
3.677 ++ __from_chunk_end = __end;
3.678 ++
3.679 ++ const extern_type* __tmp_from = __from;
3.680 ++ size_t __conv = mbsnrtowcs(__to, &__from,
3.681 ++ __from_chunk_end - __from,
3.682 ++ __max, &__state);
3.683 ++ if (__conv == static_cast<size_t>(-1))
3.684 ++ {
3.685 ++ // In case of error, in order to stop at the exact place we
3.686 ++ // have to start again from the beginning with a series of
3.687 ++ // mbrtowc.
3.688 ++ for (__from = __tmp_from;; __from += __conv)
3.689 ++ {
3.690 ++ __conv = mbrtowc(NULL, __from, __end - __from,
3.691 ++ &__tmp_state);
3.692 ++ if (__conv == static_cast<size_t>(-1)
3.693 ++ || __conv == static_cast<size_t>(-2))
3.694 ++ break;
3.695 ++ }
3.696 ++ __state = __tmp_state;
3.697 ++ __ret += __from - __tmp_from;
3.698 ++ break;
3.699 ++ }
3.700 ++ if (!__from)
3.701 ++ __from = __from_chunk_end;
3.702 ++
3.703 ++ __ret += __from - __tmp_from;
3.704 ++ __max -= __conv;
3.705 ++
3.706 ++ if (__from < __end && __max)
3.707 ++ {
3.708 ++ // XXX Probably wrong for stateful encodings
3.709 ++ __tmp_state = __state;
3.710 ++ ++__from;
3.711 ++ ++__ret;
3.712 ++ --__max;
3.713 ++ }
3.714 ++ }
3.715 ++
3.716 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.717 ++ __uselocale(__old);
3.718 ++#endif
3.719 ++
3.720 ++ return __ret;
3.721 ++ }
3.722 ++#endif
3.723 ++}
3.724 +--- gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc
3.725 ++++ gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc
3.726 +@@ -0,0 +1,80 @@
3.727 ++// std::collate implementation details, GNU version -*- C++ -*-
3.728 ++
3.729 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3.730 ++//
3.731 ++// This file is part of the GNU ISO C++ Library. This library is free
3.732 ++// software; you can redistribute it and/or modify it under the
3.733 ++// terms of the GNU General Public License as published by the
3.734 ++// Free Software Foundation; either version 2, or (at your option)
3.735 ++// any later version.
3.736 ++
3.737 ++// This library is distributed in the hope that it will be useful,
3.738 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.739 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.740 ++// GNU General Public License for more details.
3.741 ++
3.742 ++// You should have received a copy of the GNU General Public License along
3.743 ++// with this library; see the file COPYING. If not, write to the Free
3.744 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.745 ++// USA.
3.746 ++
3.747 ++// As a special exception, you may use this file as part of a free software
3.748 ++// library without restriction. Specifically, if other files instantiate
3.749 ++// templates or use macros or inline functions from this file, or you compile
3.750 ++// this file and link it with other files to produce an executable, this
3.751 ++// file does not by itself cause the resulting executable to be covered by
3.752 ++// the GNU General Public License. This exception does not however
3.753 ++// invalidate any other reasons why the executable file might be covered by
3.754 ++// the GNU General Public License.
3.755 ++
3.756 ++//
3.757 ++// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
3.758 ++//
3.759 ++
3.760 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.761 ++
3.762 ++#include <locale>
3.763 ++#include <bits/c++locale_internal.h>
3.764 ++
3.765 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.766 ++#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
3.767 ++#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
3.768 ++#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
3.769 ++#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
3.770 ++#endif
3.771 ++
3.772 ++namespace std
3.773 ++{
3.774 ++ // These are basically extensions to char_traits, and perhaps should
3.775 ++ // be put there instead of here.
3.776 ++ template<>
3.777 ++ int
3.778 ++ collate<char>::_M_compare(const char* __one, const char* __two) const
3.779 ++ {
3.780 ++ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
3.781 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
3.782 ++ }
3.783 ++
3.784 ++ template<>
3.785 ++ size_t
3.786 ++ collate<char>::_M_transform(char* __to, const char* __from,
3.787 ++ size_t __n) const
3.788 ++ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
3.789 ++
3.790 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.791 ++ template<>
3.792 ++ int
3.793 ++ collate<wchar_t>::_M_compare(const wchar_t* __one,
3.794 ++ const wchar_t* __two) const
3.795 ++ {
3.796 ++ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
3.797 ++ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
3.798 ++ }
3.799 ++
3.800 ++ template<>
3.801 ++ size_t
3.802 ++ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
3.803 ++ size_t __n) const
3.804 ++ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
3.805 ++#endif
3.806 ++}
3.807 +--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc
3.808 ++++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc
3.809 +@@ -0,0 +1,300 @@
3.810 ++// std::ctype implementation details, GNU version -*- C++ -*-
3.811 ++
3.812 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.813 ++//
3.814 ++// This file is part of the GNU ISO C++ Library. This library is free
3.815 ++// software; you can redistribute it and/or modify it under the
3.816 ++// terms of the GNU General Public License as published by the
3.817 ++// Free Software Foundation; either version 2, or (at your option)
3.818 ++// any later version.
3.819 ++
3.820 ++// This library is distributed in the hope that it will be useful,
3.821 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.822 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.823 ++// GNU General Public License for more details.
3.824 ++
3.825 ++// You should have received a copy of the GNU General Public License along
3.826 ++// with this library; see the file COPYING. If not, write to the Free
3.827 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.828 ++// USA.
3.829 ++
3.830 ++// As a special exception, you may use this file as part of a free software
3.831 ++// library without restriction. Specifically, if other files instantiate
3.832 ++// templates or use macros or inline functions from this file, or you compile
3.833 ++// this file and link it with other files to produce an executable, this
3.834 ++// file does not by itself cause the resulting executable to be covered by
3.835 ++// the GNU General Public License. This exception does not however
3.836 ++// invalidate any other reasons why the executable file might be covered by
3.837 ++// the GNU General Public License.
3.838 ++
3.839 ++//
3.840 ++// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
3.841 ++//
3.842 ++
3.843 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.844 ++
3.845 ++#define _LIBC
3.846 ++#include <locale>
3.847 ++#undef _LIBC
3.848 ++#include <bits/c++locale_internal.h>
3.849 ++
3.850 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.851 ++#define __wctype_l(S, L) wctype((S))
3.852 ++#define __towupper_l(C, L) towupper((C))
3.853 ++#define __towlower_l(C, L) towlower((C))
3.854 ++#define __iswctype_l(C, M, L) iswctype((C), (M))
3.855 ++#endif
3.856 ++
3.857 ++namespace std
3.858 ++{
3.859 ++ // NB: The other ctype<char> specializations are in src/locale.cc and
3.860 ++ // various /config/os/* files.
3.861 ++ template<>
3.862 ++ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
3.863 ++ : ctype<char>(0, false, __refs)
3.864 ++ {
3.865 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
3.866 ++ {
3.867 ++ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
3.868 ++ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
3.869 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.870 ++ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
3.871 ++ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
3.872 ++ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
3.873 ++#endif
3.874 ++ }
3.875 ++ }
3.876 ++
3.877 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.878 ++ ctype<wchar_t>::__wmask_type
3.879 ++ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
3.880 ++ {
3.881 ++ __wmask_type __ret;
3.882 ++ switch (__m)
3.883 ++ {
3.884 ++ case space:
3.885 ++ __ret = __wctype_l("space", _M_c_locale_ctype);
3.886 ++ break;
3.887 ++ case print:
3.888 ++ __ret = __wctype_l("print", _M_c_locale_ctype);
3.889 ++ break;
3.890 ++ case cntrl:
3.891 ++ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
3.892 ++ break;
3.893 ++ case upper:
3.894 ++ __ret = __wctype_l("upper", _M_c_locale_ctype);
3.895 ++ break;
3.896 ++ case lower:
3.897 ++ __ret = __wctype_l("lower", _M_c_locale_ctype);
3.898 ++ break;
3.899 ++ case alpha:
3.900 ++ __ret = __wctype_l("alpha", _M_c_locale_ctype);
3.901 ++ break;
3.902 ++ case digit:
3.903 ++ __ret = __wctype_l("digit", _M_c_locale_ctype);
3.904 ++ break;
3.905 ++ case punct:
3.906 ++ __ret = __wctype_l("punct", _M_c_locale_ctype);
3.907 ++ break;
3.908 ++ case xdigit:
3.909 ++ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
3.910 ++ break;
3.911 ++ case alnum:
3.912 ++ __ret = __wctype_l("alnum", _M_c_locale_ctype);
3.913 ++ break;
3.914 ++ case graph:
3.915 ++ __ret = __wctype_l("graph", _M_c_locale_ctype);
3.916 ++ break;
3.917 ++ default:
3.918 ++ __ret = __wmask_type();
3.919 ++ }
3.920 ++ return __ret;
3.921 ++ }
3.922 ++
3.923 ++ wchar_t
3.924 ++ ctype<wchar_t>::do_toupper(wchar_t __c) const
3.925 ++ { return __towupper_l(__c, _M_c_locale_ctype); }
3.926 ++
3.927 ++ const wchar_t*
3.928 ++ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
3.929 ++ {
3.930 ++ while (__lo < __hi)
3.931 ++ {
3.932 ++ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
3.933 ++ ++__lo;
3.934 ++ }
3.935 ++ return __hi;
3.936 ++ }
3.937 ++
3.938 ++ wchar_t
3.939 ++ ctype<wchar_t>::do_tolower(wchar_t __c) const
3.940 ++ { return __towlower_l(__c, _M_c_locale_ctype); }
3.941 ++
3.942 ++ const wchar_t*
3.943 ++ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
3.944 ++ {
3.945 ++ while (__lo < __hi)
3.946 ++ {
3.947 ++ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
3.948 ++ ++__lo;
3.949 ++ }
3.950 ++ return __hi;
3.951 ++ }
3.952 ++
3.953 ++ bool
3.954 ++ ctype<wchar_t>::
3.955 ++ do_is(mask __m, wchar_t __c) const
3.956 ++ {
3.957 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
3.958 ++ // library for blank.
3.959 ++ bool __ret = false;
3.960 ++ const size_t __bitmasksize = 11;
3.961 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
3.962 ++ if (__m & _M_bit[__bitcur]
3.963 ++ && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
3.964 ++ {
3.965 ++ __ret = true;
3.966 ++ break;
3.967 ++ }
3.968 ++ return __ret;
3.969 ++ }
3.970 ++
3.971 ++ const wchar_t*
3.972 ++ ctype<wchar_t>::
3.973 ++ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
3.974 ++ {
3.975 ++ for (; __lo < __hi; ++__vec, ++__lo)
3.976 ++ {
3.977 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
3.978 ++ // library for blank.
3.979 ++ const size_t __bitmasksize = 11;
3.980 ++ mask __m = 0;
3.981 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
3.982 ++ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
3.983 ++ __m |= _M_bit[__bitcur];
3.984 ++ *__vec = __m;
3.985 ++ }
3.986 ++ return __hi;
3.987 ++ }
3.988 ++
3.989 ++ const wchar_t*
3.990 ++ ctype<wchar_t>::
3.991 ++ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
3.992 ++ {
3.993 ++ while (__lo < __hi && !this->do_is(__m, *__lo))
3.994 ++ ++__lo;
3.995 ++ return __lo;
3.996 ++ }
3.997 ++
3.998 ++ const wchar_t*
3.999 ++ ctype<wchar_t>::
3.1000 ++ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
3.1001 ++ {
3.1002 ++ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
3.1003 ++ ++__lo;
3.1004 ++ return __lo;
3.1005 ++ }
3.1006 ++
3.1007 ++ wchar_t
3.1008 ++ ctype<wchar_t>::
3.1009 ++ do_widen(char __c) const
3.1010 ++ { return _M_widen[static_cast<unsigned char>(__c)]; }
3.1011 ++
3.1012 ++ const char*
3.1013 ++ ctype<wchar_t>::
3.1014 ++ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
3.1015 ++ {
3.1016 ++ while (__lo < __hi)
3.1017 ++ {
3.1018 ++ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
3.1019 ++ ++__lo;
3.1020 ++ ++__dest;
3.1021 ++ }
3.1022 ++ return __hi;
3.1023 ++ }
3.1024 ++
3.1025 ++ char
3.1026 ++ ctype<wchar_t>::
3.1027 ++ do_narrow(wchar_t __wc, char __dfault) const
3.1028 ++ {
3.1029 ++ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
3.1030 ++ return _M_narrow[__wc];
3.1031 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1032 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
3.1033 ++#endif
3.1034 ++ const int __c = wctob(__wc);
3.1035 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1036 ++ __uselocale(__old);
3.1037 ++#endif
3.1038 ++ return (__c == EOF ? __dfault : static_cast<char>(__c));
3.1039 ++ }
3.1040 ++
3.1041 ++ const wchar_t*
3.1042 ++ ctype<wchar_t>::
3.1043 ++ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
3.1044 ++ char* __dest) const
3.1045 ++ {
3.1046 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1047 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
3.1048 ++#endif
3.1049 ++ if (_M_narrow_ok)
3.1050 ++ while (__lo < __hi)
3.1051 ++ {
3.1052 ++ if (*__lo >= 0 && *__lo < 128)
3.1053 ++ *__dest = _M_narrow[*__lo];
3.1054 ++ else
3.1055 ++ {
3.1056 ++ const int __c = wctob(*__lo);
3.1057 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
3.1058 ++ }
3.1059 ++ ++__lo;
3.1060 ++ ++__dest;
3.1061 ++ }
3.1062 ++ else
3.1063 ++ while (__lo < __hi)
3.1064 ++ {
3.1065 ++ const int __c = wctob(*__lo);
3.1066 ++ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
3.1067 ++ ++__lo;
3.1068 ++ ++__dest;
3.1069 ++ }
3.1070 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1071 ++ __uselocale(__old);
3.1072 ++#endif
3.1073 ++ return __hi;
3.1074 ++ }
3.1075 ++
3.1076 ++ void
3.1077 ++ ctype<wchar_t>::_M_initialize_ctype()
3.1078 ++ {
3.1079 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1080 ++ __c_locale __old = __uselocale(_M_c_locale_ctype);
3.1081 ++#endif
3.1082 ++ wint_t __i;
3.1083 ++ for (__i = 0; __i < 128; ++__i)
3.1084 ++ {
3.1085 ++ const int __c = wctob(__i);
3.1086 ++ if (__c == EOF)
3.1087 ++ break;
3.1088 ++ else
3.1089 ++ _M_narrow[__i] = static_cast<char>(__c);
3.1090 ++ }
3.1091 ++ if (__i == 128)
3.1092 ++ _M_narrow_ok = true;
3.1093 ++ else
3.1094 ++ _M_narrow_ok = false;
3.1095 ++ for (size_t __j = 0;
3.1096 ++ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
3.1097 ++ _M_widen[__j] = btowc(__j);
3.1098 ++
3.1099 ++ for (size_t __k = 0; __k <= 11; ++__k)
3.1100 ++ {
3.1101 ++ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
3.1102 ++ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
3.1103 ++ }
3.1104 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1105 ++ __uselocale(__old);
3.1106 ++#endif
3.1107 ++ }
3.1108 ++#endif // _GLIBCXX_USE_WCHAR_T
3.1109 ++}
3.1110 +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc
3.1111 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc
3.1112 +@@ -0,0 +1,100 @@
3.1113 ++// std::messages implementation details, GNU version -*- C++ -*-
3.1114 ++
3.1115 ++// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3.1116 ++//
3.1117 ++// This file is part of the GNU ISO C++ Library. This library is free
3.1118 ++// software; you can redistribute it and/or modify it under the
3.1119 ++// terms of the GNU General Public License as published by the
3.1120 ++// Free Software Foundation; either version 2, or (at your option)
3.1121 ++// any later version.
3.1122 ++
3.1123 ++// This library is distributed in the hope that it will be useful,
3.1124 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.1125 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.1126 ++// GNU General Public License for more details.
3.1127 ++
3.1128 ++// You should have received a copy of the GNU General Public License along
3.1129 ++// with this library; see the file COPYING. If not, write to the Free
3.1130 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.1131 ++// USA.
3.1132 ++
3.1133 ++// As a special exception, you may use this file as part of a free software
3.1134 ++// library without restriction. Specifically, if other files instantiate
3.1135 ++// templates or use macros or inline functions from this file, or you compile
3.1136 ++// this file and link it with other files to produce an executable, this
3.1137 ++// file does not by itself cause the resulting executable to be covered by
3.1138 ++// the GNU General Public License. This exception does not however
3.1139 ++// invalidate any other reasons why the executable file might be covered by
3.1140 ++// the GNU General Public License.
3.1141 ++
3.1142 ++//
3.1143 ++// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
3.1144 ++//
3.1145 ++
3.1146 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.1147 ++
3.1148 ++#include <locale>
3.1149 ++#include <bits/c++locale_internal.h>
3.1150 ++
3.1151 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1152 ++#warning fix gettext stuff
3.1153 ++#endif
3.1154 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
3.1155 ++extern "C" char *__dcgettext(const char *domainname,
3.1156 ++ const char *msgid, int category);
3.1157 ++#undef gettext
3.1158 ++#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
3.1159 ++#else
3.1160 ++#undef gettext
3.1161 ++#define gettext(msgid) (msgid)
3.1162 ++#endif
3.1163 ++
3.1164 ++namespace std
3.1165 ++{
3.1166 ++ // Specializations.
3.1167 ++ template<>
3.1168 ++ string
3.1169 ++ messages<char>::do_get(catalog, int, int, const string& __dfault) const
3.1170 ++ {
3.1171 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1172 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
3.1173 ++ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
3.1174 ++ __uselocale(__old);
3.1175 ++ return string(__msg);
3.1176 ++#elif defined __UCLIBC_HAS_LOCALE__
3.1177 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1178 ++ setlocale(LC_ALL, _M_name_messages);
3.1179 ++ const char* __msg = gettext(__dfault.c_str());
3.1180 ++ setlocale(LC_ALL, __old);
3.1181 ++ free(__old);
3.1182 ++ return string(__msg);
3.1183 ++#else
3.1184 ++ const char* __msg = gettext(__dfault.c_str());
3.1185 ++ return string(__msg);
3.1186 ++#endif
3.1187 ++ }
3.1188 ++
3.1189 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.1190 ++ template<>
3.1191 ++ wstring
3.1192 ++ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
3.1193 ++ {
3.1194 ++# ifdef __UCLIBC_HAS_XLOCALE__
3.1195 ++ __c_locale __old = __uselocale(_M_c_locale_messages);
3.1196 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
3.1197 ++ __uselocale(__old);
3.1198 ++ return _M_convert_from_char(__msg);
3.1199 ++# elif defined __UCLIBC_HAS_LOCALE__
3.1200 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1201 ++ setlocale(LC_ALL, _M_name_messages);
3.1202 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
3.1203 ++ setlocale(LC_ALL, __old);
3.1204 ++ free(__old);
3.1205 ++ return _M_convert_from_char(__msg);
3.1206 ++# else
3.1207 ++ char* __msg = gettext(_M_convert_to_char(__dfault));
3.1208 ++ return _M_convert_from_char(__msg);
3.1209 ++# endif
3.1210 ++ }
3.1211 ++#endif
3.1212 ++}
3.1213 +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h
3.1214 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h
3.1215 +@@ -0,0 +1,118 @@
3.1216 ++// std::messages implementation details, GNU version -*- C++ -*-
3.1217 ++
3.1218 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.1219 ++//
3.1220 ++// This file is part of the GNU ISO C++ Library. This library is free
3.1221 ++// software; you can redistribute it and/or modify it under the
3.1222 ++// terms of the GNU General Public License as published by the
3.1223 ++// Free Software Foundation; either version 2, or (at your option)
3.1224 ++// any later version.
3.1225 ++
3.1226 ++// This library is distributed in the hope that it will be useful,
3.1227 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.1228 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.1229 ++// GNU General Public License for more details.
3.1230 ++
3.1231 ++// You should have received a copy of the GNU General Public License along
3.1232 ++// with this library; see the file COPYING. If not, write to the Free
3.1233 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.1234 ++// USA.
3.1235 ++
3.1236 ++// As a special exception, you may use this file as part of a free software
3.1237 ++// library without restriction. Specifically, if other files instantiate
3.1238 ++// templates or use macros or inline functions from this file, or you compile
3.1239 ++// this file and link it with other files to produce an executable, this
3.1240 ++// file does not by itself cause the resulting executable to be covered by
3.1241 ++// the GNU General Public License. This exception does not however
3.1242 ++// invalidate any other reasons why the executable file might be covered by
3.1243 ++// the GNU General Public License.
3.1244 ++
3.1245 ++//
3.1246 ++// ISO C++ 14882: 22.2.7.1.2 messages functions
3.1247 ++//
3.1248 ++
3.1249 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.1250 ++
3.1251 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1252 ++#warning fix prototypes for *textdomain funcs
3.1253 ++#endif
3.1254 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
3.1255 ++extern "C" char *__textdomain(const char *domainname);
3.1256 ++extern "C" char *__bindtextdomain(const char *domainname,
3.1257 ++ const char *dirname);
3.1258 ++#else
3.1259 ++#undef __textdomain
3.1260 ++#undef __bindtextdomain
3.1261 ++#define __textdomain(D) ((void)0)
3.1262 ++#define __bindtextdomain(D,P) ((void)0)
3.1263 ++#endif
3.1264 ++
3.1265 ++ // Non-virtual member functions.
3.1266 ++ template<typename _CharT>
3.1267 ++ messages<_CharT>::messages(size_t __refs)
3.1268 ++ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
3.1269 ++ _M_name_messages(_S_get_c_name())
3.1270 ++ { }
3.1271 ++
3.1272 ++ template<typename _CharT>
3.1273 ++ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
3.1274 ++ size_t __refs)
3.1275 ++ : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
3.1276 ++ _M_name_messages(__s)
3.1277 ++ {
3.1278 ++ char* __tmp = new char[std::strlen(__s) + 1];
3.1279 ++ std::strcpy(__tmp, __s);
3.1280 ++ _M_name_messages = __tmp;
3.1281 ++ }
3.1282 ++
3.1283 ++ template<typename _CharT>
3.1284 ++ typename messages<_CharT>::catalog
3.1285 ++ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
3.1286 ++ const char* __dir) const
3.1287 ++ {
3.1288 ++ __bindtextdomain(__s.c_str(), __dir);
3.1289 ++ return this->do_open(__s, __loc);
3.1290 ++ }
3.1291 ++
3.1292 ++ // Virtual member functions.
3.1293 ++ template<typename _CharT>
3.1294 ++ messages<_CharT>::~messages()
3.1295 ++ {
3.1296 ++ if (_M_name_messages != _S_get_c_name())
3.1297 ++ delete [] _M_name_messages;
3.1298 ++ _S_destroy_c_locale(_M_c_locale_messages);
3.1299 ++ }
3.1300 ++
3.1301 ++ template<typename _CharT>
3.1302 ++ typename messages<_CharT>::catalog
3.1303 ++ messages<_CharT>::do_open(const basic_string<char>& __s,
3.1304 ++ const locale&) const
3.1305 ++ {
3.1306 ++ // No error checking is done, assume the catalog exists and can
3.1307 ++ // be used.
3.1308 ++ __textdomain(__s.c_str());
3.1309 ++ return 0;
3.1310 ++ }
3.1311 ++
3.1312 ++ template<typename _CharT>
3.1313 ++ void
3.1314 ++ messages<_CharT>::do_close(catalog) const
3.1315 ++ { }
3.1316 ++
3.1317 ++ // messages_byname
3.1318 ++ template<typename _CharT>
3.1319 ++ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
3.1320 ++ : messages<_CharT>(__refs)
3.1321 ++ {
3.1322 ++ if (this->_M_name_messages != locale::facet::_S_get_c_name())
3.1323 ++ delete [] this->_M_name_messages;
3.1324 ++ char* __tmp = new char[std::strlen(__s) + 1];
3.1325 ++ std::strcpy(__tmp, __s);
3.1326 ++ this->_M_name_messages = __tmp;
3.1327 ++
3.1328 ++ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
3.1329 ++ {
3.1330 ++ this->_S_destroy_c_locale(this->_M_c_locale_messages);
3.1331 ++ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
3.1332 ++ }
3.1333 ++ }
3.1334 +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc
3.1335 ++++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc
3.1336 +@@ -0,0 +1,692 @@
3.1337 ++// std::moneypunct implementation details, GNU version -*- C++ -*-
3.1338 ++
3.1339 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.1340 ++//
3.1341 ++// This file is part of the GNU ISO C++ Library. This library is free
3.1342 ++// software; you can redistribute it and/or modify it under the
3.1343 ++// terms of the GNU General Public License as published by the
3.1344 ++// Free Software Foundation; either version 2, or (at your option)
3.1345 ++// any later version.
3.1346 ++
3.1347 ++// This library is distributed in the hope that it will be useful,
3.1348 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.1349 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.1350 ++// GNU General Public License for more details.
3.1351 ++
3.1352 ++// You should have received a copy of the GNU General Public License along
3.1353 ++// with this library; see the file COPYING. If not, write to the Free
3.1354 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.1355 ++// USA.
3.1356 ++
3.1357 ++// As a special exception, you may use this file as part of a free software
3.1358 ++// library without restriction. Specifically, if other files instantiate
3.1359 ++// templates or use macros or inline functions from this file, or you compile
3.1360 ++// this file and link it with other files to produce an executable, this
3.1361 ++// file does not by itself cause the resulting executable to be covered by
3.1362 ++// the GNU General Public License. This exception does not however
3.1363 ++// invalidate any other reasons why the executable file might be covered by
3.1364 ++// the GNU General Public License.
3.1365 ++
3.1366 ++//
3.1367 ++// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
3.1368 ++//
3.1369 ++
3.1370 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.1371 ++
3.1372 ++#define _LIBC
3.1373 ++#include <locale>
3.1374 ++#undef _LIBC
3.1375 ++#include <bits/c++locale_internal.h>
3.1376 ++
3.1377 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1378 ++#warning optimize this for uclibc
3.1379 ++#warning tailor for stub locale support
3.1380 ++#endif
3.1381 ++
3.1382 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.1383 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
3.1384 ++#endif
3.1385 ++
3.1386 ++namespace std
3.1387 ++{
3.1388 ++ // Construct and return valid pattern consisting of some combination of:
3.1389 ++ // space none symbol sign value
3.1390 ++ money_base::pattern
3.1391 ++ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
3.1392 ++ {
3.1393 ++ pattern __ret;
3.1394 ++
3.1395 ++ // This insanely complicated routine attempts to construct a valid
3.1396 ++ // pattern for use with monyepunct. A couple of invariants:
3.1397 ++
3.1398 ++ // if (__precedes) symbol -> value
3.1399 ++ // else value -> symbol
3.1400 ++
3.1401 ++ // if (__space) space
3.1402 ++ // else none
3.1403 ++
3.1404 ++ // none == never first
3.1405 ++ // space never first or last
3.1406 ++
3.1407 ++ // Any elegant implementations of this are welcome.
3.1408 ++ switch (__posn)
3.1409 ++ {
3.1410 ++ case 0:
3.1411 ++ case 1:
3.1412 ++ // 1 The sign precedes the value and symbol.
3.1413 ++ __ret.field[0] = sign;
3.1414 ++ if (__space)
3.1415 ++ {
3.1416 ++ // Pattern starts with sign.
3.1417 ++ if (__precedes)
3.1418 ++ {
3.1419 ++ __ret.field[1] = symbol;
3.1420 ++ __ret.field[3] = value;
3.1421 ++ }
3.1422 ++ else
3.1423 ++ {
3.1424 ++ __ret.field[1] = value;
3.1425 ++ __ret.field[3] = symbol;
3.1426 ++ }
3.1427 ++ __ret.field[2] = space;
3.1428 ++ }
3.1429 ++ else
3.1430 ++ {
3.1431 ++ // Pattern starts with sign and ends with none.
3.1432 ++ if (__precedes)
3.1433 ++ {
3.1434 ++ __ret.field[1] = symbol;
3.1435 ++ __ret.field[2] = value;
3.1436 ++ }
3.1437 ++ else
3.1438 ++ {
3.1439 ++ __ret.field[1] = value;
3.1440 ++ __ret.field[2] = symbol;
3.1441 ++ }
3.1442 ++ __ret.field[3] = none;
3.1443 ++ }
3.1444 ++ break;
3.1445 ++ case 2:
3.1446 ++ // 2 The sign follows the value and symbol.
3.1447 ++ if (__space)
3.1448 ++ {
3.1449 ++ // Pattern either ends with sign.
3.1450 ++ if (__precedes)
3.1451 ++ {
3.1452 ++ __ret.field[0] = symbol;
3.1453 ++ __ret.field[2] = value;
3.1454 ++ }
3.1455 ++ else
3.1456 ++ {
3.1457 ++ __ret.field[0] = value;
3.1458 ++ __ret.field[2] = symbol;
3.1459 ++ }
3.1460 ++ __ret.field[1] = space;
3.1461 ++ __ret.field[3] = sign;
3.1462 ++ }
3.1463 ++ else
3.1464 ++ {
3.1465 ++ // Pattern ends with sign then none.
3.1466 ++ if (__precedes)
3.1467 ++ {
3.1468 ++ __ret.field[0] = symbol;
3.1469 ++ __ret.field[1] = value;
3.1470 ++ }
3.1471 ++ else
3.1472 ++ {
3.1473 ++ __ret.field[0] = value;
3.1474 ++ __ret.field[1] = symbol;
3.1475 ++ }
3.1476 ++ __ret.field[2] = sign;
3.1477 ++ __ret.field[3] = none;
3.1478 ++ }
3.1479 ++ break;
3.1480 ++ case 3:
3.1481 ++ // 3 The sign immediately precedes the symbol.
3.1482 ++ if (__precedes)
3.1483 ++ {
3.1484 ++ __ret.field[0] = sign;
3.1485 ++ __ret.field[1] = symbol;
3.1486 ++ if (__space)
3.1487 ++ {
3.1488 ++ __ret.field[2] = space;
3.1489 ++ __ret.field[3] = value;
3.1490 ++ }
3.1491 ++ else
3.1492 ++ {
3.1493 ++ __ret.field[2] = value;
3.1494 ++ __ret.field[3] = none;
3.1495 ++ }
3.1496 ++ }
3.1497 ++ else
3.1498 ++ {
3.1499 ++ __ret.field[0] = value;
3.1500 ++ if (__space)
3.1501 ++ {
3.1502 ++ __ret.field[1] = space;
3.1503 ++ __ret.field[2] = sign;
3.1504 ++ __ret.field[3] = symbol;
3.1505 ++ }
3.1506 ++ else
3.1507 ++ {
3.1508 ++ __ret.field[1] = sign;
3.1509 ++ __ret.field[2] = symbol;
3.1510 ++ __ret.field[3] = none;
3.1511 ++ }
3.1512 ++ }
3.1513 ++ break;
3.1514 ++ case 4:
3.1515 ++ // 4 The sign immediately follows the symbol.
3.1516 ++ if (__precedes)
3.1517 ++ {
3.1518 ++ __ret.field[0] = symbol;
3.1519 ++ __ret.field[1] = sign;
3.1520 ++ if (__space)
3.1521 ++ {
3.1522 ++ __ret.field[2] = space;
3.1523 ++ __ret.field[3] = value;
3.1524 ++ }
3.1525 ++ else
3.1526 ++ {
3.1527 ++ __ret.field[2] = value;
3.1528 ++ __ret.field[3] = none;
3.1529 ++ }
3.1530 ++ }
3.1531 ++ else
3.1532 ++ {
3.1533 ++ __ret.field[0] = value;
3.1534 ++ if (__space)
3.1535 ++ {
3.1536 ++ __ret.field[1] = space;
3.1537 ++ __ret.field[2] = symbol;
3.1538 ++ __ret.field[3] = sign;
3.1539 ++ }
3.1540 ++ else
3.1541 ++ {
3.1542 ++ __ret.field[1] = symbol;
3.1543 ++ __ret.field[2] = sign;
3.1544 ++ __ret.field[3] = none;
3.1545 ++ }
3.1546 ++ }
3.1547 ++ break;
3.1548 ++ default:
3.1549 ++ ;
3.1550 ++ }
3.1551 ++ return __ret;
3.1552 ++ }
3.1553 ++
3.1554 ++ template<>
3.1555 ++ void
3.1556 ++ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
3.1557 ++ const char*)
3.1558 ++ {
3.1559 ++ if (!_M_data)
3.1560 ++ _M_data = new __moneypunct_cache<char, true>;
3.1561 ++
3.1562 ++ if (!__cloc)
3.1563 ++ {
3.1564 ++ // "C" locale
3.1565 ++ _M_data->_M_decimal_point = '.';
3.1566 ++ _M_data->_M_thousands_sep = ',';
3.1567 ++ _M_data->_M_grouping = "";
3.1568 ++ _M_data->_M_grouping_size = 0;
3.1569 ++ _M_data->_M_curr_symbol = "";
3.1570 ++ _M_data->_M_curr_symbol_size = 0;
3.1571 ++ _M_data->_M_positive_sign = "";
3.1572 ++ _M_data->_M_positive_sign_size = 0;
3.1573 ++ _M_data->_M_negative_sign = "";
3.1574 ++ _M_data->_M_negative_sign_size = 0;
3.1575 ++ _M_data->_M_frac_digits = 0;
3.1576 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1577 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1578 ++
3.1579 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1580 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
3.1581 ++ }
3.1582 ++ else
3.1583 ++ {
3.1584 ++ // Named locale.
3.1585 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
3.1586 ++ __cloc));
3.1587 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
3.1588 ++ __cloc));
3.1589 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1590 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1591 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1592 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
3.1593 ++
3.1594 ++ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
3.1595 ++ if (!__nposn)
3.1596 ++ _M_data->_M_negative_sign = "()";
3.1597 ++ else
3.1598 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
3.1599 ++ __cloc);
3.1600 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
3.1601 ++
3.1602 ++ // _Intl == true
3.1603 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
3.1604 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
3.1605 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
3.1606 ++ __cloc));
3.1607 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
3.1608 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
3.1609 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
3.1610 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1611 ++ __pposn);
3.1612 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
3.1613 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
3.1614 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.1615 ++ __nposn);
3.1616 ++ }
3.1617 ++ }
3.1618 ++
3.1619 ++ template<>
3.1620 ++ void
3.1621 ++ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
3.1622 ++ const char*)
3.1623 ++ {
3.1624 ++ if (!_M_data)
3.1625 ++ _M_data = new __moneypunct_cache<char, false>;
3.1626 ++
3.1627 ++ if (!__cloc)
3.1628 ++ {
3.1629 ++ // "C" locale
3.1630 ++ _M_data->_M_decimal_point = '.';
3.1631 ++ _M_data->_M_thousands_sep = ',';
3.1632 ++ _M_data->_M_grouping = "";
3.1633 ++ _M_data->_M_grouping_size = 0;
3.1634 ++ _M_data->_M_curr_symbol = "";
3.1635 ++ _M_data->_M_curr_symbol_size = 0;
3.1636 ++ _M_data->_M_positive_sign = "";
3.1637 ++ _M_data->_M_positive_sign_size = 0;
3.1638 ++ _M_data->_M_negative_sign = "";
3.1639 ++ _M_data->_M_negative_sign_size = 0;
3.1640 ++ _M_data->_M_frac_digits = 0;
3.1641 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1642 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1643 ++
3.1644 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1645 ++ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
3.1646 ++ }
3.1647 ++ else
3.1648 ++ {
3.1649 ++ // Named locale.
3.1650 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
3.1651 ++ __cloc));
3.1652 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
3.1653 ++ __cloc));
3.1654 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1655 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1656 ++ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1657 ++ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
3.1658 ++
3.1659 ++ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
3.1660 ++ if (!__nposn)
3.1661 ++ _M_data->_M_negative_sign = "()";
3.1662 ++ else
3.1663 ++ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
3.1664 ++ __cloc);
3.1665 ++ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
3.1666 ++
3.1667 ++ // _Intl == false
3.1668 ++ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
3.1669 ++ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
3.1670 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
3.1671 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
3.1672 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
3.1673 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
3.1674 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1675 ++ __pposn);
3.1676 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
3.1677 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
3.1678 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.1679 ++ __nposn);
3.1680 ++ }
3.1681 ++ }
3.1682 ++
3.1683 ++ template<>
3.1684 ++ moneypunct<char, true>::~moneypunct()
3.1685 ++ { delete _M_data; }
3.1686 ++
3.1687 ++ template<>
3.1688 ++ moneypunct<char, false>::~moneypunct()
3.1689 ++ { delete _M_data; }
3.1690 ++
3.1691 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.1692 ++ template<>
3.1693 ++ void
3.1694 ++ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
3.1695 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1696 ++ const char*)
3.1697 ++#else
3.1698 ++ const char* __name)
3.1699 ++#endif
3.1700 ++ {
3.1701 ++ if (!_M_data)
3.1702 ++ _M_data = new __moneypunct_cache<wchar_t, true>;
3.1703 ++
3.1704 ++ if (!__cloc)
3.1705 ++ {
3.1706 ++ // "C" locale
3.1707 ++ _M_data->_M_decimal_point = L'.';
3.1708 ++ _M_data->_M_thousands_sep = L',';
3.1709 ++ _M_data->_M_grouping = "";
3.1710 ++ _M_data->_M_grouping_size = 0;
3.1711 ++ _M_data->_M_curr_symbol = L"";
3.1712 ++ _M_data->_M_curr_symbol_size = 0;
3.1713 ++ _M_data->_M_positive_sign = L"";
3.1714 ++ _M_data->_M_positive_sign_size = 0;
3.1715 ++ _M_data->_M_negative_sign = L"";
3.1716 ++ _M_data->_M_negative_sign_size = 0;
3.1717 ++ _M_data->_M_frac_digits = 0;
3.1718 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1719 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1720 ++
3.1721 ++ // Use ctype::widen code without the facet...
3.1722 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1723 ++ _M_data->_M_atoms[__i] =
3.1724 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
3.1725 ++ }
3.1726 ++ else
3.1727 ++ {
3.1728 ++ // Named locale.
3.1729 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1730 ++ __c_locale __old = __uselocale(__cloc);
3.1731 ++#else
3.1732 ++ // Switch to named locale so that mbsrtowcs will work.
3.1733 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1734 ++ setlocale(LC_ALL, __name);
3.1735 ++#endif
3.1736 ++
3.1737 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1738 ++#warning fix this... should be monetary
3.1739 ++#endif
3.1740 ++#ifdef __UCLIBC__
3.1741 ++# ifdef __UCLIBC_HAS_XLOCALE__
3.1742 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
3.1743 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
3.1744 ++# else
3.1745 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
3.1746 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
3.1747 ++# endif
3.1748 ++#else
3.1749 ++ union { char *__s; wchar_t __w; } __u;
3.1750 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
3.1751 ++ _M_data->_M_decimal_point = __u.__w;
3.1752 ++
3.1753 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
3.1754 ++ _M_data->_M_thousands_sep = __u.__w;
3.1755 ++#endif
3.1756 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1757 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1758 ++
3.1759 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1760 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
3.1761 ++ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
3.1762 ++
3.1763 ++ wchar_t* __wcs_ps = 0;
3.1764 ++ wchar_t* __wcs_ns = 0;
3.1765 ++ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
3.1766 ++ try
3.1767 ++ {
3.1768 ++ mbstate_t __state;
3.1769 ++ size_t __len = strlen(__cpossign);
3.1770 ++ if (__len)
3.1771 ++ {
3.1772 ++ ++__len;
3.1773 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1774 ++ __wcs_ps = new wchar_t[__len];
3.1775 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
3.1776 ++ _M_data->_M_positive_sign = __wcs_ps;
3.1777 ++ }
3.1778 ++ else
3.1779 ++ _M_data->_M_positive_sign = L"";
3.1780 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
3.1781 ++
3.1782 ++ __len = strlen(__cnegsign);
3.1783 ++ if (!__nposn)
3.1784 ++ _M_data->_M_negative_sign = L"()";
3.1785 ++ else if (__len)
3.1786 ++ {
3.1787 ++ ++__len;
3.1788 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1789 ++ __wcs_ns = new wchar_t[__len];
3.1790 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
3.1791 ++ _M_data->_M_negative_sign = __wcs_ns;
3.1792 ++ }
3.1793 ++ else
3.1794 ++ _M_data->_M_negative_sign = L"";
3.1795 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
3.1796 ++
3.1797 ++ // _Intl == true.
3.1798 ++ __len = strlen(__ccurr);
3.1799 ++ if (__len)
3.1800 ++ {
3.1801 ++ ++__len;
3.1802 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1803 ++ wchar_t* __wcs = new wchar_t[__len];
3.1804 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
3.1805 ++ _M_data->_M_curr_symbol = __wcs;
3.1806 ++ }
3.1807 ++ else
3.1808 ++ _M_data->_M_curr_symbol = L"";
3.1809 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
3.1810 ++ }
3.1811 ++ catch (...)
3.1812 ++ {
3.1813 ++ delete _M_data;
3.1814 ++ _M_data = 0;
3.1815 ++ delete __wcs_ps;
3.1816 ++ delete __wcs_ns;
3.1817 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1818 ++ __uselocale(__old);
3.1819 ++#else
3.1820 ++ setlocale(LC_ALL, __old);
3.1821 ++ free(__old);
3.1822 ++#endif
3.1823 ++ __throw_exception_again;
3.1824 ++ }
3.1825 ++
3.1826 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
3.1827 ++ __cloc));
3.1828 ++ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
3.1829 ++ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
3.1830 ++ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
3.1831 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1832 ++ __pposn);
3.1833 ++ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
3.1834 ++ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
3.1835 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.1836 ++ __nposn);
3.1837 ++
3.1838 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1839 ++ __uselocale(__old);
3.1840 ++#else
3.1841 ++ setlocale(LC_ALL, __old);
3.1842 ++ free(__old);
3.1843 ++#endif
3.1844 ++ }
3.1845 ++ }
3.1846 ++
3.1847 ++ template<>
3.1848 ++ void
3.1849 ++ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
3.1850 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1851 ++ const char*)
3.1852 ++#else
3.1853 ++ const char* __name)
3.1854 ++#endif
3.1855 ++ {
3.1856 ++ if (!_M_data)
3.1857 ++ _M_data = new __moneypunct_cache<wchar_t, false>;
3.1858 ++
3.1859 ++ if (!__cloc)
3.1860 ++ {
3.1861 ++ // "C" locale
3.1862 ++ _M_data->_M_decimal_point = L'.';
3.1863 ++ _M_data->_M_thousands_sep = L',';
3.1864 ++ _M_data->_M_grouping = "";
3.1865 ++ _M_data->_M_grouping_size = 0;
3.1866 ++ _M_data->_M_curr_symbol = L"";
3.1867 ++ _M_data->_M_curr_symbol_size = 0;
3.1868 ++ _M_data->_M_positive_sign = L"";
3.1869 ++ _M_data->_M_positive_sign_size = 0;
3.1870 ++ _M_data->_M_negative_sign = L"";
3.1871 ++ _M_data->_M_negative_sign_size = 0;
3.1872 ++ _M_data->_M_frac_digits = 0;
3.1873 ++ _M_data->_M_pos_format = money_base::_S_default_pattern;
3.1874 ++ _M_data->_M_neg_format = money_base::_S_default_pattern;
3.1875 ++
3.1876 ++ // Use ctype::widen code without the facet...
3.1877 ++ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
3.1878 ++ _M_data->_M_atoms[__i] =
3.1879 ++ static_cast<wchar_t>(money_base::_S_atoms[__i]);
3.1880 ++ }
3.1881 ++ else
3.1882 ++ {
3.1883 ++ // Named locale.
3.1884 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1885 ++ __c_locale __old = __uselocale(__cloc);
3.1886 ++#else
3.1887 ++ // Switch to named locale so that mbsrtowcs will work.
3.1888 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.1889 ++ setlocale(LC_ALL, __name);
3.1890 ++#endif
3.1891 ++
3.1892 ++#ifdef __UCLIBC_MJN3_ONLY__
3.1893 ++#warning fix this... should be monetary
3.1894 ++#endif
3.1895 ++#ifdef __UCLIBC__
3.1896 ++# ifdef __UCLIBC_HAS_XLOCALE__
3.1897 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
3.1898 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
3.1899 ++# else
3.1900 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
3.1901 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
3.1902 ++# endif
3.1903 ++#else
3.1904 ++ union { char *__s; wchar_t __w; } __u;
3.1905 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
3.1906 ++ _M_data->_M_decimal_point = __u.__w;
3.1907 ++
3.1908 ++ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
3.1909 ++ _M_data->_M_thousands_sep = __u.__w;
3.1910 ++#endif
3.1911 ++ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
3.1912 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.1913 ++
3.1914 ++ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
3.1915 ++ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
3.1916 ++ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
3.1917 ++
3.1918 ++ wchar_t* __wcs_ps = 0;
3.1919 ++ wchar_t* __wcs_ns = 0;
3.1920 ++ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
3.1921 ++ try
3.1922 ++ {
3.1923 ++ mbstate_t __state;
3.1924 ++ size_t __len;
3.1925 ++ __len = strlen(__cpossign);
3.1926 ++ if (__len)
3.1927 ++ {
3.1928 ++ ++__len;
3.1929 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1930 ++ __wcs_ps = new wchar_t[__len];
3.1931 ++ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
3.1932 ++ _M_data->_M_positive_sign = __wcs_ps;
3.1933 ++ }
3.1934 ++ else
3.1935 ++ _M_data->_M_positive_sign = L"";
3.1936 ++ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
3.1937 ++
3.1938 ++ __len = strlen(__cnegsign);
3.1939 ++ if (!__nposn)
3.1940 ++ _M_data->_M_negative_sign = L"()";
3.1941 ++ else if (__len)
3.1942 ++ {
3.1943 ++ ++__len;
3.1944 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1945 ++ __wcs_ns = new wchar_t[__len];
3.1946 ++ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
3.1947 ++ _M_data->_M_negative_sign = __wcs_ns;
3.1948 ++ }
3.1949 ++ else
3.1950 ++ _M_data->_M_negative_sign = L"";
3.1951 ++ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
3.1952 ++
3.1953 ++ // _Intl == true.
3.1954 ++ __len = strlen(__ccurr);
3.1955 ++ if (__len)
3.1956 ++ {
3.1957 ++ ++__len;
3.1958 ++ memset(&__state, 0, sizeof(mbstate_t));
3.1959 ++ wchar_t* __wcs = new wchar_t[__len];
3.1960 ++ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
3.1961 ++ _M_data->_M_curr_symbol = __wcs;
3.1962 ++ }
3.1963 ++ else
3.1964 ++ _M_data->_M_curr_symbol = L"";
3.1965 ++ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
3.1966 ++ }
3.1967 ++ catch (...)
3.1968 ++ {
3.1969 ++ delete _M_data;
3.1970 ++ _M_data = 0;
3.1971 ++ delete __wcs_ps;
3.1972 ++ delete __wcs_ns;
3.1973 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1974 ++ __uselocale(__old);
3.1975 ++#else
3.1976 ++ setlocale(LC_ALL, __old);
3.1977 ++ free(__old);
3.1978 ++#endif
3.1979 ++ __throw_exception_again;
3.1980 ++ }
3.1981 ++
3.1982 ++ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
3.1983 ++ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
3.1984 ++ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
3.1985 ++ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
3.1986 ++ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
3.1987 ++ __pposn);
3.1988 ++ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
3.1989 ++ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
3.1990 ++ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
3.1991 ++ __nposn);
3.1992 ++
3.1993 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.1994 ++ __uselocale(__old);
3.1995 ++#else
3.1996 ++ setlocale(LC_ALL, __old);
3.1997 ++ free(__old);
3.1998 ++#endif
3.1999 ++ }
3.2000 ++ }
3.2001 ++
3.2002 ++ template<>
3.2003 ++ moneypunct<wchar_t, true>::~moneypunct()
3.2004 ++ {
3.2005 ++ if (_M_data->_M_positive_sign_size)
3.2006 ++ delete [] _M_data->_M_positive_sign;
3.2007 ++ if (_M_data->_M_negative_sign_size
3.2008 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
3.2009 ++ delete [] _M_data->_M_negative_sign;
3.2010 ++ if (_M_data->_M_curr_symbol_size)
3.2011 ++ delete [] _M_data->_M_curr_symbol;
3.2012 ++ delete _M_data;
3.2013 ++ }
3.2014 ++
3.2015 ++ template<>
3.2016 ++ moneypunct<wchar_t, false>::~moneypunct()
3.2017 ++ {
3.2018 ++ if (_M_data->_M_positive_sign_size)
3.2019 ++ delete [] _M_data->_M_positive_sign;
3.2020 ++ if (_M_data->_M_negative_sign_size
3.2021 ++ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
3.2022 ++ delete [] _M_data->_M_negative_sign;
3.2023 ++ if (_M_data->_M_curr_symbol_size)
3.2024 ++ delete [] _M_data->_M_curr_symbol;
3.2025 ++ delete _M_data;
3.2026 ++ }
3.2027 ++#endif
3.2028 ++}
3.2029 +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc
3.2030 ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc
3.2031 +@@ -0,0 +1,160 @@
3.2032 ++// std::numpunct implementation details, GNU version -*- C++ -*-
3.2033 ++
3.2034 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.2035 ++//
3.2036 ++// This file is part of the GNU ISO C++ Library. This library is free
3.2037 ++// software; you can redistribute it and/or modify it under the
3.2038 ++// terms of the GNU General Public License as published by the
3.2039 ++// Free Software Foundation; either version 2, or (at your option)
3.2040 ++// any later version.
3.2041 ++
3.2042 ++// This library is distributed in the hope that it will be useful,
3.2043 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.2044 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.2045 ++// GNU General Public License for more details.
3.2046 ++
3.2047 ++// You should have received a copy of the GNU General Public License along
3.2048 ++// with this library; see the file COPYING. If not, write to the Free
3.2049 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.2050 ++// USA.
3.2051 ++
3.2052 ++// As a special exception, you may use this file as part of a free software
3.2053 ++// library without restriction. Specifically, if other files instantiate
3.2054 ++// templates or use macros or inline functions from this file, or you compile
3.2055 ++// this file and link it with other files to produce an executable, this
3.2056 ++// file does not by itself cause the resulting executable to be covered by
3.2057 ++// the GNU General Public License. This exception does not however
3.2058 ++// invalidate any other reasons why the executable file might be covered by
3.2059 ++// the GNU General Public License.
3.2060 ++
3.2061 ++//
3.2062 ++// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
3.2063 ++//
3.2064 ++
3.2065 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.2066 ++
3.2067 ++#define _LIBC
3.2068 ++#include <locale>
3.2069 ++#undef _LIBC
3.2070 ++#include <bits/c++locale_internal.h>
3.2071 ++
3.2072 ++#ifdef __UCLIBC_MJN3_ONLY__
3.2073 ++#warning tailor for stub locale support
3.2074 ++#endif
3.2075 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.2076 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
3.2077 ++#endif
3.2078 ++
3.2079 ++namespace std
3.2080 ++{
3.2081 ++ template<>
3.2082 ++ void
3.2083 ++ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
3.2084 ++ {
3.2085 ++ if (!_M_data)
3.2086 ++ _M_data = new __numpunct_cache<char>;
3.2087 ++
3.2088 ++ if (!__cloc)
3.2089 ++ {
3.2090 ++ // "C" locale
3.2091 ++ _M_data->_M_grouping = "";
3.2092 ++ _M_data->_M_grouping_size = 0;
3.2093 ++ _M_data->_M_use_grouping = false;
3.2094 ++
3.2095 ++ _M_data->_M_decimal_point = '.';
3.2096 ++ _M_data->_M_thousands_sep = ',';
3.2097 ++
3.2098 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
3.2099 ++ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
3.2100 ++
3.2101 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
3.2102 ++ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
3.2103 ++ }
3.2104 ++ else
3.2105 ++ {
3.2106 ++ // Named locale.
3.2107 ++ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
3.2108 ++ __cloc));
3.2109 ++ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
3.2110 ++ __cloc));
3.2111 ++
3.2112 ++ // Check for NULL, which implies no grouping.
3.2113 ++ if (_M_data->_M_thousands_sep == '\0')
3.2114 ++ _M_data->_M_grouping = "";
3.2115 ++ else
3.2116 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
3.2117 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.2118 ++ }
3.2119 ++
3.2120 ++ // NB: There is no way to extact this info from posix locales.
3.2121 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
3.2122 ++ _M_data->_M_truename = "true";
3.2123 ++ _M_data->_M_truename_size = 4;
3.2124 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
3.2125 ++ _M_data->_M_falsename = "false";
3.2126 ++ _M_data->_M_falsename_size = 5;
3.2127 ++ }
3.2128 ++
3.2129 ++ template<>
3.2130 ++ numpunct<char>::~numpunct()
3.2131 ++ { delete _M_data; }
3.2132 ++
3.2133 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.2134 ++ template<>
3.2135 ++ void
3.2136 ++ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
3.2137 ++ {
3.2138 ++ if (!_M_data)
3.2139 ++ _M_data = new __numpunct_cache<wchar_t>;
3.2140 ++
3.2141 ++ if (!__cloc)
3.2142 ++ {
3.2143 ++ // "C" locale
3.2144 ++ _M_data->_M_grouping = "";
3.2145 ++ _M_data->_M_grouping_size = 0;
3.2146 ++ _M_data->_M_use_grouping = false;
3.2147 ++
3.2148 ++ _M_data->_M_decimal_point = L'.';
3.2149 ++ _M_data->_M_thousands_sep = L',';
3.2150 ++
3.2151 ++ // Use ctype::widen code without the facet...
3.2152 ++ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
3.2153 ++ _M_data->_M_atoms_out[__i] =
3.2154 ++ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
3.2155 ++
3.2156 ++ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
3.2157 ++ _M_data->_M_atoms_in[__j] =
3.2158 ++ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
3.2159 ++ }
3.2160 ++ else
3.2161 ++ {
3.2162 ++ // Named locale.
3.2163 ++ // NB: In the GNU model wchar_t is always 32 bit wide.
3.2164 ++ union { char *__s; wchar_t __w; } __u;
3.2165 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
3.2166 ++ _M_data->_M_decimal_point = __u.__w;
3.2167 ++
3.2168 ++ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
3.2169 ++ _M_data->_M_thousands_sep = __u.__w;
3.2170 ++
3.2171 ++ if (_M_data->_M_thousands_sep == L'\0')
3.2172 ++ _M_data->_M_grouping = "";
3.2173 ++ else
3.2174 ++ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
3.2175 ++ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
3.2176 ++ }
3.2177 ++
3.2178 ++ // NB: There is no way to extact this info from posix locales.
3.2179 ++ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
3.2180 ++ _M_data->_M_truename = L"true";
3.2181 ++ _M_data->_M_truename_size = 4;
3.2182 ++ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
3.2183 ++ _M_data->_M_falsename = L"false";
3.2184 ++ _M_data->_M_falsename_size = 5;
3.2185 ++ }
3.2186 ++
3.2187 ++ template<>
3.2188 ++ numpunct<wchar_t>::~numpunct()
3.2189 ++ { delete _M_data; }
3.2190 ++ #endif
3.2191 ++}
3.2192 +--- gcc/libstdc++-v3/config/locale/uclibc/time_members.cc
3.2193 ++++ gcc/libstdc++-v3/config/locale/uclibc/time_members.cc
3.2194 +@@ -0,0 +1,406 @@
3.2195 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
3.2196 ++
3.2197 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.2198 ++//
3.2199 ++// This file is part of the GNU ISO C++ Library. This library is free
3.2200 ++// software; you can redistribute it and/or modify it under the
3.2201 ++// terms of the GNU General Public License as published by the
3.2202 ++// Free Software Foundation; either version 2, or (at your option)
3.2203 ++// any later version.
3.2204 ++
3.2205 ++// This library is distributed in the hope that it will be useful,
3.2206 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.2207 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.2208 ++// GNU General Public License for more details.
3.2209 ++
3.2210 ++// You should have received a copy of the GNU General Public License along
3.2211 ++// with this library; see the file COPYING. If not, write to the Free
3.2212 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.2213 ++// USA.
3.2214 ++
3.2215 ++// As a special exception, you may use this file as part of a free software
3.2216 ++// library without restriction. Specifically, if other files instantiate
3.2217 ++// templates or use macros or inline functions from this file, or you compile
3.2218 ++// this file and link it with other files to produce an executable, this
3.2219 ++// file does not by itself cause the resulting executable to be covered by
3.2220 ++// the GNU General Public License. This exception does not however
3.2221 ++// invalidate any other reasons why the executable file might be covered by
3.2222 ++// the GNU General Public License.
3.2223 ++
3.2224 ++//
3.2225 ++// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
3.2226 ++// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
3.2227 ++//
3.2228 ++
3.2229 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.2230 ++
3.2231 ++#include <locale>
3.2232 ++#include <bits/c++locale_internal.h>
3.2233 ++
3.2234 ++#ifdef __UCLIBC_MJN3_ONLY__
3.2235 ++#warning tailor for stub locale support
3.2236 ++#endif
3.2237 ++#ifndef __UCLIBC_HAS_XLOCALE__
3.2238 ++#define __nl_langinfo_l(N, L) nl_langinfo((N))
3.2239 ++#endif
3.2240 ++
3.2241 ++namespace std
3.2242 ++{
3.2243 ++ template<>
3.2244 ++ void
3.2245 ++ __timepunct<char>::
3.2246 ++ _M_put(char* __s, size_t __maxlen, const char* __format,
3.2247 ++ const tm* __tm) const
3.2248 ++ {
3.2249 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.2250 ++ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
3.2251 ++ _M_c_locale_timepunct);
3.2252 ++#else
3.2253 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.2254 ++ setlocale(LC_ALL, _M_name_timepunct);
3.2255 ++ const size_t __len = strftime(__s, __maxlen, __format, __tm);
3.2256 ++ setlocale(LC_ALL, __old);
3.2257 ++ free(__old);
3.2258 ++#endif
3.2259 ++ // Make sure __s is null terminated.
3.2260 ++ if (__len == 0)
3.2261 ++ __s[0] = '\0';
3.2262 ++ }
3.2263 ++
3.2264 ++ template<>
3.2265 ++ void
3.2266 ++ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
3.2267 ++ {
3.2268 ++ if (!_M_data)
3.2269 ++ _M_data = new __timepunct_cache<char>;
3.2270 ++
3.2271 ++ if (!__cloc)
3.2272 ++ {
3.2273 ++ // "C" locale
3.2274 ++ _M_c_locale_timepunct = _S_get_c_locale();
3.2275 ++
3.2276 ++ _M_data->_M_date_format = "%m/%d/%y";
3.2277 ++ _M_data->_M_date_era_format = "%m/%d/%y";
3.2278 ++ _M_data->_M_time_format = "%H:%M:%S";
3.2279 ++ _M_data->_M_time_era_format = "%H:%M:%S";
3.2280 ++ _M_data->_M_date_time_format = "";
3.2281 ++ _M_data->_M_date_time_era_format = "";
3.2282 ++ _M_data->_M_am = "AM";
3.2283 ++ _M_data->_M_pm = "PM";
3.2284 ++ _M_data->_M_am_pm_format = "";
3.2285 ++
3.2286 ++ // Day names, starting with "C"'s Sunday.
3.2287 ++ _M_data->_M_day1 = "Sunday";
3.2288 ++ _M_data->_M_day2 = "Monday";
3.2289 ++ _M_data->_M_day3 = "Tuesday";
3.2290 ++ _M_data->_M_day4 = "Wednesday";
3.2291 ++ _M_data->_M_day5 = "Thursday";
3.2292 ++ _M_data->_M_day6 = "Friday";
3.2293 ++ _M_data->_M_day7 = "Saturday";
3.2294 ++
3.2295 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2296 ++ _M_data->_M_aday1 = "Sun";
3.2297 ++ _M_data->_M_aday2 = "Mon";
3.2298 ++ _M_data->_M_aday3 = "Tue";
3.2299 ++ _M_data->_M_aday4 = "Wed";
3.2300 ++ _M_data->_M_aday5 = "Thu";
3.2301 ++ _M_data->_M_aday6 = "Fri";
3.2302 ++ _M_data->_M_aday7 = "Sat";
3.2303 ++
3.2304 ++ // Month names, starting with "C"'s January.
3.2305 ++ _M_data->_M_month01 = "January";
3.2306 ++ _M_data->_M_month02 = "February";
3.2307 ++ _M_data->_M_month03 = "March";
3.2308 ++ _M_data->_M_month04 = "April";
3.2309 ++ _M_data->_M_month05 = "May";
3.2310 ++ _M_data->_M_month06 = "June";
3.2311 ++ _M_data->_M_month07 = "July";
3.2312 ++ _M_data->_M_month08 = "August";
3.2313 ++ _M_data->_M_month09 = "September";
3.2314 ++ _M_data->_M_month10 = "October";
3.2315 ++ _M_data->_M_month11 = "November";
3.2316 ++ _M_data->_M_month12 = "December";
3.2317 ++
3.2318 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2319 ++ _M_data->_M_amonth01 = "Jan";
3.2320 ++ _M_data->_M_amonth02 = "Feb";
3.2321 ++ _M_data->_M_amonth03 = "Mar";
3.2322 ++ _M_data->_M_amonth04 = "Apr";
3.2323 ++ _M_data->_M_amonth05 = "May";
3.2324 ++ _M_data->_M_amonth06 = "Jun";
3.2325 ++ _M_data->_M_amonth07 = "Jul";
3.2326 ++ _M_data->_M_amonth08 = "Aug";
3.2327 ++ _M_data->_M_amonth09 = "Sep";
3.2328 ++ _M_data->_M_amonth10 = "Oct";
3.2329 ++ _M_data->_M_amonth11 = "Nov";
3.2330 ++ _M_data->_M_amonth12 = "Dec";
3.2331 ++ }
3.2332 ++ else
3.2333 ++ {
3.2334 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
3.2335 ++
3.2336 ++ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
3.2337 ++ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
3.2338 ++ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
3.2339 ++ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
3.2340 ++ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
3.2341 ++ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
3.2342 ++ __cloc);
3.2343 ++ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
3.2344 ++ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
3.2345 ++ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
3.2346 ++
3.2347 ++ // Day names, starting with "C"'s Sunday.
3.2348 ++ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
3.2349 ++ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
3.2350 ++ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
3.2351 ++ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
3.2352 ++ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
3.2353 ++ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
3.2354 ++ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
3.2355 ++
3.2356 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2357 ++ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
3.2358 ++ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
3.2359 ++ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
3.2360 ++ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
3.2361 ++ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
3.2362 ++ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
3.2363 ++ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
3.2364 ++
3.2365 ++ // Month names, starting with "C"'s January.
3.2366 ++ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
3.2367 ++ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
3.2368 ++ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
3.2369 ++ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
3.2370 ++ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
3.2371 ++ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
3.2372 ++ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
3.2373 ++ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
3.2374 ++ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
3.2375 ++ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
3.2376 ++ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
3.2377 ++ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
3.2378 ++
3.2379 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2380 ++ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
3.2381 ++ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
3.2382 ++ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
3.2383 ++ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
3.2384 ++ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
3.2385 ++ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
3.2386 ++ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
3.2387 ++ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
3.2388 ++ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
3.2389 ++ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
3.2390 ++ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
3.2391 ++ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
3.2392 ++ }
3.2393 ++ }
3.2394 ++
3.2395 ++#ifdef _GLIBCXX_USE_WCHAR_T
3.2396 ++ template<>
3.2397 ++ void
3.2398 ++ __timepunct<wchar_t>::
3.2399 ++ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
3.2400 ++ const tm* __tm) const
3.2401 ++ {
3.2402 ++#ifdef __UCLIBC_HAS_XLOCALE__
3.2403 ++ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
3.2404 ++ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
3.2405 ++ _M_c_locale_timepunct);
3.2406 ++#else
3.2407 ++ char* __old = strdup(setlocale(LC_ALL, NULL));
3.2408 ++ setlocale(LC_ALL, _M_name_timepunct);
3.2409 ++ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
3.2410 ++ setlocale(LC_ALL, __old);
3.2411 ++ free(__old);
3.2412 ++#endif
3.2413 ++ // Make sure __s is null terminated.
3.2414 ++ if (__len == 0)
3.2415 ++ __s[0] = L'\0';
3.2416 ++ }
3.2417 ++
3.2418 ++ template<>
3.2419 ++ void
3.2420 ++ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
3.2421 ++ {
3.2422 ++ if (!_M_data)
3.2423 ++ _M_data = new __timepunct_cache<wchar_t>;
3.2424 ++
3.2425 ++#warning wide time stuff
3.2426 ++// if (!__cloc)
3.2427 ++ {
3.2428 ++ // "C" locale
3.2429 ++ _M_c_locale_timepunct = _S_get_c_locale();
3.2430 ++
3.2431 ++ _M_data->_M_date_format = L"%m/%d/%y";
3.2432 ++ _M_data->_M_date_era_format = L"%m/%d/%y";
3.2433 ++ _M_data->_M_time_format = L"%H:%M:%S";
3.2434 ++ _M_data->_M_time_era_format = L"%H:%M:%S";
3.2435 ++ _M_data->_M_date_time_format = L"";
3.2436 ++ _M_data->_M_date_time_era_format = L"";
3.2437 ++ _M_data->_M_am = L"AM";
3.2438 ++ _M_data->_M_pm = L"PM";
3.2439 ++ _M_data->_M_am_pm_format = L"";
3.2440 ++
3.2441 ++ // Day names, starting with "C"'s Sunday.
3.2442 ++ _M_data->_M_day1 = L"Sunday";
3.2443 ++ _M_data->_M_day2 = L"Monday";
3.2444 ++ _M_data->_M_day3 = L"Tuesday";
3.2445 ++ _M_data->_M_day4 = L"Wednesday";
3.2446 ++ _M_data->_M_day5 = L"Thursday";
3.2447 ++ _M_data->_M_day6 = L"Friday";
3.2448 ++ _M_data->_M_day7 = L"Saturday";
3.2449 ++
3.2450 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2451 ++ _M_data->_M_aday1 = L"Sun";
3.2452 ++ _M_data->_M_aday2 = L"Mon";
3.2453 ++ _M_data->_M_aday3 = L"Tue";
3.2454 ++ _M_data->_M_aday4 = L"Wed";
3.2455 ++ _M_data->_M_aday5 = L"Thu";
3.2456 ++ _M_data->_M_aday6 = L"Fri";
3.2457 ++ _M_data->_M_aday7 = L"Sat";
3.2458 ++
3.2459 ++ // Month names, starting with "C"'s January.
3.2460 ++ _M_data->_M_month01 = L"January";
3.2461 ++ _M_data->_M_month02 = L"February";
3.2462 ++ _M_data->_M_month03 = L"March";
3.2463 ++ _M_data->_M_month04 = L"April";
3.2464 ++ _M_data->_M_month05 = L"May";
3.2465 ++ _M_data->_M_month06 = L"June";
3.2466 ++ _M_data->_M_month07 = L"July";
3.2467 ++ _M_data->_M_month08 = L"August";
3.2468 ++ _M_data->_M_month09 = L"September";
3.2469 ++ _M_data->_M_month10 = L"October";
3.2470 ++ _M_data->_M_month11 = L"November";
3.2471 ++ _M_data->_M_month12 = L"December";
3.2472 ++
3.2473 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2474 ++ _M_data->_M_amonth01 = L"Jan";
3.2475 ++ _M_data->_M_amonth02 = L"Feb";
3.2476 ++ _M_data->_M_amonth03 = L"Mar";
3.2477 ++ _M_data->_M_amonth04 = L"Apr";
3.2478 ++ _M_data->_M_amonth05 = L"May";
3.2479 ++ _M_data->_M_amonth06 = L"Jun";
3.2480 ++ _M_data->_M_amonth07 = L"Jul";
3.2481 ++ _M_data->_M_amonth08 = L"Aug";
3.2482 ++ _M_data->_M_amonth09 = L"Sep";
3.2483 ++ _M_data->_M_amonth10 = L"Oct";
3.2484 ++ _M_data->_M_amonth11 = L"Nov";
3.2485 ++ _M_data->_M_amonth12 = L"Dec";
3.2486 ++ }
3.2487 ++#if 0
3.2488 ++ else
3.2489 ++ {
3.2490 ++ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
3.2491 ++
3.2492 ++ union { char *__s; wchar_t *__w; } __u;
3.2493 ++
3.2494 ++ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
3.2495 ++ _M_data->_M_date_format = __u.__w;
3.2496 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
3.2497 ++ _M_data->_M_date_era_format = __u.__w;
3.2498 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
3.2499 ++ _M_data->_M_time_format = __u.__w;
3.2500 ++ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
3.2501 ++ _M_data->_M_time_era_format = __u.__w;
3.2502 ++ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
3.2503 ++ _M_data->_M_date_time_format = __u.__w;
3.2504 ++ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
3.2505 ++ _M_data->_M_date_time_era_format = __u.__w;
3.2506 ++ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
3.2507 ++ _M_data->_M_am = __u.__w;
3.2508 ++ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
3.2509 ++ _M_data->_M_pm = __u.__w;
3.2510 ++ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
3.2511 ++ _M_data->_M_am_pm_format = __u.__w;
3.2512 ++
3.2513 ++ // Day names, starting with "C"'s Sunday.
3.2514 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
3.2515 ++ _M_data->_M_day1 = __u.__w;
3.2516 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
3.2517 ++ _M_data->_M_day2 = __u.__w;
3.2518 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
3.2519 ++ _M_data->_M_day3 = __u.__w;
3.2520 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
3.2521 ++ _M_data->_M_day4 = __u.__w;
3.2522 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
3.2523 ++ _M_data->_M_day5 = __u.__w;
3.2524 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
3.2525 ++ _M_data->_M_day6 = __u.__w;
3.2526 ++ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
3.2527 ++ _M_data->_M_day7 = __u.__w;
3.2528 ++
3.2529 ++ // Abbreviated day names, starting with "C"'s Sun.
3.2530 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
3.2531 ++ _M_data->_M_aday1 = __u.__w;
3.2532 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
3.2533 ++ _M_data->_M_aday2 = __u.__w;
3.2534 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
3.2535 ++ _M_data->_M_aday3 = __u.__w;
3.2536 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
3.2537 ++ _M_data->_M_aday4 = __u.__w;
3.2538 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
3.2539 ++ _M_data->_M_aday5 = __u.__w;
3.2540 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
3.2541 ++ _M_data->_M_aday6 = __u.__w;
3.2542 ++ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
3.2543 ++ _M_data->_M_aday7 = __u.__w;
3.2544 ++
3.2545 ++ // Month names, starting with "C"'s January.
3.2546 ++ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
3.2547 ++ _M_data->_M_month01 = __u.__w;
3.2548 ++ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
3.2549 ++ _M_data->_M_month02 = __u.__w;
3.2550 ++ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
3.2551 ++ _M_data->_M_month03 = __u.__w;
3.2552 ++ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
3.2553 ++ _M_data->_M_month04 = __u.__w;
3.2554 ++ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
3.2555 ++ _M_data->_M_month05 = __u.__w;
3.2556 ++ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
3.2557 ++ _M_data->_M_month06 = __u.__w;
3.2558 ++ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
3.2559 ++ _M_data->_M_month07 = __u.__w;
3.2560 ++ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
3.2561 ++ _M_data->_M_month08 = __u.__w;
3.2562 ++ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
3.2563 ++ _M_data->_M_month09 = __u.__w;
3.2564 ++ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
3.2565 ++ _M_data->_M_month10 = __u.__w;
3.2566 ++ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
3.2567 ++ _M_data->_M_month11 = __u.__w;
3.2568 ++ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
3.2569 ++ _M_data->_M_month12 = __u.__w;
3.2570 ++
3.2571 ++ // Abbreviated month names, starting with "C"'s Jan.
3.2572 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
3.2573 ++ _M_data->_M_amonth01 = __u.__w;
3.2574 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
3.2575 ++ _M_data->_M_amonth02 = __u.__w;
3.2576 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
3.2577 ++ _M_data->_M_amonth03 = __u.__w;
3.2578 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
3.2579 ++ _M_data->_M_amonth04 = __u.__w;
3.2580 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
3.2581 ++ _M_data->_M_amonth05 = __u.__w;
3.2582 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
3.2583 ++ _M_data->_M_amonth06 = __u.__w;
3.2584 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
3.2585 ++ _M_data->_M_amonth07 = __u.__w;
3.2586 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
3.2587 ++ _M_data->_M_amonth08 = __u.__w;
3.2588 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
3.2589 ++ _M_data->_M_amonth09 = __u.__w;
3.2590 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
3.2591 ++ _M_data->_M_amonth10 = __u.__w;
3.2592 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
3.2593 ++ _M_data->_M_amonth11 = __u.__w;
3.2594 ++ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
3.2595 ++ _M_data->_M_amonth12 = __u.__w;
3.2596 ++ }
3.2597 ++#endif // 0
3.2598 ++ }
3.2599 ++#endif
3.2600 ++}
3.2601 +--- gcc/libstdc++-v3/config/locale/uclibc/time_members.h
3.2602 ++++ gcc/libstdc++-v3/config/locale/uclibc/time_members.h
3.2603 +@@ -0,0 +1,68 @@
3.2604 ++// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
3.2605 ++
3.2606 ++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3.2607 ++//
3.2608 ++// This file is part of the GNU ISO C++ Library. This library is free
3.2609 ++// software; you can redistribute it and/or modify it under the
3.2610 ++// terms of the GNU General Public License as published by the
3.2611 ++// Free Software Foundation; either version 2, or (at your option)
3.2612 ++// any later version.
3.2613 ++
3.2614 ++// This library is distributed in the hope that it will be useful,
3.2615 ++// but WITHOUT ANY WARRANTY; without even the implied warranty of
3.2616 ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.2617 ++// GNU General Public License for more details.
3.2618 ++
3.2619 ++// You should have received a copy of the GNU General Public License along
3.2620 ++// with this library; see the file COPYING. If not, write to the Free
3.2621 ++// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3.2622 ++// USA.
3.2623 ++
3.2624 ++// As a special exception, you may use this file as part of a free software
3.2625 ++// library without restriction. Specifically, if other files instantiate
3.2626 ++// templates or use macros or inline functions from this file, or you compile
3.2627 ++// this file and link it with other files to produce an executable, this
3.2628 ++// file does not by itself cause the resulting executable to be covered by
3.2629 ++// the GNU General Public License. This exception does not however
3.2630 ++// invalidate any other reasons why the executable file might be covered by
3.2631 ++// the GNU General Public License.
3.2632 ++
3.2633 ++//
3.2634 ++// ISO C++ 14882: 22.2.5.1.2 - time_get functions
3.2635 ++// ISO C++ 14882: 22.2.5.3.2 - time_put functions
3.2636 ++//
3.2637 ++
3.2638 ++// Written by Benjamin Kosnik <bkoz@redhat.com>
3.2639 ++
3.2640 ++ template<typename _CharT>
3.2641 ++ __timepunct<_CharT>::__timepunct(size_t __refs)
3.2642 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
3.2643 ++ _M_name_timepunct(_S_get_c_name())
3.2644 ++ { _M_initialize_timepunct(); }
3.2645 ++
3.2646 ++ template<typename _CharT>
3.2647 ++ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
3.2648 ++ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
3.2649 ++ _M_name_timepunct(_S_get_c_name())
3.2650 ++ { _M_initialize_timepunct(); }
3.2651 ++
3.2652 ++ template<typename _CharT>
3.2653 ++ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
3.2654 ++ size_t __refs)
3.2655 ++ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
3.2656 ++ _M_name_timepunct(__s)
3.2657 ++ {
3.2658 ++ char* __tmp = new char[std::strlen(__s) + 1];
3.2659 ++ std::strcpy(__tmp, __s);
3.2660 ++ _M_name_timepunct = __tmp;
3.2661 ++ _M_initialize_timepunct(__cloc);
3.2662 ++ }
3.2663 ++
3.2664 ++ template<typename _CharT>
3.2665 ++ __timepunct<_CharT>::~__timepunct()
3.2666 ++ {
3.2667 ++ if (_M_name_timepunct != _S_get_c_name())
3.2668 ++ delete [] _M_name_timepunct;
3.2669 ++ delete _M_data;
3.2670 ++ _S_destroy_c_locale(_M_c_locale_timepunct);
3.2671 ++ }
3.2672 +--- gcc/libstdc++-v3/configure
3.2673 ++++ gcc/libstdc++-v3/configure
3.2674 +@@ -5764,7 +5764,7 @@
3.2675 + enableval="$enable_clocale"
3.2676 +
3.2677 + case "$enableval" in
3.2678 +- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
3.2679 ++ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
3.2680 + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
3.2681 + echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
3.2682 + { (exit 1); exit 1; }; } ;;
3.2683 +@@ -5789,6 +5789,9 @@
3.2684 + # Default to "generic".
3.2685 + if test $enable_clocale_flag = auto; then
3.2686 + case ${target_os} in
3.2687 ++ linux-uclibc*)
3.2688 ++ enable_clocale_flag=uclibc
3.2689 ++ ;;
3.2690 + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3.2691 + cat >conftest.$ac_ext <<_ACEOF
3.2692 + /* confdefs.h. */
3.2693 +@@ -6019,6 +6022,76 @@
3.2694 + CTIME_CC=config/locale/generic/time_members.cc
3.2695 + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3.2696 + ;;
3.2697 ++ uclibc)
3.2698 ++ echo "$as_me:$LINENO: result: uclibc" >&5
3.2699 ++echo "${ECHO_T}uclibc" >&6
3.2700 ++
3.2701 ++ # Declare intention to use gettext, and add support for specific
3.2702 ++ # languages.
3.2703 ++ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3.2704 ++ ALL_LINGUAS="de fr"
3.2705 ++
3.2706 ++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3.2707 ++ # Extract the first word of "msgfmt", so it can be a program name with args.
3.2708 ++set dummy msgfmt; ac_word=$2
3.2709 ++echo "$as_me:$LINENO: checking for $ac_word" >&5
3.2710 ++echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3.2711 ++if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3.2712 ++ echo $ECHO_N "(cached) $ECHO_C" >&6
3.2713 ++else
3.2714 ++ if test -n "$check_msgfmt"; then
3.2715 ++ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3.2716 ++else
3.2717 ++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3.2718 ++for as_dir in $PATH
3.2719 ++do
3.2720 ++ IFS=$as_save_IFS
3.2721 ++ test -z "$as_dir" && as_dir=.
3.2722 ++ for ac_exec_ext in '' $ac_executable_extensions; do
3.2723 ++ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3.2724 ++ ac_cv_prog_check_msgfmt="yes"
3.2725 ++ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3.2726 ++ break 2
3.2727 ++ fi
3.2728 ++done
3.2729 ++done
3.2730 ++
3.2731 ++ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3.2732 ++fi
3.2733 ++fi
3.2734 ++check_msgfmt=$ac_cv_prog_check_msgfmt
3.2735 ++if test -n "$check_msgfmt"; then
3.2736 ++ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3.2737 ++echo "${ECHO_T}$check_msgfmt" >&6
3.2738 ++else
3.2739 ++ echo "$as_me:$LINENO: result: no" >&5
3.2740 ++echo "${ECHO_T}no" >&6
3.2741 ++fi
3.2742 ++
3.2743 ++ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3.2744 ++ USE_NLS=yes
3.2745 ++ fi
3.2746 ++ # Export the build objects.
3.2747 ++ for ling in $ALL_LINGUAS; do \
3.2748 ++ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3.2749 ++ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3.2750 ++ done
3.2751 ++
3.2752 ++
3.2753 ++
3.2754 ++ CLOCALE_H=config/locale/uclibc/c_locale.h
3.2755 ++ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3.2756 ++ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3.2757 ++ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3.2758 ++ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3.2759 ++ CMESSAGES_H=config/locale/uclibc/messages_members.h
3.2760 ++ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3.2761 ++ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3.2762 ++ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3.2763 ++ CTIME_H=config/locale/uclibc/time_members.h
3.2764 ++ CTIME_CC=config/locale/uclibc/time_members.cc
3.2765 ++ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3.2766 ++ ;;
3.2767 + esac
3.2768 +
3.2769 + # This is where the testsuite looks for locale catalogs, using the
3.2770 +--- gcc/libstdc++-v3/include/c_compatibility/wchar.h
3.2771 ++++ gcc/libstdc++-v3/include/c_compatibility/wchar.h
3.2772 +@@ -101,7 +101,9 @@
3.2773 + using std::wmemcpy;
3.2774 + using std::wmemmove;
3.2775 + using std::wmemset;
3.2776 ++#if _GLIBCXX_HAVE_WCSFTIME
3.2777 + using std::wcsftime;
3.2778 ++#endif
3.2779 +
3.2780 + #if _GLIBCXX_USE_C99
3.2781 + using std::wcstold;
3.2782 +--- gcc/libstdc++-v3/include/c_std/std_cwchar.h
3.2783 ++++ gcc/libstdc++-v3/include/c_std/std_cwchar.h
3.2784 +@@ -182,7 +182,9 @@
3.2785 + using ::wcscoll;
3.2786 + using ::wcscpy;
3.2787 + using ::wcscspn;
3.2788 ++#if _GLIBCXX_HAVE_WCSFTIME
3.2789 + using ::wcsftime;
3.2790 ++#endif
3.2791 + using ::wcslen;
3.2792 + using ::wcsncat;
3.2793 + using ::wcsncmp;
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/patches/gcc/4.2.0/203-uclibc-locale-no__x.patch Sun May 20 09:28:16 2007 +0000
4.3 @@ -0,0 +1,213 @@
4.4 +--- gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.5 ++++ gcc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2006-03-10 15:32:37 +0100
4.6 +@@ -60,4 +60,49 @@
4.7 + extern "C" __typeof(wctype_l) __wctype_l;
4.8 + #endif
4.9 +
4.10 ++# define __nl_langinfo_l nl_langinfo_l
4.11 ++# define __strcoll_l strcoll_l
4.12 ++# define __strftime_l strftime_l
4.13 ++# define __strtod_l strtod_l
4.14 ++# define __strtof_l strtof_l
4.15 ++# define __strtold_l strtold_l
4.16 ++# define __strxfrm_l strxfrm_l
4.17 ++# define __newlocale newlocale
4.18 ++# define __freelocale freelocale
4.19 ++# define __duplocale duplocale
4.20 ++# define __uselocale uselocale
4.21 ++
4.22 ++# ifdef _GLIBCXX_USE_WCHAR_T
4.23 ++# define __iswctype_l iswctype_l
4.24 ++# define __towlower_l towlower_l
4.25 ++# define __towupper_l towupper_l
4.26 ++# define __wcscoll_l wcscoll_l
4.27 ++# define __wcsftime_l wcsftime_l
4.28 ++# define __wcsxfrm_l wcsxfrm_l
4.29 ++# define __wctype_l wctype_l
4.30 ++# endif
4.31 ++
4.32 ++#else
4.33 ++# define __nl_langinfo_l(N, L) nl_langinfo((N))
4.34 ++# define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
4.35 ++# define __strtod_l(S, E, L) strtod((S), (E))
4.36 ++# define __strtof_l(S, E, L) strtof((S), (E))
4.37 ++# define __strtold_l(S, E, L) strtold((S), (E))
4.38 ++# define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
4.39 ++# warning should dummy __newlocale check for C|POSIX ?
4.40 ++# define __newlocale(a, b, c) NULL
4.41 ++# define __freelocale(a) ((void)0)
4.42 ++# define __duplocale(a) __c_locale()
4.43 ++//# define __uselocale ?
4.44 ++//
4.45 ++# ifdef _GLIBCXX_USE_WCHAR_T
4.46 ++# define __iswctype_l(C, M, L) iswctype((C), (M))
4.47 ++# define __towlower_l(C, L) towlower((C))
4.48 ++# define __towupper_l(C, L) towupper((C))
4.49 ++# define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
4.50 ++//# define __wcsftime_l(S, M, F, T, L) wcsftime((S), (M), (F), (T))
4.51 ++# define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
4.52 ++# define __wctype_l(S, L) wctype((S))
4.53 ++# endif
4.54 ++
4.55 + #endif // GLIBC 2.3 and later
4.56 +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.57 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-10 15:32:37 +0100
4.58 +@@ -39,20 +39,6 @@
4.59 + #include <langinfo.h>
4.60 + #include <bits/c++locale_internal.h>
4.61 +
4.62 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.63 +-#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
4.64 +-#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
4.65 +-#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
4.66 +-#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
4.67 +-#define __strtof_l(S, E, L) strtof((S), (E))
4.68 +-#define __strtod_l(S, E, L) strtod((S), (E))
4.69 +-#define __strtold_l(S, E, L) strtold((S), (E))
4.70 +-#warning should dummy __newlocale check for C|POSIX ?
4.71 +-#define __newlocale(a, b, c) NULL
4.72 +-#define __freelocale(a) ((void)0)
4.73 +-#define __duplocale(a) __c_locale()
4.74 +-#endif
4.75 +-
4.76 + namespace std
4.77 + {
4.78 + template<>
4.79 +--- gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.80 ++++ gcc/libstdc++-v3/config/locale/uclibc/collate_members.cc 2006-03-10 15:32:37 +0100
4.81 +@@ -36,13 +36,6 @@
4.82 + #include <locale>
4.83 + #include <bits/c++locale_internal.h>
4.84 +
4.85 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.86 +-#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
4.87 +-#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
4.88 +-#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
4.89 +-#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
4.90 +-#endif
4.91 +-
4.92 + namespace std
4.93 + {
4.94 + // These are basically extensions to char_traits, and perhaps should
4.95 +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.96 ++++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:32:37 +0100
4.97 +@@ -43,10 +43,6 @@
4.98 + #warning tailor for stub locale support
4.99 + #endif
4.100 +
4.101 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.102 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.103 +-#endif
4.104 +-
4.105 + namespace std
4.106 + {
4.107 + // Construct and return valid pattern consisting of some combination of:
4.108 +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.109 ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:32:37 +0100
4.110 +@@ -41,9 +41,6 @@
4.111 + #ifdef __UCLIBC_MJN3_ONLY__
4.112 + #warning tailor for stub locale support
4.113 + #endif
4.114 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.115 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.116 +-#endif
4.117 +
4.118 + namespace std
4.119 + {
4.120 +--- gcc/libstdc++-v3/config/locale/uclibc/time_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.121 ++++ gcc/libstdc++-v3/config/locale/uclibc/time_members.cc 2006-03-10 15:32:37 +0100
4.122 +@@ -40,9 +40,6 @@
4.123 + #ifdef __UCLIBC_MJN3_ONLY__
4.124 + #warning tailor for stub locale support
4.125 + #endif
4.126 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.127 +-#define __nl_langinfo_l(N, L) nl_langinfo((N))
4.128 +-#endif
4.129 +
4.130 + namespace std
4.131 + {
4.132 +--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.133 ++++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-10 15:32:37 +0100
4.134 +@@ -38,13 +38,6 @@
4.135 + #undef _LIBC
4.136 + #include <bits/c++locale_internal.h>
4.137 +
4.138 +-#ifndef __UCLIBC_HAS_XLOCALE__
4.139 +-#define __wctype_l(S, L) wctype((S))
4.140 +-#define __towupper_l(C, L) towupper((C))
4.141 +-#define __towlower_l(C, L) towlower((C))
4.142 +-#define __iswctype_l(C, M, L) iswctype((C), (M))
4.143 +-#endif
4.144 +-
4.145 + namespace std
4.146 + {
4.147 + // NB: The other ctype<char> specializations are in src/locale.cc and
4.148 +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.149 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.cc 2006-03-10 15:32:37 +0100
4.150 +@@ -39,13 +39,10 @@
4.151 + #ifdef __UCLIBC_MJN3_ONLY__
4.152 + #warning fix gettext stuff
4.153 + #endif
4.154 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.155 +-extern "C" char *__dcgettext(const char *domainname,
4.156 +- const char *msgid, int category);
4.157 + #undef gettext
4.158 +-#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
4.159 ++#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.160 ++#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
4.161 + #else
4.162 +-#undef gettext
4.163 + #define gettext(msgid) (msgid)
4.164 + #endif
4.165 +
4.166 +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.167 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-10 15:32:37 +0100
4.168 +@@ -36,15 +36,11 @@
4.169 + #ifdef __UCLIBC_MJN3_ONLY__
4.170 + #warning fix prototypes for *textdomain funcs
4.171 + #endif
4.172 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.173 +-extern "C" char *__textdomain(const char *domainname);
4.174 +-extern "C" char *__bindtextdomain(const char *domainname,
4.175 +- const char *dirname);
4.176 +-#else
4.177 +-#undef __textdomain
4.178 +-#undef __bindtextdomain
4.179 +-#define __textdomain(D) ((void)0)
4.180 +-#define __bindtextdomain(D,P) ((void)0)
4.181 ++#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
4.182 ++#undef textdomain
4.183 ++#undef bindtextdomain
4.184 ++#define textdomain(D) ((void)0)
4.185 ++#define bindtextdomain(D,P) ((void)0)
4.186 + #endif
4.187 +
4.188 + // Non-virtual member functions.
4.189 +@@ -70,7 +66,7 @@
4.190 + messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
4.191 + const char* __dir) const
4.192 + {
4.193 +- __bindtextdomain(__s.c_str(), __dir);
4.194 ++ bindtextdomain(__s.c_str(), __dir);
4.195 + return this->do_open(__s, __loc);
4.196 + }
4.197 +
4.198 +@@ -90,7 +86,7 @@
4.199 + {
4.200 + // No error checking is done, assume the catalog exists and can
4.201 + // be used.
4.202 +- __textdomain(__s.c_str());
4.203 ++ textdomain(__s.c_str());
4.204 + return 0;
4.205 + }
4.206 +
4.207 +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.h.uclibc200no__x~ 2006-03-10 15:06:17 +0100
4.208 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-03-10 15:32:37 +0100
4.209 +@@ -68,6 +68,7 @@
4.210 + {
4.211 + extern "C" __typeof(uselocale) __uselocale;
4.212 + }
4.213 ++#define __uselocale uselocale
4.214 + #endif
4.215 +
4.216 + namespace std
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/patches/gcc/4.2.0/204-uclibc-locale-wchar_fix.patch Sun May 20 09:28:16 2007 +0000
5.3 @@ -0,0 +1,48 @@
5.4 +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
5.5 ++++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:37:27 +0100
5.6 +@@ -401,7 +401,7 @@
5.7 + # ifdef __UCLIBC_HAS_XLOCALE__
5.8 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
5.9 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
5.10 +-# else
5.11 ++# elif defined __UCLIBC_HAS_LOCALE__
5.12 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
5.13 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
5.14 + # endif
5.15 +@@ -556,7 +556,7 @@
5.16 + # ifdef __UCLIBC_HAS_XLOCALE__
5.17 + _M_data->_M_decimal_point = __cloc->decimal_point_wc;
5.18 + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
5.19 +-# else
5.20 ++# elif defined __UCLIBC_HAS_LOCALE__
5.21 + _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
5.22 + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
5.23 + # endif
5.24 +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_wchar~ 2006-03-10 15:32:37 +0100
5.25 ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:37:27 +0100
5.26 +@@ -127,12 +127,25 @@
5.27 + {
5.28 + // Named locale.
5.29 + // NB: In the GNU model wchar_t is always 32 bit wide.
5.30 ++#ifdef __UCLIBC_MJN3_ONLY__
5.31 ++#warning fix this... should be numeric
5.32 ++#endif
5.33 ++#ifdef __UCLIBC__
5.34 ++# ifdef __UCLIBC_HAS_XLOCALE__
5.35 ++ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
5.36 ++ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
5.37 ++# elif defined __UCLIBC_HAS_LOCALE__
5.38 ++ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
5.39 ++ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
5.40 ++# endif
5.41 ++#else
5.42 + union { char *__s; wchar_t __w; } __u;
5.43 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
5.44 + _M_data->_M_decimal_point = __u.__w;
5.45 +
5.46 + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
5.47 + _M_data->_M_thousands_sep = __u.__w;
5.48 ++#endif
5.49 +
5.50 + if (_M_data->_M_thousands_sep == L'\0')
5.51 + _M_data->_M_grouping = "";
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/patches/gcc/4.2.0/205-uclibc-locale-update.patch Sun May 20 09:28:16 2007 +0000
6.3 @@ -0,0 +1,347 @@
6.4 +--- gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc.uclibc200_update~ 2006-03-10 15:32:37 +0100
6.5 ++++ gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc 2006-03-10 15:39:14 +0100
6.6 +@@ -46,16 +47,13 @@
6.7 + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
6.8 + const __c_locale& __cloc)
6.9 + {
6.10 +- if (!(__err & ios_base::failbit))
6.11 +- {
6.12 +- char* __sanity;
6.13 +- errno = 0;
6.14 +- float __f = __strtof_l(__s, &__sanity, __cloc);
6.15 +- if (__sanity != __s && errno != ERANGE)
6.16 +- __v = __f;
6.17 +- else
6.18 +- __err |= ios_base::failbit;
6.19 +- }
6.20 ++ char* __sanity;
6.21 ++ errno = 0;
6.22 ++ float __f = __strtof_l(__s, &__sanity, __cloc);
6.23 ++ if (__sanity != __s && errno != ERANGE)
6.24 ++ __v = __f;
6.25 ++ else
6.26 ++ __err |= ios_base::failbit;
6.27 + }
6.28 +
6.29 + template<>
6.30 +@@ -63,16 +61,13 @@
6.31 + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
6.32 + const __c_locale& __cloc)
6.33 + {
6.34 +- if (!(__err & ios_base::failbit))
6.35 +- {
6.36 +- char* __sanity;
6.37 +- errno = 0;
6.38 +- double __d = __strtod_l(__s, &__sanity, __cloc);
6.39 +- if (__sanity != __s && errno != ERANGE)
6.40 +- __v = __d;
6.41 +- else
6.42 +- __err |= ios_base::failbit;
6.43 +- }
6.44 ++ char* __sanity;
6.45 ++ errno = 0;
6.46 ++ double __d = __strtod_l(__s, &__sanity, __cloc);
6.47 ++ if (__sanity != __s && errno != ERANGE)
6.48 ++ __v = __d;
6.49 ++ else
6.50 ++ __err |= ios_base::failbit;
6.51 + }
6.52 +
6.53 + template<>
6.54 +@@ -80,16 +75,13 @@
6.55 + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
6.56 + const __c_locale& __cloc)
6.57 + {
6.58 +- if (!(__err & ios_base::failbit))
6.59 +- {
6.60 +- char* __sanity;
6.61 +- errno = 0;
6.62 +- long double __ld = __strtold_l(__s, &__sanity, __cloc);
6.63 +- if (__sanity != __s && errno != ERANGE)
6.64 +- __v = __ld;
6.65 +- else
6.66 +- __err |= ios_base::failbit;
6.67 +- }
6.68 ++ char* __sanity;
6.69 ++ errno = 0;
6.70 ++ long double __ld = __strtold_l(__s, &__sanity, __cloc);
6.71 ++ if (__sanity != __s && errno != ERANGE)
6.72 ++ __v = __ld;
6.73 ++ else
6.74 ++ __err |= ios_base::failbit;
6.75 + }
6.76 +
6.77 + void
6.78 +@@ -110,7 +102,7 @@
6.79 + void
6.80 + locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
6.81 + {
6.82 +- if (_S_get_c_locale() != __cloc)
6.83 ++ if (__cloc && _S_get_c_locale() != __cloc)
6.84 + __freelocale(__cloc);
6.85 + }
6.86 +
6.87 +--- gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc.uclibc200_update~ 2006-03-10 15:32:37 +0100
6.88 ++++ gcc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2006-03-10 15:39:14 +0100
6.89 +@@ -33,9 +33,14 @@
6.90 +
6.91 + // Written by Benjamin Kosnik <bkoz@redhat.com>
6.92 +
6.93 ++#include <features.h>
6.94 ++#ifdef __UCLIBC_HAS_LOCALE__
6.95 + #define _LIBC
6.96 + #include <locale>
6.97 + #undef _LIBC
6.98 ++#else
6.99 ++#include <locale>
6.100 ++#endif
6.101 + #include <bits/c++locale_internal.h>
6.102 +
6.103 + namespace std
6.104 +@@ -138,20 +143,34 @@
6.105 + ctype<wchar_t>::
6.106 + do_is(mask __m, wchar_t __c) const
6.107 + {
6.108 +- // Highest bitmask in ctype_base == 10, but extra in "C"
6.109 +- // library for blank.
6.110 ++ // The case of __m == ctype_base::space is particularly important,
6.111 ++ // due to its use in many istream functions. Therefore we deal with
6.112 ++ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
6.113 ++ // is the mask corresponding to ctype_base::space. NB: an encoding
6.114 ++ // change would not affect correctness!
6.115 + bool __ret = false;
6.116 +- const size_t __bitmasksize = 11;
6.117 +- for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
6.118 +- if (__m & _M_bit[__bitcur]
6.119 +- && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
6.120 +- {
6.121 +- __ret = true;
6.122 +- break;
6.123 +- }
6.124 ++ if (__m == _M_bit[5])
6.125 ++ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
6.126 ++ else
6.127 ++ {
6.128 ++ // Highest bitmask in ctype_base == 10, but extra in "C"
6.129 ++ // library for blank.
6.130 ++ const size_t __bitmasksize = 11;
6.131 ++ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
6.132 ++ if (__m & _M_bit[__bitcur])
6.133 ++ {
6.134 ++ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
6.135 ++ {
6.136 ++ __ret = true;
6.137 ++ break;
6.138 ++ }
6.139 ++ else if (__m == _M_bit[__bitcur])
6.140 ++ break;
6.141 ++ }
6.142 ++ }
6.143 + return __ret;
6.144 + }
6.145 +-
6.146 ++
6.147 + const wchar_t*
6.148 + ctype<wchar_t>::
6.149 + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
6.150 +--- gcc/libstdc++-v3/config/locale/uclibc/messages_members.h.uclibc200_update~ 2006-03-10 15:32:37 +0100
6.151 ++++ gcc/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-03-10 15:39:14 +0100
6.152 +@@ -47,18 +47,21 @@
6.153 + template<typename _CharT>
6.154 + messages<_CharT>::messages(size_t __refs)
6.155 + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
6.156 +- _M_name_messages(_S_get_c_name())
6.157 ++ _M_name_messages(_S_get_c_name())
6.158 + { }
6.159 +
6.160 + template<typename _CharT>
6.161 + messages<_CharT>::messages(__c_locale __cloc, const char* __s,
6.162 + size_t __refs)
6.163 +- : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
6.164 +- _M_name_messages(__s)
6.165 ++ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
6.166 + {
6.167 +- char* __tmp = new char[std::strlen(__s) + 1];
6.168 +- std::strcpy(__tmp, __s);
6.169 ++ const size_t __len = std::strlen(__s) + 1;
6.170 ++ char* __tmp = new char[__len];
6.171 ++ std::memcpy(__tmp, __s, __len);
6.172 + _M_name_messages = __tmp;
6.173 ++
6.174 ++ // Last to avoid leaking memory if new throws.
6.175 ++ _M_c_locale_messages = _S_clone_c_locale(__cloc);
6.176 + }
6.177 +
6.178 + template<typename _CharT>
6.179 +--- gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc.uclibc200_update~ 2006-03-10 15:37:27 +0100
6.180 ++++ gcc/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2006-03-10 15:39:14 +0100
6.181 +@@ -33,9 +33,14 @@
6.182 +
6.183 + // Written by Benjamin Kosnik <bkoz@redhat.com>
6.184 +
6.185 ++#include <features.h>
6.186 ++#ifdef __UCLIBC_HAS_LOCALE__
6.187 + #define _LIBC
6.188 + #include <locale>
6.189 + #undef _LIBC
6.190 ++#else
6.191 ++#include <locale>
6.192 ++#endif
6.193 + #include <bits/c++locale_internal.h>
6.194 +
6.195 + #ifdef __UCLIBC_MJN3_ONLY__
6.196 +@@ -206,7 +211,7 @@
6.197 + }
6.198 + break;
6.199 + default:
6.200 +- ;
6.201 ++ __ret = pattern();
6.202 + }
6.203 + return __ret;
6.204 + }
6.205 +--- gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc.uclibc200_update~ 2006-03-10 15:37:27 +0100
6.206 ++++ gcc/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2006-03-10 15:39:14 +0100
6.207 +@@ -33,9 +33,14 @@
6.208 +
6.209 + // Written by Benjamin Kosnik <bkoz@redhat.com>
6.210 +
6.211 ++#include <features.h>
6.212 ++#ifdef __UCLIBC_HAS_LOCALE__
6.213 + #define _LIBC
6.214 + #include <locale>
6.215 + #undef _LIBC
6.216 ++#else
6.217 ++#include <locale>
6.218 ++#endif
6.219 + #include <bits/c++locale_internal.h>
6.220 +
6.221 + #ifdef __UCLIBC_MJN3_ONLY__
6.222 +--- gcc/libstdc++-v3/config/locale/uclibc/time_members.h.uclibc200_update~ 2006-03-10 15:06:17 +0100
6.223 ++++ gcc/libstdc++-v3/config/locale/uclibc/time_members.h 2006-03-10 15:39:14 +0100
6.224 +@@ -37,25 +37,33 @@
6.225 + template<typename _CharT>
6.226 + __timepunct<_CharT>::__timepunct(size_t __refs)
6.227 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
6.228 +- _M_name_timepunct(_S_get_c_name())
6.229 ++ _M_name_timepunct(_S_get_c_name())
6.230 + { _M_initialize_timepunct(); }
6.231 +
6.232 + template<typename _CharT>
6.233 + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
6.234 + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
6.235 +- _M_name_timepunct(_S_get_c_name())
6.236 ++ _M_name_timepunct(_S_get_c_name())
6.237 + { _M_initialize_timepunct(); }
6.238 +
6.239 + template<typename _CharT>
6.240 + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
6.241 + size_t __refs)
6.242 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
6.243 +- _M_name_timepunct(__s)
6.244 ++ _M_name_timepunct(NULL)
6.245 + {
6.246 +- char* __tmp = new char[std::strlen(__s) + 1];
6.247 +- std::strcpy(__tmp, __s);
6.248 ++ const size_t __len = std::strlen(__s) + 1;
6.249 ++ char* __tmp = new char[__len];
6.250 ++ std::memcpy(__tmp, __s, __len);
6.251 + _M_name_timepunct = __tmp;
6.252 +- _M_initialize_timepunct(__cloc);
6.253 ++
6.254 ++ try
6.255 ++ { _M_initialize_timepunct(__cloc); }
6.256 ++ catch(...)
6.257 ++ {
6.258 ++ delete [] _M_name_timepunct;
6.259 ++ __throw_exception_again;
6.260 ++ }
6.261 + }
6.262 +
6.263 + template<typename _CharT>
6.264 +--- gcc-4.2/libstdc++-v3/config/locale/uclibc/c_locale.h.old 2006-09-28 11:39:00.000000000 +0200
6.265 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2006-09-28 12:10:41.000000000 +0200
6.266 +@@ -39,21 +39,23 @@
6.267 + #pragma GCC system_header
6.268 +
6.269 + #include <cstring> // get std::strlen
6.270 +-#include <cstdio> // get std::snprintf or std::sprintf
6.271 ++#include <cstdio> // get std::vsnprintf or std::vsprintf
6.272 + #include <clocale>
6.273 + #include <langinfo.h> // For codecvt
6.274 + #ifdef __UCLIBC_MJN3_ONLY__
6.275 + #warning fix this
6.276 + #endif
6.277 +-#ifdef __UCLIBC_HAS_LOCALE__
6.278 ++#ifdef _GLIBCXX_USE_ICONV
6.279 + #include <iconv.h> // For codecvt using iconv, iconv_t
6.280 + #endif
6.281 +-#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
6.282 +-#include <libintl.h> // For messages
6.283 ++#ifdef HAVE_LIBINTL_H
6.284 ++#include <libintl.h> // For messages
6.285 + #endif
6.286 ++#include <cstdarg>
6.287 +
6.288 + #ifdef __UCLIBC_MJN3_ONLY__
6.289 + #warning what is _GLIBCXX_C_LOCALE_GNU for
6.290 ++// psm: used in os/gnu-linux/ctype_noninline.h
6.291 + #endif
6.292 + #define _GLIBCXX_C_LOCALE_GNU 1
6.293 +
6.294 +@@ -62,7 +64,7 @@
6.295 + #endif
6.296 + // #define _GLIBCXX_NUM_CATEGORIES 6
6.297 + #define _GLIBCXX_NUM_CATEGORIES 0
6.298 +-
6.299 ++
6.300 + #ifdef __UCLIBC_HAS_XLOCALE__
6.301 + namespace __gnu_cxx
6.302 + {
6.303 +@@ -79,22 +81,24 @@
6.304 + typedef int* __c_locale;
6.305 + #endif
6.306 +
6.307 +- // Convert numeric value of type _Tv to string and return length of
6.308 +- // string. If snprintf is available use it, otherwise fall back to
6.309 +- // the unsafe sprintf which, in general, can be dangerous and should
6.310 ++ // Convert numeric value of type double to string and return length of
6.311 ++ // string. If vsnprintf is available use it, otherwise fall back to
6.312 ++ // the unsafe vsprintf which, in general, can be dangerous and should
6.313 + // be avoided.
6.314 +- template<typename _Tv>
6.315 +- int
6.316 +- __convert_from_v(char* __out,
6.317 +- const int __size __attribute__ ((__unused__)),
6.318 +- const char* __fmt,
6.319 +-#ifdef __UCLIBC_HAS_XCLOCALE__
6.320 +- _Tv __v, const __c_locale& __cloc, int __prec)
6.321 ++ inline int
6.322 ++ __convert_from_v(const __c_locale&
6.323 ++#ifndef __UCLIBC_HAS_XCLOCALE__
6.324 ++ __cloc __attribute__ ((__unused__))
6.325 ++#endif
6.326 ++ ,
6.327 ++ char* __out,
6.328 ++ const int __size,
6.329 ++ const char* __fmt, ...)
6.330 + {
6.331 ++ va_list __args;
6.332 ++#ifdef __UCLIBC_HAS_XCLOCALE__
6.333 + __c_locale __old = __gnu_cxx::__uselocale(__cloc);
6.334 + #else
6.335 +- _Tv __v, const __c_locale&, int __prec)
6.336 +- {
6.337 + # ifdef __UCLIBC_HAS_LOCALE__
6.338 + char* __old = std::setlocale(LC_ALL, NULL);
6.339 + char* __sav = new char[std::strlen(__old) + 1];
6.340 +@@ -103,7 +107,9 @@
6.341 + # endif
6.342 + #endif
6.343 +
6.344 +- const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
6.345 ++ va_start(__args, __fmt);
6.346 ++ const int __ret = std::vsnprintf(__out, __size, __fmt, __args);
6.347 ++ va_end(__args);
6.348 +
6.349 + #ifdef __UCLIBC_HAS_XCLOCALE__
6.350 + __gnu_cxx::__uselocale(__old);
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/patches/gcc/4.2.0/300-libstdc++-pic.patch Sun May 20 09:28:16 2007 +0000
7.3 @@ -0,0 +1,50 @@
7.4 +# DP: Build and install libstdc++_pic.a library.
7.5 +
7.6 +--- gcc/libstdc++-v3/src/Makefile.am
7.7 ++++ gcc/libstdc++-v3/src/Makefile.am
7.8 +@@ -214,6 +214,12 @@
7.9 + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
7.10 +
7.11 +
7.12 ++install-exec-local:
7.13 ++ifeq ($(enable_shared),yes)
7.14 ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
7.15 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
7.16 ++endif
7.17 ++
7.18 + # Added bits to build debug library.
7.19 + if GLIBCXX_BUILD_DEBUG
7.20 + all-local: build_debug
7.21 +--- gcc/libstdc++-v3/src/Makefile.in
7.22 ++++ gcc/libstdc++-v3/src/Makefile.in
7.23 +@@ -627,7 +627,7 @@
7.24 +
7.25 + install-data-am: install-data-local
7.26 +
7.27 +-install-exec-am: install-toolexeclibLTLIBRARIES
7.28 ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
7.29 +
7.30 + install-info: install-info-am
7.31 +
7.32 +@@ -660,6 +660,7 @@
7.33 + distclean-libtool distclean-tags distdir dvi dvi-am html \
7.34 + html-am info info-am install install-am install-data \
7.35 + install-data-am install-data-local install-exec \
7.36 ++ install-exec-local \
7.37 + install-exec-am install-info install-info-am install-man \
7.38 + install-strip install-toolexeclibLTLIBRARIES installcheck \
7.39 + installcheck-am installdirs maintainer-clean \
7.40 +@@ -743,6 +743,13 @@
7.41 + install_debug:
7.42 + (cd ${debugdir} && $(MAKE) \
7.43 + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
7.44 ++
7.45 ++install-exec-local:
7.46 ++ifeq ($(enable_shared),yes)
7.47 ++ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
7.48 ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
7.49 ++endif
7.50 ++
7.51 + # Tell versions [3.59,3.63) of GNU make to not export all variables.
7.52 + # Otherwise a system limit (for SysV at least) may be exceeded.
7.53 + .NOEXPORT:
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/patches/gcc/4.2.0/301-missing-execinfo_h.patch Sun May 20 09:28:16 2007 +0000
8.3 @@ -0,0 +1,11 @@
8.4 +--- gcc-4.0.0/boehm-gc/include/gc.h-orig 2005-04-28 22:28:57.000000000 -0500
8.5 ++++ gcc-4.0.0/boehm-gc/include/gc.h 2005-04-28 22:30:38.000000000 -0500
8.6 +@@ -500,7 +500,7 @@
8.7 + #ifdef __linux__
8.8 + # include <features.h>
8.9 + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
8.10 +- && !defined(__ia64__)
8.11 ++ && !defined(__ia64__) && !defined(__UCLIBC__)
8.12 + # ifndef GC_HAVE_BUILTIN_BACKTRACE
8.13 + # define GC_HAVE_BUILTIN_BACKTRACE
8.14 + # endif
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/patches/gcc/4.2.0/302-c99-snprintf.patch Sun May 20 09:28:16 2007 +0000
9.3 @@ -0,0 +1,11 @@
9.4 +--- gcc-4.2.0.orig/libstdc++-v3/include/c_std/std_cstdio.h 2006-12-07 10:33:51.000000000 +0100
9.5 ++++ gcc-4.2.0/libstdc++-v3/include/c_std/std_cstdio.h 2007-05-20 01:05:38.000000000 +0200
9.6 +@@ -144,7 +144,7 @@
9.7 +
9.8 + _GLIBCXX_END_NAMESPACE
9.9 +
9.10 +-#if _GLIBCXX_USE_C99
9.11 ++#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
9.12 +
9.13 + #undef snprintf
9.14 + #undef vfscanf
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/patches/gcc/4.2.0/303-c99-complex-ugly-hack.patch Sun May 20 09:28:16 2007 +0000
10.3 @@ -0,0 +1,12 @@
10.4 +--- gcc-4.0.0/libstdc++-v3/configure-old 2005-04-30 22:04:48.061603912 -0500
10.5 ++++ gcc-4.0.0/libstdc++-v3/configure 2005-04-30 22:06:13.678588152 -0500
10.6 +@@ -7194,6 +7194,9 @@
10.7 + cat >>conftest.$ac_ext <<_ACEOF
10.8 + /* end confdefs.h. */
10.9 + #include <complex.h>
10.10 ++#ifdef __UCLIBC__
10.11 ++#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
10.12 ++#endif
10.13 + int
10.14 + main ()
10.15 + {
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/patches/gcc/4.2.0/304-index_macro.patch Sun May 20 09:28:16 2007 +0000
11.3 @@ -0,0 +1,24 @@
11.4 +--- gcc-4.1.0/libstdc++-v3/include/ext/rope.mps 2006-03-24 01:49:51 +0100
11.5 ++++ gcc-4.1.0/libstdc++-v3/include/ext/rope 2006-03-24 01:49:37 +0100
11.6 +@@ -59,6 +59,9 @@
11.7 + #include <bits/allocator.h>
11.8 + #include <ext/hash_fun.h>
11.9 +
11.10 ++/* cope w/ index defined as macro, SuSv3 proposal */
11.11 ++#undef index
11.12 ++
11.13 + # ifdef __GC
11.14 + # define __GC_CONST const
11.15 + # else
11.16 +--- gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h.mps 2006-03-24 01:50:04 +0100
11.17 ++++ gcc-4.1.0/libstdc++-v3/include/ext/ropeimpl.h 2006-03-24 01:50:28 +0100
11.18 +@@ -53,6 +53,9 @@
11.19 + #include <ext/memory> // For uninitialized_copy_n
11.20 + #include <ext/numeric> // For power
11.21 +
11.22 ++/* cope w/ index defined as macro, SuSv3 proposal */
11.23 ++#undef index
11.24 ++
11.25 + _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
11.26 +
11.27 + using std::size_t;
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/patches/gcc/4.2.0/305-libmudflap-susv3-legacy.patch Sun May 20 09:28:16 2007 +0000
12.3 @@ -0,0 +1,49 @@
12.4 +Index: gcc-4.2/libmudflap/mf-hooks2.c
12.5 +===================================================================
12.6 +--- gcc-4.2/libmudflap/mf-hooks2.c (revision 119834)
12.7 ++++ gcc-4.2/libmudflap/mf-hooks2.c (working copy)
12.8 +@@ -427,7 +427,7 @@
12.9 + {
12.10 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.11 + MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
12.12 +- bzero (s, n);
12.13 ++ memset (s, 0, n);
12.14 + }
12.15 +
12.16 +
12.17 +@@ -437,7 +437,7 @@
12.18 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.19 + MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
12.20 + MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
12.21 +- bcopy (src, dest, n);
12.22 ++ memmove (dest, src, n);
12.23 + }
12.24 +
12.25 +
12.26 +@@ -447,7 +447,7 @@
12.27 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.28 + MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
12.29 + MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
12.30 +- return bcmp (s1, s2, n);
12.31 ++ return n == 0 ? 0 : memcmp (s1, s2, n);
12.32 + }
12.33 +
12.34 +
12.35 +@@ -456,7 +456,7 @@
12.36 + size_t n = strlen (s);
12.37 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.38 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
12.39 +- return index (s, c);
12.40 ++ return strchr (s, c);
12.41 + }
12.42 +
12.43 +
12.44 +@@ -465,7 +465,7 @@
12.45 + size_t n = strlen (s);
12.46 + TRACE ("%s\n", __PRETTY_FUNCTION__);
12.47 + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
12.48 +- return rindex (s, c);
12.49 ++ return strrchr (s, c);
12.50 + }
12.51 +
12.52 + /* XXX: stpcpy, memccpy */
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/patches/gcc/4.2.0/306-libstdc++-namespace.patch Sun May 20 09:28:16 2007 +0000
13.3 @@ -0,0 +1,36 @@
13.4 +diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h
13.5 +--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 13:06:56.000000000 +0100
13.6 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 15:23:41.000000000 +0100
13.7 +@@ -32,7 +32,8 @@
13.8 + //
13.9 +
13.10 + // Written by Benjamin Kosnik <bkoz@redhat.com>
13.11 +-
13.12 ++namespace std
13.13 ++{
13.14 + #ifdef __UCLIBC_MJN3_ONLY__
13.15 + #warning fix prototypes for *textdomain funcs
13.16 + #endif
13.17 +@@ -115,3 +116,4 @@
13.18 + this->_S_create_c_locale(this->_M_c_locale_messages, __s);
13.19 + }
13.20 + }
13.21 ++}
13.22 +diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h
13.23 +--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 13:06:56.000000000 +0100
13.24 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 15:20:31.000000000 +0100
13.25 +@@ -33,7 +33,8 @@
13.26 + //
13.27 +
13.28 + // Written by Benjamin Kosnik <bkoz@redhat.com>
13.29 +-
13.30 ++namespace std
13.31 ++{
13.32 + template<typename _CharT>
13.33 + __timepunct<_CharT>::__timepunct(size_t __refs)
13.34 + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
13.35 +@@ -74,3 +75,4 @@
13.36 + delete _M_data;
13.37 + _S_destroy_c_locale(_M_c_locale_timepunct);
13.38 + }
13.39 ++}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/patches/gcc/4.2.0/402-libbackend_dep_gcov-iov.h.patch Sun May 20 09:28:16 2007 +0000
14.3 @@ -0,0 +1,13 @@
14.4 +Index: gcc-4.2/gcc/Makefile.in
14.5 +===================================================================
14.6 +--- gcc-4.2/gcc/Makefile.in (revision 121758)
14.7 ++++ gcc-4.2/gcc/Makefile.in (working copy)
14.8 +@@ -2658,7 +2658,7 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H)
14.9 + # FIXME: writing proper dependencies for this is a *LOT* of work.
14.10 + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \
14.11 + insn-config.h insn-flags.h insn-codes.h insn-constants.h \
14.12 +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
14.13 ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
14.14 + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
14.15 + -DTARGET_NAME=\"$(target_noncanonical)\" \
14.16 + -DLOCALEDIR=\"$(localedir)\" \
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/patches/gcc/4.2.0/800-arm-bigendian.patch Sun May 20 09:28:16 2007 +0000
15.3 @@ -0,0 +1,67 @@
15.4 +By Lennert Buytenhek <buytenh@wantstofly.org>
15.5 +Adds support for arm*b-linux* big-endian ARM targets
15.6 +
15.7 +See http://gcc.gnu.org/PR16350
15.8 +
15.9 +--- gcc-4.2.0/gcc/config/arm/linux-elf.h
15.10 ++++ gcc-4.2.0/gcc/config/arm/linux-elf.h
15.11 +@@ -28,19 +28,33 @@
15.12 + #undef TARGET_VERSION
15.13 + #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
15.14 +
15.15 ++/*
15.16 ++ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
15.17 ++ * (big endian) configurations.
15.18 ++ */
15.19 ++#if TARGET_BIG_ENDIAN_DEFAULT
15.20 ++#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
15.21 ++#define TARGET_ENDIAN_OPTION "mbig-endian"
15.22 ++#define TARGET_LINKER_EMULATION "armelfb_linux"
15.23 ++#else
15.24 ++#define TARGET_ENDIAN_DEFAULT 0
15.25 ++#define TARGET_ENDIAN_OPTION "mlittle-endian"
15.26 ++#define TARGET_LINKER_EMULATION "armelf_linux"
15.27 ++#endif
15.28 ++
15.29 + #undef TARGET_DEFAULT_FLOAT_ABI
15.30 + #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
15.31 +
15.32 + #undef TARGET_DEFAULT
15.33 +-#define TARGET_DEFAULT (0)
15.34 ++#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
15.35 +
15.36 + #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
15.37 +
15.38 +-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
15.39 ++#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
15.40 +
15.41 + #undef MULTILIB_DEFAULTS
15.42 + #define MULTILIB_DEFAULTS \
15.43 +- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
15.44 ++ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
15.45 +
15.46 + /* Now we define the strings used to build the spec file. */
15.47 + #undef LIB_SPEC
15.48 +@@ -61,7 +75,7 @@
15.49 + %{rdynamic:-export-dynamic} \
15.50 + %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "} \
15.51 + -X \
15.52 +- %{mbig-endian:-EB}" \
15.53 ++ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
15.54 + SUBTARGET_EXTRA_LINK_SPEC
15.55 +
15.56 + #undef LINK_SPEC
15.57 +--- gcc-4.2.0/gcc/config.gcc.orig 2006-09-22 14:53:41.000000000 +0200
15.58 ++++ gcc-4.2.0/gcc/config.gcc 2006-09-25 10:45:21.000000000 +0200
15.59 +@@ -696,6 +696,11 @@
15.60 + tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
15.61 + tmake_file="${tmake_file} t-linux arm/t-arm"
15.62 + case ${target} in
15.63 ++ arm*b-*)
15.64 ++ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
15.65 ++ ;;
15.66 ++ esac
15.67 ++ case ${target} in
15.68 + arm*-*-linux-*eabi)
15.69 + tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
15.70 + tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"