📄 200-uclibc-locale.patch
字号:
+ iconv_t __cd, char** __inbuf, size_t* __inbytes,+ char** __outbuf, size_t* __outbytes)+ { return __func(__cd, (_T)__inbuf, __inbytes, __outbuf, __outbytes); }++ template<typename _InternT, typename _ExternT>+ codecvt_base::result+ codecvt<_InternT, _ExternT, __enc_traits>::+ do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next,+ extern_type* __to, extern_type* __to_end,+ extern_type*& __to_next) const+ {+ result __ret = codecvt_base::error;+ if (__state._M_good())+ {+ typedef state_type::__desc_type __desc_type;+ const __desc_type* __desc = __state._M_get_out_descriptor();+ const size_t __fmultiple = sizeof(intern_type);+ size_t __fbytes = __fmultiple * (__from_end - __from);+ const size_t __tmultiple = sizeof(extern_type);+ size_t __tbytes = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus,+ // all to/from arrays must be brutally casted to char*.+ char* __cto = reinterpret_cast<char*>(__to);+ char* __cfrom;+ size_t __conv;++ // Some encodings need a byte order marker as the first item+ // in the byte stream, to designate endian-ness. The default+ // value for the byte order marker is NULL, so if this is+ // the case, it's not necessary and we can just go on our+ // merry way.+ int __int_bom = __state._M_get_internal_bom();+ if (__int_bom)+ { + size_t __size = __from_end - __from;+ intern_type* __cfixed = static_cast<intern_type*>(__builtin_alloca(sizeof(intern_type) * (__size + 1)));+ __cfixed[0] = static_cast<intern_type>(__int_bom);+ char_traits<intern_type>::copy(__cfixed + 1, __from, __size);+ __cfrom = reinterpret_cast<char*>(__cfixed);+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,+ &__fbytes, &__cto, &__tbytes); + }+ else+ {+ intern_type* __cfixed = const_cast<intern_type*>(__from);+ __cfrom = reinterpret_cast<char*>(__cfixed);+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom, &__fbytes, + &__cto, &__tbytes); + }++ if (__conv != size_t(-1))+ {+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);+ __to_next = reinterpret_cast<extern_type*>(__cto);+ __ret = codecvt_base::ok;+ }+ else + {+ if (__fbytes < __fmultiple * (__from_end - __from))+ {+ __from_next = reinterpret_cast<const intern_type*>(__cfrom);+ __to_next = reinterpret_cast<extern_type*>(__cto);+ __ret = codecvt_base::partial;+ }+ else+ __ret = codecvt_base::error;+ }+ }+ return __ret; + }++ template<typename _InternT, typename _ExternT>+ codecvt_base::result+ codecvt<_InternT, _ExternT, __enc_traits>::+ do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const+ {+ result __ret = codecvt_base::error;+ if (__state._M_good())+ {+ typedef state_type::__desc_type __desc_type;+ const __desc_type* __desc = __state._M_get_in_descriptor();+ const size_t __tmultiple = sizeof(intern_type);+ size_t __tlen = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus,+ // all to/from arrays must be brutally casted to char*.+ char* __cto = reinterpret_cast<char*>(__to);+ size_t __conv = __iconv_adaptor(iconv,*__desc, NULL, NULL,+ &__cto, &__tlen); + + if (__conv != size_t(-1))+ {+ __to_next = reinterpret_cast<extern_type*>(__cto);+ if (__tlen == __tmultiple * (__to_end - __to))+ __ret = codecvt_base::noconv;+ else if (__tlen == 0)+ __ret = codecvt_base::ok;+ else+ __ret = codecvt_base::partial;+ }+ else + __ret = codecvt_base::error;+ }+ return __ret; + }+ + template<typename _InternT, typename _ExternT>+ codecvt_base::result+ codecvt<_InternT, _ExternT, __enc_traits>::+ do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next,+ intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const+ { + result __ret = codecvt_base::error;+ if (__state._M_good())+ {+ typedef state_type::__desc_type __desc_type;+ const __desc_type* __desc = __state._M_get_in_descriptor();+ const size_t __fmultiple = sizeof(extern_type);+ size_t __flen = __fmultiple * (__from_end - __from);+ const size_t __tmultiple = sizeof(intern_type);+ size_t __tlen = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus,+ // all to/from arrays must be brutally casted to char*.+ char* __cto = reinterpret_cast<char*>(__to);+ char* __cfrom;+ size_t __conv;++ // Some encodings need a byte order marker as the first item+ // in the byte stream, to designate endian-ness. The default+ // value for the byte order marker is NULL, so if this is+ // the case, it's not necessary and we can just go on our+ // merry way.+ int __ext_bom = __state._M_get_external_bom();+ if (__ext_bom)+ { + size_t __size = __from_end - __from;+ extern_type* __cfixed = static_cast<extern_type*>(__builtin_alloca(sizeof(extern_type) * (__size + 1)));+ __cfixed[0] = static_cast<extern_type>(__ext_bom);+ char_traits<extern_type>::copy(__cfixed + 1, __from, __size);+ __cfrom = reinterpret_cast<char*>(__cfixed);+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,+ &__flen, &__cto, &__tlen); + }+ else+ {+ extern_type* __cfixed = const_cast<extern_type*>(__from);+ __cfrom = reinterpret_cast<char*>(__cfixed);+ __conv = __iconv_adaptor(iconv, *__desc, &__cfrom,+ &__flen, &__cto, &__tlen); + }++ + if (__conv != size_t(-1))+ {+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);+ __to_next = reinterpret_cast<intern_type*>(__cto);+ __ret = codecvt_base::ok;+ }+ else + {+ if (__flen < static_cast<size_t>(__from_end - __from))+ {+ __from_next = reinterpret_cast<const extern_type*>(__cfrom);+ __to_next = reinterpret_cast<intern_type*>(__cto);+ __ret = codecvt_base::partial;+ }+ else+ __ret = codecvt_base::error;+ }+ }+ return __ret; + }+ + template<typename _InternT, typename _ExternT>+ int + codecvt<_InternT, _ExternT, __enc_traits>::+ do_encoding() const throw()+ {+ int __ret = 0;+ if (sizeof(_ExternT) <= sizeof(_InternT))+ __ret = sizeof(_InternT)/sizeof(_ExternT);+ return __ret; + }+ + template<typename _InternT, typename _ExternT>+ bool + codecvt<_InternT, _ExternT, __enc_traits>::+ do_always_noconv() const throw()+ { return false; }+ + template<typename _InternT, typename _ExternT>+ int + codecvt<_InternT, _ExternT, __enc_traits>::+ do_length(const state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const+ { return min(__max, static_cast<size_t>(__end - __from)); }++#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS+// 74. Garbled text for codecvt::do_max_length+ template<typename _InternT, typename _ExternT>+ int + codecvt<_InternT, _ExternT, __enc_traits>::+ do_max_length() const throw()+ { return 1; }+#endifdiff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/collate_members.cc--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/collate_members.cc 2004-01-09 08:06:24.000000000 -0600@@ -0,0 +1,80 @@+// std::collate implementation details, GNU version -*- C++ -*-++// Copyright (C) 2001, 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.++//+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions+//++// Written by Benjamin Kosnik <bkoz@redhat.com>++#include <locale>+#include <bits/c++locale_internal.h>++#ifndef __UCLIBC_HAS_XLOCALE__+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))+#endif++namespace std+{+ // These are basically extensions to char_traits, and perhaps should+ // be put there instead of here.+ template<>+ int + collate<char>::_M_compare(const char* __one, const char* __two) const+ { + int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);+ }+ + template<>+ size_t+ collate<char>::_M_transform(char* __to, const char* __from, + size_t __n) const + { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }++#ifdef _GLIBCPP_USE_WCHAR_T+ template<>+ int + collate<wchar_t>::_M_compare(const wchar_t* __one, + const wchar_t* __two) const+ {+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);+ }+ + template<>+ size_t+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,+ size_t __n) const+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }+#endif+}diff -urN gcc-3.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/ctype_members.cc--- gcc-3.3.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 18:00:00.000000000 -0600+++ gcc-3.3.2-uClibc/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2004-01-09 08:15:41.000000000 -0600@@ -0,0 +1,274 @@+// std::ctype implementation details, GNU version -*- 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.2.1.1.2 ctype virtual functions.+//++// Written by Benjamin Kosnik <bkoz@redhat.com>++#define _LIBC+#include <locale>+#undef _LIBC+#include <bits/c++locale_internal.h>++#ifndef __UCLIBC_HAS_XLOCALE__+#define __wctype_l(S, L) wctype((S))+#define __towupper_l(C, L) towupper((C))+#define __towlower_l(C, L) towlower((C))+#define __iswctype_l(C, M, L) iswctype((C), (M))+#endif++namespace std+{+ // NB: The other ctype<char> specializations are in src/locale.cc and+ // various /config/os/* files.+ template<>+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)+ : ctype<char>(0, false, __refs) + { + _S_destroy_c_locale(_M_c_locale_ctype);+ _S_create_c_locale(_M_c_locale_ctype, __s); +#ifdef __UCLIBC_HAS_XLOCALE__+ _M_toupper = _M_c_locale_ctype->__ctype_toupper;+ _M_tolower = _M_c_locale_ctype->__ctype_tolower;+ _M_table = _M_c_locale_ctype->__ctype_b;+#endif+ }++#ifdef _GLIBCPP_USE_WCHAR_T + ctype<wchar_t>::__wmask_type+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const+ {+ __wmask_type __ret;+ switch (__m)+ {+ case space:+ __ret = __wctype_l("space", _M_c_locale_ctype);+ break;+ case print:+ __ret = __wctype_l("print", _M_c_locale_ctype);+ break;+ case cntrl:+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);+ break;+ case upper:+ __ret = __wctype_l("upper", _M_c_locale_ctype);+ break;+ case lower:+ __ret = __wctype_l("lower", _M_c_locale_ctype);+ break;+ case alpha:+ __ret = __wctype_l("alpha", _M_c_locale_ctype);+ break;+ case digit:+ __ret = __wctype_l("digit", _M_c_locale_ctype);+ break;+ case punct:+ __ret = __wctype_l("punct", _M_c_locale_ctype);+ break;+ case xdigit:+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);+ break;+ case alnum:+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -