diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-20 08:30:01 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-20 08:30:01 +0000 |
commit | 88825d882818d439e1fcc53095749b1fb839573a (patch) | |
tree | 2a5dcdc28c5a07e9a96570184d62aa77b9a7b0f0 /libstdc++-v3/src | |
parent | c6d7113cdcd4eaf0b3cbdd0a3b949c3d51361052 (diff) | |
download | gcc-88825d882818d439e1fcc53095749b1fb839573a.tar.gz |
2001-09-19 Benjamin Kosnik <bkoz@redhat.com>
Implement std::time_put.
* include/bits/locale_facets.h: Include time_members.h.
(__timepunct): New.
(time_put): Implement.
* include/bits/locale_facets.tcc (do_put): Put generic versions here.
* include/bits/localefwd.h: Bump number of facets.
* config/locale/time_members_generic.h: New file.
* config/locale/time_members_gnu.h: New file.
* config/locale/c_locale_generic.h: Include clocale.
* src/locale-inst.cc: Add use_facet instantiations for __timepunct.
* src/locale.cc: Add __timepunct initializations.
* src/localename.cc (locale::_Impl::_Impl(string, size_t)): Same.
* include/Makefile.am (stamp-target): Add time_members.h.
* include/Makefile.in: Regenerate.
* acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add CTIME_H.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* testsuite/22_locale/time_put.cc: New file.
* testsuite/22_locale/time_put_members_char.cc: New file.
* docs/html/22_locale/locale.html: Add note.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45702 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/Makefile.in | 52 | ||||
-rw-r--r-- | libstdc++-v3/src/locale-inst.cc | 35 | ||||
-rw-r--r-- | libstdc++-v3/src/locale.cc | 2 | ||||
-rw-r--r-- | libstdc++-v3/src/localename.cc | 5 |
4 files changed, 71 insertions, 23 deletions
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index edea4108471..80caff14ac8 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -66,6 +66,7 @@ AR = @AR@ AS = @AS@ ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@ BASIC_FILE_H = @BASIC_FILE_H@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ @@ -76,6 +77,7 @@ CMESSAGES_H = @CMESSAGES_H@ CPP = @CPP@ CSHADOW_FLAGS = @CSHADOW_FLAGS@ CSTDIO_H = @CSTDIO_H@ +CTIME_H = @CTIME_H@ CXXCPP = @CXXCPP@ C_INCLUDE_DIR = @C_INCLUDE_DIR@ DATADIRNAME = @DATADIRNAME@ @@ -86,16 +88,16 @@ EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ GCJ = @GCJ@ GCJFLAGS = @GCJFLAGS@ GENCAT = @GENCAT@ +GLIBC21 = @GLIBC21@ GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ -INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ +INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LIBICONV = @LIBICONV@ LIBMATHOBJS = @LIBMATHOBJS@ LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@ LIBTOOL = @LIBTOOL@ @@ -137,7 +139,6 @@ glibcpp_toolexecdir = @glibcpp_toolexecdir@ glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@ gxx_include_dir = @gxx_include_dir@ ifGNUmake = @ifGNUmake@ -l = @l@ libio_la = @libio_la@ libtool_VERSION = @libtool_VERSION@ release_VERSION = @release_VERSION@ @@ -161,11 +162,13 @@ OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ # These bits are all figured out from configure. Look in acinclude.m4 # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden. -CONFIG_CXXFLAGS = @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ +CONFIG_CXXFLAGS = \ + @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ # Warning flags to use. -WARN_CXXFLAGS = @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once +WARN_CXXFLAGS = \ + @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES @@ -175,17 +178,29 @@ LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@ LIBIO_INCLUDES = @LIBIO_INCLUDES@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ -INCLUDES = -nostdinc++ $(GLIBCPP_INCLUDES) $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) $(TOPLEVEL_INCLUDES) +INCLUDES = \ + -nostdinc++ \ + $(GLIBCPP_INCLUDES) \ + $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \ + $(TOPLEVEL_INCLUDES) -sources = basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc complex_io.cc functexcept.cc globals.cc ios.cc limits.cc locale.cc locale-inst.cc localename.cc collate.cc messages.cc moneypunct.cc numpunct.cc misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc valarray-inst.cc wstring-inst.cc +sources = \ + basic_file.cc bitset.cc c++locale.cc cmath.cc codecvt.cc \ + complex_io.cc functexcept.cc globals.cc ios.cc limits.cc \ + locale.cc locale-inst.cc localename.cc \ + collate.cc messages.cc moneypunct.cc numpunct.cc \ + misc-inst.cc stdexcept.cc stl-inst.cc string-inst.cc strstream.cc \ + valarray-inst.cc wstring-inst.cc VPATH = $(top_srcdir):$(top_srcdir)/src libstdc___la_SOURCES = $(sources) -libstdc___la_LIBADD = ../libmath/libmath.la @libio_la@ ../libsupc++/libsupc++convenience.la +libstdc___la_LIBADD = \ + ../libmath/libmath.la @libio_la@ \ + ../libsupc++/libsupc++convenience.la libstdc___la_LDFLAGS = -version-info @libtool_VERSION@ -lm @@ -205,7 +220,12 @@ GLIBCPP_INCLUDE_DIR = @glibcpp_builddir@/include # The no-implicit-templates flag will generate unresolved references to # the concept-checking symbols. So we must disable the checks while # actually building the library. -AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) +AM_CXXFLAGS = \ + -fno-implicit-templates \ + $(LIBSUPCXX_CXXFLAGS) \ + $(WARN_CXXFLAGS) \ + $(OPTIMIZE_CXXFLAGS) \ + $(CONFIG_CXXFLAGS) # libstdc++ libtool notes @@ -226,7 +246,8 @@ AM_CXXFLAGS = -fno-implicit-templates $(LIBSUPCXX_CXXFLAGS) $(WARN_CXXFLAGS) # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to # attempt to infer which configuration to use -LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) # 3) We'd have a problem when building the shared libstdc++ object if @@ -235,7 +256,8 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) $( # course is problematic at this point. So, we get the top-level # directory to configure libstdc++-v3 to use gcc as the C++ # compilation driver. -CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@ +CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ + @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@ CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = diff --git a/libstdc++-v3/src/locale-inst.cc b/libstdc++-v3/src/locale-inst.cc index df0a3af4866..7e60498cc49 100644 --- a/libstdc++-v3/src/locale-inst.cc +++ b/libstdc++-v3/src/locale-inst.cc @@ -81,12 +81,14 @@ namespace std #endif // time_get and time_put + template class __timepunct<char>; template class time_put<char, obuf_iterator>; template class time_put_byname<char, obuf_iterator>; template class time_get<char, ibuf_iterator>; template class time_get_byname<char, ibuf_iterator>; #ifdef _GLIBCPP_USE_WCHAR_T + template class __timepunct<wchar_t>; template class time_put<wchar_t, wobuf_iterator>; template class time_put_byname<wchar_t, wobuf_iterator>; template class time_get<wchar_t, wibuf_iterator>; @@ -130,49 +132,70 @@ namespace std #endif // use_facet + template + const numpunct<char>& + use_facet<numpunct<char> >(const locale&); + template const num_put<char, obuf_iterator >& use_facet<num_put<char, obuf_iterator> >(const locale&); + template const num_get<char, ibuf_iterator >& use_facet<num_get<char, ibuf_iterator> >(const locale&); + template const codecvt<char, char, mbstate_t>& use_facet<codecvt<char, char, mbstate_t> >(const locale&); - template - const numpunct<char>& - use_facet<numpunct<char> >(const locale&); + template const collate<char>& use_facet<collate<char> >(const locale&); + template const moneypunct<char, true>& use_facet<moneypunct<char, true> >(const locale&); + template const moneypunct<char, false>& use_facet<moneypunct<char, false> >(const locale&); + + template + const __timepunct<char>& + use_facet<__timepunct<char> >(const locale&); + #ifdef _GLIBCPP_USE_WCHAR_T + template + const numpunct<wchar_t>& + use_facet<numpunct<wchar_t> >(const locale&); + template const num_put<wchar_t, wobuf_iterator>& use_facet<num_put<wchar_t, wobuf_iterator> >(const locale&); + template const num_get<wchar_t, wibuf_iterator>& use_facet<num_get<wchar_t, wibuf_iterator> >(const locale&); + template const codecvt<wchar_t, char, mbstate_t>& use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&); - template - const numpunct<wchar_t>& - use_facet<numpunct<wchar_t> >(const locale&); + template const collate<wchar_t>& use_facet<collate<wchar_t> >(const locale&); + template const moneypunct<wchar_t, true>& use_facet<moneypunct<wchar_t, true> >(const locale&); + template const moneypunct<wchar_t, false>& use_facet<moneypunct<wchar_t, false> >(const locale&); + + template + const __timepunct<wchar_t>& + use_facet<__timepunct<wchar_t> >(const locale&); #endif // has_facet diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index d69e7e62455..8e76f51b651 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -114,9 +114,11 @@ namespace std const locale::id* const locale::_Impl::_S_id_time[] = { + &__timepunct<char>::id, &time_get<char>::id, &time_put<char>::id, #ifdef _GLIBCPP_USE_WCHAR_T + &__timepunct<wchar_t>::id, &time_get<wchar_t>::id, &time_put<wchar_t>::id, #endif diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc index f921c2f19a2..738acdef203 100644 --- a/libstdc++-v3/src/localename.cc +++ b/libstdc++-v3/src/localename.cc @@ -90,8 +90,7 @@ namespace std _M_names[i] = __str; // Construct all standard facets and add them to _M_facets. - // XXX Eventually, all should use __clocale ctor like numpunct - // XXX how to deal cleanly, consistently with null ("C") __cloc? + // XXX How to deal cleanly, consistently with null ("C") __cloc? _M_init_facet(new std::collate<char>(__cloc)); _M_init_facet(new std::ctype<char>); _M_init_facet(new codecvt<char, char, mbstate_t>); @@ -102,6 +101,7 @@ namespace std _M_init_facet(new numpunct<char>(__cloc)); _M_init_facet(new num_get<char>); _M_init_facet(new num_put<char>); + _M_init_facet(new __timepunct<char>(__cloc, __str.c_str())); _M_init_facet(new time_get<char>); _M_init_facet(new time_put<char>); _M_init_facet(new std::messages<char>(__cloc, __str.c_str())); @@ -117,6 +117,7 @@ namespace std _M_init_facet(new numpunct<wchar_t>(__cloc)); _M_init_facet(new num_get<wchar_t>); _M_init_facet(new num_put<wchar_t>); + _M_init_facet(new __timepunct<wchar_t>(__cloc, __str.c_str())); _M_init_facet(new time_get<wchar_t>); _M_init_facet(new time_put<wchar_t>); _M_init_facet(new std::messages<wchar_t>(__cloc, __str.c_str())); |