Clean up initialization and simplfy caching of underlying "C" locale objects.
2001-12-14 Benjamin Kosnik <bkoz@redhat.com> Clean up initialization and simplfy caching of underlying "C" locale objects. * src/localename.cc (locale::_Impl::_Impl(string, size_t): Unconditionally create __clocale object for all named locales, including "C" and "POSIX". * config/locale/c_locale_generic.cc (locale::facet::_S_create_c_locale): Always set __cloc to zero. * config/locale/c_locale_gnu.cc: Always delete. * include/bits/localefwd.h (locale::facet::_S_c_locale): New. * src/locale.cc (locale::classic()): Initialize locale::facet::_S_c_locale. (locale::facet::_S_c_locale): Define. * include/bits/locale_facets.h: Add ctype_byname<wchar_t> ctor specialization. * src/locale.cc: Add definition here. * config/os/gnu-linux/bits/ctype_inline.h: Tweak. * config/os/gnu-linux/bits/ctype_noninline.h: Adjust initializations. * include/bits/locale_facets.h (ctype<char>::_M_c_locale_ctype): Add. Adjust ctors, dtors. (ctype<char>::_M_toupper): Remove const&. (ctype<char>::_M_tolower): Remove const&. (ctype<char>::_M_ctable): Remove const&. * include/bits/locale_facets.h (collate): Clean up initialization of _M_c_locale_collate in ctors and dtors. * config/locale/collate_members_gnu.cc: Always use extended functions. * include/bits/locale_facets.h (messages): Clean up inits in ctor/dtor. (messages_byname): Same. * config/locale/messages_members_generic.h (messages::~messages): Remove. * config/locale/messages_members_gnu.h: Same. * include/bits/localefwd.h: Clean. Move dtor definitions to * src/locale.cc: Here. * testsuite/22_locale/facet.cc: Fix spelling. Named locale support for ctype<wchar_t>. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add variable ctype_members_* bits. * aclocal.m4: Regenerate. * configure: Regenerate. * src/Makefile.am (sources): Add ctype.cc. * src/Makefile.in: Regenerate. * config/locale/ctype_members_generic.cc: New file. * config/locale/ctype_members_gnu.cc: New file. * src/locale.cc: Remove ctype<wchart_t> definitions. From-SVN: r48034
This commit is contained in:
parent
88f92c0f3f
commit
def9790d51
@ -1,3 +1,55 @@
|
|||||||
|
2001-12-14 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
|
Clean up initialization and simplfy caching of underlying "C"
|
||||||
|
locale objects.
|
||||||
|
* src/localename.cc (locale::_Impl::_Impl(string, size_t):
|
||||||
|
Unconditionally create __clocale object for all named locales,
|
||||||
|
including "C" and "POSIX".
|
||||||
|
* config/locale/c_locale_generic.cc
|
||||||
|
(locale::facet::_S_create_c_locale): Always set __cloc to zero.
|
||||||
|
* config/locale/c_locale_gnu.cc: Always delete.
|
||||||
|
* include/bits/localefwd.h (locale::facet::_S_c_locale): New.
|
||||||
|
* src/locale.cc (locale::classic()): Initialize
|
||||||
|
locale::facet::_S_c_locale.
|
||||||
|
(locale::facet::_S_c_locale): Define.
|
||||||
|
|
||||||
|
* include/bits/locale_facets.h: Add ctype_byname<wchar_t> ctor
|
||||||
|
specialization.
|
||||||
|
* src/locale.cc: Add definition here.
|
||||||
|
* config/os/gnu-linux/bits/ctype_inline.h: Tweak.
|
||||||
|
* config/os/gnu-linux/bits/ctype_noninline.h: Adjust initializations.
|
||||||
|
* include/bits/locale_facets.h (ctype<char>::_M_c_locale_ctype): Add.
|
||||||
|
Adjust ctors, dtors.
|
||||||
|
(ctype<char>::_M_toupper): Remove const&.
|
||||||
|
(ctype<char>::_M_tolower): Remove const&.
|
||||||
|
(ctype<char>::_M_ctable): Remove const&.
|
||||||
|
|
||||||
|
* include/bits/locale_facets.h (collate): Clean up initialization
|
||||||
|
of _M_c_locale_collate in ctors and dtors.
|
||||||
|
* config/locale/collate_members_gnu.cc: Always use extended
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* include/bits/locale_facets.h (messages): Clean up inits in ctor/dtor.
|
||||||
|
(messages_byname): Same.
|
||||||
|
* config/locale/messages_members_generic.h (messages::~messages):
|
||||||
|
Remove.
|
||||||
|
* config/locale/messages_members_gnu.h: Same.
|
||||||
|
|
||||||
|
* include/bits/localefwd.h: Clean. Move dtor definitions to
|
||||||
|
* src/locale.cc: Here.
|
||||||
|
* testsuite/22_locale/facet.cc: Fix spelling.
|
||||||
|
|
||||||
|
Named locale support for ctype<wchar_t>.
|
||||||
|
* acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add variable
|
||||||
|
ctype_members_* bits.
|
||||||
|
* aclocal.m4: Regenerate.
|
||||||
|
* configure: Regenerate.
|
||||||
|
* src/Makefile.am (sources): Add ctype.cc.
|
||||||
|
* src/Makefile.in: Regenerate.
|
||||||
|
* config/locale/ctype_members_generic.cc: New file.
|
||||||
|
* config/locale/ctype_members_gnu.cc: New file.
|
||||||
|
* src/locale.cc: Remove ctype<wchart_t> definitions.
|
||||||
|
|
||||||
2001-12-13 Roger Sayle <roger@eyesopen.com>
|
2001-12-13 Roger Sayle <roger@eyesopen.com>
|
||||||
|
|
||||||
* acconfig.h: Test for __builtin_sqrt instead of
|
* acconfig.h: Test for __builtin_sqrt instead of
|
||||||
|
@ -1059,6 +1059,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
CLOCALE_CC=config/locale/c_locale_generic.cc
|
CLOCALE_CC=config/locale/c_locale_generic.cc
|
||||||
CCODECVT_H=config/locale/codecvt_specializations_generic.h
|
CCODECVT_H=config/locale/codecvt_specializations_generic.h
|
||||||
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
||||||
|
CCTYPE_CC=config/locale/ctype_members_generic.cc
|
||||||
CMESSAGES_H=config/locale/messages_members_generic.h
|
CMESSAGES_H=config/locale/messages_members_generic.h
|
||||||
CMESSAGES_CC=config/locale/messages_members_generic.cc
|
CMESSAGES_CC=config/locale/messages_members_generic.cc
|
||||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||||
@ -1088,6 +1089,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
CLOCALE_CC=config/locale/c_locale_gnu.cc
|
CLOCALE_CC=config/locale/c_locale_gnu.cc
|
||||||
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
||||||
CCOLLATE_CC=config/locale/collate_members_gnu.cc
|
CCOLLATE_CC=config/locale/collate_members_gnu.cc
|
||||||
|
CCTYPE_CC=config/locale/ctype_members_gnu.cc
|
||||||
CMESSAGES_H=config/locale/messages_members_gnu.h
|
CMESSAGES_H=config/locale/messages_members_gnu.h
|
||||||
CMESSAGES_CC=config/locale/messages_members_gnu.cc
|
CMESSAGES_CC=config/locale/messages_members_gnu.cc
|
||||||
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
|
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
|
||||||
@ -1104,6 +1106,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
|
CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
|
||||||
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
||||||
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
||||||
|
CCTYPE_CC=config/locale/ctype_members_generic.cc
|
||||||
CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
|
CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
|
||||||
CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
|
CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
|
||||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||||
@ -1127,6 +1130,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
AC_SUBST(CMESSAGES_H)
|
AC_SUBST(CMESSAGES_H)
|
||||||
AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
|
AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
|
||||||
AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
|
AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
|
||||||
|
AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
|
||||||
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
|
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
|
||||||
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
|
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
|
||||||
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
|
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
|
||||||
|
4
libstdc++-v3/aclocal.m4
vendored
4
libstdc++-v3/aclocal.m4
vendored
@ -1071,6 +1071,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
CLOCALE_CC=config/locale/c_locale_generic.cc
|
CLOCALE_CC=config/locale/c_locale_generic.cc
|
||||||
CCODECVT_H=config/locale/codecvt_specializations_generic.h
|
CCODECVT_H=config/locale/codecvt_specializations_generic.h
|
||||||
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
||||||
|
CCTYPE_CC=config/locale/ctype_members_generic.cc
|
||||||
CMESSAGES_H=config/locale/messages_members_generic.h
|
CMESSAGES_H=config/locale/messages_members_generic.h
|
||||||
CMESSAGES_CC=config/locale/messages_members_generic.cc
|
CMESSAGES_CC=config/locale/messages_members_generic.cc
|
||||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||||
@ -1100,6 +1101,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
CLOCALE_CC=config/locale/c_locale_gnu.cc
|
CLOCALE_CC=config/locale/c_locale_gnu.cc
|
||||||
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
||||||
CCOLLATE_CC=config/locale/collate_members_gnu.cc
|
CCOLLATE_CC=config/locale/collate_members_gnu.cc
|
||||||
|
CCTYPE_CC=config/locale/ctype_members_gnu.cc
|
||||||
CMESSAGES_H=config/locale/messages_members_gnu.h
|
CMESSAGES_H=config/locale/messages_members_gnu.h
|
||||||
CMESSAGES_CC=config/locale/messages_members_gnu.cc
|
CMESSAGES_CC=config/locale/messages_members_gnu.cc
|
||||||
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
|
CMONEY_CC=config/locale/moneypunct_members_gnu.cc
|
||||||
@ -1116,6 +1118,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
|
CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
|
||||||
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
|
||||||
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
CCOLLATE_CC=config/locale/collate_members_generic.cc
|
||||||
|
CCTYPE_CC=config/locale/ctype_members_generic.cc
|
||||||
CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
|
CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
|
||||||
CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
|
CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
|
||||||
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
CMONEY_CC=config/locale/moneypunct_members_generic.cc
|
||||||
@ -1139,6 +1142,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
|
|||||||
AC_SUBST(CMESSAGES_H)
|
AC_SUBST(CMESSAGES_H)
|
||||||
AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
|
AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
|
||||||
AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
|
AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
|
||||||
|
AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
|
||||||
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
|
AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
|
||||||
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
|
AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
|
||||||
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
|
AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
void
|
void
|
||||||
locale::facet::_S_create_c_locale(__c_locale&, const char*)
|
locale::facet::_S_create_c_locale(__c_locale& __cloc, const char*)
|
||||||
{ }
|
{ __cloc = NULL; }
|
||||||
|
|
||||||
void
|
void
|
||||||
locale::facet::_S_destroy_c_locale(__c_locale&)
|
locale::facet::_S_destroy_c_locale(__c_locale&)
|
||||||
|
@ -56,10 +56,7 @@ namespace std
|
|||||||
|
|
||||||
void
|
void
|
||||||
locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
|
locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
|
||||||
{
|
{ __freelocale(__cloc); }
|
||||||
if (__cloc)
|
|
||||||
__freelocale(__cloc);
|
|
||||||
}
|
|
||||||
|
|
||||||
__c_locale
|
__c_locale
|
||||||
locale::facet::_S_clone_c_locale(__c_locale& __cloc)
|
locale::facet::_S_clone_c_locale(__c_locale& __cloc)
|
||||||
|
@ -43,46 +43,25 @@ namespace std
|
|||||||
int
|
int
|
||||||
collate<char>::_M_compare_helper(const char* __one,
|
collate<char>::_M_compare_helper(const char* __one,
|
||||||
const char* __two) const
|
const char* __two) const
|
||||||
{
|
{ return __strcoll_l(__one, __two, _M_c_locale_collate); }
|
||||||
if (_M_c_locale_collate)
|
|
||||||
return __strcoll_l(__one, __two, _M_c_locale_collate);
|
|
||||||
else
|
|
||||||
return strcoll(__one, __two);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
size_t
|
size_t
|
||||||
collate<char>::_M_transform_helper(char* __to, const char* __from,
|
collate<char>::_M_transform_helper(char* __to, const char* __from,
|
||||||
size_t __n) const
|
size_t __n) const
|
||||||
{
|
{ return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
|
||||||
if (_M_c_locale_collate)
|
|
||||||
return __strxfrm_l(__to, __from, __n, _M_c_locale_collate);
|
|
||||||
else
|
|
||||||
return strxfrm(__to, __from, __n);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||||
template<>
|
template<>
|
||||||
int
|
int
|
||||||
collate<wchar_t>::_M_compare_helper(const wchar_t* __one,
|
collate<wchar_t>::_M_compare_helper(const wchar_t* __one,
|
||||||
const wchar_t* __two) const
|
const wchar_t* __two) const
|
||||||
{
|
{ return __wcscoll_l(__one, __two, _M_c_locale_collate); }
|
||||||
if (_M_c_locale_collate)
|
|
||||||
return __wcscoll_l(__one, __two, _M_c_locale_collate);
|
|
||||||
else
|
|
||||||
return wcscoll(__one, __two);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
size_t
|
size_t
|
||||||
collate<wchar_t>::_M_transform_helper(wchar_t* __to,
|
collate<wchar_t>::_M_transform_helper(wchar_t* __to, const wchar_t* __from,
|
||||||
const wchar_t* __from,
|
|
||||||
size_t __n) const
|
size_t __n) const
|
||||||
{
|
{ return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
|
||||||
if (_M_c_locale_collate)
|
|
||||||
return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate);
|
|
||||||
else
|
|
||||||
return wcsxfrm(__to, __from, __n);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
195
libstdc++-v3/config/locale/ctype_members_generic.cc
Normal file
195
libstdc++-v3/config/locale/ctype_members_generic.cc
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
// std::ctype implementation details, generic version -*- C++ -*-
|
||||||
|
|
||||||
|
// Copyright (C) 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
|
||||||
|
// 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>
|
||||||
|
|
||||||
|
#include <locale>
|
||||||
|
|
||||||
|
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 _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("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;
|
||||||
|
};
|
||||||
|
|
||||||
|
wchar_t
|
||||||
|
ctype<wchar_t>::do_toupper(wchar_t __c) const
|
||||||
|
{ return towupper(__c); }
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi)
|
||||||
|
{
|
||||||
|
*__lo = towupper(*__lo);
|
||||||
|
++__lo;
|
||||||
|
}
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t
|
||||||
|
ctype<wchar_t>::do_tolower(wchar_t __c) const
|
||||||
|
{ return towlower(__c); }
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi)
|
||||||
|
{
|
||||||
|
*__lo = towlower(*__lo);
|
||||||
|
++__lo;
|
||||||
|
}
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_is(mask __m, char_type __c) const
|
||||||
|
{ return static_cast<bool>(iswctype(__c, _M_convert_to_wmask(__m))); }
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __m) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi && !this->do_is(*__m, *__lo))
|
||||||
|
++__lo;
|
||||||
|
return __lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi && !this->do_is(__m, *__lo))
|
||||||
|
++__lo;
|
||||||
|
return __lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi && this->do_is(__m, *__lo) != 0)
|
||||||
|
++__lo;
|
||||||
|
return __lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_widen(char __c) const
|
||||||
|
{ return btowc(__c); }
|
||||||
|
|
||||||
|
const char*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
|
||||||
|
{
|
||||||
|
mbstate_t __state;
|
||||||
|
memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
|
||||||
|
mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
|
||||||
|
char
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_narrow(wchar_t __wc, char __dfault) const
|
||||||
|
{
|
||||||
|
int __c = wctob(__wc);
|
||||||
|
return (__c == EOF ? __dfault : static_cast<char>(__c));
|
||||||
|
}
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
|
||||||
|
char* __dest) const
|
||||||
|
{
|
||||||
|
mbstate_t __state;
|
||||||
|
memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
|
||||||
|
size_t __len = __hi - __lo;
|
||||||
|
size_t __conv = wcsrtombs(__dest, &__lo, __len, &__state);
|
||||||
|
if (__conv == __len)
|
||||||
|
*__dest = __dfault;
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
#endif // _GLIBCPP_USE_WCHAR_T
|
||||||
|
}
|
200
libstdc++-v3/config/locale/ctype_members_gnu.cc
Normal file
200
libstdc++-v3/config/locale/ctype_members_gnu.cc
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
// std::ctype implementation details, GNU version -*- C++ -*-
|
||||||
|
|
||||||
|
// Copyright (C) 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
|
||||||
|
// 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>
|
||||||
|
|
||||||
|
#include <locale>
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (_M_c_locale_ctype)
|
||||||
|
_S_destroy_c_locale(_M_c_locale_ctype);
|
||||||
|
_S_create_c_locale(_M_c_locale_ctype, __s);
|
||||||
|
_M_toupper = _M_c_locale_ctype->__ctype_toupper;
|
||||||
|
_M_tolower = _M_c_locale_ctype->__ctype_tolower;
|
||||||
|
_M_table = _M_c_locale_ctype->__ctype_b;
|
||||||
|
}
|
||||||
|
|
||||||
|
#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);
|
||||||
|
break;
|
||||||
|
case graph:
|
||||||
|
__ret = __wctype_l("graph", _M_c_locale_ctype);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
__ret = 0;
|
||||||
|
}
|
||||||
|
return __ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
wchar_t
|
||||||
|
ctype<wchar_t>::do_toupper(wchar_t __c) const
|
||||||
|
{ return __towupper_l(__c, _M_c_locale_ctype); }
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi)
|
||||||
|
{
|
||||||
|
*__lo = __towupper_l(*__lo, _M_c_locale_ctype);
|
||||||
|
++__lo;
|
||||||
|
}
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t
|
||||||
|
ctype<wchar_t>::do_tolower(wchar_t __c) const
|
||||||
|
{ return __towlower_l(__c, _M_c_locale_ctype); }
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi)
|
||||||
|
{
|
||||||
|
*__lo = __towlower_l(*__lo, _M_c_locale_ctype);
|
||||||
|
++__lo;
|
||||||
|
}
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_is(mask __m, char_type __c) const
|
||||||
|
{ return static_cast<bool>(__iswctype_l(__c, _M_convert_to_wmask(__m),
|
||||||
|
_M_c_locale_ctype)); }
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __m) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi && !this->do_is(*__m, *__lo))
|
||||||
|
++__lo;
|
||||||
|
return __lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi && !this->do_is(__m, *__lo))
|
||||||
|
++__lo;
|
||||||
|
return __lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
|
||||||
|
{
|
||||||
|
while (__lo < __hi && this->do_is(__m, *__lo) != 0)
|
||||||
|
++__lo;
|
||||||
|
return __lo;
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_widen(char __c) const
|
||||||
|
{ return btowc(__c); }
|
||||||
|
|
||||||
|
const char*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
|
||||||
|
{
|
||||||
|
mbstate_t __state;
|
||||||
|
memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
|
||||||
|
mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
|
||||||
|
char
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_narrow(wchar_t __wc, char __dfault) const
|
||||||
|
{
|
||||||
|
int __c = wctob(__wc);
|
||||||
|
return (__c == EOF ? __dfault : static_cast<char>(__c));
|
||||||
|
}
|
||||||
|
|
||||||
|
const wchar_t*
|
||||||
|
ctype<wchar_t>::
|
||||||
|
do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
|
||||||
|
char* __dest) const
|
||||||
|
{
|
||||||
|
mbstate_t __state;
|
||||||
|
memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
|
||||||
|
size_t __len = __hi - __lo;
|
||||||
|
size_t __conv = wcsrtombs(__dest, &__lo, __len, &__state);
|
||||||
|
if (__conv == __len)
|
||||||
|
*__dest = __dfault;
|
||||||
|
return __hi;
|
||||||
|
}
|
||||||
|
#endif // _GLIBCPP_USE_WCHAR_T
|
||||||
|
}
|
@ -41,10 +41,6 @@
|
|||||||
{ return this->do_open(__s, __loc); }
|
{ return this->do_open(__s, __loc); }
|
||||||
|
|
||||||
// Virtual member functions.
|
// Virtual member functions.
|
||||||
template<typename _CharT>
|
|
||||||
messages<_CharT>::~messages()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
template<typename _CharT>
|
template<typename _CharT>
|
||||||
messages<_CharT>::catalog
|
messages<_CharT>::catalog
|
||||||
messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
|
messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
|
||||||
|
@ -43,14 +43,6 @@
|
|||||||
return this->do_open(__s, __loc);
|
return this->do_open(__s, __loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Virtual member functions.
|
|
||||||
template<typename _CharT>
|
|
||||||
messages<_CharT>::~messages()
|
|
||||||
{
|
|
||||||
if (_M_c_locale_messages)
|
|
||||||
_S_destroy_c_locale(_M_c_locale_messages);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename _CharT>
|
template<typename _CharT>
|
||||||
messages<_CharT>::catalog
|
messages<_CharT>::catalog
|
||||||
messages<_CharT>::do_open(const basic_string<char>& __s,
|
messages<_CharT>::do_open(const basic_string<char>& __s,
|
||||||
|
@ -61,8 +61,7 @@
|
|||||||
ctype<char>::
|
ctype<char>::
|
||||||
scan_not(mask __m, const char* __low, const char* __high) const
|
scan_not(mask __m, const char* __low, const char* __high) const
|
||||||
{
|
{
|
||||||
while (__low < __high
|
while (__low < __high && (_M_table[*__low] & __m) != 0)
|
||||||
&& (_M_table[*__low] & __m) != 0)
|
|
||||||
++__low;
|
++__low;
|
||||||
return __low;
|
return __low;
|
||||||
}
|
}
|
||||||
|
@ -43,25 +43,27 @@
|
|||||||
ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del,
|
ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del,
|
||||||
size_t __refs)
|
size_t __refs)
|
||||||
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
|
||||||
_M_toupper(__cloc ? __cloc->__ctype_toupper : __ctype_toupper),
|
_M_ctable(__ctype_b)
|
||||||
_M_tolower(__cloc ? __cloc->__ctype_tolower : __ctype_tolower),
|
{
|
||||||
_M_ctable(__ctype_b),
|
_M_c_locale_ctype = _S_clone_c_locale(__cloc);
|
||||||
_M_table(__table ? __table : (__cloc ? __cloc->__ctype_b : __ctype_b))
|
_M_toupper = _M_c_locale_ctype->__ctype_toupper;
|
||||||
{ }
|
_M_tolower = _M_c_locale_ctype->__ctype_tolower;
|
||||||
|
_M_table = __table ? __table : _M_c_locale_ctype->__ctype_b;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
|
ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
|
||||||
size_t __refs)
|
size_t __refs)
|
||||||
: __ctype_abstract_base<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_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
|
||||||
_M_ctable(__ctype_b), _M_table(__table ? __table : __ctype_b)
|
_M_ctable(__ctype_b), _M_table(__table ? __table : __ctype_b)
|
||||||
{ }
|
{ _M_c_locale_ctype = NULL; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) :
|
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) :
|
||||||
__ctype_abstract_base<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_toupper(__ctype_toupper), _M_tolower(__ctype_tolower),
|
||||||
_M_ctable(__ctype_b), _M_table(__table == 0 ? _M_ctable : __table)
|
_M_ctable(__ctype_b), _M_table(__table == 0 ? _M_ctable : __table)
|
||||||
{ }
|
{ _M_c_locale_ctype = NULL; }
|
||||||
|
|
||||||
char
|
char
|
||||||
ctype<char>::do_toupper(char __c) const
|
ctype<char>::do_toupper(char __c) const
|
||||||
|
1778
libstdc++-v3/configure
vendored
1778
libstdc++-v3/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -171,7 +171,7 @@ namespace std
|
|||||||
explicit
|
explicit
|
||||||
ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
|
ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
|
||||||
|
|
||||||
static locale::id id;
|
static locale::id id;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual
|
virtual
|
||||||
@ -225,15 +225,16 @@ namespace std
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef char char_type;
|
typedef char char_type;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
// Data Members:
|
// Data Members:
|
||||||
bool _M_del;
|
__c_locale _M_c_locale_ctype;
|
||||||
__to_type const& _M_toupper;
|
bool _M_del;
|
||||||
__to_type const& _M_tolower;
|
__to_type _M_toupper;
|
||||||
const mask* const& _M_ctable;
|
__to_type _M_tolower;
|
||||||
const mask* _M_table;
|
const mask* _M_ctable;
|
||||||
|
const mask* _M_table;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static locale::id id;
|
static locale::id id;
|
||||||
@ -259,9 +260,6 @@ namespace std
|
|||||||
scan_not(mask __m, const char* __lo, const char* __hi) const;
|
scan_not(mask __m, const char* __lo, const char* __hi) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual
|
|
||||||
~ctype();
|
|
||||||
|
|
||||||
const mask*
|
const mask*
|
||||||
table() const throw()
|
table() const throw()
|
||||||
{ return _M_table; }
|
{ return _M_table; }
|
||||||
@ -270,6 +268,9 @@ namespace std
|
|||||||
classic_table() throw()
|
classic_table() throw()
|
||||||
{ return _M_ctable; }
|
{ return _M_ctable; }
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~ctype();
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
do_is(mask __m, char_type __c) const;
|
do_is(mask __m, char_type __c) const;
|
||||||
|
|
||||||
@ -306,7 +307,7 @@ namespace std
|
|||||||
|
|
||||||
virtual const char_type*
|
virtual const char_type*
|
||||||
do_narrow(const char_type* __lo, const char_type* __hi,
|
do_narrow(const char_type* __lo, const char_type* __hi,
|
||||||
char __dfault, char* __dest) const;
|
char __dfault, char* __dest) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@ -320,11 +321,15 @@ namespace std
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Types:
|
// Types:
|
||||||
typedef wchar_t char_type;
|
typedef wchar_t char_type;
|
||||||
typedef wctype_t __wmask_type;
|
typedef wctype_t __wmask_type;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
__c_locale _M_c_locale_ctype;
|
||||||
|
|
||||||
|
public:
|
||||||
// Data Members:
|
// Data Members:
|
||||||
static locale::id id;
|
static locale::id id;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
ctype(size_t __refs = 0);
|
ctype(size_t __refs = 0);
|
||||||
@ -375,7 +380,7 @@ namespace std
|
|||||||
|
|
||||||
virtual const char_type*
|
virtual const char_type*
|
||||||
do_narrow(const char_type* __lo, const char_type* __hi,
|
do_narrow(const char_type* __lo, const char_type* __hi,
|
||||||
char __dfault, char* __dest) const;
|
char __dfault, char* __dest) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -395,22 +400,25 @@ namespace std
|
|||||||
typedef _CharT char_type;
|
typedef _CharT char_type;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
ctype_byname(const char*, size_t __refs = 0);
|
ctype_byname(const char* __s, size_t __refs = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual
|
virtual
|
||||||
~ctype_byname() { }
|
~ctype_byname() { };
|
||||||
};
|
};
|
||||||
|
|
||||||
// 22.2.1.4 Class ctype_byname specialization
|
// 22.2.1.4 Class ctype_byname specializations.
|
||||||
template<>
|
template<>
|
||||||
ctype_byname<char>::ctype_byname(const char*, size_t refs);
|
ctype_byname<char>::ctype_byname(const char*, size_t refs);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);
|
||||||
|
|
||||||
// 22.2.1.5 Template class codecvt
|
// 22.2.1.5 Template class codecvt
|
||||||
#include <bits/codecvt.h>
|
#include <bits/codecvt.h>
|
||||||
|
|
||||||
|
|
||||||
|
// 22.2.2 The numeric category.
|
||||||
class __num_base
|
class __num_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -815,17 +823,14 @@ namespace std
|
|||||||
|
|
||||||
explicit
|
explicit
|
||||||
collate(size_t __refs = 0)
|
collate(size_t __refs = 0)
|
||||||
: locale::facet(__refs), _M_c_locale_collate(NULL)
|
: locale::facet(__refs)
|
||||||
{ }
|
{ _M_c_locale_collate = _S_clone_c_locale(_S_c_locale); }
|
||||||
|
|
||||||
// Non-standard.
|
// Non-standard.
|
||||||
explicit
|
explicit
|
||||||
collate(__c_locale __cloc, size_t __refs = 0)
|
collate(__c_locale __cloc, size_t __refs = 0)
|
||||||
: locale::facet(__refs)
|
: locale::facet(__refs)
|
||||||
{
|
{ _M_c_locale_collate = _S_clone_c_locale(__cloc); }
|
||||||
if (__cloc)
|
|
||||||
_M_c_locale_collate = _S_clone_c_locale(__cloc);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
compare(const _CharT* __lo1, const _CharT* __hi1,
|
compare(const _CharT* __lo1, const _CharT* __hi1,
|
||||||
@ -850,10 +855,7 @@ namespace std
|
|||||||
protected:
|
protected:
|
||||||
virtual
|
virtual
|
||||||
~collate()
|
~collate()
|
||||||
{
|
{ _S_destroy_c_locale(_M_c_locale_collate); }
|
||||||
if (_M_c_locale_collate)
|
|
||||||
_S_destroy_c_locale(_M_c_locale_collate);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual int
|
virtual int
|
||||||
do_compare(const _CharT* __lo1, const _CharT* __hi1,
|
do_compare(const _CharT* __lo1, const _CharT* __hi1,
|
||||||
@ -899,10 +901,13 @@ namespace std
|
|||||||
explicit
|
explicit
|
||||||
collate_byname(const char* __s, size_t __refs = 0)
|
collate_byname(const char* __s, size_t __refs = 0)
|
||||||
: collate<_CharT>(__refs)
|
: collate<_CharT>(__refs)
|
||||||
{ _S_create_c_locale(_M_c_locale_collate, __s); }
|
{
|
||||||
|
_S_destroy_c_locale(_M_c_locale_collate);
|
||||||
|
_S_create_c_locale(_M_c_locale_collate, __s);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual
|
virtual
|
||||||
~collate_byname() { }
|
~collate_byname() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1609,9 +1614,8 @@ namespace std
|
|||||||
|
|
||||||
explicit
|
explicit
|
||||||
messages(size_t __refs = 0)
|
messages(size_t __refs = 0)
|
||||||
: locale::facet(__refs), _M_c_locale_messages(NULL),
|
: locale::facet(__refs), _M_name_messages("C")
|
||||||
_M_name_messages("C")
|
{ _M_c_locale_messages = _S_clone_c_locale(_S_c_locale); }
|
||||||
{ }
|
|
||||||
|
|
||||||
// Non-standard.
|
// Non-standard.
|
||||||
explicit
|
explicit
|
||||||
@ -1619,8 +1623,7 @@ namespace std
|
|||||||
: locale::facet(__refs)
|
: locale::facet(__refs)
|
||||||
{
|
{
|
||||||
_M_name_messages = __name;
|
_M_name_messages = __name;
|
||||||
if (__cloc)
|
_M_c_locale_messages = _S_clone_c_locale(__cloc);
|
||||||
_M_c_locale_messages = _S_clone_c_locale(__cloc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catalog
|
catalog
|
||||||
@ -1641,7 +1644,8 @@ namespace std
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual
|
virtual
|
||||||
~messages();
|
~messages()
|
||||||
|
{ _S_destroy_c_locale(_M_c_locale_messages); }
|
||||||
|
|
||||||
virtual catalog
|
virtual catalog
|
||||||
do_open(const basic_string<char>&, const locale&) const;
|
do_open(const basic_string<char>&, const locale&) const;
|
||||||
@ -1723,8 +1727,9 @@ namespace std
|
|||||||
messages_byname(const char* __s, size_t __refs = 0)
|
messages_byname(const char* __s, size_t __refs = 0)
|
||||||
: messages<_CharT>(__refs)
|
: messages<_CharT>(__refs)
|
||||||
{
|
{
|
||||||
_S_create_c_locale(_M_c_locale_messages, __s);
|
|
||||||
_M_name_messages = __s;
|
_M_name_messages = __s;
|
||||||
|
_S_destroy_c_locale(_M_c_locale_messages);
|
||||||
|
_S_create_c_locale(_M_c_locale_messages, __s);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -282,7 +282,10 @@ namespace std
|
|||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_S_initialize()
|
_S_initialize()
|
||||||
{ if (!_S_classic) classic(); }
|
{
|
||||||
|
if (!_S_classic)
|
||||||
|
classic();
|
||||||
|
}
|
||||||
|
|
||||||
static category
|
static category
|
||||||
_S_normalize_category(category);
|
_S_normalize_category(category);
|
||||||
@ -344,7 +347,7 @@ namespace std
|
|||||||
_Impl(string __name, size_t);
|
_Impl(string __name, size_t);
|
||||||
~_Impl() throw();
|
~_Impl() throw();
|
||||||
|
|
||||||
bool
|
inline bool
|
||||||
_M_check_same_name()
|
_M_check_same_name()
|
||||||
{
|
{
|
||||||
bool __ret = true;
|
bool __ret = true;
|
||||||
@ -352,6 +355,7 @@ namespace std
|
|||||||
__ret &= _M_names[i] == _M_names[i + 1];
|
__ret &= _M_names[i] == _M_names[i + 1];
|
||||||
return __ret;
|
return __ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_replace_categories(const _Impl*, category);
|
_M_replace_categories(const _Impl*, category);
|
||||||
|
|
||||||
@ -387,11 +391,15 @@ namespace std
|
|||||||
friend class __enc_traits;
|
friend class __enc_traits;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// Contains data from the underlying "C" library for default "C"
|
||||||
|
// and "POSIX" locales.
|
||||||
|
static __c_locale _S_c_locale;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
facet(size_t __refs = 0) throw();
|
facet(size_t __refs = 0) throw();
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
~facet() { };
|
~facet();
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_S_create_c_locale(__c_locale& __cloc, const char* __s);
|
_S_create_c_locale(__c_locale& __cloc, const char* __s);
|
||||||
@ -447,8 +455,7 @@ namespace std
|
|||||||
public:
|
public:
|
||||||
// NB: This class is always a static data member, and thus can be
|
// NB: This class is always a static data member, and thus can be
|
||||||
// counted on to be zero-initialized.
|
// counted on to be zero-initialized.
|
||||||
// XXX id() : _M_index(0) { }
|
id();
|
||||||
id() { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Facet>
|
template<typename _Facet>
|
||||||
|
@ -60,13 +60,14 @@ INCLUDES = \
|
|||||||
$(TOPLEVEL_INCLUDES)
|
$(TOPLEVEL_INCLUDES)
|
||||||
|
|
||||||
sources = \
|
sources = \
|
||||||
basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc \
|
globals.cc limits.cc \
|
||||||
complex_io.cc functexcept.cc globals.cc ios.cc limits.cc \
|
basic_file.cc complex_io.cc ios.cc strstream.cc \
|
||||||
locale.cc locale-inst.cc localename.cc \
|
cmath.cc bitset.cc \
|
||||||
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
|
functexcept.cc stdexcept.cc vterminate.cc \
|
||||||
vterminate.cc \
|
c++locale.cc locale.cc localename.cc codecvt.cc \
|
||||||
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
|
collate.cc ctype.cc messages.cc moneypunct.cc numpunct.cc time.cc \
|
||||||
valarray-inst.cc wstring-inst.cc concept-inst.cc ext-inst.cc
|
concept-inst.cc locale-inst.cc misc-inst.cc stl-inst.cc \
|
||||||
|
string-inst.cc wstring-inst.cc valarray-inst.cc ext-inst.cc
|
||||||
|
|
||||||
VPATH = $(top_srcdir)/src:$(top_srcdir)
|
VPATH = $(top_srcdir)/src:$(top_srcdir)
|
||||||
|
|
||||||
|
@ -185,13 +185,14 @@ INCLUDES = \
|
|||||||
|
|
||||||
|
|
||||||
sources = \
|
sources = \
|
||||||
basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc \
|
globals.cc limits.cc \
|
||||||
complex_io.cc functexcept.cc globals.cc ios.cc limits.cc \
|
basic_file.cc complex_io.cc ios.cc strstream.cc \
|
||||||
locale.cc locale-inst.cc localename.cc \
|
cmath.cc bitset.cc \
|
||||||
collate.cc messages.cc moneypunct.cc numpunct.cc time.cc \
|
functexcept.cc stdexcept.cc vterminate.cc \
|
||||||
vterminate.cc \
|
c++locale.cc locale.cc localename.cc codecvt.cc \
|
||||||
misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \
|
collate.cc ctype.cc messages.cc moneypunct.cc numpunct.cc time.cc \
|
||||||
valarray-inst.cc wstring-inst.cc concept-inst.cc ext-inst.cc
|
concept-inst.cc locale-inst.cc misc-inst.cc stl-inst.cc \
|
||||||
|
string-inst.cc wstring-inst.cc valarray-inst.cc ext-inst.cc
|
||||||
|
|
||||||
|
|
||||||
VPATH = $(top_srcdir)/src:$(top_srcdir)
|
VPATH = $(top_srcdir)/src:$(top_srcdir)
|
||||||
@ -264,12 +265,12 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
|||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
libstdc___la_OBJECTS = basic_file.lo bitset.lo c++locale.lo cmath.lo \
|
libstdc___la_OBJECTS = globals.lo limits.lo basic_file.lo complex_io.lo \
|
||||||
codecvt.lo complex_io.lo functexcept.lo globals.lo ios.lo limits.lo \
|
ios.lo strstream.lo cmath.lo bitset.lo functexcept.lo stdexcept.lo \
|
||||||
locale.lo locale-inst.lo localename.lo collate.lo messages.lo \
|
vterminate.lo c++locale.lo locale.lo localename.lo codecvt.lo \
|
||||||
moneypunct.lo numpunct.lo time.lo vterminate.lo misc-inst.lo \
|
collate.lo ctype.lo messages.lo moneypunct.lo numpunct.lo time.lo \
|
||||||
stdexcept.lo stl-inst.lo string-inst.lo strstream.lo valarray-inst.lo \
|
concept-inst.lo locale-inst.lo misc-inst.lo stl-inst.lo string-inst.lo \
|
||||||
wstring-inst.lo concept-inst.lo ext-inst.lo
|
wstring-inst.lo valarray-inst.lo ext-inst.lo
|
||||||
CXXFLAGS = @CXXFLAGS@
|
CXXFLAGS = @CXXFLAGS@
|
||||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||||
CXXLD = $(CXX)
|
CXXLD = $(CXX)
|
||||||
|
@ -348,9 +348,18 @@ namespace std
|
|||||||
return __ret;
|
return __ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__c_locale
|
||||||
|
locale::facet::_S_c_locale;
|
||||||
|
|
||||||
|
locale::facet::
|
||||||
|
~facet() { }
|
||||||
|
|
||||||
locale::facet::
|
locale::facet::
|
||||||
facet(size_t __refs) throw() : _M_references(__refs)
|
facet(size_t __refs) throw() : _M_references(__refs)
|
||||||
{ }
|
{
|
||||||
|
if (!_S_c_locale)
|
||||||
|
_S_create_c_locale(_S_c_locale, "C");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
locale::facet::
|
locale::facet::
|
||||||
@ -370,6 +379,8 @@ namespace std
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
locale::id::id() { }
|
||||||
|
|
||||||
// Definitions for static const data members of ctype_base.
|
// Definitions for static const data members of ctype_base.
|
||||||
const ctype_base::mask ctype_base::space;
|
const ctype_base::mask ctype_base::space;
|
||||||
const ctype_base::mask ctype_base::print;
|
const ctype_base::mask ctype_base::print;
|
||||||
@ -389,7 +400,12 @@ namespace std
|
|||||||
const size_t ctype<char>::table_size;
|
const size_t ctype<char>::table_size;
|
||||||
|
|
||||||
ctype<char>::~ctype()
|
ctype<char>::~ctype()
|
||||||
{ if (_M_del) delete[] this->table(); }
|
{
|
||||||
|
if (_M_c_locale_ctype)
|
||||||
|
_S_destroy_c_locale(_M_c_locale_ctype);
|
||||||
|
if (_M_del)
|
||||||
|
delete[] this->table();
|
||||||
|
}
|
||||||
|
|
||||||
// These are dummy placeholders as these virtual functions are never called.
|
// These are dummy placeholders as these virtual functions are never called.
|
||||||
bool
|
bool
|
||||||
@ -431,171 +447,26 @@ namespace std
|
|||||||
return __hi;
|
return __hi;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||||
ctype_byname<char>::ctype_byname(const char* /*__s*/, size_t __refs)
|
|
||||||
: ctype<char>(new mask[table_size], true, __refs)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
#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("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>::ctype(size_t __refs)
|
||||||
: __ctype_abstract_base<wchar_t>(__refs) { }
|
: __ctype_abstract_base<wchar_t>(__refs)
|
||||||
|
{ _M_c_locale_ctype = _S_clone_c_locale(_S_c_locale); }
|
||||||
|
|
||||||
ctype<wchar_t>::ctype(__c_locale /*__cloc*/, size_t __refs)
|
ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs)
|
||||||
: __ctype_abstract_base<wchar_t>(__refs) { }
|
: __ctype_abstract_base<wchar_t>(__refs)
|
||||||
|
{ _M_c_locale_ctype = _S_clone_c_locale(__cloc); }
|
||||||
|
|
||||||
wchar_t
|
ctype<wchar_t>::~ctype()
|
||||||
ctype<wchar_t>::do_toupper(wchar_t __c) const
|
{ _S_destroy_c_locale(_M_c_locale_ctype); }
|
||||||
{ return towupper(__c); }
|
|
||||||
|
|
||||||
const wchar_t*
|
|
||||||
ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
|
|
||||||
{
|
|
||||||
while (__lo < __hi)
|
|
||||||
{
|
|
||||||
*__lo = towupper(*__lo);
|
|
||||||
++__lo;
|
|
||||||
}
|
|
||||||
return __hi;
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t
|
|
||||||
ctype<wchar_t>::do_tolower(wchar_t __c) const
|
|
||||||
{ return towlower(__c); }
|
|
||||||
|
|
||||||
const wchar_t*
|
|
||||||
ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
|
|
||||||
{
|
|
||||||
while (__lo < __hi)
|
|
||||||
{
|
|
||||||
*__lo = towlower(*__lo);
|
|
||||||
++__lo;
|
|
||||||
}
|
|
||||||
return __hi;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_is(mask __m, char_type __c) const
|
|
||||||
{ return static_cast<bool>(iswctype(__c, _M_convert_to_wmask(__m))); }
|
|
||||||
|
|
||||||
const wchar_t*
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __m) const
|
|
||||||
{
|
|
||||||
while (__lo < __hi && !this->is(*__m, *__lo))
|
|
||||||
++__lo;
|
|
||||||
return __lo;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t*
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
|
|
||||||
{
|
|
||||||
while (__lo < __hi && !this->is(__m, *__lo))
|
|
||||||
++__lo;
|
|
||||||
return __lo;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t*
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
|
|
||||||
{
|
|
||||||
while (__lo < __hi && this->is(__m, *__lo) != 0)
|
|
||||||
++__lo;
|
|
||||||
return __lo;
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_widen(char __c) const
|
|
||||||
{ return btowc(__c); }
|
|
||||||
|
|
||||||
const char*
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
|
|
||||||
{
|
|
||||||
mbstate_t __state;
|
|
||||||
memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
|
|
||||||
mbsrtowcs(__dest, &__lo, __hi - __lo, &__state);
|
|
||||||
return __hi;
|
|
||||||
}
|
|
||||||
|
|
||||||
char
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_narrow(wchar_t __wc, char __dfault) const
|
|
||||||
{
|
|
||||||
int __c = wctob(__wc);
|
|
||||||
return (__c == EOF ? __dfault : static_cast<char>(__c));
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t*
|
|
||||||
ctype<wchar_t>::
|
|
||||||
do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
|
|
||||||
char* __dest) const
|
|
||||||
{
|
|
||||||
mbstate_t __state;
|
|
||||||
memset(static_cast<void*>(&__state), 0, sizeof(mbstate_t));
|
|
||||||
size_t __len = __hi - __lo;
|
|
||||||
size_t __conv = wcsrtombs(__dest, &__lo, __len, &__state);
|
|
||||||
if (__conv == __len)
|
|
||||||
*__dest = __dfault;
|
|
||||||
return __hi;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ctype_byname<wchar_t>::
|
ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
|
||||||
ctype_byname(const char* /*__s*/, size_t __refs)
|
: ctype<wchar_t>(__refs)
|
||||||
: ctype<wchar_t>(__refs) { }
|
{
|
||||||
#endif // _GLIBCPP_USE_WCHAR_T
|
_S_destroy_c_locale(_M_c_locale_ctype);
|
||||||
|
_S_create_c_locale(_M_c_locale_ctype, __s);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Definitions for static const data members of time_base
|
// Definitions for static const data members of time_base
|
||||||
template<>
|
template<>
|
||||||
@ -618,7 +489,7 @@ namespace std
|
|||||||
|
|
||||||
// Definitions for static const data members of money_base
|
// Definitions for static const data members of money_base
|
||||||
const money_base::pattern
|
const money_base::pattern
|
||||||
money_base::_S_default_pattern = {{symbol, sign, none, value}};
|
money_base::_S_default_pattern = { {symbol, sign, none, value} };
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
const ctype<char>&
|
const ctype<char>&
|
||||||
@ -708,12 +579,12 @@ namespace std
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
moneypunct_byname<char, false>::moneypunct_byname(const char* /*__s*/,
|
moneypunct_byname<char, false>::moneypunct_byname(const char*,
|
||||||
size_t __refs)
|
size_t __refs)
|
||||||
: moneypunct<char, false>(__refs) { }
|
: moneypunct<char, false>(__refs) { }
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
moneypunct_byname<char, true>::moneypunct_byname(const char* /*__s*/,
|
moneypunct_byname<char, true>::moneypunct_byname(const char*,
|
||||||
size_t __refs)
|
size_t __refs)
|
||||||
: moneypunct<char, true>(__refs) { }
|
: moneypunct<char, true>(__refs) { }
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
@ -72,9 +72,14 @@ namespace std
|
|||||||
{
|
{
|
||||||
// Initialize the underlying locale model, which also checks to
|
// Initialize the underlying locale model, which also checks to
|
||||||
// see if the given name is valid.
|
// see if the given name is valid.
|
||||||
__c_locale __cloc = NULL;
|
__c_locale __cloc;
|
||||||
|
locale::facet::_S_create_c_locale(__cloc, __str.c_str());
|
||||||
|
|
||||||
|
// This is needed as presently "C" locales != required data in
|
||||||
|
// __timepunct, numpunct, and moneypunct.
|
||||||
|
__c_locale __cloc_c = NULL;
|
||||||
if (__str != "C" && __str != "POSIX")
|
if (__str != "C" && __str != "POSIX")
|
||||||
locale::facet::_S_create_c_locale(__cloc, __str.c_str());
|
__cloc_c = __cloc;
|
||||||
|
|
||||||
// Allocate facet container.
|
// Allocate facet container.
|
||||||
try
|
try
|
||||||
@ -90,18 +95,17 @@ namespace std
|
|||||||
_M_names[i] = __str;
|
_M_names[i] = __str;
|
||||||
|
|
||||||
// Construct all standard facets and add them to _M_facets.
|
// 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::collate<char>(__cloc));
|
||||||
_M_init_facet(new std::ctype<char>(__cloc));
|
_M_init_facet(new std::ctype<char>(__cloc));
|
||||||
_M_init_facet(new codecvt<char, char, mbstate_t>);
|
_M_init_facet(new codecvt<char, char, mbstate_t>);
|
||||||
_M_init_facet(new moneypunct<char, false>(__cloc));
|
_M_init_facet(new moneypunct<char, false>(__cloc_c));
|
||||||
_M_init_facet(new moneypunct<char, true>(__cloc));
|
_M_init_facet(new moneypunct<char, true>(__cloc_c));
|
||||||
_M_init_facet(new money_get<char>);
|
_M_init_facet(new money_get<char>);
|
||||||
_M_init_facet(new money_put<char>);
|
_M_init_facet(new money_put<char>);
|
||||||
_M_init_facet(new numpunct<char>(__cloc));
|
_M_init_facet(new numpunct<char>(__cloc_c));
|
||||||
_M_init_facet(new num_get<char>);
|
_M_init_facet(new num_get<char>);
|
||||||
_M_init_facet(new num_put<char>);
|
_M_init_facet(new num_put<char>);
|
||||||
_M_init_facet(new __timepunct<char>(__cloc, __str.c_str()));
|
_M_init_facet(new __timepunct<char>(__cloc_c, __str.c_str()));
|
||||||
_M_init_facet(new time_get<char>);
|
_M_init_facet(new time_get<char>);
|
||||||
_M_init_facet(new time_put<char>);
|
_M_init_facet(new time_put<char>);
|
||||||
_M_init_facet(new std::messages<char>(__cloc, __str.c_str()));
|
_M_init_facet(new std::messages<char>(__cloc, __str.c_str()));
|
||||||
@ -110,14 +114,14 @@ namespace std
|
|||||||
_M_init_facet(new std::collate<wchar_t>(__cloc));
|
_M_init_facet(new std::collate<wchar_t>(__cloc));
|
||||||
_M_init_facet(new std::ctype<wchar_t>(__cloc));
|
_M_init_facet(new std::ctype<wchar_t>(__cloc));
|
||||||
_M_init_facet(new codecvt<wchar_t, char, mbstate_t>);
|
_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, false>(__cloc_c));
|
||||||
_M_init_facet(new moneypunct<wchar_t, true>(__cloc));
|
_M_init_facet(new moneypunct<wchar_t, true>(__cloc_c));
|
||||||
_M_init_facet(new money_get<wchar_t>);
|
_M_init_facet(new money_get<wchar_t>);
|
||||||
_M_init_facet(new money_put<wchar_t>);
|
_M_init_facet(new money_put<wchar_t>);
|
||||||
_M_init_facet(new numpunct<wchar_t>(__cloc));
|
_M_init_facet(new numpunct<wchar_t>(__cloc_c));
|
||||||
_M_init_facet(new num_get<wchar_t>);
|
_M_init_facet(new num_get<wchar_t>);
|
||||||
_M_init_facet(new num_put<wchar_t>);
|
_M_init_facet(new num_put<wchar_t>);
|
||||||
_M_init_facet(new __timepunct<wchar_t>(__cloc, __str.c_str()));
|
_M_init_facet(new __timepunct<wchar_t>(__cloc_c, __str.c_str()));
|
||||||
_M_init_facet(new time_get<wchar_t>);
|
_M_init_facet(new time_get<wchar_t>);
|
||||||
_M_init_facet(new time_put<wchar_t>);
|
_M_init_facet(new time_put<wchar_t>);
|
||||||
_M_init_facet(new std::messages<wchar_t>(__cloc, __str.c_str()));
|
_M_init_facet(new std::messages<wchar_t>(__cloc, __str.c_str()));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// 2000-09-01 Benjamin Kosnik <bkoz@redhat.com>
|
// 2000-09-01 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
// 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
|
// 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
|
// software; you can redistribute it and/or modify it under the
|
||||||
@ -92,16 +92,17 @@ void test01()
|
|||||||
gctype.tolower(c_array, c_array + len);
|
gctype.tolower(c_array, c_array + len);
|
||||||
VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) );
|
VERIFY( !std::char_traits<char_type>::compare(c_array, strlit02, len - 1) );
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_ASSERT
|
#ifdef DEBUG_ASSERT
|
||||||
assert(test);
|
assert(test);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
#if _GLIBCPP_USE_WCHAR_T
|
#if _GLIBCPP_USE_WCHAR_T
|
||||||
test01();
|
test01();
|
||||||
#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 2 or if it is a class deerived from locale:;facet and containing a
|
// 2 or if it is a class derived from locale:;facet and containing a
|
||||||
// publicly-accessible declaration as follows:
|
// publicly-accessible declaration as follows:
|
||||||
class gnu_facet: public std::locale::facet
|
class gnu_facet: public std::locale::facet
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user