gcc/libstdc++-v3/src/locale.cc

591 lines
15 KiB
C++
Raw Normal View History

Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
// Copyright (C) 1997, 1998, 1999, 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
// 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.
Makefile.am (std_headers): Remove cXXX from list. 2002-01-04 Benjamin Kosnik <bkoz@redhat.com> * include/Makefile.am (std_headers): Remove cXXX from list. (c_base_srcdir): No bits subdirectory. (c_base_builddir): Same. (c_base_headers): Adjust names, add ciso646. (bits_headers): Remove std_xxx.h headers. * include/Makefile.in: Regenerate. * include/ext/iterator: Adjust includes. * include/ext/ropeimpl.h: Same. * include/ext/stl_hash_fun.h: Same. * include/ext/algorithm: Same. * include/backward/bvector.h: Adjust includes. * include/backward/vector.h: Same. * include/backward/strstream: Same. * include/backward/streambuf.h: Same. * include/backward/stack.h: Same. * include/backward/set.h: Same. * include/backward/queue.h: Same. * include/backward/multiset.h: Same. * include/backward/multimap.h: Same. * include/backward/map.h: Same. * include/backward/list.h: Same. * include/backward/iterator.h: Same. * include/backward/iostream.h: Same. * include/backward/iomanip.h: Same. * include/backward/fstream.h: Same. * include/backward/deque.h: Same. * include/backward/complex.h: Same. * include/bits/std_algorithm.h: Move to... * include/std/algorithm: ...here. * include/bits/std_iosfwd.h, std_locale.h, std_stack.h, std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h, std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h, std_deque.h, std_istream.h, std_numeric.h, std_string.h, std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h, std_queue.h, std_valarray.h, std_functional.h, std_limits.h, std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h: Same. * include/c_std/bits/std_cassert.h: Move to... * include/c_std/cassert: Here. * include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c_std/cmath: Adjust cmath.tcc include. * include/c_std/cstdlib: Adjust includes. * include/c_std/cwchar: Same. * include/c_std/ctime: Same. * include/c_std/cstring: Same. * include/c_std/cstdio: Same. * include/c_std/bits: Remove directory. * include/c/bits/std_cassert.h: Move to... * include/c/cassert: Here. * include/c/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c/bits: Remove directory. * include/std/cwctype: Remove. * include/std/cwchar: Remove. * include/std/ctime: Remove. * include/std/cstring: Remove. * include/std/cstdlib: Remove. * include/std/cstdio: Remove. * include/std/cstddef: Remove. * include/std/cstdarg: Remove. * include/std/csignal: Remove. * include/std/csetjmp: Remove. * include/std/cmath: Remove. * include/std/clocale: Remove. * include/std/climits: Remove. * include/std/ciso646: Remove. * include/std/cfloat: Remove. * include/std/cerrno: Remove. * include/std/cctype: Remove. * include/std/cassert: Remove. * include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h> files and subsituting <.xxx> * include/bits/valarray_array.h: Same. * include/bits/stl_uninitialized.h: Same. * include/bits/stl_alloc.h: Same. * include/bits/stl_algobase.h: Same. * include/bits/sstream.tcc: Same. * include/bits/pthread_allocimpl.h: Same. * include/bits/ostream.tcc: Same. * include/bits/localefwd.h: Same. * include/bits/locale_facets.tcc: Same. * include/bits/locale_facets.h: Same. * include/bits/istream.tcc: Same. * include/bits/char_traits.h: Same. * include/bits/boost_concept_check.h: Same. * include/bits/basic_file.h: Same. * include/std/bitset: Same. * include/std/complex: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/ios: Same. * include/std/iostream: Same. * include/std/ostream: Same. * include/std/sstream: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/iterator: Same. * include/std/valarray: Same. * src/ios.cc: Adjust includes. * src/valarray-inst.cc: Same. * src/string-inst.cc: Same. * src/stl-inst.cc: Same. * src/stdexcept.cc: Same. * src/misc-inst.cc: Same. * src/localename.cc: Same. * src/locale-inst.cc: Same. * src/locale.cc: Same. * src/limits.cc: Same. * src/concept-inst.cc: Same. * src/complex_io.cc: Same. * src/codecvt.cc: Same. * src/bitset.cc: Same. * src/cmath.cc: Same. From-SVN: r48544
2002-01-04 22:27:36 +01:00
#include <clocale>
#include <cstring>
#include <cassert>
#include <cctype>
#include <limits>
Makefile.am (LIBSUPCXX_INCLUDES): Adjust. 2000-10-10 Benjamin Kosnik <bkoz@purist.soma.redhat.com> * Makefile.am (LIBSUPCXX_INCLUDES): Adjust. * libsupc++/include: Remove * libsupc++/include/*: Move to ... * libsupc++: Here. * libsupc++/Makefile.am (glibcppinstall_HEADERS): Install headers. (glibcppinstalldir): New. * src/Makefile.am (c_base_headers): New. (c_shadow_headers): New (c_headers): New. (myinstallheaders): Correct install issues. * src/Makefile.in: Regenerate. * Makefile.am (CSHADOW_INCLUDES): Simplify. * Makefile.in: Regenerate. * acinclude.m4 (GLIBCPP_ENABLE_SHADOW): Add c_include_dir. * aclocal.m4: Regenerate. * mkcheck.in (SRC_DIR): Use it. * include/bits/std_stdexcept.h: And here. * include/bits/std_ios.h: Change std_exception.h to exception. * src/locale.cc: And here. * src/locale-inst.cc: And here. * include/bits/valarray_array.h: And here. * include/bits/stl_alloc.h: And here. * include/bits/stl_algobase.h: And here. * include/bits/pthread_allocimpl.h: And here. * include/bits/stl_construct.h: Change to std_new.h to new. * include/bits/locale_facets.h: Change std_typeinfo.h to typeinfo. * src/Makefile.am (INCLUDES): Add LIBSUPCXX_INCLUDES. (headers): Remove duplicated headers. (std_headers): And here. * src/Makefile.in: Regenerate. * libsupc++/Makefile.am (LIBSUPCXX_INCLUDES): Remove. * libsupc++/Makefile.in: Regenerate. * Makefile.am (LIBSUPCXX_INCLUDES): Add here. (AM_MAKEFLAGS): And here. * Makefile.in: Regenerate. * include/bits/std_typeinfo.h: Remove. * include/bits/std_new.h: Remove * include/bits/std_exception.h: Remove. * std/new: Remove. * std/typeinfo: Remove. * std/exception: Remove. * libio/_G_config.h (__need_ptrdiff_t): Add. * libsupc++/include/new: Change stddef.h to cstddef. * libsupc++/tinfo.h: Change limits.h to climits. * libsupc++/pure.cc: Comment out _GNU_LIBRARY_ bits, as this renders the file uncompilable. Add copyright. * include/c_std/bits/std_cstddef.h: Don't bring wchar_t into std namespace, as it is a fundamental type. From-SVN: r36833
2000-10-11 01:50:39 +02:00
#include <exception>
Makefile.am (std_headers): Remove cXXX from list. 2002-01-04 Benjamin Kosnik <bkoz@redhat.com> * include/Makefile.am (std_headers): Remove cXXX from list. (c_base_srcdir): No bits subdirectory. (c_base_builddir): Same. (c_base_headers): Adjust names, add ciso646. (bits_headers): Remove std_xxx.h headers. * include/Makefile.in: Regenerate. * include/ext/iterator: Adjust includes. * include/ext/ropeimpl.h: Same. * include/ext/stl_hash_fun.h: Same. * include/ext/algorithm: Same. * include/backward/bvector.h: Adjust includes. * include/backward/vector.h: Same. * include/backward/strstream: Same. * include/backward/streambuf.h: Same. * include/backward/stack.h: Same. * include/backward/set.h: Same. * include/backward/queue.h: Same. * include/backward/multiset.h: Same. * include/backward/multimap.h: Same. * include/backward/map.h: Same. * include/backward/list.h: Same. * include/backward/iterator.h: Same. * include/backward/iostream.h: Same. * include/backward/iomanip.h: Same. * include/backward/fstream.h: Same. * include/backward/deque.h: Same. * include/backward/complex.h: Same. * include/bits/std_algorithm.h: Move to... * include/std/algorithm: ...here. * include/bits/std_iosfwd.h, std_locale.h, std_stack.h, std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h, std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h, std_deque.h, std_istream.h, std_numeric.h, std_string.h, std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h, std_queue.h, std_valarray.h, std_functional.h, std_limits.h, std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h: Same. * include/c_std/bits/std_cassert.h: Move to... * include/c_std/cassert: Here. * include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c_std/cmath: Adjust cmath.tcc include. * include/c_std/cstdlib: Adjust includes. * include/c_std/cwchar: Same. * include/c_std/ctime: Same. * include/c_std/cstring: Same. * include/c_std/cstdio: Same. * include/c_std/bits: Remove directory. * include/c/bits/std_cassert.h: Move to... * include/c/cassert: Here. * include/c/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c/bits: Remove directory. * include/std/cwctype: Remove. * include/std/cwchar: Remove. * include/std/ctime: Remove. * include/std/cstring: Remove. * include/std/cstdlib: Remove. * include/std/cstdio: Remove. * include/std/cstddef: Remove. * include/std/cstdarg: Remove. * include/std/csignal: Remove. * include/std/csetjmp: Remove. * include/std/cmath: Remove. * include/std/clocale: Remove. * include/std/climits: Remove. * include/std/ciso646: Remove. * include/std/cfloat: Remove. * include/std/cerrno: Remove. * include/std/cctype: Remove. * include/std/cassert: Remove. * include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h> files and subsituting <.xxx> * include/bits/valarray_array.h: Same. * include/bits/stl_uninitialized.h: Same. * include/bits/stl_alloc.h: Same. * include/bits/stl_algobase.h: Same. * include/bits/sstream.tcc: Same. * include/bits/pthread_allocimpl.h: Same. * include/bits/ostream.tcc: Same. * include/bits/localefwd.h: Same. * include/bits/locale_facets.tcc: Same. * include/bits/locale_facets.h: Same. * include/bits/istream.tcc: Same. * include/bits/char_traits.h: Same. * include/bits/boost_concept_check.h: Same. * include/bits/basic_file.h: Same. * include/std/bitset: Same. * include/std/complex: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/ios: Same. * include/std/iostream: Same. * include/std/ostream: Same. * include/std/sstream: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/iterator: Same. * include/std/valarray: Same. * src/ios.cc: Adjust includes. * src/valarray-inst.cc: Same. * src/string-inst.cc: Same. * src/stl-inst.cc: Same. * src/stdexcept.cc: Same. * src/misc-inst.cc: Same. * src/localename.cc: Same. * src/locale-inst.cc: Same. * src/locale.cc: Same. * src/limits.cc: Same. * src/concept-inst.cc: Same. * src/complex_io.cc: Same. * src/codecvt.cc: Same. * src/bitset.cc: Same. * src/cmath.cc: Same. From-SVN: r48544
2002-01-04 22:27:36 +01:00
#include <stdexcept>
#include <locale>
#include <istream>
#include <ostream>
#include <vector>
#include <memory> // for auto_ptr
#ifdef _GLIBCPP_USE_WCHAR_T
Makefile.am (std_headers): Remove cXXX from list. 2002-01-04 Benjamin Kosnik <bkoz@redhat.com> * include/Makefile.am (std_headers): Remove cXXX from list. (c_base_srcdir): No bits subdirectory. (c_base_builddir): Same. (c_base_headers): Adjust names, add ciso646. (bits_headers): Remove std_xxx.h headers. * include/Makefile.in: Regenerate. * include/ext/iterator: Adjust includes. * include/ext/ropeimpl.h: Same. * include/ext/stl_hash_fun.h: Same. * include/ext/algorithm: Same. * include/backward/bvector.h: Adjust includes. * include/backward/vector.h: Same. * include/backward/strstream: Same. * include/backward/streambuf.h: Same. * include/backward/stack.h: Same. * include/backward/set.h: Same. * include/backward/queue.h: Same. * include/backward/multiset.h: Same. * include/backward/multimap.h: Same. * include/backward/map.h: Same. * include/backward/list.h: Same. * include/backward/iterator.h: Same. * include/backward/iostream.h: Same. * include/backward/iomanip.h: Same. * include/backward/fstream.h: Same. * include/backward/deque.h: Same. * include/backward/complex.h: Same. * include/bits/std_algorithm.h: Move to... * include/std/algorithm: ...here. * include/bits/std_iosfwd.h, std_locale.h, std_stack.h, std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h, std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h, std_deque.h, std_istream.h, std_numeric.h, std_string.h, std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h, std_queue.h, std_valarray.h, std_functional.h, std_limits.h, std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h: Same. * include/c_std/bits/std_cassert.h: Move to... * include/c_std/cassert: Here. * include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c_std/cmath: Adjust cmath.tcc include. * include/c_std/cstdlib: Adjust includes. * include/c_std/cwchar: Same. * include/c_std/ctime: Same. * include/c_std/cstring: Same. * include/c_std/cstdio: Same. * include/c_std/bits: Remove directory. * include/c/bits/std_cassert.h: Move to... * include/c/cassert: Here. * include/c/std_cctype.h, std_cerrno.h, std_cfloat.h, std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h, std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h, std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h, std_cwctype.h: Same. * include/c/bits: Remove directory. * include/std/cwctype: Remove. * include/std/cwchar: Remove. * include/std/ctime: Remove. * include/std/cstring: Remove. * include/std/cstdlib: Remove. * include/std/cstdio: Remove. * include/std/cstddef: Remove. * include/std/cstdarg: Remove. * include/std/csignal: Remove. * include/std/csetjmp: Remove. * include/std/cmath: Remove. * include/std/clocale: Remove. * include/std/climits: Remove. * include/std/ciso646: Remove. * include/std/cfloat: Remove. * include/std/cerrno: Remove. * include/std/cctype: Remove. * include/std/cassert: Remove. * include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h> files and subsituting <.xxx> * include/bits/valarray_array.h: Same. * include/bits/stl_uninitialized.h: Same. * include/bits/stl_alloc.h: Same. * include/bits/stl_algobase.h: Same. * include/bits/sstream.tcc: Same. * include/bits/pthread_allocimpl.h: Same. * include/bits/ostream.tcc: Same. * include/bits/localefwd.h: Same. * include/bits/locale_facets.tcc: Same. * include/bits/locale_facets.h: Same. * include/bits/istream.tcc: Same. * include/bits/char_traits.h: Same. * include/bits/boost_concept_check.h: Same. * include/bits/basic_file.h: Same. * include/std/bitset: Same. * include/std/complex: Same. * include/std/fstream: Same. * include/std/functional: Same. * include/std/ios: Same. * include/std/iostream: Same. * include/std/ostream: Same. * include/std/sstream: Same. * include/std/streambuf: Same. * include/std/string: Same. * include/std/iterator: Same. * include/std/valarray: Same. * src/ios.cc: Adjust includes. * src/valarray-inst.cc: Same. * src/string-inst.cc: Same. * src/stl-inst.cc: Same. * src/stdexcept.cc: Same. * src/misc-inst.cc: Same. * src/localename.cc: Same. * src/locale-inst.cc: Same. * src/locale.cc: Same. * src/limits.cc: Same. * src/concept-inst.cc: Same. * src/complex_io.cc: Same. * src/codecvt.cc: Same. * src/bitset.cc: Same. * src/cmath.cc: Same. From-SVN: r48544
2002-01-04 22:27:36 +01:00
# include <cwctype> // for towupper, etc.
#endif
namespace std
{
// Defined in globals.cc.
extern locale::_Impl locale_impl_c;
extern locale locale_c;
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
// Definitions for static const data members of locale.
const locale::category locale::none;
const locale::category locale::ctype;
const locale::category locale::numeric;
const locale::category locale::collate;
const locale::category locale::time;
const locale::category locale::monetary;
const locale::category locale::messages;
const locale::category locale::all;
locale::_Impl* locale::_S_classic;
locale::_Impl* locale::_S_global;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
const size_t locale::_S_num_categories;
const size_t locale::_S_num_facets;
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
// Definitions for locale::id of standard facets.
locale::id ctype<char>::id;
locale::id codecvt<char, char, mbstate_t>::id;
#ifdef _GLIBCPP_USE_WCHAR_T
locale::id ctype<wchar_t>::id;
locale::id codecvt<wchar_t, char, mbstate_t>::id;
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#endif
// Definitions for static const data members of locale::id
size_t locale::id::_S_highwater; // init'd to 0 by linker
// Definitions for static const data members of locale::_Impl
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
const locale::id* const
locale::_Impl::_S_id_ctype[] =
{
&std::ctype<char>::id,
&codecvt<char, char, mbstate_t>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#ifdef _GLIBCPP_USE_WCHAR_T
&std::ctype<wchar_t>::id,
&codecvt<wchar_t, char, mbstate_t>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#endif
0
};
const locale::id* const
locale::_Impl::_S_id_numeric[] =
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
{
&num_get<char>::id,
&num_put<char>::id,
&numpunct<char>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#ifdef _GLIBCPP_USE_WCHAR_T
&num_get<wchar_t>::id,
&num_put<wchar_t>::id,
&numpunct<wchar_t>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#endif
0
};
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
const locale::id* const
locale::_Impl::_S_id_collate[] =
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
{
&std::collate<char>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#ifdef _GLIBCPP_USE_WCHAR_T
&std::collate<wchar_t>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#endif
0
};
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
const locale::id* const
locale::_Impl::_S_id_time[] =
{
&__timepunct<char>::id,
&time_get<char>::id,
&time_put<char>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#ifdef _GLIBCPP_USE_WCHAR_T
&__timepunct<wchar_t>::id,
&time_get<wchar_t>::id,
&time_put<wchar_t>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#endif
0
};
const locale::id* const
locale::_Impl::_S_id_monetary[] =
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
{
&money_get<char>::id,
&money_put<char>::id,
&moneypunct<char, false>::id,
&moneypunct<char, true >::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#ifdef _GLIBCPP_USE_WCHAR_T
&money_get<wchar_t>::id,
&money_put<wchar_t>::id,
&moneypunct<wchar_t, false>::id,
&moneypunct<wchar_t, true >::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#endif
0
};
const locale::id* const
locale::_Impl::_S_id_messages[] =
{
&std::messages<char>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#ifdef _GLIBCPP_USE_WCHAR_T
&std::messages<wchar_t>::id,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
#endif
0
};
const locale::id* const* const
locale::_Impl::_S_facet_categories[] =
{
// Order must match the decl order in class locale.
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
locale::_Impl::_S_id_ctype,
locale::_Impl::_S_id_numeric,
locale::_Impl::_S_id_collate,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
locale::_Impl::_S_id_time,
locale::_Impl::_S_id_monetary,
locale_facets.tcc (_S_build_float_format): Move ... 2000-08-31 Benjamin Kosnik <bkoz@cygnus.com> * bits/locale_facets.tcc (_S_build_float_format): Move ... * src/locale.cc: Here. * bits/locale_facets.tcc (num_get::_M_extract): Clean up generic definition. Move specialization to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move _Format_cache specializations to ... * src/locale.cc: Here. * bits/locale_facets.tcc: Move use_facet<ctype> specializations to ... * src/locale.cc: Here. * bits/std_locale.h: Note that locale_facets.tcc should be included here, for standards conformance. It may increase compile times though. For the time being, enable. * testsuite/22_locale/facet.cc: New file, some parts commented out for the time being. * mkcheck.in: Append total time to test summary file. * bits/sbuf_iter.h : Formatting tweaks. Clean up static const data member definitions. * src/locale.cc: Add definitions for all missing locale, locale::_Imp, and locale::id static data members. (ctype<char>): Add table_size define. (money_base): Add _S_default_pattern, uglify. * bits/localefwd.h: Add definitions for static members of _Count_ones. * bits/locale_facets.h: Tweaks. * bits/locale_facets.tcc: Tweaks. * bits/string.tcc: Add definition for npos. * bits/ios_base.h: Tweaks. * bits/ios_base.h (ios_base::Init::_M_ios_base_init): Change to _S_ios_base_init. * src/ios.cc: And here. Add _S_local_words definition. Add definitions for __ios_flags const static data. * src/codecvt.cc: Same for __enc_traits. * src/locale-inst.cc: Remove money_base data member definition here. From-SVN: r36093
2000-09-01 10:58:07 +02:00
locale::_Impl::_S_id_messages,
0
};
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
locale::~locale() throw()
{ _M_impl->_M_remove_reference(); }
void
locale::_M_coalesce(const locale& __base, const locale& __add,
category __cat)
{
__cat = _S_normalize_category(__cat);
_M_impl = new _Impl(*__base._M_impl, 1);
try
{ _M_impl->_M_replace_categories(__add._M_impl, __cat); }
catch (...)
{
_M_impl->_M_remove_reference();
Add support for -fno-exceptions. 2001-02-15 Benjamin Kosnik <bkoz@redhat.com> Add support for -fno-exceptions. * include/bits/exception_support.h: Remove. * include/bits/basic_string.h: Remove exception_support. (string::_M_check): Replace __OUTOFRANGE with __throw_out_of_range. (string::at): Same. (string::substr): Same. * include/bits/basic_string.tcc (string::reserve): Replace __LENGTHERROR with __throw_length_error. (string::_S_create): Same. (string::resize): Same. (string::_M_replace): Same. (string::replace): Same. (string::copy): Replace __OUTOFRANGE with __throw_out_of_range. (string::compare): Same. * include/bits/stl_vector.h: Remove exception_support. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/bits/stl_range_errors.h: Remove. * include/bits/stl_deque.h: Use __throw_range_error. * include/bits/std_deque.h: Include functexcept.h. * include/bits/std_vector.h: Same. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/ext/stl_bvector.h (class __BVECTOR): Use __throw_range_error. * include/ext/bvector: Remove stl_range_errors.h * include/bits/c++config (_GLIBCPP_USE_EXCEPTIONS): Remove. * include/bits/functexcept.h: New file. * src/functexcept.cc: New file. Definitions for function-based exception routines. * src/Makefile.am (sources): Add functexcept.cc. * src/Makefile.in: Regenerate. * include/bits/stl_config.h (__STL_USE_EXCEPTIONS): Wrap with __EXCEPTIONS. * include/bits/localefwd.h: Include functexcept.h. * include/bits/std_iosfwd.h: Same. * include/bits/basic_ios.h: Use __throw_ios_failure instead of throw basic_ios::failure. * include/bits/fstream.tcc (filebuf::_M_allocate_buffers): Use __throw_exception_again. (filebuf::_M_filebuf_init): Same. * include/bits/streambuf.tcc (__copy_streambufs): Same. * include/bits/ostream.tcc (ostream::operator<<): Same. * include/bits/istream.tcc (istream::operator>>): Same. * include/bits/basic_string.tcc (string::_M_mutate): Same. (string::_S_construct): Same. (string::_M_clone): Same. * include/bits/locale_facets.tcc (use_facet(const locale&)): Use __throw_bad_cast. (num_put<_CharT, _OutIter>::do_put): Use __throw_exception_again. * src/localename.cc (locale::_Imp::_Imp(const _Impl&, size_t): Use __throw_exception_again. (locale::_Imp::_Imp(string, size_t): Same. (locale::_Imp::_M_replace_facet): Use __throw_runtime_error. * src/locale.cc (locale::_M_coalesce): Use __throw_exception_again. (locale::locale(const char*)): Use __throw_runtime_error. (locale::classic): Use __throw_exception_again. (locale::_S_normalize_category): Use __throw_runtime_error. * src/stdexcept.cc: Remove cruft. * libsupc++/exception_defines.h: New file. * libsupc++/new_opnt.cc: Include exception_defines.h. * libsupc++/vec.cc: Same. (__cxa_vec_new2): Use __throw_exception_again. (__cxa_vec_new3): Same. (__cxa_vec_ctor): Same. (__cxa_vec_delete3): Same. (__cxa_vec_cctor): Same. (__cxa_vec_delete2): Same. (__cxa_vec_dtor): Same. * libsupc++/exception_support.cc: Include exception_defines.h. Only compile exception-handling bits if __EXCEPTIONS is defined. Remove old ABI support. * libsupc++/new_op.cc (new): Include exception_defines.h. Use std::__throw_bad_alloc() instead of throw bad_alloc. * libsupc++/Makefile.am: Add exception_defines.h. * libsupc++/Makefile.in: Reformat. * libsupc++/*: Format. From-SVN: r39730
2001-02-16 01:44:44 +01:00
__throw_exception_again;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
}
locale::locale() throw()
{
_S_initialize();
(_M_impl = _S_global)->_M_add_reference();
} // XXX MT
locale::locale(const locale& __other) throw()
{ (_M_impl = __other._M_impl)->_M_add_reference(); }
// This is used to initialize global and classic locales, and
// assumes that the _Impl objects are constructed correctly.
locale::locale(_Impl* __ip) throw() : _M_impl(__ip)
{ }
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
locale::locale(const char* __s)
{
if (__s)
{
_S_initialize();
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
(_M_impl = _S_classic)->_M_add_reference();
else if (strcmp(__s, "") == 0)
_M_impl = new _Impl(setlocale(LC_ALL, __s), 1);
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
else
_M_impl = new _Impl(__s, 1);
}
else
Add support for -fno-exceptions. 2001-02-15 Benjamin Kosnik <bkoz@redhat.com> Add support for -fno-exceptions. * include/bits/exception_support.h: Remove. * include/bits/basic_string.h: Remove exception_support. (string::_M_check): Replace __OUTOFRANGE with __throw_out_of_range. (string::at): Same. (string::substr): Same. * include/bits/basic_string.tcc (string::reserve): Replace __LENGTHERROR with __throw_length_error. (string::_S_create): Same. (string::resize): Same. (string::_M_replace): Same. (string::replace): Same. (string::copy): Replace __OUTOFRANGE with __throw_out_of_range. (string::compare): Same. * include/bits/stl_vector.h: Remove exception_support. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/bits/stl_range_errors.h: Remove. * include/bits/stl_deque.h: Use __throw_range_error. * include/bits/std_deque.h: Include functexcept.h. * include/bits/std_vector.h: Same. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/ext/stl_bvector.h (class __BVECTOR): Use __throw_range_error. * include/ext/bvector: Remove stl_range_errors.h * include/bits/c++config (_GLIBCPP_USE_EXCEPTIONS): Remove. * include/bits/functexcept.h: New file. * src/functexcept.cc: New file. Definitions for function-based exception routines. * src/Makefile.am (sources): Add functexcept.cc. * src/Makefile.in: Regenerate. * include/bits/stl_config.h (__STL_USE_EXCEPTIONS): Wrap with __EXCEPTIONS. * include/bits/localefwd.h: Include functexcept.h. * include/bits/std_iosfwd.h: Same. * include/bits/basic_ios.h: Use __throw_ios_failure instead of throw basic_ios::failure. * include/bits/fstream.tcc (filebuf::_M_allocate_buffers): Use __throw_exception_again. (filebuf::_M_filebuf_init): Same. * include/bits/streambuf.tcc (__copy_streambufs): Same. * include/bits/ostream.tcc (ostream::operator<<): Same. * include/bits/istream.tcc (istream::operator>>): Same. * include/bits/basic_string.tcc (string::_M_mutate): Same. (string::_S_construct): Same. (string::_M_clone): Same. * include/bits/locale_facets.tcc (use_facet(const locale&)): Use __throw_bad_cast. (num_put<_CharT, _OutIter>::do_put): Use __throw_exception_again. * src/localename.cc (locale::_Imp::_Imp(const _Impl&, size_t): Use __throw_exception_again. (locale::_Imp::_Imp(string, size_t): Same. (locale::_Imp::_M_replace_facet): Use __throw_runtime_error. * src/locale.cc (locale::_M_coalesce): Use __throw_exception_again. (locale::locale(const char*)): Use __throw_runtime_error. (locale::classic): Use __throw_exception_again. (locale::_S_normalize_category): Use __throw_runtime_error. * src/stdexcept.cc: Remove cruft. * libsupc++/exception_defines.h: New file. * libsupc++/new_opnt.cc: Include exception_defines.h. * libsupc++/vec.cc: Same. (__cxa_vec_new2): Use __throw_exception_again. (__cxa_vec_new3): Same. (__cxa_vec_ctor): Same. (__cxa_vec_delete3): Same. (__cxa_vec_cctor): Same. (__cxa_vec_delete2): Same. (__cxa_vec_dtor): Same. * libsupc++/exception_support.cc: Include exception_defines.h. Only compile exception-handling bits if __EXCEPTIONS is defined. Remove old ABI support. * libsupc++/new_op.cc (new): Include exception_defines.h. Use std::__throw_bad_alloc() instead of throw bad_alloc. * libsupc++/Makefile.am: Add exception_defines.h. * libsupc++/Makefile.in: Reformat. * libsupc++/*: Format. From-SVN: r39730
2001-02-16 01:44:44 +01:00
__throw_runtime_error("attempt to create locale from NULL name");
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
locale::locale(const locale& __base, const char* __s, category __cat)
{
// NB: There are complicated, yet more efficient ways to do
// this. Building up locales on a per-category way is tedious, so
// let's do it this way until people complain.
locale __add(__s);
_M_coalesce(__base, __add, __cat);
}
locale::locale(const locale& __base, const locale& __add, category __cat)
{ _M_coalesce(__base, __add, __cat); }
bool
locale::operator==(const locale& __rhs) const throw()
{
string __name = this->name();
return (_M_impl == __rhs._M_impl
|| (__name != "*" && __name == __rhs.name()));
}
const locale&
locale::operator=(const locale& __other) throw()
{
__other._M_impl->_M_add_reference();
_M_impl->_M_remove_reference();
_M_impl = __other._M_impl;
return *this;
}
locale
locale::global(const locale& __other)
{
// XXX MT
_S_initialize();
_Impl* __old = _S_global;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
__other._M_impl->_M_add_reference();
_S_global = __other._M_impl;
if (_S_global->_M_check_same_name() && _S_global->_M_names[0] != "*")
setlocale(LC_ALL, __other.name().c_str());
// Reference count sanity check: one reference removed for the
// subsition of __other locale, one added by return-by-value. Net
// difference: zero. When the returned locale object's destrutor
// is called, then the reference count is decremented and possibly
// destroyed.
return locale(__old);
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
string
locale::name() const
{
string __ret;
// Need some kind of separator character. This one was pretty much
// arbitrarily chosen as to not conflict with glibc locales: the
// exact formatting is not set in stone.
const char __separator = '|';
if (_M_impl->_M_check_same_name())
__ret = _M_impl->_M_names[0];
else
{
for (size_t i = 0; i < _S_num_categories; ++i)
__ret += __separator + _M_impl->_M_names[i];
}
return __ret;
}
locale const&
locale::classic()
{
// XXX MT
if (!_S_classic)
{
try
{
// 26 Standard facets, 2 references.
// One reference for _M_classic, one for _M_global
_S_classic = new (&locale_impl_c) _Impl("C", 2);
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
_S_global = _S_classic;
new (&locale_c) locale(_S_classic);
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
catch(...)
{
// Just call destructor, so that locale_impl_c's memory is
// not deallocated via a call to delete.
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
if (_S_classic)
_S_classic->~_Impl();
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
_S_classic = _S_global = 0;
Add support for -fno-exceptions. 2001-02-15 Benjamin Kosnik <bkoz@redhat.com> Add support for -fno-exceptions. * include/bits/exception_support.h: Remove. * include/bits/basic_string.h: Remove exception_support. (string::_M_check): Replace __OUTOFRANGE with __throw_out_of_range. (string::at): Same. (string::substr): Same. * include/bits/basic_string.tcc (string::reserve): Replace __LENGTHERROR with __throw_length_error. (string::_S_create): Same. (string::resize): Same. (string::_M_replace): Same. (string::replace): Same. (string::copy): Replace __OUTOFRANGE with __throw_out_of_range. (string::compare): Same. * include/bits/stl_vector.h: Remove exception_support. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/bits/stl_range_errors.h: Remove. * include/bits/stl_deque.h: Use __throw_range_error. * include/bits/std_deque.h: Include functexcept.h. * include/bits/std_vector.h: Same. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/ext/stl_bvector.h (class __BVECTOR): Use __throw_range_error. * include/ext/bvector: Remove stl_range_errors.h * include/bits/c++config (_GLIBCPP_USE_EXCEPTIONS): Remove. * include/bits/functexcept.h: New file. * src/functexcept.cc: New file. Definitions for function-based exception routines. * src/Makefile.am (sources): Add functexcept.cc. * src/Makefile.in: Regenerate. * include/bits/stl_config.h (__STL_USE_EXCEPTIONS): Wrap with __EXCEPTIONS. * include/bits/localefwd.h: Include functexcept.h. * include/bits/std_iosfwd.h: Same. * include/bits/basic_ios.h: Use __throw_ios_failure instead of throw basic_ios::failure. * include/bits/fstream.tcc (filebuf::_M_allocate_buffers): Use __throw_exception_again. (filebuf::_M_filebuf_init): Same. * include/bits/streambuf.tcc (__copy_streambufs): Same. * include/bits/ostream.tcc (ostream::operator<<): Same. * include/bits/istream.tcc (istream::operator>>): Same. * include/bits/basic_string.tcc (string::_M_mutate): Same. (string::_S_construct): Same. (string::_M_clone): Same. * include/bits/locale_facets.tcc (use_facet(const locale&)): Use __throw_bad_cast. (num_put<_CharT, _OutIter>::do_put): Use __throw_exception_again. * src/localename.cc (locale::_Imp::_Imp(const _Impl&, size_t): Use __throw_exception_again. (locale::_Imp::_Imp(string, size_t): Same. (locale::_Imp::_M_replace_facet): Use __throw_runtime_error. * src/locale.cc (locale::_M_coalesce): Use __throw_exception_again. (locale::locale(const char*)): Use __throw_runtime_error. (locale::classic): Use __throw_exception_again. (locale::_S_normalize_category): Use __throw_runtime_error. * src/stdexcept.cc: Remove cruft. * libsupc++/exception_defines.h: New file. * libsupc++/new_opnt.cc: Include exception_defines.h. * libsupc++/vec.cc: Same. (__cxa_vec_new2): Use __throw_exception_again. (__cxa_vec_new3): Same. (__cxa_vec_ctor): Same. (__cxa_vec_delete3): Same. (__cxa_vec_cctor): Same. (__cxa_vec_delete2): Same. (__cxa_vec_dtor): Same. * libsupc++/exception_support.cc: Include exception_defines.h. Only compile exception-handling bits if __EXCEPTIONS is defined. Remove old ABI support. * libsupc++/new_op.cc (new): Include exception_defines.h. Use std::__throw_bad_alloc() instead of throw bad_alloc. * libsupc++/Makefile.am: Add exception_defines.h. * libsupc++/Makefile.in: Reformat. * libsupc++/*: Format. From-SVN: r39730
2001-02-16 01:44:44 +01:00
__throw_exception_again;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
}
return locale_c;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
locale::category
locale::_S_normalize_category(category __cat)
{
int __ret = 0;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
if (__cat == none || (__cat & all) && !(__cat & ~all))
__ret = __cat;
else
{
// NB: May be a C-style "LC_ALL" category; convert.
switch (__cat)
{
case LC_COLLATE:
__ret = collate;
break;
case LC_CTYPE:
__ret = ctype;
break;
case LC_MONETARY:
__ret = monetary;
break;
case LC_NUMERIC:
__ret = numeric;
break;
case LC_TIME:
__ret = time;
break;
#ifdef _GLIBCPP_HAVE_LC_MESSAGES
case LC_MESSAGES:
__ret = messages;
break;
#endif
case LC_ALL:
__ret = all;
break;
default:
Add support for -fno-exceptions. 2001-02-15 Benjamin Kosnik <bkoz@redhat.com> Add support for -fno-exceptions. * include/bits/exception_support.h: Remove. * include/bits/basic_string.h: Remove exception_support. (string::_M_check): Replace __OUTOFRANGE with __throw_out_of_range. (string::at): Same. (string::substr): Same. * include/bits/basic_string.tcc (string::reserve): Replace __LENGTHERROR with __throw_length_error. (string::_S_create): Same. (string::resize): Same. (string::_M_replace): Same. (string::replace): Same. (string::copy): Replace __OUTOFRANGE with __throw_out_of_range. (string::compare): Same. * include/bits/stl_vector.h: Remove exception_support. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/bits/stl_range_errors.h: Remove. * include/bits/stl_deque.h: Use __throw_range_error. * include/bits/std_deque.h: Include functexcept.h. * include/bits/std_vector.h: Same. * src/Makefile.am (base_headers): Remove here. * src/Makefile.in: Regenerate. * include/ext/stl_bvector.h (class __BVECTOR): Use __throw_range_error. * include/ext/bvector: Remove stl_range_errors.h * include/bits/c++config (_GLIBCPP_USE_EXCEPTIONS): Remove. * include/bits/functexcept.h: New file. * src/functexcept.cc: New file. Definitions for function-based exception routines. * src/Makefile.am (sources): Add functexcept.cc. * src/Makefile.in: Regenerate. * include/bits/stl_config.h (__STL_USE_EXCEPTIONS): Wrap with __EXCEPTIONS. * include/bits/localefwd.h: Include functexcept.h. * include/bits/std_iosfwd.h: Same. * include/bits/basic_ios.h: Use __throw_ios_failure instead of throw basic_ios::failure. * include/bits/fstream.tcc (filebuf::_M_allocate_buffers): Use __throw_exception_again. (filebuf::_M_filebuf_init): Same. * include/bits/streambuf.tcc (__copy_streambufs): Same. * include/bits/ostream.tcc (ostream::operator<<): Same. * include/bits/istream.tcc (istream::operator>>): Same. * include/bits/basic_string.tcc (string::_M_mutate): Same. (string::_S_construct): Same. (string::_M_clone): Same. * include/bits/locale_facets.tcc (use_facet(const locale&)): Use __throw_bad_cast. (num_put<_CharT, _OutIter>::do_put): Use __throw_exception_again. * src/localename.cc (locale::_Imp::_Imp(const _Impl&, size_t): Use __throw_exception_again. (locale::_Imp::_Imp(string, size_t): Same. (locale::_Imp::_M_replace_facet): Use __throw_runtime_error. * src/locale.cc (locale::_M_coalesce): Use __throw_exception_again. (locale::locale(const char*)): Use __throw_runtime_error. (locale::classic): Use __throw_exception_again. (locale::_S_normalize_category): Use __throw_runtime_error. * src/stdexcept.cc: Remove cruft. * libsupc++/exception_defines.h: New file. * libsupc++/new_opnt.cc: Include exception_defines.h. * libsupc++/vec.cc: Same. (__cxa_vec_new2): Use __throw_exception_again. (__cxa_vec_new3): Same. (__cxa_vec_ctor): Same. (__cxa_vec_delete3): Same. (__cxa_vec_cctor): Same. (__cxa_vec_delete2): Same. (__cxa_vec_dtor): Same. * libsupc++/exception_support.cc: Include exception_defines.h. Only compile exception-handling bits if __EXCEPTIONS is defined. Remove old ABI support. * libsupc++/new_op.cc (new): Include exception_defines.h. Use std::__throw_bad_alloc() instead of throw bad_alloc. * libsupc++/Makefile.am: Add exception_defines.h. * libsupc++/Makefile.in: Reformat. * libsupc++/*: Format. From-SVN: r39730
2001-02-16 01:44:44 +01:00
__throw_runtime_error("bad locale category");
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
}
return __ret;
}
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
2001-12-15 08:05:04 +01:00
__c_locale
locale::facet::_S_c_locale;
locale::facet::
~facet() { }
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
locale::facet::
facet(size_t __refs) throw() : _M_references(__refs)
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
2001-12-15 08:05:04 +01:00
{
if (!_S_c_locale)
_S_create_c_locale(_S_c_locale, "C");
}
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
void
locale::facet::
_M_add_reference() throw()
Numeric facets cleanup. 2001-11-27 Benjamin Kosnik <bkoz@redhat.com> Numeric facets cleanup. * include/bits/locale_facets.h (__num_base::_S_atoms): Add, remove + and - signs. (__num_base::_M_zero): Add (__num_base::_M_e): Add. (__num_base::_M_E): Add. * include/bits/locale_facets.tcc (num_get::_M_extract): Remove. (num_get::_M_extract_float): New. (num_get::_M_extract_int): New. * src/locale.cc (num_get::_M_extract): Remove. * include/bits/locale_facets.tcc (num_put::_M_insert_float): Simplify, use _M_insert. (num_put::do_put(bool)): Simplify, remove __pad. (__pad): Remove. (__pad_output): Change to __pad. * include/bits/ostream.tcc: And here. * src/locale-inst: Remove instantiations. * include/bits/locale_facets.h: Move helper functions in to class num_put. (num_put::_M_insert_float): Same, for __output_integer. (num_put::_M_insert_int): Same, for __output_float. (num_put::_M_insert): New. (__num_base): Add. (__num_base::_S_format_float): Move __build_float_format into class __num_base. (__num_base::_S_format_int): Move __build_int_format into class __num_base. * include/bits/locale_facets.tcc (__group_digits): Change to (__add_grouping): This. * src/locale-inst.cc: And here. Tweak instantiations. * src/misc-inst.cc: Remove instantiations. * include/bits/ostream.tcc (__pad_char): Rename, adjust inserters for new calling conventions, move to... * include/bits/locale_facets.tcc (__pad_output): Here. Adjust signature to make it useful for both ostream and num_put. (__pad_numeric): Remove. * src/misc-inst.cc: Remove instantiations. * src/locale-inst.cc: Same. * include/bits/locale_facets.h (_Numeric_get): Remove. (_Numeric_put): Remove. (num_get::get(short)): Remove. (num_get::get(int)): Remove. (num_get::do_get(short)): Remove. (num_get::do_get(int)): Remove. * include/bits/istream.tcc (istream::operator>>(short)): Fix as per DR 118. (istream::operator>>(int)): Same. * include/bits/locale_facets.h (_Format_cache): Remove. * include/bits/locale_facets.tcc: Same. * src/locale.cc: Same. * src/locale-inst.cc: Same. * include/bits/ostream.tcc: Same. * src/ios.cc (ios_base::imbue): Remove here as well. * testsuite/22_locale/num_get.cc: New file. * testsuite/22_locale/num_get_members_char.cc: New file. * testsuite/22_locale/num_get_members_wchar_t.cc: New. * testsuite/22_locale/numpunct_members_wchar_t.cc: New file. * testsuite/22_locale/num_put.cc: New file. * testsuite/22_locale/num_put_members_char.cc: New file. * testsuite/22_locale/num_put_members_wchar_t.cc: New file. * testsuite/27_io/ostream_inserter_arith.cc: Fix. * testsuite/27_io/istream_extractor_arith.cc: Fix. From-SVN: r47397
2001-11-28 05:07:11 +01:00
{ ++_M_references; } // XXX MT
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
void
locale::facet::
_M_remove_reference() throw()
{
if (_M_references-- == 0)
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
{
try
{ delete this; }
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
catch (...)
{ }
}
}
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
2001-12-15 08:05:04 +01:00
locale::id::id() { }
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
// Definitions for static const data members of ctype_base.
const ctype_base::mask ctype_base::space;
const ctype_base::mask ctype_base::print;
const ctype_base::mask ctype_base::cntrl;
const ctype_base::mask ctype_base::upper;
const ctype_base::mask ctype_base::lower;
const ctype_base::mask ctype_base::alpha;
const ctype_base::mask ctype_base::digit;
const ctype_base::mask ctype_base::punct;
const ctype_base::mask ctype_base::xdigit;
const ctype_base::mask ctype_base::alnum;
const ctype_base::mask ctype_base::graph;
// Platform-specific initialization code for ctype tables.
#include <bits/ctype_noninline.h>
const size_t ctype<char>::table_size;
ctype<char>::~ctype()
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
2001-12-15 08:05:04 +01:00
{
if (_M_c_locale_ctype)
_S_destroy_c_locale(_M_c_locale_ctype);
if (_M_del)
delete[] this->table();
}
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
// 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; }
const char*
ctype<char>::do_widen(const char* __lo, const char* __hi, char* __dest) const
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
{
memcpy(__dest, __lo, __hi - __lo);
return __hi;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
char
ctype<char>::do_narrow(char __c, char /*__dfault*/) const
{ return __c; }
const char*
ctype<char>::do_narrow(const char* __lo, const char* __hi,
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
char /*__dfault*/, char* __dest) const
{
memcpy(__dest, __lo, __hi - __lo);
return __hi;
Preliminary named locales. 2001-01-29 Benjamin Kosnik <bkoz@redhat.com> Preliminary named locales. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): New macro. * aclocal.m4: Regenerate. * configure.in: Use it. * configure: Regerate. * src/Makefile.am (sources): Add c++locale.cc. (build_headers): Add c++locale.h. * src/Makefile.in: Regenerate. * config/c_locale_gnu.h: New file. * config/c_locale_gnu.cc: New file. Non-inline member functions for named locales, gnu-specific. * config/c_locale_generic.h: New file. * config/c_locale_generic.cc: New file. Non-inline member functions for named locales, generic version. * docs/html/configopts.html: Add documentation on new options. * include/bits/locale_facets.h (class _Messages): Remove. (class _Moneypunct): Remove. * src/locale-inst.cc: Remove. * include/bits/locale_facets.h (class _Collate): Remove. * src/locale-inst.cc (std): Remove. * src/locale.cc: And here. * include/bits/localefwd.h (locale::_M_coalesce): New function. Correctly put together multi-name locales. (_Impl(const _Impl&, category, size_t)): Remove. * include/bits/localefwd.h (locale::_Impl): Remove _M_construct_* member functions. (_M_normalize_category_names): Remove. (_M_replace_categories): Fix. * src/localename.cc (locale::_Impl::_M_construct_collate): Remove. (locale::_Impl::_M_construct_ctype): Remove. (locale::_Impl::_M_construct_monetary): Remove. (locale::_Impl::_M_construct_numeric): Remove. (locale::_Impl::_M_construct_time): Remove. (locale::_Impl::_M_construct_messages): Remove. * include/bits/locale_facets.h (_Bad_use_facet): Remove. (_Use_facet_failure_handle): Remove. * src/locale.cc: Remove definitions. * src/locale-inst.cc: And here. * testsuite/22_locale/ctor_copy_dtor.cc (test01): Fixup. Add tests. * src/localename.cc (locale::facet::_S_create_c_locale): Properly create and error-check underlying locale object. (locale::facet::_S_destroy_c_locale): Add, take care of properly tearing down underlying locale object. * include/bits/localefwd.h (locale::facet): Declare. * testsuite/22_locale/members.cc: Don't test "fr_FR" locale for correctness, as glibc apparently has incorrect info in it. Test with it when it works again..... * include/bits/localefwd.h (locale::_Impl::__vec_string): Remove. Number of categories is fixed at six, so just simplify and make this an array of strings. (locale::_Impl::_M_has_name): Remove. (locale::_Impl::_M_name): Remove. (locale::_Impl::_M_category_names): Turns into... (locale::_Impl::_M_names): ...this. (locale::_Impl::_M_has_same_name()): New function. * src/localename.cc (locale::_Impl::~_Impl()): Remove here. (locale::_Impl::_Impl(size_t __refs, string __str)): Simplify signature. * src/locale.cc (locale::name()): Construct mangled name accurately reflecting combined locale categories. * src/locale.cc (locale::classic()): Don't initialize here. * src/localename.cc (locale::_Impl::_Impl(size_t __num, size_t __refs, bool __has_name, string __str): Do it here. * include/bits/localefwd.h: _S_categories_num to _S_num_categories. _S_facets_num to _S_num_facets. (locale::id::id()): Explicitly set _M_index to zero. * src/locale.cc: Same. * src/locale.cc: (locale::locale(const char*)): Construct named locales uniquely. * src/locale.cc: Remove numpunct_byname ctors. * testsuite/22_locale/numpunct_byname.cc: New file. * testsuite/22_locale/numpunct.cc: New file. * include/bits/localefwd.h (class locale): Change data members to protected, from private. (_Impl::_M_get_c_locale): Add member function. (locale::facet::_M_get_global_impl()): Add member function. * include/bits/locale_facets.h (numpunct::_M_init): Change to take a __c_locale pointer. (numpunct::numpunct( __c_locale*, size_t)): Add additonal ctor for named locales. * testsuite/22_locale/members.cc: New file, test name and combine. * include/bits/locale_facets.h (class numpunct): Remove class _Punct and _Numpunct. Rewrite class numpunct to be correct for named locales. * include/bits/localefwd.h (locale::_Imp::_M_c_locale): Add. * src/localename.cc (_Impl::~_Impl()): Call __frelocale. (_Imp::_Impl(size_t, size_t, bool, string)) Initialize _M_c_locale. * src/locale-inst.cc: Remove _Numpunct, _Punct instantiations. * testsuite/22_locale/numpunct_char_members.cc: New file. From-SVN: r39347
2001-01-30 10:18:51 +01:00
}
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
2001-12-15 08:05:04 +01:00
#ifdef _GLIBCPP_USE_WCHAR_T
Named locale support for ctype<char>. 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. From-SVN: r47953
2001-12-13 00:16:35 +01:00
ctype<wchar_t>::ctype(size_t __refs)
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
2001-12-15 08:05:04 +01:00
: __ctype_abstract_base<wchar_t>(__refs)
{ _M_c_locale_ctype = _S_clone_c_locale(_S_c_locale); }
Named locale support for ctype<char>. 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. From-SVN: r47953
2001-12-13 00:16:35 +01:00
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
2001-12-15 08:05:04 +01:00
ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs)
: __ctype_abstract_base<wchar_t>(__refs)
{ _M_c_locale_ctype = _S_clone_c_locale(__cloc); }
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
2001-12-15 08:05:04 +01:00
ctype<wchar_t>::~ctype()
{ _S_destroy_c_locale(_M_c_locale_ctype); }
template<>
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
2001-12-15 08:05:04 +01:00
ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
: ctype<wchar_t>(__refs)
{
_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
template<>
const char*
__timepunct<char>::_S_timezones[14] =
{
"GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
"IST", "EET", "CST", "JST"
};
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
const wchar_t*
__timepunct<wchar_t>::_S_timezones[14] =
{
L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
};
#endif
// Definitions for static const data members of money_base
const money_base::pattern
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
2001-12-15 08:05:04 +01:00
money_base::_S_default_pattern = { {symbol, sign, none, value} };
template<>
const ctype<char>&
use_facet<ctype<char> >(const locale& __loc)
{
size_t __i = ctype<char>::id._M_index;
const locale::_Impl* __tmp = __loc._M_impl;
return static_cast<const ctype<char>&>(* (*(__tmp->_M_facets))[__i]);
}
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
const ctype<wchar_t>&
use_facet<ctype<wchar_t> >(const locale& __loc)
{
size_t __i = ctype<wchar_t>::id._M_index;
const locale::_Impl* __tmp = __loc._M_impl;
return static_cast<const ctype<wchar_t>&>(* (*(__tmp->_M_facets))[__i]);
}
#endif
const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF";
const double __num_base::_S_scale_hex = log(10.0)/log(16.0);
const double __num_base::_S_scale_oct = log(10.0)/log(8.0);
bool
__num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod,
streamsize __prec)
{
bool __incl_prec = false;
ios_base::fmtflags __flags = __io.flags();
*__fptr++ = '%';
// [22.2.2.2.2] Table 60
if (__flags & ios_base::showpos)
*__fptr++ = '+';
if (__flags & ios_base::showpoint)
*__fptr++ = '#';
// As per [22.2.2.2.2.11]
if (__flags & ios_base::fixed || __prec > 0)
{
*__fptr++ = '.';
*__fptr++ = '*';
__incl_prec = true;
}
if (__mod)
*__fptr++ = __mod;
ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
// [22.2.2.2.2] Table 58
if (__fltfield == ios_base::fixed)
*__fptr++ = 'f';
else if (__fltfield == ios_base::scientific)
*__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e';
else
*__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g';
*__fptr = '\0';
return __incl_prec;
}
void
__num_base::_S_format_int(const ios_base& __io, char* __fptr, char __mod,
char __modl)
{
ios_base::fmtflags __flags = __io.flags();
*__fptr++ = '%';
// [22.2.2.2.2] Table 60
if (__flags & ios_base::showpos)
*__fptr++ = '+';
if (__flags & ios_base::showbase)
*__fptr++ = '#';
*__fptr++ = 'l';
// For long long types.
if (__modl)
*__fptr++ = __modl;
ios_base::fmtflags __bsefield = __flags & ios_base::basefield;
if (__bsefield == ios_base::hex)
*__fptr++ = (__flags & ios_base::uppercase) ? 'X' : 'x';
else if (__bsefield == ios_base::oct)
*__fptr++ = 'o';
else
*__fptr++ = __mod;
*__fptr = '\0';
}
template<>
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
2001-12-15 08:05:04 +01:00
moneypunct_byname<char, false>::moneypunct_byname(const char*,
size_t __refs)
: moneypunct<char, false>(__refs) { }
template<>
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
2001-12-15 08:05:04 +01:00
moneypunct_byname<char, true>::moneypunct_byname(const char*,
size_t __refs)
: moneypunct<char, true>(__refs) { }
} // namespace std