⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 200-uclibc-locale.patch

📁 最新的文件系统生成工具
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
Warning!  This patch is not finished.  The wide char time-related stuffis broken or non-functional.  But it serves as a starting point to getthings building while I continue to work on the uClibc locale internals.diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h	1969-12-31 18:00:00.000000000 -0600+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c++locale_internal.h	2004-01-09 07:55:02.000000000 -0600@@ -0,0 +1,63 @@+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-++// Copyright (C) 2002 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(strtol_l) __strtol_l;+extern "C" __typeof(strtoll_l) __strtoll_l;+extern "C" __typeof(strtoul_l) __strtoul_l;+extern "C" __typeof(strtoull_l) __strtoull_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.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.cc--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.cc	1969-12-31 18:00:00.000000000 -0600+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.cc	2004-01-09 08:37:55.000000000 -0600@@ -0,0 +1,231 @@+// 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 <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))+#endif++namespace std +{+  template<>+    void+    __convert_to_v(const char* __s, long& __v, ios_base::iostate& __err, +		   const __c_locale& __cloc, int __base)+    {+      if (!(__err & ios_base::failbit))+      {+	char* __sanity;+	errno = 0;+	long __l = __strtol_l(__s, &__sanity, __base, __cloc);+	if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)+	  __v = __l;+	else+	  __err |= ios_base::failbit;+      }+    }++  template<>+    void+    __convert_to_v(const char* __s, unsigned long& __v, +		   ios_base::iostate& __err, const __c_locale& __cloc, +		   int __base)+    {+      if (!(__err & ios_base::failbit))+	{+	  char* __sanity;+	  errno = 0;+	  unsigned long __ul = __strtoul_l(__s, &__sanity, __base, __cloc);+          if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)+	    __v = __ul;+	  else+	    __err |= ios_base::failbit;+	}+    }++#ifdef _GLIBCPP_USE_LONG_LONG+  template<>+    void+    __convert_to_v(const char* __s, long long& __v, ios_base::iostate& __err, +		   const __c_locale& __cloc, int __base)+    {+      if (!(__err & ios_base::failbit))+	{+	  char* __sanity;+	  errno = 0;+	  long long __ll = __strtoll_l(__s, &__sanity, __base, __cloc);+          if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)+	    __v = __ll;+	  else+	    __err |= ios_base::failbit;+	}+    }++  template<>+    void+    __convert_to_v(const char* __s, unsigned long long& __v, +		   ios_base::iostate& __err, const __c_locale& __cloc, +		   int __base)+    {+      if (!(__err & ios_base::failbit))+	{      +	  char* __sanity;+	  errno = 0;+	  unsigned long long __ull = __strtoull_l(__s, &__sanity, __base, +						  __cloc);+          if (__sanity != __s && *__sanity == '\0' && errno != ERANGE)+	    __v = __ull;+	  else+	    __err |= ios_base::failbit;+	}  +    }+#endif++  template<>+    void+    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, +		   const __c_locale& __cloc, int)+    {+      if (!(__err & ios_base::failbit))+	{+	  char* __sanity;+	  errno = 0;+	  float __f = __strtof_l(__s, &__sanity, __cloc);+          if (__sanity != __s && *__sanity == '\0' && 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, int)+    {+      if (!(__err & ios_base::failbit))+	{+	  char* __sanity;+	  errno = 0;+	  double __d = __strtod_l(__s, &__sanity, __cloc);+          if (__sanity != __s && *__sanity == '\0' && 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, int)+    {+      if (!(__err & ios_base::failbit))+	{+	  char* __sanity;+	  errno = 0;+	  long double __ld = __strtold_l(__s, &__sanity, __cloc);+          if (__sanity != __s && *__sanity == '\0' && 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)+  {+#ifdef __UCLIBC_HAS_XLOCALE__+    __cloc = __newlocale(1 << LC_ALL, __s, __old);+    if (!__cloc)+      {+	// This named locale is not supported by the underlying OS.+	__throw_runtime_error("attempt to create locale from unknown name");+      }+#else+    __cloc = NULL;+#endif+  }+  +  void+  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)+  {+#ifdef __UCLIBC_HAS_XLOCALE__+    if (_S_c_locale != __cloc)+      __freelocale(__cloc); +#else+    __cloc = NULL;+#endif+  }++  __c_locale+  locale::facet::_S_clone_c_locale(__c_locale& __cloc)+#ifdef __UCLIBC_HAS_XLOCALE__+  { return __duplocale(__cloc); }+#else+  { return __c_locale(); }+#endif++  const char* locale::_S_categories[_S_categories_size +				    + _S_extra_categories_size] =+    {+      "LC_CTYPE", +      "LC_NUMERIC",+      "LC_TIME", +      "LC_COLLATE", +      "LC_MONETARY",+      "LC_MESSAGES"+#if _GLIBCPP_NUM_CATEGORIES != 0+      , +      "LC_PAPER", +      "LC_NAME", +      "LC_ADDRESS",+      "LC_TELEPHONE", +      "LC_MEASUREMENT", +      "LC_IDENTIFICATION" +#endif+    };+}  // namespace stddiff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.h--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/c_locale.h	1969-12-31 18:00:00.000000000 -0600+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/c_locale.h	2004-01-09 07:51:06.000000000 -0600@@ -0,0 +1,118 @@+// 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>++#ifndef _CPP_BITS_C_LOCALE_H+#define _CPP_BITS_C_LOCALE_H 1++#pragma GCC system_header++#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+#endif+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__+#include <libintl.h> 		// For messages+#endif++#ifdef __UCLIBC_MJN3_ONLY__+#warning what is _GLIBCPP_C_LOCALE_GNU for+#endif+#define _GLIBCPP_C_LOCALE_GNU 1++#ifdef __UCLIBC_MJN3_ONLY__+#warning fix categories+#endif+// #define _GLIBCPP_NUM_CATEGORIES 6+#define _GLIBCPP_NUM_CATEGORIES 0++#ifdef __UCLIBC_HAS_XLOCALE__+namespace __gnu_cxx+{+  extern "C" __typeof(uselocale) __uselocale;+}+#endif++namespace std+{+#ifdef __UCLIBC_HAS_XLOCALE__+  typedef __locale_t		__c_locale;+#else+  typedef int*			__c_locale;+#endif++  // Convert numeric value of type _Tv to string and return length of+  // string.  If snprintf is available use it, otherwise fall back to+  // the unsafe sprintf which, in general, can be dangerous and should+  // be avoided.+  template<typename _Tv>+    int+    __convert_from_v(char* __out, const int __size, const char* __fmt,+#ifdef __UCLIBC_HAS_XLOCALE__+		     _Tv __v, const __c_locale& __cloc, int __prec = -1)+    {+      __c_locale __old = __gnu_cxx::__uselocale(__cloc);+#else

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -