diff options
author | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-06-13 02:13:54 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-06-13 02:13:54 +0000 |
commit | 088eb5a274b3e2d90d15b5ef5706463abbc6b847 (patch) | |
tree | 51563b8b86b75220b40d2d6f32d188493d22c62d | |
parent | d54a528ae41f74bd3d8686742ae4feed435576d7 (diff) | |
download | gcc-088eb5a274b3e2d90d15b5ef5706463abbc6b847.zip gcc-088eb5a274b3e2d90d15b5ef5706463abbc6b847.tar.gz gcc-088eb5a274b3e2d90d15b5ef5706463abbc6b847.tar.bz2 |
[multiple changes]
2000-06-12 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* bits/locale_facets.h (ctype<wchar_t>): Remove unnecessary data
members.
* src/locale.cc: Add cwchar include here. Remove incorrect
definitions, and stub them out.
* config/generic/ctype.cc (ctype): Remove ctype<wchar_t> bits.
* config/solaris/solaris2.7/ctype.cc (ctype): Same.
* config/solaris/solaris2.5/ctype.cc (ctype): Same.
* config/newlib/ctype.cc: Same.
* config/gnu-linux/ctype.cc: Same.
* config/bsd/ctype.cc: Same.
* config/aix/ctype.cc: Same.
2000-06-12 Branko Cibej <branko.cibej@hermes.si>
* config/solaris/solaris2.6/ctype.cc (do_toupper, do_tolower): Use
towupper and towlower to convert wide characters.
From-SVN: r34511
-rw-r--r-- | libstdc++-v3/ChangeLog | 19 | ||||
-rw-r--r-- | libstdc++-v3/bits/locale_facets.h | 8 | ||||
-rw-r--r-- | libstdc++-v3/config/aix/ctype.cc | 39 | ||||
-rw-r--r-- | libstdc++-v3/config/bsd/ctype.cc | 35 | ||||
-rw-r--r-- | libstdc++-v3/config/generic/ctype.cc | 35 | ||||
-rw-r--r-- | libstdc++-v3/config/gnu-linux/ctype.cc | 40 | ||||
-rw-r--r-- | libstdc++-v3/config/newlib/ctype.cc | 42 | ||||
-rw-r--r-- | libstdc++-v3/config/solaris/solaris2.5/ctype.cc | 46 | ||||
-rw-r--r-- | libstdc++-v3/config/solaris/solaris2.6/ctype.cc | 36 | ||||
-rw-r--r-- | libstdc++-v3/config/solaris/solaris2.7/ctype.cc | 37 | ||||
-rw-r--r-- | libstdc++-v3/src/locale.cc | 92 |
11 files changed, 80 insertions, 349 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 988901e..c0b73b6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,24 @@ 2000-06-12 Benjamin Kosnik <bkoz@purist.soma.redhat.com> + * bits/locale_facets.h (ctype<wchar_t>): Remove unnecessary data + members. + * src/locale.cc: Add cwchar include here. Remove incorrect + definitions, and stub them out. + * config/generic/ctype.cc (ctype): Remove ctype<wchar_t> bits. + * config/solaris/solaris2.7/ctype.cc (ctype): Same. + * config/solaris/solaris2.5/ctype.cc (ctype): Same. + * config/newlib/ctype.cc: Same. + * config/gnu-linux/ctype.cc: Same. + * config/bsd/ctype.cc: Same. + * config/aix/ctype.cc: Same. + +2000-06-12 Branko Cibej <branko.cibej@hermes.si> + + * config/solaris/solaris2.6/ctype.cc (do_toupper, do_tolower): Use + towupper and towlower to convert wide characters. + +2000-06-12 Benjamin Kosnik <bkoz@purist.soma.redhat.com> + * mkcheck.in: Clean up confusion regarding NAME, PRE_NAME. 2000-06-08 Branko Cibej <branko.cibej@hermes.si> diff --git a/libstdc++-v3/bits/locale_facets.h b/libstdc++-v3/bits/locale_facets.h index 2568585..f987f01 100644 --- a/libstdc++-v3/bits/locale_facets.h +++ b/libstdc++-v3/bits/locale_facets.h @@ -390,15 +390,7 @@ namespace std // Types: typedef wchar_t char_type; typedef ctype::mask mask; - typedef size_t __table_type; - - private: - __to_type const& _M_toupper; - __to_type const& _M_tolower; - const mask* const& _M_ctable; - static const __table_type _S_table_size = ctype<char>::table_size; - public: static locale::id id; explicit diff --git a/libstdc++-v3/config/aix/ctype.cc b/libstdc++-v3/config/aix/ctype.cc index 2c600f0..6797299 100644 --- a/libstdc++-v3/config/aix/ctype.cc +++ b/libstdc++-v3/config/aix/ctype.cc @@ -69,42 +69,3 @@ } return __high; } - -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL) - { } - - wchar_t - ctype<wchar_t>::do_toupper(wchar_t __c) const - { return towupper(__c); } - - const wchar_t* - ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const - { - for (;low < high; ++low) - if (*low < _S_table_size) - *low = this->do_toupper(*low); - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(wchar_t __c) const - { return towlower(__c); } - - const wchar_t* - ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const - { - for (; __low < __high; ++__low) - if (*__low < _S_table_size) - *__low = this->do_tolower(*__low); - return __high; - } -#endif - - - - - - diff --git a/libstdc++-v3/config/bsd/ctype.cc b/libstdc++-v3/config/bsd/ctype.cc index 01a7315..f419865 100644 --- a/libstdc++-v3/config/bsd/ctype.cc +++ b/libstdc++-v3/config/bsd/ctype.cc @@ -69,38 +69,3 @@ } return __high; } - -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL) - { } - - wchar_t - ctype<wchar_t>::do_toupper(char_type __c) const - { return (__c < _S_table_size) ? _S_toupper[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const - { - for (;low < high; ++low) - if (*low < _S_table_size) - *low = _S_toupper[*low]; - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(char_type __c) const - { return (__c < _S_table_size) ? _S_tolower[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_tolower(char_type* __low, const char_type* __high) const - { - for (; __low < __high; ++__low) - if (*__low < _S_table_size) - *__low = _S_toupper[*__low]; - return __high; - } -#endif - - diff --git a/libstdc++-v3/config/generic/ctype.cc b/libstdc++-v3/config/generic/ctype.cc index 0bf6b6b..e4de5c2 100644 --- a/libstdc++-v3/config/generic/ctype.cc +++ b/libstdc++-v3/config/generic/ctype.cc @@ -69,38 +69,3 @@ } return __high; } - -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL) - { } - - wchar_t - ctype<wchar_t>::do_toupper(char_type __c) const - { return (__c < _S_table_size) ? _S_toupper[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const - { - for (;low < high; ++low) - if (*low < _S_table_size) - *low = _S_toupper[*low]; - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(char_type __c) const - { return (__c < _S_table_size) ? _S_tolower[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_tolower(char_type* __low, const char_type* __high) const - { - for (; __low < __high; ++__low) - if (*__low < _S_table_size) - *__low = _S_toupper[*__low]; - return __high; - } -#endif - - diff --git a/libstdc++-v3/config/gnu-linux/ctype.cc b/libstdc++-v3/config/gnu-linux/ctype.cc index f6abe08..dc10a63 100644 --- a/libstdc++-v3/config/gnu-linux/ctype.cc +++ b/libstdc++-v3/config/gnu-linux/ctype.cc @@ -70,43 +70,3 @@ return __high; } -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), - _M_ctable(__ctype_b) - { } - - wchar_t - ctype<wchar_t>::do_toupper(wchar_t __c) const - { - return ((static_cast<__table_type>(__c) < _S_table_size) - ? _M_toupper[__c] : __c); - } - - const wchar_t* - ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const - { - for (;low < high; ++low) - if (static_cast<__table_type>(*low) < _S_table_size) - *low = _M_toupper[*low]; - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(wchar_t __c) const - { - return ((static_cast<__table_type>(__c) < _S_table_size) - ? _M_tolower[__c] : __c); - } - - const wchar_t* - ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const - { - for (; __low < __high; ++__low) - if (static_cast<__table_type>(*__low) < _S_table_size) - *__low = _M_toupper[*__low]; - return __high; - } -#endif - - diff --git a/libstdc++-v3/config/newlib/ctype.cc b/libstdc++-v3/config/newlib/ctype.cc index db401bd..1984d65 100644 --- a/libstdc++-v3/config/newlib/ctype.cc +++ b/libstdc++-v3/config/newlib/ctype.cc @@ -76,45 +76,3 @@ return __high; } -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(_ctype_) - { } - - wchar_t - ctype<wchar_t>::do_toupper(wchar_t __c) const - { - int __x = __c; - bool __testok = __c < _S_table_size && this->is(ctype_base::upper, __c); - return (__testok ? (__x - 'A' + 'a') : __x); - } - - const wchar_t* - ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const - { - for (;low < high; ++low) - if (*low < _S_table_size) - *low = this->do_toupper(*low); - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(wchar_t __c) const - { - int __x = __c; - bool __testok = __c < _S_table_size && this->is(ctype_base::lower, __c); - return (__testok ? (__x - 'A' + 'a') : __x); - } - - const wchar_t* - ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const - { - for (; __low < __high; ++__low) - if (*__low < _S_table_size) - *__low = this->do_tolower(*__low); - return __high; - } -#endif - - diff --git a/libstdc++-v3/config/solaris/solaris2.5/ctype.cc b/libstdc++-v3/config/solaris/solaris2.5/ctype.cc index 7e01ad6..c02a31e 100644 --- a/libstdc++-v3/config/solaris/solaris2.5/ctype.cc +++ b/libstdc++-v3/config/solaris/solaris2.5/ctype.cc @@ -70,49 +70,3 @@ return __high; } -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(__ctype) - { } - - wchar_t - ctype<wchar_t>::do_toupper(wchar_t __c) const - { - int __x = __c; - bool __testok = __c < _S_table_size && this->is(ctype_base::upper, __c); - return (__testok ? __x : (__x - 'a' + 'A')); - } - - const wchar_t* - ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const - { - for (;low < high; ++low) - if (*low < _S_table_size) - *low = this->do_toupper(*low); - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(wchar_t __c) const - { - int __x = __c; - bool __testok = __c < _S_table_size && this->is(ctype_base::lower, __c); - return (__testok ? __x: (__x - 'A' + 'a')); - } - - const wchar_t* - ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const - { - for (; __low < __high; ++__low) - if (*__low < _S_table_size) - *__low = this->do_tolower(*__low); - return __high; - } -#endif - - - - - - diff --git a/libstdc++-v3/config/solaris/solaris2.6/ctype.cc b/libstdc++-v3/config/solaris/solaris2.6/ctype.cc index 97a9a56..f760ac9 100644 --- a/libstdc++-v3/config/solaris/solaris2.6/ctype.cc +++ b/libstdc++-v3/config/solaris/solaris2.6/ctype.cc @@ -69,39 +69,3 @@ } return __high; } - -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_ctable(__ctype_mask) - { } - - wchar_t - ctype<wchar_t>::do_toupper(wchar_t __c) const - { return (__c < _S_table_size) ? _M_toupper[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const - { - for (;low < high; ++low) - if (*low < _S_table_size) - *low = _M_toupper[*low]; - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(wchar_t __c) const - { return (__c < _S_table_size) ? _M_tolower[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const - { - for (; __low < __high; ++__low) - if (*__low < _S_table_size) - *__low = _M_toupper[*__low]; - return __high; - } -#endif - - - diff --git a/libstdc++-v3/config/solaris/solaris2.7/ctype.cc b/libstdc++-v3/config/solaris/solaris2.7/ctype.cc index d8f8370..348495e 100644 --- a/libstdc++-v3/config/solaris/solaris2.7/ctype.cc +++ b/libstdc++-v3/config/solaris/solaris2.7/ctype.cc @@ -70,41 +70,4 @@ return __high; } -#ifdef _GLIBCPP_USE_WCHAR_T - ctype<wchar_t>::ctype(size_t /*__refs*/) throw() - : _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_ctable(__ctype_mask) - { } - - wchar_t - ctype<wchar_t>::do_toupper(wchar_t __c) const - { return (static_cast<__table_type>(__c) < _S_table_size) ? _M_toupper[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_toupper(wchar_t* low, const wchar_t* high) const - { - for (;low < high; ++low) - if (static_cast<__table_type>(*low) < _S_table_size) - *low = _M_toupper[*low]; - return high; - } - - wchar_t - ctype<wchar_t>::do_tolower(wchar_t __c) const - { return (static_cast<__table_type>(__c) < _S_table_size) ? _M_tolower[__c] : __c; } - - const wchar_t* - ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const - { - for (; __low < __high; ++__low) - if (static_cast<__table_type>(*__low) < _S_table_size) - *__low = _M_toupper[*__low]; - return __high; - } -#endif - - - - - diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index 3327ea2..4faa2a4 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -37,7 +37,9 @@ #include <bits/std_ostream.h> #include <bits/std_vector.h> #include <bits/std_memory.h> // for auto_ptr - +#ifdef _GLIBCPP_USE_WCHAR_T + #include <bits/std_cwctype.h> // for towupper, etc. +#endif namespace std { // locale::_Impl @@ -641,76 +643,104 @@ namespace std { ctype<wchar_t>:: ~ctype() { } + // NB: These ctype<wchar_t> methods are not configuration-specific, + // unlike the ctype<char> bits. + ctype<wchar_t>::ctype(size_t /*__refs*/) throw() { } + + wchar_t + ctype<wchar_t>::do_toupper(wchar_t __c) const + { return ::towupper(__c); } + + const wchar_t* + ctype<wchar_t>::do_toupper(wchar_t* __low, const wchar_t* __high) const + { + while (__low < __high) + { + *__low = ::towupper(*__low); + ++__low; + } + return __high; + } + + wchar_t + ctype<wchar_t>::do_tolower(wchar_t __c) const + { return ::towlower(__c); } + + const wchar_t* + ctype<wchar_t>::do_tolower(wchar_t* __low, const wchar_t* __high) const + { + while (__low < __high) + { + *__low = ::towlower(*__low); + ++__low; + } + return __high; + } + bool ctype<wchar_t>:: - do_is(mask __m, char_type __c) const + do_is(mask /*__m*/, char_type /*__c*/) const { - return ((static_cast<__table_type>(__c) < _S_table_size) - && (_M_ctable[__c] & __m)); + // XXX + return false; } const wchar_t* ctype<wchar_t>:: - do_is(const wchar_t* __low, const wchar_t* __high, mask* __vec) const + do_is(const wchar_t* __low, const wchar_t* /*__high*/, mask* /*__vec*/) const { - for (; __low < __high; ++__low, ++__vec) - *__vec = ((static_cast<__table_type>(*__low) < _S_table_size) - ? _M_ctable[*__low] : mask(0)); - return __high; + // XXX + return __low; } const wchar_t* ctype<wchar_t>:: - do_scan_is(mask __m, const wchar_t* __low, const wchar_t* __high) const + do_scan_is(mask /*__m*/, const wchar_t* __low, const wchar_t* /*__high*/) const { - while (__low < __high - && (_S_table_size < static_cast<__table_type>(*__low) - || !(_M_ctable[*__low] & __m))) - ++__low; + // XXX return __low; } const wchar_t* ctype<wchar_t>:: - do_scan_not(mask __m, const char_type* __low, const char_type* __high) const + do_scan_not(mask /*__m*/, const char_type* __low, + const char_type* /*__high*/) const { - while (__low < __high - && static_cast<__table_type>(*__low) < _S_table_size - && (_M_ctable[*__low] & __m)) - ++__low; + // XXX return __low; } wchar_t ctype<wchar_t>:: do_widen(char __c) const - { return static_cast<wchar_t>((unsigned char)__c); } + { + // XXX + return static_cast<wchar_t>((unsigned char)__c); + } const char* ctype<wchar_t>:: - do_widen(const char* __low, const char* __high, wchar_t* __dest) const + do_widen(const char* /*__low*/, const char* __high, + wchar_t* /*__dest*/) const { - while (__low < __high) - *__dest++ = static_cast<wchar_t>((unsigned char)*__low++); + // XXX return __high; } char ctype<wchar_t>:: - do_narrow(wchar_t __c, char __dfault) const + do_narrow(wchar_t /*__c*/, char __dfault) const { - return ((static_cast<__table_type>(__c) < _S_table_size) - ? static_cast<char>(__c) : __dfault); + // XXX + return __dfault; } const wchar_t* ctype<wchar_t>:: - do_narrow(const wchar_t* __low, const wchar_t* __high, - char __dfault, char* __dest) const + do_narrow(const wchar_t* /*__low*/, const wchar_t* __high, + char /*__dfault*/, char* /*__dest*/) const { - for (; __low < __high; ++__dest, ++__low) - *__dest = (static_cast<__table_type>(*__low) < _S_table_size) - ? static_cast<char>(*__low) : __dfault; + // XXX return __high; } |