📄 200-uclibc-locale.patch
字号:
diff -urN gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 gcc-3.4.2/libstdc++-v3/acinclude.m4--- gcc-3.4.2-dist/libstdc++-v3/acinclude.m4 2004-07-15 12:42:45.000000000 -0500+++ gcc-3.4.2/libstdc++-v3/acinclude.m4 2004-09-10 10:47:40.000000000 -0500@@ -996,7 +996,7 @@ AC_MSG_CHECKING([for C locale to use]) GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], [use MODEL for target locale package],- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto]) # If they didn't use this option switch, or if they specified --enable # with no specific model, we'll have to look for one. If they@@ -1012,6 +1012,9 @@ # Default to "generic". if test $enable_clocale_flag = auto; then case x${target_os} in+ x*-uclibc*)+ enable_clocale_flag=uclibc+ ;; xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu) AC_EGREP_CPP([_GLIBCXX_ok], [ #include <features.h>@@ -1138,6 +1141,41 @@ CTIME_CC=config/locale/generic/time_members.cc CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h ;;+ uclibc)+ AC_MSG_RESULT(uclibc)++ # Declare intention to use gettext, and add support for specific+ # languages.+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT+ ALL_LINGUAS="de fr"++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then+ USE_NLS=yes+ fi+ # Export the build objects.+ for ling in $ALL_LINGUAS; do \+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \+ done+ AC_SUBST(glibcxx_MOFILES)+ AC_SUBST(glibcxx_POFILES)++ CLOCALE_H=config/locale/uclibc/c_locale.h+ CLOCALE_CC=config/locale/uclibc/c_locale.cc+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc+ CMESSAGES_H=config/locale/uclibc/messages_members.h+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc+ CMONEY_CC=config/locale/uclibc/monetary_members.cc+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc+ CTIME_H=config/locale/uclibc/time_members.h+ CTIME_CC=config/locale/uclibc/time_members.cc+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h+ ;; esac # This is where the testsuite looks for locale catalogs, using thediff -urN gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 gcc-3.4.2/libstdc++-v3/aclocal.m4--- gcc-3.4.2-dist/libstdc++-v3/aclocal.m4 2004-08-13 15:44:03.000000000 -0500+++ gcc-3.4.2/libstdc++-v3/aclocal.m4 2004-09-10 10:47:40.000000000 -0500@@ -1025,6 +1025,9 @@ # Default to "generic". if test $enable_clocale_flag = auto; then case x${target_os} in+ x*-uclibc*)+ enable_clocale_flag=uclibc+ ;; xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu) AC_EGREP_CPP([_GLIBCXX_ok], [ #include <features.h>@@ -1151,6 +1154,41 @@ CTIME_CC=config/locale/generic/time_members.cc CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h ;;+ uclibc)+ AC_MSG_RESULT(uclibc)++ # Declare intention to use gettext, and add support for specific+ # languages.+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT+ ALL_LINGUAS="de fr"++ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then+ USE_NLS=yes+ fi+ # Export the build objects.+ for ling in $ALL_LINGUAS; do \+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \+ done+ AC_SUBST(glibcxx_MOFILES)+ AC_SUBST(glibcxx_POFILES)++ CLOCALE_H=config/locale/uclibc/c_locale.h+ CLOCALE_CC=config/locale/uclibc/c_locale.cc+ CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc+ CMESSAGES_H=config/locale/uclibc/messages_members.h+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc+ CMONEY_CC=config/locale/uclibc/monetary_members.cc+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc+ CTIME_H=config/locale/uclibc/time_members.h+ CTIME_CC=config/locale/uclibc/time_members.cc+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h+ ;; esac # This is where the testsuite looks for locale catalogs, using thediff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 18:00:00.000000000 -0600+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2004-09-10 10:47:40.000000000 -0500@@ -0,0 +1,59 @@+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-++// Copyright (C) 2002, 2004 Free Software Foundation, Inc.+//+// This file is part of the GNU ISO C++ Library. This library is free+// software; you can redistribute it and/or modify it under the+// terms of the GNU General Public License as published by the+// Free Software Foundation; either version 2, or (at your option)+// any later version.++// This library is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.++// You should have received a copy of the GNU General Public License along+// with this library; see the file COPYING. If not, write to the Free+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,+// USA.++// As a special exception, you may use this file as part of a free software+// library without restriction. Specifically, if other files instantiate+// templates or use macros or inline functions from this file, or you compile+// this file and link it with other files to produce an executable, this+// file does not by itself cause the resulting executable to be covered by+// the GNU General Public License. This exception does not however+// invalidate any other reasons why the executable file might be covered by+// the GNU General Public License.++// Written by Jakub Jelinek <jakub@redhat.com>++#include <clocale>++#ifdef __UCLIBC_MJN3_ONLY__+#warning clean this up+#endif++#ifdef __UCLIBC_HAS_XLOCALE__+ +extern "C" __typeof(iswctype_l) __iswctype_l;+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;+extern "C" __typeof(strcoll_l) __strcoll_l;+extern "C" __typeof(strftime_l) __strftime_l;+extern "C" __typeof(strtod_l) __strtod_l;+extern "C" __typeof(strtof_l) __strtof_l;+extern "C" __typeof(strtold_l) __strtold_l;+extern "C" __typeof(strxfrm_l) __strxfrm_l;+extern "C" __typeof(towlower_l) __towlower_l;+extern "C" __typeof(towupper_l) __towupper_l;+extern "C" __typeof(wcscoll_l) __wcscoll_l;+extern "C" __typeof(wcsftime_l) __wcsftime_l;+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;+extern "C" __typeof(wctype_l) __wctype_l;+extern "C" __typeof(newlocale) __newlocale;+extern "C" __typeof(freelocale) __freelocale;+extern "C" __typeof(duplocale) __duplocale;+extern "C" __typeof(uselocale) __uselocale;++#endif // GLIBC 2.3 and laterdiff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.cc--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 18:00:00.000000000 -0600+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2004-09-10 10:47:40.000000000 -0500@@ -0,0 +1,160 @@+// Wrapper for underlying C-language localization -*- C++ -*-++// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.+//+// This file is part of the GNU ISO C++ Library. This library is free+// software; you can redistribute it and/or modify it under the+// terms of the GNU General Public License as published by the+// Free Software Foundation; either version 2, or (at your option)+// any later version.++// This library is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.++// You should have received a copy of the GNU General Public License along+// with this library; see the file COPYING. If not, write to the Free+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,+// USA.++// As a special exception, you may use this file as part of a free software+// library without restriction. Specifically, if other files instantiate+// templates or use macros or inline functions from this file, or you compile+// this file and link it with other files to produce an executable, this+// file does not by itself cause the resulting executable to be covered by+// the GNU General Public License. This exception does not however+// invalidate any other reasons why the executable file might be covered by+// the GNU General Public License.++//+// ISO C++ 14882: 22.8 Standard locale categories.+//++// Written by Benjamin Kosnik <bkoz@redhat.com>++#include <cerrno> // For errno+#include <locale>+#include <stdexcept>+#include <langinfo.h>+#include <bits/c++locale_internal.h>++#ifndef __UCLIBC_HAS_XLOCALE__+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))+#define __strtof_l(S, E, L) strtof((S), (E))+#define __strtod_l(S, E, L) strtod((S), (E))+#define __strtold_l(S, E, L) strtold((S), (E))+#warning should dummy __newlocale check for C|POSIX ?+#define __newlocale(a, b, c) NULL+#define __freelocale(a) ((void)0)+#define __duplocale(a) __c_locale()+#endif++namespace std +{+ template<>+ void+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, + const __c_locale& __cloc)+ {+ if (!(__err & ios_base::failbit))+ {+ char* __sanity;+ errno = 0;+ float __f = __strtof_l(__s, &__sanity, __cloc);+ if (__sanity != __s && errno != ERANGE)+ __v = __f;+ else+ __err |= ios_base::failbit;+ }+ }++ template<>+ void+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, + const __c_locale& __cloc)+ {+ if (!(__err & ios_base::failbit))+ {+ char* __sanity;+ errno = 0;+ double __d = __strtod_l(__s, &__sanity, __cloc);+ if (__sanity != __s && errno != ERANGE)+ __v = __d;+ else+ __err |= ios_base::failbit;+ }+ }++ template<>+ void+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,+ const __c_locale& __cloc)+ {+ if (!(__err & ios_base::failbit))+ {+ char* __sanity;+ errno = 0;+ long double __ld = __strtold_l(__s, &__sanity, __cloc);+ if (__sanity != __s && errno != ERANGE)+ __v = __ld;+ else+ __err |= ios_base::failbit;+ }+ }++ void+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, + __c_locale __old)+ {+ __cloc = __newlocale(1 << LC_ALL, __s, __old);+#ifdef __UCLIBC_HAS_XLOCALE__+ if (!__cloc)+ {+ // This named locale is not supported by the underlying OS.+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "+ "name not valid"));+ }+#endif+ }+ + void+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)+ {+ if (_S_get_c_locale() != __cloc)+ __freelocale(__cloc); + }++ __c_locale+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)+ { return __duplocale(__cloc); }+} // namespace std++namespace __gnu_cxx+{+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =+ {+ "LC_CTYPE", + "LC_NUMERIC",+ "LC_TIME", + "LC_COLLATE", + "LC_MONETARY",+ "LC_MESSAGES", +#if _GLIBCXX_NUM_CATEGORIES != 0+ "LC_PAPER", + "LC_NAME", + "LC_ADDRESS",+ "LC_TELEPHONE", + "LC_MEASUREMENT", + "LC_IDENTIFICATION" +#endif+ };+}++namespace std+{+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;+} // namespace stddiff -urN gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.h--- gcc-3.4.2-dist/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600+++ gcc-3.4.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2004-09-10 10:48:08.000000000 -0500@@ -0,0 +1,115 @@+// Wrapper for underlying C-language localization -*- C++ -*-++// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.+//+// This file is part of the GNU ISO C++ Library. This library is free+// software; you can redistribute it and/or modify it under the+// terms of the GNU General Public License as published by the+// Free Software Foundation; either version 2, or (at your option)+// any later version.++// This library is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.++// You should have received a copy of the GNU General Public License along+// with this library; see the file COPYING. If not, write to the Free+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,+// USA.++// As a special exception, you may use this file as part of a free software+// library without restriction. Specifically, if other files instantiate+// templates or use macros or inline functions from this file, or you compile+// this file and link it with other files to produce an executable, this+// file does not by itself cause the resulting executable to be covered by+// the GNU General Public License. This exception does not however+// invalidate any other reasons why the executable file might be covered by+// the GNU General Public License.++//+// ISO C++ 14882: 22.8 Standard locale categories.+//++// Written by Benjamin Kosnik <bkoz@redhat.com>++#ifndef _C_LOCALE_H+#define _C_LOCALE_H 1++#pragma GCC system_header++#include <cstring> // get std::strlen+#include <cstdio> // get std::snprintf or std::sprintf+#include <clocale>+#include <langinfo.h> // For codecvt+#ifdef __UCLIBC_MJN3_ONLY__+#warning fix this+#endif+#ifdef __UCLIBC_HAS_LOCALE__+#include <iconv.h> // For codecvt using iconv, iconv_t
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -