yann@552: Original patch from gentoo: gentoo/src/patchsets/gcc/4.3.0/uclibc/90_all_200-uclibc-locale.patch yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/acinclude.m4 gcc-4.3.0/libstdc++-v3/acinclude.m4 yann@552: --- gcc-4.3.0.orig/libstdc++-v3/acinclude.m4 2008-02-29 01:00:39.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/acinclude.m4 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -1349,7 +1349,7 @@ yann@552: AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ yann@552: GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], yann@552: [use MODEL for target locale package], yann@552: - [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) yann@552: + [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) yann@552: yann@552: # Deal with gettext issues. Default to not using it (=no) until we detect yann@552: # support for it later. Let the user turn it off via --e/d, but let that yann@552: @@ -1370,6 +1370,9 @@ yann@552: # Default to "generic". yann@552: if test $enable_clocale_flag = auto; then yann@552: case ${target_os} in yann@552: + *-uclibc*) yann@552: + enable_clocale_flag=uclibc yann@552: + ;; yann@552: linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) yann@552: enable_clocale_flag=gnu yann@552: ;; yann@552: @@ -1541,6 +1544,40 @@ yann@552: CTIME_CC=config/locale/generic/time_members.cc yann@552: CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h yann@552: ;; yann@552: + uclibc) yann@552: + AC_MSG_RESULT(uclibc) yann@552: + yann@552: + # Declare intention to use gettext, and add support for specific yann@552: + # languages. yann@552: + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT yann@552: + ALL_LINGUAS="de fr" yann@552: + yann@552: + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. yann@552: + AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) yann@552: + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then yann@552: + USE_NLS=yes yann@552: + fi yann@552: + # Export the build objects. yann@552: + for ling in $ALL_LINGUAS; do \ yann@552: + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ yann@552: + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ yann@552: + done yann@552: + AC_SUBST(glibcxx_MOFILES) yann@552: + AC_SUBST(glibcxx_POFILES) yann@552: + yann@552: + CLOCALE_H=config/locale/uclibc/c_locale.h yann@552: + CLOCALE_CC=config/locale/uclibc/c_locale.cc yann@552: + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc yann@552: + CCOLLATE_CC=config/locale/uclibc/collate_members.cc yann@552: + CCTYPE_CC=config/locale/uclibc/ctype_members.cc yann@552: + CMESSAGES_H=config/locale/uclibc/messages_members.h yann@552: + CMESSAGES_CC=config/locale/uclibc/messages_members.cc yann@552: + CMONEY_CC=config/locale/uclibc/monetary_members.cc yann@552: + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc yann@552: + CTIME_H=config/locale/uclibc/time_members.h yann@552: + CTIME_CC=config/locale/uclibc/time_members.cc yann@552: + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h yann@552: + ;; yann@552: esac yann@552: yann@552: # This is where the testsuite looks for locale catalogs, using the yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,63 @@ yann@552: +// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// Written by Jakub Jelinek yann@552: + yann@552: +#include yann@552: +#include yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning clean this up yann@552: +#endif yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + yann@552: +extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l; yann@552: +extern "C" __typeof(strcoll_l) __strcoll_l; yann@552: +extern "C" __typeof(strftime_l) __strftime_l; yann@552: +extern "C" __typeof(strtod_l) __strtod_l; yann@552: +extern "C" __typeof(strtof_l) __strtof_l; yann@552: +extern "C" __typeof(strtold_l) __strtold_l; yann@552: +extern "C" __typeof(strxfrm_l) __strxfrm_l; yann@552: +extern "C" __typeof(newlocale) __newlocale; yann@552: +extern "C" __typeof(freelocale) __freelocale; yann@552: +extern "C" __typeof(duplocale) __duplocale; yann@552: +extern "C" __typeof(uselocale) __uselocale; yann@552: + yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: +extern "C" __typeof(iswctype_l) __iswctype_l; yann@552: +extern "C" __typeof(towlower_l) __towlower_l; yann@552: +extern "C" __typeof(towupper_l) __towupper_l; yann@552: +extern "C" __typeof(wcscoll_l) __wcscoll_l; yann@552: +extern "C" __typeof(wcsftime_l) __wcsftime_l; yann@552: +extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l; yann@552: +extern "C" __typeof(wctype_l) __wctype_l; yann@552: +#endif yann@552: + yann@552: +#endif // GLIBC 2.3 and later yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,160 @@ yann@552: +// Wrapper for underlying C-language localization -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.8 Standard locale categories. yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#include // For errno yann@552: +#include yann@552: +#include yann@552: +#include yann@552: +#include yann@552: + yann@552: +#ifndef __UCLIBC_HAS_XLOCALE__ yann@552: +#define __strtol_l(S, E, B, L) strtol((S), (E), (B)) yann@552: +#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B)) yann@552: +#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B)) yann@552: +#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B)) yann@552: +#define __strtof_l(S, E, L) strtof((S), (E)) yann@552: +#define __strtod_l(S, E, L) strtod((S), (E)) yann@552: +#define __strtold_l(S, E, L) strtold((S), (E)) yann@552: +#warning should dummy __newlocale check for C|POSIX ? yann@552: +#define __newlocale(a, b, c) NULL yann@552: +#define __freelocale(a) ((void)0) yann@552: +#define __duplocale(a) __c_locale() yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + template<> yann@552: + void yann@552: + __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, yann@552: + const __c_locale& __cloc) yann@552: + { yann@552: + if (!(__err & ios_base::failbit)) yann@552: + { yann@552: + char* __sanity; yann@552: + errno = 0; yann@552: + float __f = __strtof_l(__s, &__sanity, __cloc); yann@552: + if (__sanity != __s && errno != ERANGE) yann@552: + __v = __f; yann@552: + else yann@552: + __err |= ios_base::failbit; yann@552: + } yann@552: + } yann@552: + yann@552: + template<> yann@552: + void yann@552: + __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, yann@552: + const __c_locale& __cloc) yann@552: + { yann@552: + if (!(__err & ios_base::failbit)) yann@552: + { yann@552: + char* __sanity; yann@552: + errno = 0; yann@552: + double __d = __strtod_l(__s, &__sanity, __cloc); yann@552: + if (__sanity != __s && errno != ERANGE) yann@552: + __v = __d; yann@552: + else yann@552: + __err |= ios_base::failbit; yann@552: + } yann@552: + } yann@552: + yann@552: + template<> yann@552: + void yann@552: + __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err, yann@552: + const __c_locale& __cloc) yann@552: + { yann@552: + if (!(__err & ios_base::failbit)) yann@552: + { yann@552: + char* __sanity; yann@552: + errno = 0; yann@552: + long double __ld = __strtold_l(__s, &__sanity, __cloc); yann@552: + if (__sanity != __s && errno != ERANGE) yann@552: + __v = __ld; yann@552: + else yann@552: + __err |= ios_base::failbit; yann@552: + } yann@552: + } yann@552: + yann@552: + void yann@552: + locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, yann@552: + __c_locale __old) yann@552: + { yann@552: + __cloc = __newlocale(1 << LC_ALL, __s, __old); yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + if (!__cloc) yann@552: + { yann@552: + // This named locale is not supported by the underlying OS. yann@552: + __throw_runtime_error(__N("locale::facet::_S_create_c_locale " yann@552: + "name not valid")); yann@552: + } yann@552: +#endif yann@552: + } yann@552: + yann@552: + void yann@552: + locale::facet::_S_destroy_c_locale(__c_locale& __cloc) yann@552: + { yann@552: + if (_S_get_c_locale() != __cloc) yann@552: + __freelocale(__cloc); yann@552: + } yann@552: + yann@552: + __c_locale yann@552: + locale::facet::_S_clone_c_locale(__c_locale& __cloc) yann@552: + { return __duplocale(__cloc); } yann@552: +} // namespace std yann@552: + yann@552: +namespace __gnu_cxx yann@552: +{ yann@552: + const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] = yann@552: + { yann@552: + "LC_CTYPE", yann@552: + "LC_NUMERIC", yann@552: + "LC_TIME", yann@552: + "LC_COLLATE", yann@552: + "LC_MONETARY", yann@552: + "LC_MESSAGES", yann@552: +#if _GLIBCXX_NUM_CATEGORIES != 0 yann@552: + "LC_PAPER", yann@552: + "LC_NAME", yann@552: + "LC_ADDRESS", yann@552: + "LC_TELEPHONE", yann@552: + "LC_MEASUREMENT", yann@552: + "LC_IDENTIFICATION" yann@552: +#endif yann@552: + }; yann@552: +} yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + const char* const* const locale::_S_categories = __gnu_cxx::category_names; yann@552: +} // namespace std yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/c_locale.h 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,117 @@ yann@552: +// Wrapper for underlying C-language localization -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.8 Standard locale categories. yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#ifndef _C_LOCALE_H yann@552: +#define _C_LOCALE_H 1 yann@552: + yann@552: +#pragma GCC system_header yann@552: + yann@552: +#include // get std::strlen yann@552: +#include // get std::snprintf or std::sprintf yann@552: +#include yann@552: +#include // For codecvt yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning fix this yann@552: +#endif yann@552: +#ifdef __UCLIBC_HAS_LOCALE__ yann@552: +#include // For codecvt using iconv, iconv_t yann@552: +#endif yann@552: +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ yann@552: +#include // For messages yann@552: +#endif yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning what is _GLIBCXX_C_LOCALE_GNU for yann@552: +#endif yann@552: +#define _GLIBCXX_C_LOCALE_GNU 1 yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning fix categories yann@552: +#endif yann@552: +// #define _GLIBCXX_NUM_CATEGORIES 6 yann@552: +#define _GLIBCXX_NUM_CATEGORIES 0 yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: +namespace __gnu_cxx yann@552: +{ yann@552: + extern "C" __typeof(uselocale) __uselocale; yann@552: +} yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + typedef __locale_t __c_locale; yann@552: +#else yann@552: + typedef int* __c_locale; yann@552: +#endif yann@552: + yann@552: + // Convert numeric value of type _Tv to string and return length of yann@552: + // string. If snprintf is available use it, otherwise fall back to yann@552: + // the unsafe sprintf which, in general, can be dangerous and should yann@552: + // be avoided. yann@552: + template yann@552: + int yann@552: + __convert_from_v(char* __out, yann@552: + const int __size __attribute__ ((__unused__)), yann@552: + const char* __fmt, yann@552: +#ifdef __UCLIBC_HAS_XCLOCALE__ yann@552: + _Tv __v, const __c_locale& __cloc, int __prec) yann@552: + { yann@552: + __c_locale __old = __gnu_cxx::__uselocale(__cloc); yann@552: +#else yann@552: + _Tv __v, const __c_locale&, int __prec) yann@552: + { yann@552: +# ifdef __UCLIBC_HAS_LOCALE__ yann@552: + char* __old = std::setlocale(LC_ALL, NULL); yann@552: + char* __sav = new char[std::strlen(__old) + 1]; yann@552: + std::strcpy(__sav, __old); yann@552: + std::setlocale(LC_ALL, "C"); yann@552: +# endif yann@552: +#endif yann@552: + yann@552: + const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v); yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XCLOCALE__ yann@552: + __gnu_cxx::__uselocale(__old); yann@552: +#elif defined __UCLIBC_HAS_LOCALE__ yann@552: + std::setlocale(LC_ALL, __sav); yann@552: + delete [] __sav; yann@552: +#endif yann@552: + return __ret; yann@552: + } yann@552: +} yann@552: + yann@552: +#endif yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,306 @@ yann@552: +// std::codecvt implementation details, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2002, 2003 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.1.5 - Template class codecvt yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#include yann@552: +#include yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + // Specializations. yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: + codecvt_base::result yann@552: + codecvt:: yann@552: + do_out(state_type& __state, const intern_type* __from, yann@552: + const intern_type* __from_end, const intern_type*& __from_next, yann@552: + extern_type* __to, extern_type* __to_end, yann@552: + extern_type*& __to_next) const yann@552: + { yann@552: + result __ret = ok; yann@552: + state_type __tmp_state(__state); yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_codecvt); yann@552: +#endif yann@552: + yann@552: + // wcsnrtombs is *very* fast but stops if encounters NUL characters: yann@552: + // in case we fall back to wcrtomb and then continue, in a loop. yann@552: + // NB: wcsnrtombs is a GNU extension yann@552: + for (__from_next = __from, __to_next = __to; yann@552: + __from_next < __from_end && __to_next < __to_end yann@552: + && __ret == ok;) yann@552: + { yann@552: + const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0', yann@552: + __from_end - __from_next); yann@552: + if (!__from_chunk_end) yann@552: + __from_chunk_end = __from_end; yann@552: + yann@552: + __from = __from_next; yann@552: + const size_t __conv = wcsnrtombs(__to_next, &__from_next, yann@552: + __from_chunk_end - __from_next, yann@552: + __to_end - __to_next, &__state); yann@552: + if (__conv == static_cast(-1)) yann@552: + { yann@552: + // In case of error, in order to stop at the exact place we yann@552: + // have to start again from the beginning with a series of yann@552: + // wcrtomb. yann@552: + for (; __from < __from_next; ++__from) yann@552: + __to_next += wcrtomb(__to_next, *__from, &__tmp_state); yann@552: + __state = __tmp_state; yann@552: + __ret = error; yann@552: + } yann@552: + else if (__from_next && __from_next < __from_chunk_end) yann@552: + { yann@552: + __to_next += __conv; yann@552: + __ret = partial; yann@552: + } yann@552: + else yann@552: + { yann@552: + __from_next = __from_chunk_end; yann@552: + __to_next += __conv; yann@552: + } yann@552: + yann@552: + if (__from_next < __from_end && __ret == ok) yann@552: + { yann@552: + extern_type __buf[MB_LEN_MAX]; yann@552: + __tmp_state = __state; yann@552: + const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); yann@552: + if (__conv > static_cast(__to_end - __to_next)) yann@552: + __ret = partial; yann@552: + else yann@552: + { yann@552: + memcpy(__to_next, __buf, __conv); yann@552: + __state = __tmp_state; yann@552: + __to_next += __conv; yann@552: + ++__from_next; yann@552: + } yann@552: + } yann@552: + } yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + yann@552: + return __ret; yann@552: + } yann@552: + yann@552: + codecvt_base::result yann@552: + codecvt:: yann@552: + do_in(state_type& __state, const extern_type* __from, yann@552: + const extern_type* __from_end, const extern_type*& __from_next, yann@552: + intern_type* __to, intern_type* __to_end, yann@552: + intern_type*& __to_next) const yann@552: + { yann@552: + result __ret = ok; yann@552: + state_type __tmp_state(__state); yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_codecvt); yann@552: +#endif yann@552: + yann@552: + // mbsnrtowcs is *very* fast but stops if encounters NUL characters: yann@552: + // in case we store a L'\0' and then continue, in a loop. yann@552: + // NB: mbsnrtowcs is a GNU extension yann@552: + for (__from_next = __from, __to_next = __to; yann@552: + __from_next < __from_end && __to_next < __to_end yann@552: + && __ret == ok;) yann@552: + { yann@552: + const extern_type* __from_chunk_end; yann@552: + __from_chunk_end = static_cast(memchr(__from_next, '\0', yann@552: + __from_end yann@552: + - __from_next)); yann@552: + if (!__from_chunk_end) yann@552: + __from_chunk_end = __from_end; yann@552: + yann@552: + __from = __from_next; yann@552: + size_t __conv = mbsnrtowcs(__to_next, &__from_next, yann@552: + __from_chunk_end - __from_next, yann@552: + __to_end - __to_next, &__state); yann@552: + if (__conv == static_cast(-1)) yann@552: + { yann@552: + // In case of error, in order to stop at the exact place we yann@552: + // have to start again from the beginning with a series of yann@552: + // mbrtowc. yann@552: + for (;; ++__to_next, __from += __conv) yann@552: + { yann@552: + __conv = mbrtowc(__to_next, __from, __from_end - __from, yann@552: + &__tmp_state); yann@552: + if (__conv == static_cast(-1) yann@552: + || __conv == static_cast(-2)) yann@552: + break; yann@552: + } yann@552: + __from_next = __from; yann@552: + __state = __tmp_state; yann@552: + __ret = error; yann@552: + } yann@552: + else if (__from_next && __from_next < __from_chunk_end) yann@552: + { yann@552: + // It is unclear what to return in this case (see DR 382). yann@552: + __to_next += __conv; yann@552: + __ret = partial; yann@552: + } yann@552: + else yann@552: + { yann@552: + __from_next = __from_chunk_end; yann@552: + __to_next += __conv; yann@552: + } yann@552: + yann@552: + if (__from_next < __from_end && __ret == ok) yann@552: + { yann@552: + if (__to_next < __to_end) yann@552: + { yann@552: + // XXX Probably wrong for stateful encodings yann@552: + __tmp_state = __state; yann@552: + ++__from_next; yann@552: + *__to_next++ = L'\0'; yann@552: + } yann@552: + else yann@552: + __ret = partial; yann@552: + } yann@552: + } yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + yann@552: + return __ret; yann@552: + } yann@552: + yann@552: + int yann@552: + codecvt:: yann@552: + do_encoding() const throw() yann@552: + { yann@552: + // XXX This implementation assumes that the encoding is yann@552: + // stateless and is either single-byte or variable-width. yann@552: + int __ret = 0; yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_codecvt); yann@552: +#endif yann@552: + if (MB_CUR_MAX == 1) yann@552: + __ret = 1; yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + return __ret; yann@552: + } yann@552: + yann@552: + int yann@552: + codecvt:: yann@552: + do_max_length() const throw() yann@552: + { yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_codecvt); yann@552: +#endif yann@552: + // XXX Probably wrong for stateful encodings. yann@552: + int __ret = MB_CUR_MAX; yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + return __ret; yann@552: + } yann@552: + yann@552: + int yann@552: + codecvt:: yann@552: + do_length(state_type& __state, const extern_type* __from, yann@552: + const extern_type* __end, size_t __max) const yann@552: + { yann@552: + int __ret = 0; yann@552: + state_type __tmp_state(__state); yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_codecvt); yann@552: +#endif yann@552: + yann@552: + // mbsnrtowcs is *very* fast but stops if encounters NUL characters: yann@552: + // in case we advance past it and then continue, in a loop. yann@552: + // NB: mbsnrtowcs is a GNU extension yann@552: + yann@552: + // A dummy internal buffer is needed in order for mbsnrtocws to consider yann@552: + // its fourth parameter (it wouldn't with NULL as first parameter). yann@552: + wchar_t* __to = static_cast(__builtin_alloca(sizeof(wchar_t) yann@552: + * __max)); yann@552: + while (__from < __end && __max) yann@552: + { yann@552: + const extern_type* __from_chunk_end; yann@552: + __from_chunk_end = static_cast(memchr(__from, '\0', yann@552: + __end yann@552: + - __from)); yann@552: + if (!__from_chunk_end) yann@552: + __from_chunk_end = __end; yann@552: + yann@552: + const extern_type* __tmp_from = __from; yann@552: + size_t __conv = mbsnrtowcs(__to, &__from, yann@552: + __from_chunk_end - __from, yann@552: + __max, &__state); yann@552: + if (__conv == static_cast(-1)) yann@552: + { yann@552: + // In case of error, in order to stop at the exact place we yann@552: + // have to start again from the beginning with a series of yann@552: + // mbrtowc. yann@552: + for (__from = __tmp_from;; __from += __conv) yann@552: + { yann@552: + __conv = mbrtowc(NULL, __from, __end - __from, yann@552: + &__tmp_state); yann@552: + if (__conv == static_cast(-1) yann@552: + || __conv == static_cast(-2)) yann@552: + break; yann@552: + } yann@552: + __state = __tmp_state; yann@552: + __ret += __from - __tmp_from; yann@552: + break; yann@552: + } yann@552: + if (!__from) yann@552: + __from = __from_chunk_end; yann@552: + yann@552: + __ret += __from - __tmp_from; yann@552: + __max -= __conv; yann@552: + yann@552: + if (__from < __end && __max) yann@552: + { yann@552: + // XXX Probably wrong for stateful encodings yann@552: + __tmp_state = __state; yann@552: + ++__from; yann@552: + ++__ret; yann@552: + --__max; yann@552: + } yann@552: + } yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + yann@552: + return __ret; yann@552: + } yann@552: +#endif yann@552: +} yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/collate_members.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,80 @@ yann@552: +// std::collate implementation details, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.4.1.2 collate virtual functions yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#include yann@552: +#include yann@552: + yann@552: +#ifndef __UCLIBC_HAS_XLOCALE__ yann@552: +#define __strcoll_l(S1, S2, L) strcoll((S1), (S2)) yann@552: +#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N)) yann@552: +#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2)) yann@552: +#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N)) yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + // These are basically extensions to char_traits, and perhaps should yann@552: + // be put there instead of here. yann@552: + template<> yann@552: + int yann@552: + collate::_M_compare(const char* __one, const char* __two) const yann@552: + { yann@552: + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate); yann@552: + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); yann@552: + } yann@552: + yann@552: + template<> yann@552: + size_t yann@552: + collate::_M_transform(char* __to, const char* __from, yann@552: + size_t __n) const yann@552: + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); } yann@552: + yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: + template<> yann@552: + int yann@552: + collate::_M_compare(const wchar_t* __one, yann@552: + const wchar_t* __two) const yann@552: + { yann@552: + int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate); yann@552: + return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0); yann@552: + } yann@552: + yann@552: + template<> yann@552: + size_t yann@552: + collate::_M_transform(wchar_t* __to, const wchar_t* __from, yann@552: + size_t __n) const yann@552: + { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); } yann@552: +#endif yann@552: +} yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,300 @@ yann@552: +// std::ctype implementation details, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions. yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#define _LIBC yann@552: +#include yann@552: +#undef _LIBC yann@552: +#include yann@552: + yann@552: +#ifndef __UCLIBC_HAS_XLOCALE__ yann@552: +#define __wctype_l(S, L) wctype((S)) yann@552: +#define __towupper_l(C, L) towupper((C)) yann@552: +#define __towlower_l(C, L) towlower((C)) yann@552: +#define __iswctype_l(C, M, L) iswctype((C), (M)) yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + // NB: The other ctype specializations are in src/locale.cc and yann@552: + // various /config/os/* files. yann@552: + template<> yann@552: + ctype_byname::ctype_byname(const char* __s, size_t __refs) yann@552: + : ctype(0, false, __refs) yann@552: + { yann@552: + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) yann@552: + { yann@552: + this->_S_destroy_c_locale(this->_M_c_locale_ctype); yann@552: + this->_S_create_c_locale(this->_M_c_locale_ctype, __s); yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper; yann@552: + this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower; yann@552: + this->_M_table = this->_M_c_locale_ctype->__ctype_b; yann@552: +#endif yann@552: + } yann@552: + } yann@552: + yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: + ctype::__wmask_type yann@552: + ctype::_M_convert_to_wmask(const mask __m) const yann@552: + { yann@552: + __wmask_type __ret; yann@552: + switch (__m) yann@552: + { yann@552: + case space: yann@552: + __ret = __wctype_l("space", _M_c_locale_ctype); yann@552: + break; yann@552: + case print: yann@552: + __ret = __wctype_l("print", _M_c_locale_ctype); yann@552: + break; yann@552: + case cntrl: yann@552: + __ret = __wctype_l("cntrl", _M_c_locale_ctype); yann@552: + break; yann@552: + case upper: yann@552: + __ret = __wctype_l("upper", _M_c_locale_ctype); yann@552: + break; yann@552: + case lower: yann@552: + __ret = __wctype_l("lower", _M_c_locale_ctype); yann@552: + break; yann@552: + case alpha: yann@552: + __ret = __wctype_l("alpha", _M_c_locale_ctype); yann@552: + break; yann@552: + case digit: yann@552: + __ret = __wctype_l("digit", _M_c_locale_ctype); yann@552: + break; yann@552: + case punct: yann@552: + __ret = __wctype_l("punct", _M_c_locale_ctype); yann@552: + break; yann@552: + case xdigit: yann@552: + __ret = __wctype_l("xdigit", _M_c_locale_ctype); yann@552: + break; yann@552: + case alnum: yann@552: + __ret = __wctype_l("alnum", _M_c_locale_ctype); yann@552: + break; yann@552: + case graph: yann@552: + __ret = __wctype_l("graph", _M_c_locale_ctype); yann@552: + break; yann@552: + default: yann@552: + __ret = __wmask_type(); yann@552: + } yann@552: + return __ret; yann@552: + } yann@552: + yann@552: + wchar_t yann@552: + ctype::do_toupper(wchar_t __c) const yann@552: + { return __towupper_l(__c, _M_c_locale_ctype); } yann@552: + yann@552: + const wchar_t* yann@552: + ctype::do_toupper(wchar_t* __lo, const wchar_t* __hi) const yann@552: + { yann@552: + while (__lo < __hi) yann@552: + { yann@552: + *__lo = __towupper_l(*__lo, _M_c_locale_ctype); yann@552: + ++__lo; yann@552: + } yann@552: + return __hi; yann@552: + } yann@552: + yann@552: + wchar_t yann@552: + ctype::do_tolower(wchar_t __c) const yann@552: + { return __towlower_l(__c, _M_c_locale_ctype); } yann@552: + yann@552: + const wchar_t* yann@552: + ctype::do_tolower(wchar_t* __lo, const wchar_t* __hi) const yann@552: + { yann@552: + while (__lo < __hi) yann@552: + { yann@552: + *__lo = __towlower_l(*__lo, _M_c_locale_ctype); yann@552: + ++__lo; yann@552: + } yann@552: + return __hi; yann@552: + } yann@552: + yann@552: + bool yann@552: + ctype:: yann@552: + do_is(mask __m, wchar_t __c) const yann@552: + { yann@552: + // Highest bitmask in ctype_base == 10, but extra in "C" yann@552: + // library for blank. yann@552: + bool __ret = false; yann@552: + const size_t __bitmasksize = 11; yann@552: + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) yann@552: + if (__m & _M_bit[__bitcur] yann@552: + && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype)) yann@552: + { yann@552: + __ret = true; yann@552: + break; yann@552: + } yann@552: + return __ret; yann@552: + } yann@552: + yann@552: + const wchar_t* yann@552: + ctype:: yann@552: + do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const yann@552: + { yann@552: + for (; __lo < __hi; ++__vec, ++__lo) yann@552: + { yann@552: + // Highest bitmask in ctype_base == 10, but extra in "C" yann@552: + // library for blank. yann@552: + const size_t __bitmasksize = 11; yann@552: + mask __m = 0; yann@552: + for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur) yann@552: + if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype)) yann@552: + __m |= _M_bit[__bitcur]; yann@552: + *__vec = __m; yann@552: + } yann@552: + return __hi; yann@552: + } yann@552: + yann@552: + const wchar_t* yann@552: + ctype:: yann@552: + do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const yann@552: + { yann@552: + while (__lo < __hi && !this->do_is(__m, *__lo)) yann@552: + ++__lo; yann@552: + return __lo; yann@552: + } yann@552: + yann@552: + const wchar_t* yann@552: + ctype:: yann@552: + do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const yann@552: + { yann@552: + while (__lo < __hi && this->do_is(__m, *__lo) != 0) yann@552: + ++__lo; yann@552: + return __lo; yann@552: + } yann@552: + yann@552: + wchar_t yann@552: + ctype:: yann@552: + do_widen(char __c) const yann@552: + { return _M_widen[static_cast(__c)]; } yann@552: + yann@552: + const char* yann@552: + ctype:: yann@552: + do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const yann@552: + { yann@552: + while (__lo < __hi) yann@552: + { yann@552: + *__dest = _M_widen[static_cast(*__lo)]; yann@552: + ++__lo; yann@552: + ++__dest; yann@552: + } yann@552: + return __hi; yann@552: + } yann@552: + yann@552: + char yann@552: + ctype:: yann@552: + do_narrow(wchar_t __wc, char __dfault) const yann@552: + { yann@552: + if (__wc >= 0 && __wc < 128 && _M_narrow_ok) yann@552: + return _M_narrow[__wc]; yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_ctype); yann@552: +#endif yann@552: + const int __c = wctob(__wc); yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + return (__c == EOF ? __dfault : static_cast(__c)); yann@552: + } yann@552: + yann@552: + const wchar_t* yann@552: + ctype:: yann@552: + do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, yann@552: + char* __dest) const yann@552: + { yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_ctype); yann@552: +#endif yann@552: + if (_M_narrow_ok) yann@552: + while (__lo < __hi) yann@552: + { yann@552: + if (*__lo >= 0 && *__lo < 128) yann@552: + *__dest = _M_narrow[*__lo]; yann@552: + else yann@552: + { yann@552: + const int __c = wctob(*__lo); yann@552: + *__dest = (__c == EOF ? __dfault : static_cast(__c)); yann@552: + } yann@552: + ++__lo; yann@552: + ++__dest; yann@552: + } yann@552: + else yann@552: + while (__lo < __hi) yann@552: + { yann@552: + const int __c = wctob(*__lo); yann@552: + *__dest = (__c == EOF ? __dfault : static_cast(__c)); yann@552: + ++__lo; yann@552: + ++__dest; yann@552: + } yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + return __hi; yann@552: + } yann@552: + yann@552: + void yann@552: + ctype::_M_initialize_ctype() yann@552: + { yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_ctype); yann@552: +#endif yann@552: + wint_t __i; yann@552: + for (__i = 0; __i < 128; ++__i) yann@552: + { yann@552: + const int __c = wctob(__i); yann@552: + if (__c == EOF) yann@552: + break; yann@552: + else yann@552: + _M_narrow[__i] = static_cast(__c); yann@552: + } yann@552: + if (__i == 128) yann@552: + _M_narrow_ok = true; yann@552: + else yann@552: + _M_narrow_ok = false; yann@552: + for (size_t __j = 0; yann@552: + __j < sizeof(_M_widen) / sizeof(wint_t); ++__j) yann@552: + _M_widen[__j] = btowc(__j); yann@552: + yann@552: + for (size_t __k = 0; __k <= 11; ++__k) yann@552: + { yann@552: + _M_bit[__k] = static_cast(_ISbit(__k)); yann@552: + _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]); yann@552: + } yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#endif yann@552: + } yann@552: +#endif // _GLIBCXX_USE_WCHAR_T yann@552: +} yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,100 @@ yann@552: +// std::messages implementation details, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.7.1.2 messages virtual functions yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#include yann@552: +#include yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning fix gettext stuff yann@552: +#endif yann@552: +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ yann@552: +extern "C" char *__dcgettext(const char *domainname, yann@552: + const char *msgid, int category); yann@552: +#undef gettext yann@552: +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES) yann@552: +#else yann@552: +#undef gettext yann@552: +#define gettext(msgid) (msgid) yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + // Specializations. yann@552: + template<> yann@552: + string yann@552: + messages::do_get(catalog, int, int, const string& __dfault) const yann@552: + { yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_messages); yann@552: + const char* __msg = const_cast(gettext(__dfault.c_str())); yann@552: + __uselocale(__old); yann@552: + return string(__msg); yann@552: +#elif defined __UCLIBC_HAS_LOCALE__ yann@552: + char* __old = strdup(setlocale(LC_ALL, NULL)); yann@552: + setlocale(LC_ALL, _M_name_messages); yann@552: + const char* __msg = gettext(__dfault.c_str()); yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: + return string(__msg); yann@552: +#else yann@552: + const char* __msg = gettext(__dfault.c_str()); yann@552: + return string(__msg); yann@552: +#endif yann@552: + } yann@552: + yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: + template<> yann@552: + wstring yann@552: + messages::do_get(catalog, int, int, const wstring& __dfault) const yann@552: + { yann@552: +# ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(_M_c_locale_messages); yann@552: + char* __msg = gettext(_M_convert_to_char(__dfault)); yann@552: + __uselocale(__old); yann@552: + return _M_convert_from_char(__msg); yann@552: +# elif defined __UCLIBC_HAS_LOCALE__ yann@552: + char* __old = strdup(setlocale(LC_ALL, NULL)); yann@552: + setlocale(LC_ALL, _M_name_messages); yann@552: + char* __msg = gettext(_M_convert_to_char(__dfault)); yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: + return _M_convert_from_char(__msg); yann@552: +# else yann@552: + char* __msg = gettext(_M_convert_to_char(__dfault)); yann@552: + return _M_convert_from_char(__msg); yann@552: +# endif yann@552: + } yann@552: +#endif yann@552: +} yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/messages_members.h 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,118 @@ yann@552: +// std::messages implementation details, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.7.1.2 messages functions yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning fix prototypes for *textdomain funcs yann@552: +#endif yann@552: +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__ yann@552: +extern "C" char *__textdomain(const char *domainname); yann@552: +extern "C" char *__bindtextdomain(const char *domainname, yann@552: + const char *dirname); yann@552: +#else yann@552: +#undef __textdomain yann@552: +#undef __bindtextdomain yann@552: +#define __textdomain(D) ((void)0) yann@552: +#define __bindtextdomain(D,P) ((void)0) yann@552: +#endif yann@552: + yann@552: + // Non-virtual member functions. yann@552: + template yann@552: + messages<_CharT>::messages(size_t __refs) yann@552: + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), yann@552: + _M_name_messages(_S_get_c_name()) yann@552: + { } yann@552: + yann@552: + template yann@552: + messages<_CharT>::messages(__c_locale __cloc, const char* __s, yann@552: + size_t __refs) yann@552: + : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)), yann@552: + _M_name_messages(__s) yann@552: + { yann@552: + char* __tmp = new char[std::strlen(__s) + 1]; yann@552: + std::strcpy(__tmp, __s); yann@552: + _M_name_messages = __tmp; yann@552: + } yann@552: + yann@552: + template yann@552: + typename messages<_CharT>::catalog yann@552: + messages<_CharT>::open(const basic_string& __s, const locale& __loc, yann@552: + const char* __dir) const yann@552: + { yann@552: + __bindtextdomain(__s.c_str(), __dir); yann@552: + return this->do_open(__s, __loc); yann@552: + } yann@552: + yann@552: + // Virtual member functions. yann@552: + template yann@552: + messages<_CharT>::~messages() yann@552: + { yann@552: + if (_M_name_messages != _S_get_c_name()) yann@552: + delete [] _M_name_messages; yann@552: + _S_destroy_c_locale(_M_c_locale_messages); yann@552: + } yann@552: + yann@552: + template yann@552: + typename messages<_CharT>::catalog yann@552: + messages<_CharT>::do_open(const basic_string& __s, yann@552: + const locale&) const yann@552: + { yann@552: + // No error checking is done, assume the catalog exists and can yann@552: + // be used. yann@552: + __textdomain(__s.c_str()); yann@552: + return 0; yann@552: + } yann@552: + yann@552: + template yann@552: + void yann@552: + messages<_CharT>::do_close(catalog) const yann@552: + { } yann@552: + yann@552: + // messages_byname yann@552: + template yann@552: + messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) yann@552: + : messages<_CharT>(__refs) yann@552: + { yann@552: + if (this->_M_name_messages != locale::facet::_S_get_c_name()) yann@552: + delete [] this->_M_name_messages; yann@552: + char* __tmp = new char[std::strlen(__s) + 1]; yann@552: + std::strcpy(__tmp, __s); yann@552: + this->_M_name_messages = __tmp; yann@552: + yann@552: + if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0) yann@552: + { yann@552: + this->_S_destroy_c_locale(this->_M_c_locale_messages); yann@552: + this->_S_create_c_locale(this->_M_c_locale_messages, __s); yann@552: + } yann@552: + } yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,692 @@ yann@552: +// std::moneypunct implementation details, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#define _LIBC yann@552: +#include yann@552: +#undef _LIBC yann@552: +#include yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning optimize this for uclibc yann@552: +#warning tailor for stub locale support yann@552: +#endif yann@552: + yann@552: +#ifndef __UCLIBC_HAS_XLOCALE__ yann@552: +#define __nl_langinfo_l(N, L) nl_langinfo((N)) yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + // Construct and return valid pattern consisting of some combination of: yann@552: + // space none symbol sign value yann@552: + money_base::pattern yann@552: + money_base::_S_construct_pattern(char __precedes, char __space, char __posn) yann@552: + { yann@552: + pattern __ret; yann@552: + yann@552: + // This insanely complicated routine attempts to construct a valid yann@552: + // pattern for use with monyepunct. A couple of invariants: yann@552: + yann@552: + // if (__precedes) symbol -> value yann@552: + // else value -> symbol yann@552: + yann@552: + // if (__space) space yann@552: + // else none yann@552: + yann@552: + // none == never first yann@552: + // space never first or last yann@552: + yann@552: + // Any elegant implementations of this are welcome. yann@552: + switch (__posn) yann@552: + { yann@552: + case 0: yann@552: + case 1: yann@552: + // 1 The sign precedes the value and symbol. yann@552: + __ret.field[0] = sign; yann@552: + if (__space) yann@552: + { yann@552: + // Pattern starts with sign. yann@552: + if (__precedes) yann@552: + { yann@552: + __ret.field[1] = symbol; yann@552: + __ret.field[3] = value; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[1] = value; yann@552: + __ret.field[3] = symbol; yann@552: + } yann@552: + __ret.field[2] = space; yann@552: + } yann@552: + else yann@552: + { yann@552: + // Pattern starts with sign and ends with none. yann@552: + if (__precedes) yann@552: + { yann@552: + __ret.field[1] = symbol; yann@552: + __ret.field[2] = value; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[1] = value; yann@552: + __ret.field[2] = symbol; yann@552: + } yann@552: + __ret.field[3] = none; yann@552: + } yann@552: + break; yann@552: + case 2: yann@552: + // 2 The sign follows the value and symbol. yann@552: + if (__space) yann@552: + { yann@552: + // Pattern either ends with sign. yann@552: + if (__precedes) yann@552: + { yann@552: + __ret.field[0] = symbol; yann@552: + __ret.field[2] = value; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[0] = value; yann@552: + __ret.field[2] = symbol; yann@552: + } yann@552: + __ret.field[1] = space; yann@552: + __ret.field[3] = sign; yann@552: + } yann@552: + else yann@552: + { yann@552: + // Pattern ends with sign then none. yann@552: + if (__precedes) yann@552: + { yann@552: + __ret.field[0] = symbol; yann@552: + __ret.field[1] = value; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[0] = value; yann@552: + __ret.field[1] = symbol; yann@552: + } yann@552: + __ret.field[2] = sign; yann@552: + __ret.field[3] = none; yann@552: + } yann@552: + break; yann@552: + case 3: yann@552: + // 3 The sign immediately precedes the symbol. yann@552: + if (__precedes) yann@552: + { yann@552: + __ret.field[0] = sign; yann@552: + __ret.field[1] = symbol; yann@552: + if (__space) yann@552: + { yann@552: + __ret.field[2] = space; yann@552: + __ret.field[3] = value; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[2] = value; yann@552: + __ret.field[3] = none; yann@552: + } yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[0] = value; yann@552: + if (__space) yann@552: + { yann@552: + __ret.field[1] = space; yann@552: + __ret.field[2] = sign; yann@552: + __ret.field[3] = symbol; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[1] = sign; yann@552: + __ret.field[2] = symbol; yann@552: + __ret.field[3] = none; yann@552: + } yann@552: + } yann@552: + break; yann@552: + case 4: yann@552: + // 4 The sign immediately follows the symbol. yann@552: + if (__precedes) yann@552: + { yann@552: + __ret.field[0] = symbol; yann@552: + __ret.field[1] = sign; yann@552: + if (__space) yann@552: + { yann@552: + __ret.field[2] = space; yann@552: + __ret.field[3] = value; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[2] = value; yann@552: + __ret.field[3] = none; yann@552: + } yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[0] = value; yann@552: + if (__space) yann@552: + { yann@552: + __ret.field[1] = space; yann@552: + __ret.field[2] = symbol; yann@552: + __ret.field[3] = sign; yann@552: + } yann@552: + else yann@552: + { yann@552: + __ret.field[1] = symbol; yann@552: + __ret.field[2] = sign; yann@552: + __ret.field[3] = none; yann@552: + } yann@552: + } yann@552: + break; yann@552: + default: yann@552: + ; yann@552: + } yann@552: + return __ret; yann@552: + } yann@552: + yann@552: + template<> yann@552: + void yann@552: + moneypunct::_M_initialize_moneypunct(__c_locale __cloc, yann@552: + const char*) yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __moneypunct_cache; yann@552: + yann@552: + if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_data->_M_decimal_point = '.'; yann@552: + _M_data->_M_thousands_sep = ','; yann@552: + _M_data->_M_grouping = ""; yann@552: + _M_data->_M_grouping_size = 0; yann@552: + _M_data->_M_curr_symbol = ""; yann@552: + _M_data->_M_curr_symbol_size = 0; yann@552: + _M_data->_M_positive_sign = ""; yann@552: + _M_data->_M_positive_sign_size = 0; yann@552: + _M_data->_M_negative_sign = ""; yann@552: + _M_data->_M_negative_sign_size = 0; yann@552: + _M_data->_M_frac_digits = 0; yann@552: + _M_data->_M_pos_format = money_base::_S_default_pattern; yann@552: + _M_data->_M_neg_format = money_base::_S_default_pattern; yann@552: + yann@552: + for (size_t __i = 0; __i < money_base::_S_end; ++__i) yann@552: + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; yann@552: + } yann@552: + else yann@552: + { yann@552: + // Named locale. yann@552: + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, yann@552: + __cloc)); yann@552: + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, yann@552: + __cloc)); yann@552: + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); yann@552: + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); yann@552: + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); yann@552: + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); yann@552: + yann@552: + char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); yann@552: + if (!__nposn) yann@552: + _M_data->_M_negative_sign = "()"; yann@552: + else yann@552: + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, yann@552: + __cloc); yann@552: + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); yann@552: + yann@552: + // _Intl == true yann@552: + _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); yann@552: + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); yann@552: + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, yann@552: + __cloc)); yann@552: + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); yann@552: + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); yann@552: + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); yann@552: + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, yann@552: + __pposn); yann@552: + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); yann@552: + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); yann@552: + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, yann@552: + __nposn); yann@552: + } yann@552: + } yann@552: + yann@552: + template<> yann@552: + void yann@552: + moneypunct::_M_initialize_moneypunct(__c_locale __cloc, yann@552: + const char*) yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __moneypunct_cache; yann@552: + yann@552: + if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_data->_M_decimal_point = '.'; yann@552: + _M_data->_M_thousands_sep = ','; yann@552: + _M_data->_M_grouping = ""; yann@552: + _M_data->_M_grouping_size = 0; yann@552: + _M_data->_M_curr_symbol = ""; yann@552: + _M_data->_M_curr_symbol_size = 0; yann@552: + _M_data->_M_positive_sign = ""; yann@552: + _M_data->_M_positive_sign_size = 0; yann@552: + _M_data->_M_negative_sign = ""; yann@552: + _M_data->_M_negative_sign_size = 0; yann@552: + _M_data->_M_frac_digits = 0; yann@552: + _M_data->_M_pos_format = money_base::_S_default_pattern; yann@552: + _M_data->_M_neg_format = money_base::_S_default_pattern; yann@552: + yann@552: + for (size_t __i = 0; __i < money_base::_S_end; ++__i) yann@552: + _M_data->_M_atoms[__i] = money_base::_S_atoms[__i]; yann@552: + } yann@552: + else yann@552: + { yann@552: + // Named locale. yann@552: + _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, yann@552: + __cloc)); yann@552: + _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, yann@552: + __cloc)); yann@552: + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); yann@552: + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); yann@552: + _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); yann@552: + _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign); yann@552: + yann@552: + char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); yann@552: + if (!__nposn) yann@552: + _M_data->_M_negative_sign = "()"; yann@552: + else yann@552: + _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, yann@552: + __cloc); yann@552: + _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign); yann@552: + yann@552: + // _Intl == false yann@552: + _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); yann@552: + _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol); yann@552: + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); yann@552: + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); yann@552: + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); yann@552: + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); yann@552: + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, yann@552: + __pposn); yann@552: + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); yann@552: + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); yann@552: + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, yann@552: + __nposn); yann@552: + } yann@552: + } yann@552: + yann@552: + template<> yann@552: + moneypunct::~moneypunct() yann@552: + { delete _M_data; } yann@552: + yann@552: + template<> yann@552: + moneypunct::~moneypunct() yann@552: + { delete _M_data; } yann@552: + yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: + template<> yann@552: + void yann@552: + moneypunct::_M_initialize_moneypunct(__c_locale __cloc, yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + const char*) yann@552: +#else yann@552: + const char* __name) yann@552: +#endif yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __moneypunct_cache; yann@552: + yann@552: + if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_data->_M_decimal_point = L'.'; yann@552: + _M_data->_M_thousands_sep = L','; yann@552: + _M_data->_M_grouping = ""; yann@552: + _M_data->_M_grouping_size = 0; yann@552: + _M_data->_M_curr_symbol = L""; yann@552: + _M_data->_M_curr_symbol_size = 0; yann@552: + _M_data->_M_positive_sign = L""; yann@552: + _M_data->_M_positive_sign_size = 0; yann@552: + _M_data->_M_negative_sign = L""; yann@552: + _M_data->_M_negative_sign_size = 0; yann@552: + _M_data->_M_frac_digits = 0; yann@552: + _M_data->_M_pos_format = money_base::_S_default_pattern; yann@552: + _M_data->_M_neg_format = money_base::_S_default_pattern; yann@552: + yann@552: + // Use ctype::widen code without the facet... yann@552: + for (size_t __i = 0; __i < money_base::_S_end; ++__i) yann@552: + _M_data->_M_atoms[__i] = yann@552: + static_cast(money_base::_S_atoms[__i]); yann@552: + } yann@552: + else yann@552: + { yann@552: + // Named locale. yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(__cloc); yann@552: +#else yann@552: + // Switch to named locale so that mbsrtowcs will work. yann@552: + char* __old = strdup(setlocale(LC_ALL, NULL)); yann@552: + setlocale(LC_ALL, __name); yann@552: +#endif yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning fix this... should be monetary yann@552: +#endif yann@552: +#ifdef __UCLIBC__ yann@552: +# ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + _M_data->_M_decimal_point = __cloc->decimal_point_wc; yann@552: + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; yann@552: +# else yann@552: + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; yann@552: + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; yann@552: +# endif yann@552: +#else yann@552: + union { char *__s; wchar_t __w; } __u; yann@552: + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); yann@552: + _M_data->_M_decimal_point = __u.__w; yann@552: + yann@552: + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); yann@552: + _M_data->_M_thousands_sep = __u.__w; yann@552: +#endif yann@552: + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); yann@552: + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); yann@552: + yann@552: + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); yann@552: + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); yann@552: + const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc); yann@552: + yann@552: + wchar_t* __wcs_ps = 0; yann@552: + wchar_t* __wcs_ns = 0; yann@552: + const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc)); yann@552: + try yann@552: + { yann@552: + mbstate_t __state; yann@552: + size_t __len = strlen(__cpossign); yann@552: + if (__len) yann@552: + { yann@552: + ++__len; yann@552: + memset(&__state, 0, sizeof(mbstate_t)); yann@552: + __wcs_ps = new wchar_t[__len]; yann@552: + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); yann@552: + _M_data->_M_positive_sign = __wcs_ps; yann@552: + } yann@552: + else yann@552: + _M_data->_M_positive_sign = L""; yann@552: + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); yann@552: + yann@552: + __len = strlen(__cnegsign); yann@552: + if (!__nposn) yann@552: + _M_data->_M_negative_sign = L"()"; yann@552: + else if (__len) yann@552: + { yann@552: + ++__len; yann@552: + memset(&__state, 0, sizeof(mbstate_t)); yann@552: + __wcs_ns = new wchar_t[__len]; yann@552: + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); yann@552: + _M_data->_M_negative_sign = __wcs_ns; yann@552: + } yann@552: + else yann@552: + _M_data->_M_negative_sign = L""; yann@552: + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); yann@552: + yann@552: + // _Intl == true. yann@552: + __len = strlen(__ccurr); yann@552: + if (__len) yann@552: + { yann@552: + ++__len; yann@552: + memset(&__state, 0, sizeof(mbstate_t)); yann@552: + wchar_t* __wcs = new wchar_t[__len]; yann@552: + mbsrtowcs(__wcs, &__ccurr, __len, &__state); yann@552: + _M_data->_M_curr_symbol = __wcs; yann@552: + } yann@552: + else yann@552: + _M_data->_M_curr_symbol = L""; yann@552: + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); yann@552: + } yann@552: + catch (...) yann@552: + { yann@552: + delete _M_data; yann@552: + _M_data = 0; yann@552: + delete __wcs_ps; yann@552: + delete __wcs_ns; yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#else yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: +#endif yann@552: + __throw_exception_again; yann@552: + } yann@552: + yann@552: + _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, yann@552: + __cloc)); yann@552: + char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc)); yann@552: + char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc)); yann@552: + char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc)); yann@552: + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, yann@552: + __pposn); yann@552: + char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc)); yann@552: + char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc)); yann@552: + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, yann@552: + __nposn); yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#else yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: +#endif yann@552: + } yann@552: + } yann@552: + yann@552: + template<> yann@552: + void yann@552: + moneypunct::_M_initialize_moneypunct(__c_locale __cloc, yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + const char*) yann@552: +#else yann@552: + const char* __name) yann@552: +#endif yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __moneypunct_cache; yann@552: + yann@552: + if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_data->_M_decimal_point = L'.'; yann@552: + _M_data->_M_thousands_sep = L','; yann@552: + _M_data->_M_grouping = ""; yann@552: + _M_data->_M_grouping_size = 0; yann@552: + _M_data->_M_curr_symbol = L""; yann@552: + _M_data->_M_curr_symbol_size = 0; yann@552: + _M_data->_M_positive_sign = L""; yann@552: + _M_data->_M_positive_sign_size = 0; yann@552: + _M_data->_M_negative_sign = L""; yann@552: + _M_data->_M_negative_sign_size = 0; yann@552: + _M_data->_M_frac_digits = 0; yann@552: + _M_data->_M_pos_format = money_base::_S_default_pattern; yann@552: + _M_data->_M_neg_format = money_base::_S_default_pattern; yann@552: + yann@552: + // Use ctype::widen code without the facet... yann@552: + for (size_t __i = 0; __i < money_base::_S_end; ++__i) yann@552: + _M_data->_M_atoms[__i] = yann@552: + static_cast(money_base::_S_atoms[__i]); yann@552: + } yann@552: + else yann@552: + { yann@552: + // Named locale. yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __c_locale __old = __uselocale(__cloc); yann@552: +#else yann@552: + // Switch to named locale so that mbsrtowcs will work. yann@552: + char* __old = strdup(setlocale(LC_ALL, NULL)); yann@552: + setlocale(LC_ALL, __name); yann@552: +#endif yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning fix this... should be monetary yann@552: +#endif yann@552: +#ifdef __UCLIBC__ yann@552: +# ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + _M_data->_M_decimal_point = __cloc->decimal_point_wc; yann@552: + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; yann@552: +# else yann@552: + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; yann@552: + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; yann@552: +# endif yann@552: +#else yann@552: + union { char *__s; wchar_t __w; } __u; yann@552: + __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc); yann@552: + _M_data->_M_decimal_point = __u.__w; yann@552: + yann@552: + __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc); yann@552: + _M_data->_M_thousands_sep = __u.__w; yann@552: +#endif yann@552: + _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc); yann@552: + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); yann@552: + yann@552: + const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc); yann@552: + const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc); yann@552: + const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc); yann@552: + yann@552: + wchar_t* __wcs_ps = 0; yann@552: + wchar_t* __wcs_ns = 0; yann@552: + const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc)); yann@552: + try yann@552: + { yann@552: + mbstate_t __state; yann@552: + size_t __len; yann@552: + __len = strlen(__cpossign); yann@552: + if (__len) yann@552: + { yann@552: + ++__len; yann@552: + memset(&__state, 0, sizeof(mbstate_t)); yann@552: + __wcs_ps = new wchar_t[__len]; yann@552: + mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state); yann@552: + _M_data->_M_positive_sign = __wcs_ps; yann@552: + } yann@552: + else yann@552: + _M_data->_M_positive_sign = L""; yann@552: + _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign); yann@552: + yann@552: + __len = strlen(__cnegsign); yann@552: + if (!__nposn) yann@552: + _M_data->_M_negative_sign = L"()"; yann@552: + else if (__len) yann@552: + { yann@552: + ++__len; yann@552: + memset(&__state, 0, sizeof(mbstate_t)); yann@552: + __wcs_ns = new wchar_t[__len]; yann@552: + mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state); yann@552: + _M_data->_M_negative_sign = __wcs_ns; yann@552: + } yann@552: + else yann@552: + _M_data->_M_negative_sign = L""; yann@552: + _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign); yann@552: + yann@552: + // _Intl == true. yann@552: + __len = strlen(__ccurr); yann@552: + if (__len) yann@552: + { yann@552: + ++__len; yann@552: + memset(&__state, 0, sizeof(mbstate_t)); yann@552: + wchar_t* __wcs = new wchar_t[__len]; yann@552: + mbsrtowcs(__wcs, &__ccurr, __len, &__state); yann@552: + _M_data->_M_curr_symbol = __wcs; yann@552: + } yann@552: + else yann@552: + _M_data->_M_curr_symbol = L""; yann@552: + _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol); yann@552: + } yann@552: + catch (...) yann@552: + { yann@552: + delete _M_data; yann@552: + _M_data = 0; yann@552: + delete __wcs_ps; yann@552: + delete __wcs_ns; yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#else yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: +#endif yann@552: + __throw_exception_again; yann@552: + } yann@552: + yann@552: + _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc)); yann@552: + char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc)); yann@552: + char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc)); yann@552: + char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc)); yann@552: + _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, yann@552: + __pposn); yann@552: + char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc)); yann@552: + char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc)); yann@552: + _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, yann@552: + __nposn); yann@552: + yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __uselocale(__old); yann@552: +#else yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: +#endif yann@552: + } yann@552: + } yann@552: + yann@552: + template<> yann@552: + moneypunct::~moneypunct() yann@552: + { yann@552: + if (_M_data->_M_positive_sign_size) yann@552: + delete [] _M_data->_M_positive_sign; yann@552: + if (_M_data->_M_negative_sign_size yann@552: + && wcscmp(_M_data->_M_negative_sign, L"()") != 0) yann@552: + delete [] _M_data->_M_negative_sign; yann@552: + if (_M_data->_M_curr_symbol_size) yann@552: + delete [] _M_data->_M_curr_symbol; yann@552: + delete _M_data; yann@552: + } yann@552: + yann@552: + template<> yann@552: + moneypunct::~moneypunct() yann@552: + { yann@552: + if (_M_data->_M_positive_sign_size) yann@552: + delete [] _M_data->_M_positive_sign; yann@552: + if (_M_data->_M_negative_sign_size yann@552: + && wcscmp(_M_data->_M_negative_sign, L"()") != 0) yann@552: + delete [] _M_data->_M_negative_sign; yann@552: + if (_M_data->_M_curr_symbol_size) yann@552: + delete [] _M_data->_M_curr_symbol; yann@552: + delete _M_data; yann@552: + } yann@552: +#endif yann@552: +} yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,160 @@ yann@552: +// std::numpunct implementation details, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#define _LIBC yann@552: +#include yann@552: +#undef _LIBC yann@552: +#include yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning tailor for stub locale support yann@552: +#endif yann@552: +#ifndef __UCLIBC_HAS_XLOCALE__ yann@552: +#define __nl_langinfo_l(N, L) nl_langinfo((N)) yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + template<> yann@552: + void yann@552: + numpunct::_M_initialize_numpunct(__c_locale __cloc) yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __numpunct_cache; yann@552: + yann@552: + if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_data->_M_grouping = ""; yann@552: + _M_data->_M_grouping_size = 0; yann@552: + _M_data->_M_use_grouping = false; yann@552: + yann@552: + _M_data->_M_decimal_point = '.'; yann@552: + _M_data->_M_thousands_sep = ','; yann@552: + yann@552: + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) yann@552: + _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i]; yann@552: + yann@552: + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) yann@552: + _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j]; yann@552: + } yann@552: + else yann@552: + { yann@552: + // Named locale. yann@552: + _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, yann@552: + __cloc)); yann@552: + _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, yann@552: + __cloc)); yann@552: + yann@552: + // Check for NULL, which implies no grouping. yann@552: + if (_M_data->_M_thousands_sep == '\0') yann@552: + _M_data->_M_grouping = ""; yann@552: + else yann@552: + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); yann@552: + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); yann@552: + } yann@552: + yann@552: + // NB: There is no way to extact this info from posix locales. yann@552: + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); yann@552: + _M_data->_M_truename = "true"; yann@552: + _M_data->_M_truename_size = 4; yann@552: + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); yann@552: + _M_data->_M_falsename = "false"; yann@552: + _M_data->_M_falsename_size = 5; yann@552: + } yann@552: + yann@552: + template<> yann@552: + numpunct::~numpunct() yann@552: + { delete _M_data; } yann@552: + yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: + template<> yann@552: + void yann@552: + numpunct::_M_initialize_numpunct(__c_locale __cloc) yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __numpunct_cache; yann@552: + yann@552: + if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_data->_M_grouping = ""; yann@552: + _M_data->_M_grouping_size = 0; yann@552: + _M_data->_M_use_grouping = false; yann@552: + yann@552: + _M_data->_M_decimal_point = L'.'; yann@552: + _M_data->_M_thousands_sep = L','; yann@552: + yann@552: + // Use ctype::widen code without the facet... yann@552: + for (size_t __i = 0; __i < __num_base::_S_oend; ++__i) yann@552: + _M_data->_M_atoms_out[__i] = yann@552: + static_cast(__num_base::_S_atoms_out[__i]); yann@552: + yann@552: + for (size_t __j = 0; __j < __num_base::_S_iend; ++__j) yann@552: + _M_data->_M_atoms_in[__j] = yann@552: + static_cast(__num_base::_S_atoms_in[__j]); yann@552: + } yann@552: + else yann@552: + { yann@552: + // Named locale. yann@552: + // NB: In the GNU model wchar_t is always 32 bit wide. yann@552: + union { char *__s; wchar_t __w; } __u; yann@552: + __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc); yann@552: + _M_data->_M_decimal_point = __u.__w; yann@552: + yann@552: + __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc); yann@552: + _M_data->_M_thousands_sep = __u.__w; yann@552: + yann@552: + if (_M_data->_M_thousands_sep == L'\0') yann@552: + _M_data->_M_grouping = ""; yann@552: + else yann@552: + _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc); yann@552: + _M_data->_M_grouping_size = strlen(_M_data->_M_grouping); yann@552: + } yann@552: + yann@552: + // NB: There is no way to extact this info from posix locales. yann@552: + // _M_truename = __nl_langinfo_l(YESSTR, __cloc); yann@552: + _M_data->_M_truename = L"true"; yann@552: + _M_data->_M_truename_size = 4; yann@552: + // _M_falsename = __nl_langinfo_l(NOSTR, __cloc); yann@552: + _M_data->_M_falsename = L"false"; yann@552: + _M_data->_M_falsename_size = 5; yann@552: + } yann@552: + yann@552: + template<> yann@552: + numpunct::~numpunct() yann@552: + { delete _M_data; } yann@552: + #endif yann@552: +} yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.cc 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,406 @@ yann@552: +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions yann@552: +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: +#include yann@552: +#include yann@552: + yann@552: +#ifdef __UCLIBC_MJN3_ONLY__ yann@552: +#warning tailor for stub locale support yann@552: +#endif yann@552: +#ifndef __UCLIBC_HAS_XLOCALE__ yann@552: +#define __nl_langinfo_l(N, L) nl_langinfo((N)) yann@552: +#endif yann@552: + yann@552: +namespace std yann@552: +{ yann@552: + template<> yann@552: + void yann@552: + __timepunct:: yann@552: + _M_put(char* __s, size_t __maxlen, const char* __format, yann@552: + const tm* __tm) const yann@552: + { yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + const size_t __len = __strftime_l(__s, __maxlen, __format, __tm, yann@552: + _M_c_locale_timepunct); yann@552: +#else yann@552: + char* __old = strdup(setlocale(LC_ALL, NULL)); yann@552: + setlocale(LC_ALL, _M_name_timepunct); yann@552: + const size_t __len = strftime(__s, __maxlen, __format, __tm); yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: +#endif yann@552: + // Make sure __s is null terminated. yann@552: + if (__len == 0) yann@552: + __s[0] = '\0'; yann@552: + } yann@552: + yann@552: + template<> yann@552: + void yann@552: + __timepunct::_M_initialize_timepunct(__c_locale __cloc) yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __timepunct_cache; yann@552: + yann@552: + if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_c_locale_timepunct = _S_get_c_locale(); yann@552: + yann@552: + _M_data->_M_date_format = "%m/%d/%y"; yann@552: + _M_data->_M_date_era_format = "%m/%d/%y"; yann@552: + _M_data->_M_time_format = "%H:%M:%S"; yann@552: + _M_data->_M_time_era_format = "%H:%M:%S"; yann@552: + _M_data->_M_date_time_format = ""; yann@552: + _M_data->_M_date_time_era_format = ""; yann@552: + _M_data->_M_am = "AM"; yann@552: + _M_data->_M_pm = "PM"; yann@552: + _M_data->_M_am_pm_format = ""; yann@552: + yann@552: + // Day names, starting with "C"'s Sunday. yann@552: + _M_data->_M_day1 = "Sunday"; yann@552: + _M_data->_M_day2 = "Monday"; yann@552: + _M_data->_M_day3 = "Tuesday"; yann@552: + _M_data->_M_day4 = "Wednesday"; yann@552: + _M_data->_M_day5 = "Thursday"; yann@552: + _M_data->_M_day6 = "Friday"; yann@552: + _M_data->_M_day7 = "Saturday"; yann@552: + yann@552: + // Abbreviated day names, starting with "C"'s Sun. yann@552: + _M_data->_M_aday1 = "Sun"; yann@552: + _M_data->_M_aday2 = "Mon"; yann@552: + _M_data->_M_aday3 = "Tue"; yann@552: + _M_data->_M_aday4 = "Wed"; yann@552: + _M_data->_M_aday5 = "Thu"; yann@552: + _M_data->_M_aday6 = "Fri"; yann@552: + _M_data->_M_aday7 = "Sat"; yann@552: + yann@552: + // Month names, starting with "C"'s January. yann@552: + _M_data->_M_month01 = "January"; yann@552: + _M_data->_M_month02 = "February"; yann@552: + _M_data->_M_month03 = "March"; yann@552: + _M_data->_M_month04 = "April"; yann@552: + _M_data->_M_month05 = "May"; yann@552: + _M_data->_M_month06 = "June"; yann@552: + _M_data->_M_month07 = "July"; yann@552: + _M_data->_M_month08 = "August"; yann@552: + _M_data->_M_month09 = "September"; yann@552: + _M_data->_M_month10 = "October"; yann@552: + _M_data->_M_month11 = "November"; yann@552: + _M_data->_M_month12 = "December"; yann@552: + yann@552: + // Abbreviated month names, starting with "C"'s Jan. yann@552: + _M_data->_M_amonth01 = "Jan"; yann@552: + _M_data->_M_amonth02 = "Feb"; yann@552: + _M_data->_M_amonth03 = "Mar"; yann@552: + _M_data->_M_amonth04 = "Apr"; yann@552: + _M_data->_M_amonth05 = "May"; yann@552: + _M_data->_M_amonth06 = "Jun"; yann@552: + _M_data->_M_amonth07 = "Jul"; yann@552: + _M_data->_M_amonth08 = "Aug"; yann@552: + _M_data->_M_amonth09 = "Sep"; yann@552: + _M_data->_M_amonth10 = "Oct"; yann@552: + _M_data->_M_amonth11 = "Nov"; yann@552: + _M_data->_M_amonth12 = "Dec"; yann@552: + } yann@552: + else yann@552: + { yann@552: + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); yann@552: + yann@552: + _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc); yann@552: + _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc); yann@552: + _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc); yann@552: + _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc); yann@552: + _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc); yann@552: + _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, yann@552: + __cloc); yann@552: + _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc); yann@552: + _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc); yann@552: + _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc); yann@552: + yann@552: + // Day names, starting with "C"'s Sunday. yann@552: + _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc); yann@552: + _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc); yann@552: + _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc); yann@552: + _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc); yann@552: + _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc); yann@552: + _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc); yann@552: + _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc); yann@552: + yann@552: + // Abbreviated day names, starting with "C"'s Sun. yann@552: + _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc); yann@552: + _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc); yann@552: + _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc); yann@552: + _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc); yann@552: + _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc); yann@552: + _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc); yann@552: + _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc); yann@552: + yann@552: + // Month names, starting with "C"'s January. yann@552: + _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc); yann@552: + _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc); yann@552: + _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc); yann@552: + _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc); yann@552: + _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc); yann@552: + _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc); yann@552: + _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc); yann@552: + _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc); yann@552: + _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc); yann@552: + _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc); yann@552: + _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc); yann@552: + _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc); yann@552: + yann@552: + // Abbreviated month names, starting with "C"'s Jan. yann@552: + _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc); yann@552: + _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc); yann@552: + _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc); yann@552: + _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc); yann@552: + _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc); yann@552: + _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc); yann@552: + _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc); yann@552: + _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc); yann@552: + _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc); yann@552: + _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc); yann@552: + _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc); yann@552: + _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc); yann@552: + } yann@552: + } yann@552: + yann@552: +#ifdef _GLIBCXX_USE_WCHAR_T yann@552: + template<> yann@552: + void yann@552: + __timepunct:: yann@552: + _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, yann@552: + const tm* __tm) const yann@552: + { yann@552: +#ifdef __UCLIBC_HAS_XLOCALE__ yann@552: + __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct); yann@552: + const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm, yann@552: + _M_c_locale_timepunct); yann@552: +#else yann@552: + char* __old = strdup(setlocale(LC_ALL, NULL)); yann@552: + setlocale(LC_ALL, _M_name_timepunct); yann@552: + const size_t __len = wcsftime(__s, __maxlen, __format, __tm); yann@552: + setlocale(LC_ALL, __old); yann@552: + free(__old); yann@552: +#endif yann@552: + // Make sure __s is null terminated. yann@552: + if (__len == 0) yann@552: + __s[0] = L'\0'; yann@552: + } yann@552: + yann@552: + template<> yann@552: + void yann@552: + __timepunct::_M_initialize_timepunct(__c_locale __cloc) yann@552: + { yann@552: + if (!_M_data) yann@552: + _M_data = new __timepunct_cache; yann@552: + yann@552: +#warning wide time stuff yann@552: +// if (!__cloc) yann@552: + { yann@552: + // "C" locale yann@552: + _M_c_locale_timepunct = _S_get_c_locale(); yann@552: + yann@552: + _M_data->_M_date_format = L"%m/%d/%y"; yann@552: + _M_data->_M_date_era_format = L"%m/%d/%y"; yann@552: + _M_data->_M_time_format = L"%H:%M:%S"; yann@552: + _M_data->_M_time_era_format = L"%H:%M:%S"; yann@552: + _M_data->_M_date_time_format = L""; yann@552: + _M_data->_M_date_time_era_format = L""; yann@552: + _M_data->_M_am = L"AM"; yann@552: + _M_data->_M_pm = L"PM"; yann@552: + _M_data->_M_am_pm_format = L""; yann@552: + yann@552: + // Day names, starting with "C"'s Sunday. yann@552: + _M_data->_M_day1 = L"Sunday"; yann@552: + _M_data->_M_day2 = L"Monday"; yann@552: + _M_data->_M_day3 = L"Tuesday"; yann@552: + _M_data->_M_day4 = L"Wednesday"; yann@552: + _M_data->_M_day5 = L"Thursday"; yann@552: + _M_data->_M_day6 = L"Friday"; yann@552: + _M_data->_M_day7 = L"Saturday"; yann@552: + yann@552: + // Abbreviated day names, starting with "C"'s Sun. yann@552: + _M_data->_M_aday1 = L"Sun"; yann@552: + _M_data->_M_aday2 = L"Mon"; yann@552: + _M_data->_M_aday3 = L"Tue"; yann@552: + _M_data->_M_aday4 = L"Wed"; yann@552: + _M_data->_M_aday5 = L"Thu"; yann@552: + _M_data->_M_aday6 = L"Fri"; yann@552: + _M_data->_M_aday7 = L"Sat"; yann@552: + yann@552: + // Month names, starting with "C"'s January. yann@552: + _M_data->_M_month01 = L"January"; yann@552: + _M_data->_M_month02 = L"February"; yann@552: + _M_data->_M_month03 = L"March"; yann@552: + _M_data->_M_month04 = L"April"; yann@552: + _M_data->_M_month05 = L"May"; yann@552: + _M_data->_M_month06 = L"June"; yann@552: + _M_data->_M_month07 = L"July"; yann@552: + _M_data->_M_month08 = L"August"; yann@552: + _M_data->_M_month09 = L"September"; yann@552: + _M_data->_M_month10 = L"October"; yann@552: + _M_data->_M_month11 = L"November"; yann@552: + _M_data->_M_month12 = L"December"; yann@552: + yann@552: + // Abbreviated month names, starting with "C"'s Jan. yann@552: + _M_data->_M_amonth01 = L"Jan"; yann@552: + _M_data->_M_amonth02 = L"Feb"; yann@552: + _M_data->_M_amonth03 = L"Mar"; yann@552: + _M_data->_M_amonth04 = L"Apr"; yann@552: + _M_data->_M_amonth05 = L"May"; yann@552: + _M_data->_M_amonth06 = L"Jun"; yann@552: + _M_data->_M_amonth07 = L"Jul"; yann@552: + _M_data->_M_amonth08 = L"Aug"; yann@552: + _M_data->_M_amonth09 = L"Sep"; yann@552: + _M_data->_M_amonth10 = L"Oct"; yann@552: + _M_data->_M_amonth11 = L"Nov"; yann@552: + _M_data->_M_amonth12 = L"Dec"; yann@552: + } yann@552: +#if 0 yann@552: + else yann@552: + { yann@552: + _M_c_locale_timepunct = _S_clone_c_locale(__cloc); yann@552: + yann@552: + union { char *__s; wchar_t *__w; } __u; yann@552: + yann@552: + __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc); yann@552: + _M_data->_M_date_format = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc); yann@552: + _M_data->_M_date_era_format = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc); yann@552: + _M_data->_M_time_format = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc); yann@552: + _M_data->_M_time_era_format = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc); yann@552: + _M_data->_M_date_time_format = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc); yann@552: + _M_data->_M_date_time_era_format = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc); yann@552: + _M_data->_M_am = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc); yann@552: + _M_data->_M_pm = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc); yann@552: + _M_data->_M_am_pm_format = __u.__w; yann@552: + yann@552: + // Day names, starting with "C"'s Sunday. yann@552: + __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc); yann@552: + _M_data->_M_day1 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc); yann@552: + _M_data->_M_day2 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc); yann@552: + _M_data->_M_day3 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc); yann@552: + _M_data->_M_day4 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc); yann@552: + _M_data->_M_day5 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc); yann@552: + _M_data->_M_day6 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc); yann@552: + _M_data->_M_day7 = __u.__w; yann@552: + yann@552: + // Abbreviated day names, starting with "C"'s Sun. yann@552: + __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc); yann@552: + _M_data->_M_aday1 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc); yann@552: + _M_data->_M_aday2 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc); yann@552: + _M_data->_M_aday3 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc); yann@552: + _M_data->_M_aday4 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc); yann@552: + _M_data->_M_aday5 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc); yann@552: + _M_data->_M_aday6 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc); yann@552: + _M_data->_M_aday7 = __u.__w; yann@552: + yann@552: + // Month names, starting with "C"'s January. yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc); yann@552: + _M_data->_M_month01 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc); yann@552: + _M_data->_M_month02 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc); yann@552: + _M_data->_M_month03 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc); yann@552: + _M_data->_M_month04 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc); yann@552: + _M_data->_M_month05 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc); yann@552: + _M_data->_M_month06 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc); yann@552: + _M_data->_M_month07 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc); yann@552: + _M_data->_M_month08 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc); yann@552: + _M_data->_M_month09 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc); yann@552: + _M_data->_M_month10 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc); yann@552: + _M_data->_M_month11 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc); yann@552: + _M_data->_M_month12 = __u.__w; yann@552: + yann@552: + // Abbreviated month names, starting with "C"'s Jan. yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc); yann@552: + _M_data->_M_amonth01 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc); yann@552: + _M_data->_M_amonth02 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc); yann@552: + _M_data->_M_amonth03 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc); yann@552: + _M_data->_M_amonth04 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc); yann@552: + _M_data->_M_amonth05 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc); yann@552: + _M_data->_M_amonth06 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc); yann@552: + _M_data->_M_amonth07 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc); yann@552: + _M_data->_M_amonth08 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc); yann@552: + _M_data->_M_amonth09 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc); yann@552: + _M_data->_M_amonth10 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc); yann@552: + _M_data->_M_amonth11 = __u.__w; yann@552: + __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc); yann@552: + _M_data->_M_amonth12 = __u.__w; yann@552: + } yann@552: +#endif // 0 yann@552: + } yann@552: +#endif yann@552: +} yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h yann@552: --- gcc-4.3.0.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1970-01-01 01:00:00.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/config/locale/uclibc/time_members.h 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -0,0 +1,68 @@ yann@552: +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- yann@552: + yann@552: +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. yann@552: +// yann@552: +// This file is part of the GNU ISO C++ Library. This library is free yann@552: +// software; you can redistribute it and/or modify it under the yann@552: +// terms of the GNU General Public License as published by the yann@552: +// Free Software Foundation; either version 2, or (at your option) yann@552: +// any later version. yann@552: + yann@552: +// This library is distributed in the hope that it will be useful, yann@552: +// but WITHOUT ANY WARRANTY; without even the implied warranty of yann@552: +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the yann@552: +// GNU General Public License for more details. yann@552: + yann@552: +// You should have received a copy of the GNU General Public License along yann@552: +// with this library; see the file COPYING. If not, write to the Free yann@552: +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, yann@552: +// USA. yann@552: + yann@552: +// As a special exception, you may use this file as part of a free software yann@552: +// library without restriction. Specifically, if other files instantiate yann@552: +// templates or use macros or inline functions from this file, or you compile yann@552: +// this file and link it with other files to produce an executable, this yann@552: +// file does not by itself cause the resulting executable to be covered by yann@552: +// the GNU General Public License. This exception does not however yann@552: +// invalidate any other reasons why the executable file might be covered by yann@552: +// the GNU General Public License. yann@552: + yann@552: +// yann@552: +// ISO C++ 14882: 22.2.5.1.2 - time_get functions yann@552: +// ISO C++ 14882: 22.2.5.3.2 - time_put functions yann@552: +// yann@552: + yann@552: +// Written by Benjamin Kosnik yann@552: + yann@552: + template yann@552: + __timepunct<_CharT>::__timepunct(size_t __refs) yann@552: + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), yann@552: + _M_name_timepunct(_S_get_c_name()) yann@552: + { _M_initialize_timepunct(); } yann@552: + yann@552: + template yann@552: + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) yann@552: + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), yann@552: + _M_name_timepunct(_S_get_c_name()) yann@552: + { _M_initialize_timepunct(); } yann@552: + yann@552: + template yann@552: + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, yann@552: + size_t __refs) yann@552: + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), yann@552: + _M_name_timepunct(__s) yann@552: + { yann@552: + char* __tmp = new char[std::strlen(__s) + 1]; yann@552: + std::strcpy(__tmp, __s); yann@552: + _M_name_timepunct = __tmp; yann@552: + _M_initialize_timepunct(__cloc); yann@552: + } yann@552: + yann@552: + template yann@552: + __timepunct<_CharT>::~__timepunct() yann@552: + { yann@552: + if (_M_name_timepunct != _S_get_c_name()) yann@552: + delete [] _M_name_timepunct; yann@552: + delete _M_data; yann@552: + _S_destroy_c_locale(_M_c_locale_timepunct); yann@552: + } yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/configure gcc-4.3.0/libstdc++-v3/configure yann@552: --- gcc-4.3.0.orig/libstdc++-v3/configure 2008-02-29 01:00:39.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/configure 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -14001,7 +14001,7 @@ yann@552: enableval="$enable_clocale" yann@552: yann@552: case "$enableval" in yann@552: - generic|gnu|ieee_1003.1-2001|yes|no|auto) ;; yann@552: + generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;; yann@552: *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5 yann@552: echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;} yann@552: { (exit 1); exit 1; }; } ;; yann@552: @@ -14034,6 +14034,9 @@ yann@552: # Default to "generic". yann@552: if test $enable_clocale_flag = auto; then yann@552: case ${target_os} in yann@552: + linux-uclibc*) yann@552: + enable_clocale_flag=uclibc yann@552: + ;; yann@552: linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) yann@552: enable_clocale_flag=gnu yann@552: ;; yann@552: @@ -14422,6 +14425,76 @@ yann@552: CTIME_CC=config/locale/generic/time_members.cc yann@552: CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h yann@552: ;; yann@552: + uclibc) yann@552: + echo "$as_me:$LINENO: result: uclibc" >&5 yann@552: +echo "${ECHO_T}uclibc" >&6 yann@552: + yann@552: + # Declare intention to use gettext, and add support for specific yann@552: + # languages. yann@552: + # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT yann@552: + ALL_LINGUAS="de fr" yann@552: + yann@552: + # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. yann@552: + # Extract the first word of "msgfmt", so it can be a program name with args. yann@552: +set dummy msgfmt; ac_word=$2 yann@552: +echo "$as_me:$LINENO: checking for $ac_word" >&5 yann@552: +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 yann@552: +if test "${ac_cv_prog_check_msgfmt+set}" = set; then yann@552: + echo $ECHO_N "(cached) $ECHO_C" >&6 yann@552: +else yann@552: + if test -n "$check_msgfmt"; then yann@552: + ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test. yann@552: +else yann@552: +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR yann@552: +for as_dir in $PATH yann@552: +do yann@552: + IFS=$as_save_IFS yann@552: + test -z "$as_dir" && as_dir=. yann@552: + for ac_exec_ext in '' $ac_executable_extensions; do yann@552: + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then yann@552: + ac_cv_prog_check_msgfmt="yes" yann@552: + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 yann@552: + break 2 yann@552: + fi yann@552: +done yann@552: +done yann@552: + yann@552: + test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no" yann@552: +fi yann@552: +fi yann@552: +check_msgfmt=$ac_cv_prog_check_msgfmt yann@552: +if test -n "$check_msgfmt"; then yann@552: + echo "$as_me:$LINENO: result: $check_msgfmt" >&5 yann@552: +echo "${ECHO_T}$check_msgfmt" >&6 yann@552: +else yann@552: + echo "$as_me:$LINENO: result: no" >&5 yann@552: +echo "${ECHO_T}no" >&6 yann@552: +fi yann@552: + yann@552: + if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then yann@552: + USE_NLS=yes yann@552: + fi yann@552: + # Export the build objects. yann@552: + for ling in $ALL_LINGUAS; do \ yann@552: + glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ yann@552: + glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ yann@552: + done yann@552: + yann@552: + yann@552: + yann@552: + CLOCALE_H=config/locale/uclibc/c_locale.h yann@552: + CLOCALE_CC=config/locale/uclibc/c_locale.cc yann@552: + CCODECVT_CC=config/locale/uclibc/codecvt_members.cc yann@552: + CCOLLATE_CC=config/locale/uclibc/collate_members.cc yann@552: + CCTYPE_CC=config/locale/uclibc/ctype_members.cc yann@552: + CMESSAGES_H=config/locale/uclibc/messages_members.h yann@552: + CMESSAGES_CC=config/locale/uclibc/messages_members.cc yann@552: + CMONEY_CC=config/locale/uclibc/monetary_members.cc yann@552: + CNUMERIC_CC=config/locale/uclibc/numeric_members.cc yann@552: + CTIME_H=config/locale/uclibc/time_members.h yann@552: + CTIME_CC=config/locale/uclibc/time_members.cc yann@552: + CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h yann@552: + ;; yann@552: esac yann@552: yann@552: # This is where the testsuite looks for locale catalogs, using the yann@552: diff -durN gcc-4.3.0.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.3.0/libstdc++-v3/include/c_compatibility/wchar.h yann@552: --- gcc-4.3.0.orig/libstdc++-v3/include/c_compatibility/wchar.h 2007-03-04 23:59:49.000000000 +0100 yann@552: +++ gcc-4.3.0/libstdc++-v3/include/c_compatibility/wchar.h 2008-06-10 14:45:35.000000000 +0200 yann@552: @@ -106,7 +106,9 @@ yann@552: using std::wmemcpy; yann@552: using std::wmemmove; yann@552: using std::wmemset; yann@552: +#if _GLIBCXX_HAVE_WCSFTIME yann@552: using std::wcsftime; yann@552: +#endif yann@552: yann@552: #if _GLIBCXX_USE_C99 yann@552: using std::wcstold;