locale_facets.h (ctype): Remove _Ctype_nois and _Ctype and replace with common __ctype_abstract_base.
2000-12-06 Benjamin Kosnik <bkoz@kredhat.com> * include/bits/locale_facets.h (ctype): Remove _Ctype_nois and _Ctype and replace with common __ctype_abstract_base. (ctype<wchar_t>::_M_convert_to_wmask): Move to locale.cc. * config/os/gnu-linux/bits/ctype_noninline.h (ctype<char>::ctype): And here. * config/os/solaris/solaris2.7/bits/ctype_noninline.h (ctype): Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h (ctype): Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h (ctype): Same. * config/os/newlib/bits/ctype_noninline.h (ctype): Same. * config/os/irix/bits/ctype_noninline.h (ctype): Same. * config/os/hpux/bits/ctype_noninline.h (ctype): Same. * config/os/generic/bits/ctype_noninline.h (ctype): Same. * config/os/aix/bits/ctype_noninline.h (ctype): Same. * config/os/bsd/netbsd/bits/ctype_noninline.h (ctype): Same. * config/os/bsd/freebsd/bits/ctype_noninline.h (ctype): Same. * src/locale-inst.cc: Clean instantiations. * src/locale.cc (ctype<char>): Add definitions here. (ctype<wchar_t>::_M_wmask): Move definitions here. * config/os/generic/bits/ctype_inline.h (ctype<char>::is): Implement in a generic way, with only "C" functionality and no knowlege of the target os. * config/os/generic/bits/os_defines.h: Change comments to C++ style. * testsuite/22_locale/ctype_char_members.cc (test01): Add tests. * include/bits/codecvt.h (ctype_byname): Remove specializations, as not required. * include/bits/localefwd.h (codecvt_byname): And here. * src/codecvt.cc: Remove codecvt_byname specializations. * include/c/bits/std_cstdio.h: Include c++config.h. From-SVN: r38100
This commit is contained in:
parent
1120a1d327
commit
167ed88f7a
@ -1,3 +1,37 @@
|
||||
2000-12-06 Benjamin Kosnik <bkoz@kredhat.com>
|
||||
|
||||
* include/bits/locale_facets.h (ctype): Remove _Ctype_nois and
|
||||
_Ctype and replace with common __ctype_abstract_base.
|
||||
(ctype<wchar_t>::_M_convert_to_wmask): Move to locale.cc.
|
||||
* config/os/gnu-linux/bits/ctype_noninline.h (ctype<char>::ctype):
|
||||
And here.
|
||||
* config/os/solaris/solaris2.7/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/solaris/solaris2.6/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/solaris/solaris2.5/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/newlib/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/irix/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/hpux/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/generic/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/aix/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/bsd/netbsd/bits/ctype_noninline.h (ctype): Same.
|
||||
* config/os/bsd/freebsd/bits/ctype_noninline.h (ctype): Same.
|
||||
* src/locale-inst.cc: Clean instantiations.
|
||||
* src/locale.cc (ctype<char>): Add definitions here.
|
||||
(ctype<wchar_t>::_M_wmask): Move definitions here.
|
||||
|
||||
* config/os/generic/bits/ctype_inline.h (ctype<char>::is):
|
||||
Implement in a generic way, with only "C" functionality and no
|
||||
knowlege of the target os.
|
||||
* config/os/generic/bits/os_defines.h: Change comments to C++ style.
|
||||
* testsuite/22_locale/ctype_char_members.cc (test01): Add tests.
|
||||
|
||||
* include/bits/codecvt.h (ctype_byname): Remove specializations,
|
||||
as not required.
|
||||
* include/bits/localefwd.h (codecvt_byname): And here.
|
||||
* src/codecvt.cc: Remove codecvt_byname specializations.
|
||||
|
||||
* include/c/bits/std_cstdio.h: Include c++config.h.
|
||||
|
||||
2000-12-06 Phil Edwards <pme@sources.redhat.com>
|
||||
|
||||
* acinclude.m4 (GLIBCPP_CHECK_*_DECL_AND_LINKAGE_*): Pre-test
|
||||
@ -15,7 +49,7 @@
|
||||
* configure.target (*-*-freebsd, *-*-netbsd): Correct paths to
|
||||
os_include_dir.
|
||||
|
||||
Tue Dec 5 20:24:15 2000 Jeffrey A Law (law@cygnus.com)
|
||||
2000-12-05 Jeffrey A Law <law@cygnus.com>
|
||||
|
||||
* configure.target (hpux): Set os_include_dir.
|
||||
* config/os/hpux/bits/ctype_base.h: New file
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL),
|
||||
_M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL),
|
||||
_M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL),
|
||||
_M_ctable(NULL), _M_table(__table == 0 ? (_ctype_ + 1) : __table)
|
||||
{ }
|
||||
|
@ -34,11 +34,57 @@
|
||||
// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
|
||||
// functions go in ctype.cc
|
||||
|
||||
// The following definitions are portable, but insanely slow. If one
|
||||
// cares at all about performance, then specialized ctype
|
||||
// functionality should be added for the native os in question: see
|
||||
// the config/os/bits/ctype_*.h files.
|
||||
|
||||
bool
|
||||
ctype<char>::
|
||||
is(mask __m, char __c) const throw()
|
||||
{ return _M_table[(unsigned char)(__c)] & __m; }
|
||||
|
||||
{
|
||||
bool __ret = false;
|
||||
switch (__m)
|
||||
{
|
||||
case space:
|
||||
__ret = isspace(__c);
|
||||
break;
|
||||
case print:
|
||||
__ret = isprint(__c);
|
||||
break;
|
||||
case cntrl:
|
||||
__ret = iscntrl(__c);
|
||||
break;
|
||||
case upper:
|
||||
__ret = isupper(__c);
|
||||
break;
|
||||
case lower:
|
||||
__ret = islower(__c);
|
||||
break;
|
||||
case alpha:
|
||||
__ret = isalpha(__c);
|
||||
break;
|
||||
case digit:
|
||||
__ret = isdigit(__c);
|
||||
break;
|
||||
case punct:
|
||||
__ret = ispunct(__c);
|
||||
break;
|
||||
case xdigit:
|
||||
__ret = isxdigit(__c);
|
||||
break;
|
||||
case alnum:
|
||||
__ret = isalnum(__c);
|
||||
break;
|
||||
case graph:
|
||||
__ret = isgraph(__c);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
const char*
|
||||
ctype<char>::
|
||||
is(const char* __low, const char* __high, mask* __vec) const throw()
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL),
|
||||
_M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -31,11 +31,7 @@
|
||||
#ifndef _GLIBCPP_OS_DEFINES
|
||||
# define _GLIBCPP_OS_DEFINES
|
||||
|
||||
|
||||
/* System-specific #define, typedefs, corrections, etc, go here. This
|
||||
file will come before all others. */
|
||||
|
||||
// System-specific #define, typedefs, corrections, etc, go here. This
|
||||
// file will come before all others.
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#endif
|
||||
|
||||
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
|
||||
_M_ctable(__ctype_b), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL),
|
||||
_M_ctable(NULL), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -35,10 +35,8 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL),
|
||||
_M_tolower(NULL),
|
||||
_M_ctable(NULL),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL),
|
||||
_M_table(!__table
|
||||
? (const mask*) (__libc_attr._ctype_tbl->_class + 1)
|
||||
: __table)
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL),
|
||||
_M_ctable(_ctype_), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(NULL), _M_tolower(NULL),
|
||||
_M_ctable(__ctype), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(__trans_upper), _M_tolower(__trans_lower),
|
||||
_M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
|
||||
size_t __refs = 0)
|
||||
: _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
|
||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||
_M_toupper(__trans_upper), _M_tolower(__trans_lower),
|
||||
_M_ctable(__ctype_mask), _M_table(__table == 0 ? _M_ctable: __table)
|
||||
{ }
|
||||
|
@ -385,11 +385,11 @@ namespace std
|
||||
// in the future. Using this adaptor, g++ will do the work for us.
|
||||
template<typename _T>
|
||||
inline size_t
|
||||
__iconv_adaptor(size_t(*iconv_func)(iconv_t, _T, size_t *, char**, size_t*),
|
||||
iconv_t cd, char **inbuf, size_t *inbytesleft,
|
||||
char **outbuf, size_t *outbytesleft)
|
||||
__iconv_adaptor(size_t(*iconv_func)(iconv_t, _T, size_t*, char**, size_t*),
|
||||
iconv_t cd, char** inbuf, size_t* inbytesleft,
|
||||
char** outbuf, size_t* outbytesleft)
|
||||
{
|
||||
return iconv_func (cd, (_T)inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
return iconv_func(cd, (_T)inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
}
|
||||
|
||||
template<typename _InternT, typename _ExternT>
|
||||
@ -709,40 +709,11 @@ namespace std
|
||||
public:
|
||||
explicit
|
||||
codecvt_byname(const char*, size_t __refs = 0)
|
||||
: codecvt<_InternT,_ExternT,_StateT> (__refs) { }
|
||||
: codecvt<_InternT, _ExternT, _StateT>(__refs) { }
|
||||
protected:
|
||||
virtual
|
||||
~codecvt_byname() { }
|
||||
};
|
||||
|
||||
template<>
|
||||
class codecvt_byname<char, char, mbstate_t>
|
||||
: public codecvt<char, char, mbstate_t>
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
codecvt_byname(const char*, size_t __refs = 0);
|
||||
|
||||
protected:
|
||||
virtual
|
||||
~codecvt_byname();
|
||||
};
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
class codecvt_byname<wchar_t, char, mbstate_t>
|
||||
: public codecvt<wchar_t, char, mbstate_t>
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
codecvt_byname(const char*, size_t __refs = 0);
|
||||
|
||||
protected:
|
||||
virtual
|
||||
~codecvt_byname();
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // _CPP_BITS_CODECVT_H
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include <typeinfo> // For bad_cast, which shouldn't be here.
|
||||
#include <bits/std_ios.h> // For ios_base
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
#include <bits/std_cwctype.h> // For wctype_t
|
||||
#endif /* _GLIBCPP_USE_WCHAR_T */
|
||||
# include <bits/std_cwctype.h> // For wctype_t
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
@ -83,15 +83,30 @@ namespace std
|
||||
#include <bits/ctype_base.h>
|
||||
|
||||
// 22.2.1.1 Template class ctype
|
||||
// _Ctype_nois is the common base for ctype<char>. It lacks "do_is"
|
||||
// and related virtuals. These are filled in by _Ctype, below.
|
||||
// __ctype_abstract_base is the common base for ctype<_CharT>.
|
||||
template<typename _CharT>
|
||||
class _Ctype_nois : public locale::facet, public ctype_base
|
||||
class __ctype_abstract_base : public locale::facet, public ctype_base
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
typedef _CharT char_type;
|
||||
|
||||
bool
|
||||
is(mask __m, char_type __c) const
|
||||
{ return this->do_is(__m, __c); }
|
||||
|
||||
const char_type*
|
||||
is(const char_type *__lo, const char_type *__hi, mask *__vec) const
|
||||
{ return this->do_is(__lo, __hi, __vec); }
|
||||
|
||||
const char_type*
|
||||
scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
|
||||
{ return this->do_scan_is(__m, __lo, __hi); }
|
||||
|
||||
const char_type*
|
||||
scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
|
||||
{ return this->do_scan_not(__m, __lo, __hi); }
|
||||
|
||||
char_type
|
||||
toupper(char_type __c) const
|
||||
{ return this->do_toupper(__c); }
|
||||
@ -127,11 +142,26 @@ namespace std
|
||||
|
||||
protected:
|
||||
explicit
|
||||
_Ctype_nois(size_t __refs = 0): locale::facet(__refs) { }
|
||||
__ctype_abstract_base(size_t __refs = 0): locale::facet(__refs) { }
|
||||
|
||||
virtual
|
||||
~_Ctype_nois() { }
|
||||
~__ctype_abstract_base() { }
|
||||
|
||||
virtual bool
|
||||
do_is(mask __m, char_type __c) const = 0;
|
||||
|
||||
virtual const char_type*
|
||||
do_is(const char_type* __lo, const char_type* __hi,
|
||||
mask* __vec) const = 0;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_is(mask __m, const char_type* __lo,
|
||||
const char_type* __hi) const = 0;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_not(mask __m, const char_type* __lo,
|
||||
const char_type* __hi) const = 0;
|
||||
|
||||
virtual char_type
|
||||
do_toupper(char_type) const = 0;
|
||||
|
||||
@ -159,163 +189,28 @@ namespace std
|
||||
char __dfault, char* __dest) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// NB: Generic, mostly useless implementation.
|
||||
template<typename _CharT>
|
||||
class _Ctype : public _Ctype_nois<_CharT>
|
||||
class ctype : public __ctype_abstract_base<_CharT>
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
typedef _CharT char_type;
|
||||
typedef typename _Ctype_nois<_CharT>::mask mask;
|
||||
|
||||
bool
|
||||
is(mask __m, char_type __c) const
|
||||
{ return this->do_is(__m, __c); }
|
||||
|
||||
const char_type*
|
||||
is(const char_type *__lo, const char_type *__hi, mask *__vec) const
|
||||
{ return this->do_is(__lo, __hi, __vec); }
|
||||
|
||||
const char_type*
|
||||
scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
|
||||
{ return this->do_scan_is(__m, __lo, __hi); }
|
||||
|
||||
const char_type*
|
||||
scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
|
||||
{ return this->do_scan_not(__m, __lo, __hi); }
|
||||
|
||||
protected:
|
||||
explicit
|
||||
_Ctype(size_t __refs = 0) : _Ctype_nois<_CharT>(__refs) { }
|
||||
|
||||
virtual
|
||||
~_Ctype() { }
|
||||
|
||||
virtual bool
|
||||
do_is(mask __m, char_type __c) const = 0;
|
||||
|
||||
virtual const char_type*
|
||||
do_is(const char_type* __lo, const char_type* __hi,
|
||||
mask* __vec) const = 0;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_is(mask __m, const char_type* __lo,
|
||||
const char_type* __hi) const = 0;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_not(mask __m, const char_type* __lo,
|
||||
const char_type* __hi) const = 0;
|
||||
};
|
||||
|
||||
template<typename _CharT>
|
||||
class ctype : public _Ctype<_CharT>
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
typedef _CharT char_type;
|
||||
typedef typename ctype::mask mask;
|
||||
typedef _CharT char_type;
|
||||
typedef typename ctype::mask mask;
|
||||
|
||||
explicit
|
||||
ctype(size_t __refs = 0) : _Ctype<_CharT>(__refs) { }
|
||||
ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
virtual
|
||||
~ctype() { }
|
||||
|
||||
virtual bool
|
||||
do_is(mask, char_type) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_is(const char_type* __lo, const char_type*, mask*) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __lo;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_is(mask, const char_type* __lo, const char_type*) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __lo;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_not(mask, const char_type* __lo, const char_type*) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __lo;
|
||||
}
|
||||
|
||||
virtual char_type
|
||||
do_toupper(char_type __c) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __c;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_toupper(char_type* __lo, const char_type*) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __lo;
|
||||
}
|
||||
|
||||
virtual char_type
|
||||
do_tolower(char_type __c) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __c;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_tolower(char_type* __lo, const char_type*) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __lo;
|
||||
}
|
||||
|
||||
virtual char_type
|
||||
do_widen(char __c) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __c;
|
||||
}
|
||||
|
||||
virtual const char*
|
||||
do_widen(const char* __lo, const char*, char_type*) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __lo;
|
||||
}
|
||||
|
||||
virtual char
|
||||
do_narrow(char_type, char __c) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __c;
|
||||
}
|
||||
|
||||
virtual const char_type*
|
||||
do_narrow(const char_type* __lo, const char_type*, char, char*) const
|
||||
{
|
||||
// XXX Need definitions for these abstract mf's.
|
||||
return __lo;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 22.2.1.3 ctype specializations
|
||||
// NB: Can use _Ctype_nois to actually implement the "is"
|
||||
// functionality in the non-virtual (thus inline-able) member
|
||||
// fuctions.
|
||||
template<>
|
||||
class ctype<char> : public _Ctype_nois<char>
|
||||
class ctype<char> : public __ctype_abstract_base<char>
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
@ -363,6 +258,21 @@ namespace std
|
||||
classic_table() throw()
|
||||
{ return _M_ctable; }
|
||||
|
||||
virtual bool
|
||||
do_is(mask __m, char_type __c) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_is(const char_type* __lo, const char_type* __hi,
|
||||
mask* __vec) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_is(mask __m, const char_type* __lo,
|
||||
const char_type* __hi) const;
|
||||
|
||||
virtual const char_type*
|
||||
do_scan_not(mask __m, const char_type* __lo,
|
||||
const char_type* __hi) const;
|
||||
|
||||
virtual char_type
|
||||
do_toupper(char_type) const;
|
||||
|
||||
@ -397,7 +307,7 @@ namespace std
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
// ctype<wchar_t> specialization
|
||||
template<>
|
||||
class ctype<wchar_t> : public _Ctype<wchar_t>
|
||||
class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
@ -413,49 +323,7 @@ namespace std
|
||||
|
||||
protected:
|
||||
__wmask_type
|
||||
_M_convert_to_wmask(const mask __m) const
|
||||
{
|
||||
__wmask_type __ret;
|
||||
switch (__m)
|
||||
{
|
||||
case space:
|
||||
__ret = wctype("space");
|
||||
break;
|
||||
case print:
|
||||
__ret = wctype("print");
|
||||
break;
|
||||
case cntrl:
|
||||
__ret = wctype("cntrl");
|
||||
break;
|
||||
case upper:
|
||||
__ret = wctype("upper");
|
||||
break;
|
||||
case lower:
|
||||
__ret = wctype("lower");
|
||||
break;
|
||||
case alpha:
|
||||
__ret = wctype("alpha");
|
||||
break;
|
||||
case digit:
|
||||
__ret = wctype("digit");
|
||||
break;
|
||||
case punct:
|
||||
__ret = wctype("punct");
|
||||
break;
|
||||
case xdigit:
|
||||
__ret = wctype("xdigit");
|
||||
break;
|
||||
case alnum:
|
||||
__ret = wctype("alnum");
|
||||
break;
|
||||
case graph:
|
||||
__ret = wctype("graph");
|
||||
break;
|
||||
default:
|
||||
__ret = 0;
|
||||
}
|
||||
return __ret;
|
||||
};
|
||||
_M_convert_to_wmask(const mask __m) const;
|
||||
|
||||
virtual
|
||||
~ctype();
|
||||
@ -526,13 +394,9 @@ namespace std
|
||||
~ctype_byname() { }
|
||||
};
|
||||
|
||||
// 22.2.1.4 Class ctype_byname specializations
|
||||
// 22.2.1.4 Class ctype_byname specialization
|
||||
template<>
|
||||
ctype_byname<char>::ctype_byname(const char*, size_t refs);
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);
|
||||
#endif
|
||||
|
||||
|
||||
template<typename _CharT, typename _InIter>
|
||||
|
@ -153,10 +153,6 @@ namespace std
|
||||
|
||||
template<typename _InternT, typename _ExternT, typename _StateT>
|
||||
class codecvt_byname;
|
||||
template<> class codecvt_byname<char, char, mbstate_t>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<> class codecvt_byname<wchar_t, char, mbstate_t>;
|
||||
#endif
|
||||
|
||||
// 22.2.2 and 22.2.3 numeric
|
||||
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
|
||||
|
@ -36,6 +36,7 @@
|
||||
#ifndef _CPP_CSTDIO
|
||||
#define _CPP_CSTDIO 1
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <bits/std_cstdarg.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
|
@ -105,13 +105,6 @@ namespace std {
|
||||
do_max_length() const throw()
|
||||
{ return 1; }
|
||||
|
||||
codecvt_byname<char, char, mbstate_t>::
|
||||
codecvt_byname(const char* /*__s*/, size_t __refs)
|
||||
: codecvt<char, char, mbstate_t>(__refs) { }
|
||||
|
||||
codecvt_byname<char, char, mbstate_t>::
|
||||
~codecvt_byname() { }
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
// codecvt<wchar_t, char, mbstate_t> required specialization
|
||||
locale::id codecvt<wchar_t, char, mbstate_t>::id;
|
||||
@ -210,13 +203,6 @@ namespace std {
|
||||
codecvt<wchar_t, char, mbstate_t>::
|
||||
do_max_length() const throw()
|
||||
{ return 1; }
|
||||
|
||||
codecvt_byname<wchar_t, char, mbstate_t>::
|
||||
codecvt_byname(const char* /*__s*/, size_t __refs)
|
||||
: codecvt<wchar_t, char, mbstate_t> (__refs) { }
|
||||
|
||||
codecvt_byname<wchar_t, char, mbstate_t>::
|
||||
~codecvt_byname() { }
|
||||
#endif // _GLIBCPP_USE_WCHAR_T
|
||||
|
||||
} // namespace std
|
||||
|
@ -118,20 +118,20 @@ namespace std {
|
||||
#endif
|
||||
|
||||
// ctype
|
||||
// template class ctype<unsigned char>; // No definitions avail.
|
||||
// template class ctype<signed char>; // No definitions avail.
|
||||
template class _Ctype<char>;
|
||||
template class _Ctype_nois<char>;
|
||||
template class __ctype_abstract_base<char>;
|
||||
template class ctype_byname<char>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template class _Ctype<wchar_t>;
|
||||
template class _Ctype_nois<wchar_t>;
|
||||
template class __ctype_abstract_base<wchar_t>;
|
||||
template class ctype_byname<wchar_t>;
|
||||
#endif
|
||||
|
||||
// codecvt
|
||||
template class __codecvt_abstract_base<char, char, mbstate_t>;
|
||||
template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
|
||||
template class codecvt_byname<char, char, mbstate_t>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template class codecvt_byname<wchar_t, char, mbstate_t>;
|
||||
#endif
|
||||
|
||||
// collate
|
||||
template class _Collate<char>;
|
||||
|
@ -788,6 +788,23 @@ namespace std {
|
||||
ctype<char>::~ctype()
|
||||
{ if (_M_del) delete[] this->table(); }
|
||||
|
||||
// These are dummy placeholders as these virtual functions are never called.
|
||||
bool
|
||||
ctype<char>::do_is(mask, char_type) const
|
||||
{ return false; }
|
||||
|
||||
const char*
|
||||
ctype<char>::do_is(const char_type* __c, const char_type*, mask*) const
|
||||
{ return __c; }
|
||||
|
||||
const char*
|
||||
ctype<char>::do_scan_is(mask, const char_type* __c, const char_type*) const
|
||||
{ return __c; }
|
||||
|
||||
const char*
|
||||
ctype<char>::do_scan_not(mask, const char_type* __c, const char_type*) const
|
||||
{ return __c; }
|
||||
|
||||
char
|
||||
ctype<char>::do_widen(char __c) const
|
||||
{ return __c; }
|
||||
@ -875,12 +892,58 @@ namespace std {
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
locale::id ctype<wchar_t>::id;
|
||||
|
||||
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("space");
|
||||
break;
|
||||
case print:
|
||||
__ret = wctype("print");
|
||||
break;
|
||||
case cntrl:
|
||||
__ret = wctype("cntrl");
|
||||
break;
|
||||
case upper:
|
||||
__ret = wctype("upper");
|
||||
break;
|
||||
case lower:
|
||||
__ret = wctype("lower");
|
||||
break;
|
||||
case alpha:
|
||||
__ret = wctype("alpha");
|
||||
break;
|
||||
case digit:
|
||||
__ret = wctype("digit");
|
||||
break;
|
||||
case punct:
|
||||
__ret = wctype("punct");
|
||||
break;
|
||||
case xdigit:
|
||||
__ret = wctype("xdigit");
|
||||
break;
|
||||
case alnum:
|
||||
__ret = wctype("alnum");
|
||||
break;
|
||||
case graph:
|
||||
__ret = wctype("graph");
|
||||
break;
|
||||
default:
|
||||
__ret = 0;
|
||||
}
|
||||
return __ret;
|
||||
};
|
||||
|
||||
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) : _Ctype<wchar_t>(__refs) { }
|
||||
ctype<wchar_t>::ctype(size_t __refs) : __ctype_abstract_base<wchar_t>(__refs)
|
||||
{ }
|
||||
|
||||
wchar_t
|
||||
ctype<wchar_t>::do_toupper(wchar_t __c) const
|
||||
|
@ -33,7 +33,7 @@
|
||||
// NB: Don't include any other headers in this file.
|
||||
#include <debug_assert.h>
|
||||
|
||||
class gnu_ctype: public std::ctype<char> {};
|
||||
class gnu_ctype: public std::ctype<char> { };
|
||||
|
||||
void test01()
|
||||
{
|
||||
@ -71,6 +71,22 @@ void test01()
|
||||
VERIFY( gctype.is(std::ctype_base::graph, c40) );
|
||||
VERIFY( gctype.is(std::ctype_base::graph, c20) );
|
||||
|
||||
// const char* is(const char* low, const char* high, mask* vec) const
|
||||
std::ctype_base::mask m01 = static_cast<std::ctype_base::mask>(0);
|
||||
std::ctype_base::mask m02 = std::ctype_base::digit;
|
||||
const char* cc0 = strlit00;
|
||||
const char* cc1 = NULL;
|
||||
const char* cc2 = NULL;
|
||||
#if 1
|
||||
cc1 = gctype.is(cc0, cc0, &m01);
|
||||
VERIFY( cc1 == strlit00 );
|
||||
cc2 = gctype.is(cc0, cc0 + 3, &m01);
|
||||
VERIFY( cc2 == strlit00 + 3);
|
||||
|
||||
cc1 = gctype.is(cc0, cc0 + 13, &m02);
|
||||
VERIFY( cc1 == strlit00 + 13);
|
||||
#endif
|
||||
|
||||
// char toupper(char c) const
|
||||
c100 = gctype.toupper(c10);
|
||||
VERIFY( c100 == c00 );
|
||||
|
Loading…
Reference in New Issue
Block a user