+2001-12-12 Benjamin Kosnik <bkoz@redhat.com>
+
+ Named locale support for ctype<char>.
+ * config/locale/c_locale_gnu.h (_GLIBCPP_C_LOCALE_GNU): New.
+ * config/os/gnu-linux/bits/ctype_noninline.h (ctype<char>): Add
+ definitions for alternate constructor.
+ * 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/irix6.5/bits/ctype_noninline.h (ctype): Same.
+ * config/os/irix/irix5.2/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/djgpp/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.
+ * config/os/aix/bits/ctype_noninline.h (ctype): Same.
+ * include/bits/locale_facets.h (ctype<_CharT>): Remove dummy
+ definitions for all virtual functions. These are now explicitly
+ undefined for non-required factets, ie any non-char, non-wchar_t
+ instantiations.
+ * src/localename.cc (locale::_Impl::_Impl(string, size_t): Named
+ locales use alternate constructor for ctype facet.
+ * include/bits/locale_facets.h (ctype<char>::ctype(__c_locale, const
+ mask*, bool, size_t): Add.
+ (ctype<wchar_t>::ctype(__c_locale, size_t): Add.
+ * src/locale.cc (ctype<wchar_t>::ctype(__c_locale, size_t)): Add
+ definition.
+
+ * testsuite/22_locale/ctype_members_char.cc (test02): Add, mark
+ XFAIL for non-gnu locale models.
+
2001-12-12 Philip Martin <philip@codematters.co.uk>
Ross Smith <r-smith@ihug.co.nz>
Paolo Carlini <pcarlini@unitus.it>
#include <iconv.h> // For codecvt using iconv, iconv_t
#include <libintl.h> // For messages
+#define _GLIBCPP_C_LOCALE_GNU 1
+
namespace std
{
typedef __locale_t __c_locale;
}
-
-
-
-
-
// Locale support -*- C++ -*-
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Locale support -*- C++ -*-
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Locale support -*- C++ -*-
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Information as gleaned from DJGPP <ctype.h>
+ ctype<char>::ctype(__c_locale, const mask* __table = 0, bool __del = false,
+ size_t __refs = 0)
+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
+ _M_ctable(NULL), _M_table(__table == 0 ? __dj_ctype_flags : __table)
+ { }
+
ctype<char>::ctype(const mask* __table = 0, bool __del = false,
- size_t __refs = 0)
- : __ctype_abstract_base<char>(__refs),
- _M_del(__table != 0 && __del),
- _M_toupper(__dj_ctype_toupper),
- _M_tolower(__dj_ctype_tolower),
- _M_ctable(NULL),
- _M_table(__table == 0 ? __dj_ctype_flags : __table)
- { }
+ size_t __refs = 0)
+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
+ _M_ctable(NULL), _M_table(__table == 0 ? __dj_ctype_flags : __table)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Locale support -*- C++ -*-
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997-2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
++__low;
return __low;
}
-
-
-
-
// Locale support -*- C++ -*-
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997-2001 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
using _C_legacy::__ctype_b;
#endif
+#if _GLIBCPP_C_LOCALE_GNU
+ ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del,
+ size_t __refs)
+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(__cloc ? __cloc->__ctype_toupper : __ctype_toupper),
+ _M_tolower(__cloc ? __cloc->__ctype_tolower : __ctype_tolower),
+ _M_ctable(__ctype_b),
+ _M_table(__table ? __table : (__cloc ? __cloc->__ctype_b : __ctype_b))
+ { }
+#else
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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 ? __table : __ctype_b)
+ { }
+#endif
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) :
__ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
_M_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
// Locale support -*- C++ -*-
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997-2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
+ _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL),
+ _M_table(!__table ? __ctype : __table)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
- _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL),
- _M_table(!__table ? __ctype : __table)
+ _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL),
+ _M_table(!__table ? __ctype : __table)
{ }
char
// Locale support -*- C++ -*-
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: __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)
- { }
+ _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL),
+ _M_table(!__table ?
+ (const mask*) (__libc_attr._ctype_tbl->_class + 1) : __table)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Locale support -*- C++ -*-
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Locale support -*- C++ -*-
-// Copyright (C) 2000 Cygnus Solutions
+// Copyright (C) 2000, 2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Locale support -*- C++ -*-
-// Copyright (C) 1997-1999, 2000 Cygnus Solutions
+// Copyright (C) 1997-2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
// Locale support -*- C++ -*-
-// Copyright (C) 1997-1999, 2000 Cygnus Solutions
+// Copyright (C) 1997-2001 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
// Information as gleaned from /usr/include/ctype.h
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
+ : __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)
+ { }
+
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
- : __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)
- { }
+ : __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)
+ { }
char
ctype<char>::do_toupper(char __c) const
protected:
virtual
- ~ctype() { }
+ ~ctype();
virtual bool
- do_is(mask __m, char_type __c) const
- { return false; }
+ 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
- { return __hi; }
+ 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
- { return __hi; }
+ 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
- { return __hi; }
+ const char_type* __hi) const;
virtual char_type
- do_toupper(char_type __c) const
- { return __c; }
+ do_toupper(char_type __c) const;
virtual const char_type*
- do_toupper(char_type* __lo, const char_type* __hi) const
- { return __hi; }
+ do_toupper(char_type* __lo, const char_type* __hi) const;
virtual char_type
- do_tolower(char_type __c) const
- { return __c; }
+ do_tolower(char_type __c) const;
virtual const char_type*
- do_tolower(char_type* __lo, const char_type* __hi) const
- { return __hi; }
-
+ do_tolower(char_type* __lo, const char_type* __hi) const;
+
virtual char_type
- do_widen(char __c) const
- { return char_type(); }
+ do_widen(char __c) const;
virtual const char*
- do_widen(const char* __lo, const char* __hi, char_type* __dest) const
- { return __hi; }
+ do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
virtual char
- do_narrow(char_type, char __dfault) const
- { return __dfault; }
+ do_narrow(char_type, char __dfault) const;
virtual const char_type*
do_narrow(const char_type* __lo, const char_type* __hi,
- char __dfault, char* __dest) const
- { return __hi; }
+ char __dfault, char* __dest) const;
};
template<typename _CharT>
locale::id ctype<_CharT>::id;
- // 22.2.1.3 ctype specializations
+ // 22.2.1.3 ctype<char> specialization.
template<>
class ctype<char> : public __ctype_abstract_base<char>
{
explicit
ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);
+ explicit
+ ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,
+ size_t __refs = 0);
+
inline bool
is(mask __m, char __c) const;
use_facet<ctype<char> >(const locale& __loc);
#ifdef _GLIBCPP_USE_WCHAR_T
- // ctype<wchar_t> specialization
+ // 22.2.1.3 ctype<wchar_t> specialization
template<>
class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
{
explicit
ctype(size_t __refs = 0);
+ explicit
+ ctype(__c_locale __cloc, size_t __refs = 0);
+
protected:
__wmask_type
_M_convert_to_wmask(const mask __m) const;
// NB: These ctype<wchar_t> methods are not configuration-specific,
// unlike the ctype<char> bits.
- ctype<wchar_t>::ctype(size_t __refs) : __ctype_abstract_base<wchar_t>(__refs)
- { }
+ ctype<wchar_t>::ctype(size_t __refs)
+ : __ctype_abstract_base<wchar_t>(__refs) { }
+
+ ctype<wchar_t>::ctype(__c_locale /*__cloc*/, size_t __refs)
+ : __ctype_abstract_base<wchar_t>(__refs) { }
wchar_t
ctype<wchar_t>::do_toupper(wchar_t __c) const
// Construct all standard facets and add them to _M_facets.
// XXX How to deal cleanly, consistently with null ("C") __cloc?
_M_init_facet(new std::collate<char>(__cloc));
- _M_init_facet(new std::ctype<char>);
+ _M_init_facet(new std::ctype<char>(__cloc));
_M_init_facet(new codecvt<char, char, mbstate_t>);
_M_init_facet(new moneypunct<char, false>(__cloc));
_M_init_facet(new moneypunct<char, true>(__cloc));
#ifdef _GLIBCPP_USE_WCHAR_T
_M_init_facet(new std::collate<wchar_t>(__cloc));
- _M_init_facet(new std::ctype<wchar_t>);
+ _M_init_facet(new std::ctype<wchar_t>(__cloc));
_M_init_facet(new codecvt<wchar_t, char, mbstate_t>);
_M_init_facet(new moneypunct<wchar_t, false>(__cloc));
_M_init_facet(new moneypunct<wchar_t, true>(__cloc));
// 22.2.1.3.2 ctype<char> members
#include <locale>
-// NB: Don't include any other headers in this file.
+#include <vector>
+//#include <iostream>
+//#include <iomanip>
#include <testsuite_hooks.h>
+// XXX This test (test02) is not working for non-glibc locale models.
+// { dg-do run { xfail *-*-* } }
+
class gnu_ctype: public std::ctype<char> { };
void test01()
#endif
}
-int main() {
+// libstdc++/4456, libstdc++/4457, libstdc++/4458
+void test02()
+{
+ using namespace std;
+ typedef ctype_base::mask mask;
+ typedef vector<mask> vector_type;
+
+ bool test = true;
+
+ // const int max = numeric_limits<char>::max();
+ const int max = 255;
+ const int ctype_mask_max = 10;
+ vector_type v_c(max);
+ vector_type v_de(max);
+
+ // "C"
+ locale loc_c = locale::classic();
+ const ctype<char>& ctype_c = use_facet<ctype<char> >(loc_c);
+ for (int i = 0; i < max; ++i)
+ {
+ char c = static_cast<char>(i);
+ mask mask_test = static_cast<mask>(0);
+ mask mask_is = static_cast<mask>(0);
+ for (int j = 0; j <= ctype_mask_max; ++j)
+ {
+ mask_test = static_cast<mask>(1 << j);
+ if (ctype_c.is(mask_test, c))
+ mask_is |= mask_test;
+ }
+ v_c[i] = mask_is;
+ }
+
+ // "de_DE"
+ locale loc_de("de_DE");
+ const ctype<char>& ctype_de = use_facet<ctype<char> >(loc_de);
+ for (int i = 0; i < max; ++i)
+ {
+ char c = static_cast<char>(i);
+ mask mask_test = static_cast<mask>(0);
+ mask mask_is = static_cast<mask>(0);
+ for (int j = 0; j <= ctype_mask_max; ++j)
+ {
+ mask_test = static_cast<mask>(1 << j);
+ if (ctype_de.is(mask_test, c))
+ mask_is |= mask_test;
+ }
+ v_de[i] = mask_is;
+ }
+
+#if QUANNUM_VERBOSE_LYRICALLY_ADEPT_BAY_AREA_MCS_MODE
+ for (int i = 0; i < max; ++i)
+ {
+ char mark = v_c[i] == v_de[i] ? ' ' : '-';
+ cout << i << ' ' << mark << ' ' << static_cast<char>(i) << '\t' ;
+ cout << "v_c: " << setw(4) << v_c[i] << '\t';
+ cout << "v_de: " << setw(4) << v_de[i] << endl;
+ }
+ cout << (v_c == v_de) << endl;
+#endif
+
+ VERIFY( v_c != v_de );
+}
+
+int main()
+{
test01();
+ test02();
return 0;
}