From 93dbe8d76d1cdf06f6108260b0d35989e906ee9b Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Mon, 21 Jan 2002 04:08:54 +0000 Subject: [PATCH] [multiple changes] 2002-01-20 Benjamin Kosnik * include/bits/locale_facets.h (ctype::classic_table): Remove definition. (ctype::_S_ctable): Remove. * config/os/gnu-linux/bits/ctype_noninline.h (ctype::_S_table): Remove definition. (ctype::classic_table): Define. (ctype::ctype): Replace _S_ctable with classic_table(). * config/os/aix/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/generic/bits/ctype_noninline.h: Same. * config/os/gnu-linux/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/mingw32/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. 2002-01-20 Danny Smith * config/os/mingw32/bits/ctype_noninline.h: Declare _ctype instead of _pctype. Use to define _S_ctable. Add definition for alternate ctor. Initialise _M_ctable to _S_ctable in ctors. (do_toupper, do_tolower): Use inline code appropriate for C-locale rather than ::toupper, ::tolower. From-SVN: r49032 --- libstdc++-v3/ChangeLog | 32 +++++++++++++++++++ libstdc++-v3/config/os/aix/bits/ctype_noninline.h | 11 ++++--- .../config/os/bsd/freebsd/bits/ctype_noninline.h | 9 +++--- .../config/os/bsd/netbsd/bits/ctype_noninline.h | 5 +-- .../config/os/djgpp/bits/ctype_noninline.h | 5 +-- .../config/os/generic/bits/ctype_noninline.h | 11 ++++--- .../config/os/gnu-linux/bits/ctype_noninline.h | 11 ++++--- libstdc++-v3/config/os/hpux/bits/ctype_noninline.h | 7 +++-- .../config/os/irix/irix5.2/bits/ctype_noninline.h | 5 +-- .../config/os/irix/irix6.5/bits/ctype_noninline.h | 5 +-- .../config/os/mingw32/bits/ctype_noninline.h | 36 +++++++++++++++------- .../config/os/newlib/bits/ctype_noninline.h | 9 +++--- .../os/solaris/solaris2.5/bits/ctype_noninline.h | 11 ++++--- .../os/solaris/solaris2.6/bits/ctype_noninline.h | 9 +++--- .../os/solaris/solaris2.7/bits/ctype_noninline.h | 9 +++--- libstdc++-v3/include/bits/locale_facets.h | 4 +-- 16 files changed, 118 insertions(+), 61 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d8ada87..16dc9b3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,35 @@ +2002-01-20 Benjamin Kosnik + + * include/bits/locale_facets.h (ctype::classic_table): + Remove definition. + (ctype::_S_ctable): Remove. + * config/os/gnu-linux/bits/ctype_noninline.h + (ctype::_S_table): Remove definition. + (ctype::classic_table): Define. + (ctype::ctype): Replace _S_ctable with classic_table(). + * config/os/aix/bits/ctype_noninline.h: Same. + * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. + * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. + * config/os/djgpp/bits/ctype_noninline.h: Same. + * config/os/generic/bits/ctype_noninline.h: Same. + * config/os/gnu-linux/bits/ctype_noninline.h: Same. + * config/os/hpux/bits/ctype_noninline.h: Same. + * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. + * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. + * config/os/mingw32/bits/ctype_noninline.h: Same. + * config/os/newlib/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. + * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. + +2002-01-20 Danny Smith + + * config/os/mingw32/bits/ctype_noninline.h: Declare _ctype instead + of _pctype. Use to define _S_ctable. Add definition for alternate + ctor. Initialise _M_ctable to _S_ctable in ctors. + (do_toupper, do_tolower): Use inline code appropriate for C-locale + rather than ::toupper, ::tolower. + 2002-01-18 Loren Rittle * testsuite/18_support/numeric_limits.cc (test_extrema): diff --git a/libstdc++-v3/config/os/aix/bits/ctype_noninline.h b/libstdc++-v3/config/os/aix/bits/ctype_noninline.h index dabcae9..0e081d7 100644 --- a/libstdc++-v3/config/os/aix/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/aix/bits/ctype_noninline.h @@ -33,18 +33,19 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; - + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } + ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : classic_table()) { } ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h index db58ecb..9b45244 100644 --- a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_noninline.h @@ -33,18 +33,19 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : classic_table()) { } ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : _S_ctable) + _M_toupper(NULL), _M_tolower(NULL), _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h index f27d93d..ee9475e 100644 --- a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_noninline.h @@ -33,8 +33,9 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) diff --git a/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h index fd68e81..e84468c 100644 --- a/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/djgpp/bits/ctype_noninline.h @@ -33,8 +33,9 @@ // Information as gleaned from DJGPP - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } ctype::ctype(__c_locale, const mask* __table = 0, bool __del = false, size_t __refs = 0) diff --git a/libstdc++-v3/config/os/generic/bits/ctype_noninline.h b/libstdc++-v3/config/os/generic/bits/ctype_noninline.h index 36846d7..9fec00b 100644 --- a/libstdc++-v3/config/os/generic/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/generic/bits/ctype_noninline.h @@ -34,20 +34,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; - + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } + ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table == 0 ? _S_ctable : __table) + _M_table(__table == 0 ? classic_table() : __table) { } ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table == 0 ? _S_ctable : __table) + _M_table(__table == 0 ? classic_table() : __table) { } char diff --git a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h index 1f2bdcf..86a38fa 100644 --- a/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/gnu-linux/bits/ctype_noninline.h @@ -40,9 +40,10 @@ using _C_legacy::__ctype_b; #endif - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable = __ctype_b; - + const ctype_base::mask* + ctype::classic_table() throw() + { return __ctype_b; } + #if _GLIBCPP_C_LOCALE_GNU ctype::ctype(__c_locale __cloc, const mask* __table, bool __del, size_t __refs) @@ -58,14 +59,14 @@ size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { _M_c_locale_ctype = NULL; } #endif ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { _M_c_locale_ctype = NULL; } char diff --git a/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h b/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h index fae41de..7ec3b30 100644 --- a/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/hpux/bits/ctype_noninline.h @@ -34,9 +34,10 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; - + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } + ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h index 10fef4e..f9df21f 100644 --- a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h @@ -34,8 +34,9 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) diff --git a/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h index 73676f0..009e611 100644 --- a/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h @@ -33,8 +33,9 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) diff --git a/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h b/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h index a877cf8..11a7843 100644 --- a/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/mingw32/bits/ctype_noninline.h @@ -1,6 +1,6 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +// Copyright (C) 1997, 1998, 1999, 2000, 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 @@ -33,26 +33,37 @@ // Information as gleaned from /mingw32/include/ctype.h. -// This should be in mingw's ctype.h but isn't in older versions + // This should be in mingw's ctype.h but isn't in older versions + // Static classic C-locale table. _ctype[0] is EOF + extern "C" unsigned short __declspec(dllimport) _ctype[]; - extern "C" unsigned short* __declspec(dllimport) _pctype; + const ctype_base::mask* + ctype::classic_table() throw() + { return _ctype + 1; } + + ctype::ctype(__c_locale, const mask* __table = 0, bool __del = false, + size_t __refs = 0) + : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } ctype::ctype(const mask* __table, bool __del, size_t __refs) - : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), - _M_toupper(NULL), _M_tolower(NULL), - _M_ctable(NULL), _M_table(__table == 0 ? (_pctype) : __table) - { } + : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), + _M_toupper(NULL), _M_tolower(NULL), + _M_table(__table ? __table : classic_table()) + { } char ctype::do_toupper(char __c) const - { return ::toupper((int) __c); } + { return (this->is(ctype_base::lower, __c) ? (__c - 'a' + 'A') : __c); } const char* ctype::do_toupper(char* __low, const char* __high) const { while (__low < __high) { - *__low = ::toupper((int) *__low); + *__low = this->do_toupper(*__low); ++__low; } return __high; @@ -60,16 +71,19 @@ char ctype::do_tolower(char __c) const - { return ::tolower((int) __c); } + { return (this->is(ctype_base::upper, __c) ? (__c - 'A' + 'a') : __c); } const char* ctype::do_tolower(char* __low, const char* __high) const { while (__low < __high) { - *__low = ::tolower((int) *__low); + *__low = this->do_tolower(*__low); ++__low; } return __high; } + + + diff --git a/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h b/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h index 89a486b..546f5c5 100644 --- a/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/newlib/bits/ctype_noninline.h @@ -33,20 +33,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h index a37df89..9ab764a 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_noninline.h @@ -33,20 +33,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; - + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } + ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(NULL), _M_tolower(NULL), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h index 19ad6d9..8e1c2d7 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.6/bits/ctype_noninline.h @@ -33,20 +33,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable; + const ctype_base::mask* + ctype::classic_table() throw() + { return 0; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } char diff --git a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h index c668ae2..eafc1fc 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_noninline.h @@ -34,20 +34,21 @@ // Information as gleaned from /usr/include/ctype.h - // Data for classic_table(). - const ctype_base::mask* ctype::_S_ctable = __ctype_mask; + const ctype_base::mask* + ctype::classic_table() throw() + { return __ctype_mask; } ctype::ctype(__c_locale, const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table ? __table : _S_ctable) + _M_table(__table ? __table : classic_table()) { } ctype::ctype(const mask* __table, bool __del, size_t __refs) : __ctype_abstract_base(__refs), _M_del(__table != 0 && __del), _M_toupper(__trans_upper), _M_tolower(__trans_lower), - _M_table(__table == 0 ? __table : _S_ctable) + _M_table(__table == 0 ? __table : classic_table()) { } char diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 8108bf0..9f435be 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -238,7 +238,6 @@ namespace std public: static locale::id id; static const size_t table_size = 1 + static_cast(-1); - static const mask* _S_ctable; explicit ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); @@ -265,8 +264,7 @@ namespace std { return _M_table; } static const mask* - classic_table() throw() - { return _S_ctable; } + classic_table() throw(); virtual ~ctype(); -- 2.7.4