diff options
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/Makefile.am | 515 | ||||
-rw-r--r-- | libstdc++-v3/src/Makefile.in | 858 | ||||
-rw-r--r-- | libstdc++-v3/src/bitset.cc | 107 | ||||
-rw-r--r-- | libstdc++-v3/src/cmath.cc | 85 | ||||
-rw-r--r-- | libstdc++-v3/src/complex.cc | 274 | ||||
-rw-r--r-- | libstdc++-v3/src/complex_io.cc | 160 | ||||
-rw-r--r-- | libstdc++-v3/src/complexf.cc | 5 | ||||
-rw-r--r-- | libstdc++-v3/src/complexl.cc | 8 | ||||
-rw-r--r-- | libstdc++-v3/src/gen-num-limits.cc | 707 | ||||
-rw-r--r-- | libstdc++-v3/src/ios.cc | 321 | ||||
-rw-r--r-- | libstdc++-v3/src/limits_generic.cc | 340 | ||||
-rw-r--r-- | libstdc++-v3/src/locale-inst.cc | 311 | ||||
-rw-r--r-- | libstdc++-v3/src/locale.cc | 820 | ||||
-rw-r--r-- | libstdc++-v3/src/localename.cc | 250 | ||||
-rw-r--r-- | libstdc++-v3/src/misc-inst.cc | 210 | ||||
-rw-r--r-- | libstdc++-v3/src/stdexcept.cc | 74 | ||||
-rw-r--r-- | libstdc++-v3/src/stdstreams.cc | 48 | ||||
-rw-r--r-- | libstdc++-v3/src/stl-inst.cc | 52 | ||||
-rw-r--r-- | libstdc++-v3/src/string-inst.cc | 406 | ||||
-rw-r--r-- | libstdc++-v3/src/strstream.cc | 427 | ||||
-rw-r--r-- | libstdc++-v3/src/valarray-inst.cc | 64 |
21 files changed, 6042 insertions, 0 deletions
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am new file mode 100644 index 0000000..770c482 --- /dev/null +++ b/libstdc++-v3/src/Makefile.am @@ -0,0 +1,515 @@ +## Makefile for the src subdirectory of the GNU C++ Standard library. +## +## Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +## +## This file is part of the libstdc++ version 3 distribution. +## Process this file with automake to produce Makefile.in. + +## 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. + +AUTOMAKE_OPTIONS = 1.3 gnits +MAINT_CHARSET = latin1 + +# Cross compiler and multilib support. +# Install a library built with a cross compiler in tooldir, not libdir. +if USE_LIBDIR +toolexeclibdir = $(libdir)$(MULTISUBDIR) +else +toolexecdir = $(exec_prefix)/$(target_alias) +toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR) +endif + +toolexeclib_LTLIBRARIES = libstdc++.la + + +WERROR = -Werror +# OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fsquangle -fnew-exceptions \ +# -fdata-sections -ffunction-sections \ +# -fvtable-gc -Wl,--gc-sections +# AC_CXXFLAGS = @OPTLEVEL@ @DEBUGFLAGS@ @NAMESPACES@ +AC_CXXFLAGS = @DEBUGFLAGS@ +AM_CXXFLAGS = -fno-implicit-templates \ + -Wall -Wno-format -W -Wwrite-strings -Winline $(WERROR) \ + $(OPTIMIZE_CXXFLAGS) $(AC_CXXFLAGS) + +# Need to explicitly set this so that AM_CXXFLAGS is last. (That way, +# things like -O2 passed down from the toplevel can be overridden by +# --enable-debug.) +CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) + +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) + +# We have a problem when building the shared libstdc++ object if the +# rules automake generates would be used. We cannot allow CXX to be used +# in libtool since this would add -lstdc++ to the link line which of +# course is impossible. +CXXLINK = $(LIBTOOL) --mode=link "$(CC)" $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + +TOPLEVEL_INCLUDES = -I$(includedir) +LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio + +CONFIG_INCLUDES = \ + -I$(top_srcdir)/@cpu_include_dir@ \ + -I$(top_srcdir)/@ctype_include_dir@ + +INCLUDES = \ + -nostdinc++ -I$(top_srcdir) \ + $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES) + +headers = \ + bits/cpp_type_traits.h \ + bits/std_cctype.h bits/ctype_base.h bits/ctype_specializations.h \ + bits/char_traits.h \ + bits/basic_string.h bits/std_string.h bits/string.tcc \ + bits/generic_shadow.h bits/std_utility.h \ + bits/std_complex.h \ + bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \ + bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \ + bits/gslice.h bits/gslice_array.h bits/indirect_array.h \ + bits/std_cassert.h bits/std_cwctype.h bits/std_ciso646.h \ + bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h \ + bits/std_clocale.h bits/std_cmath.h \ + bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h \ + bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h \ + bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h \ + bits/std_typeinfo.h bits/std_new.h \ + bits/std_exception.h bits/exception_support.h \ + bits/std_fstream.h bits/std_iomanip.h \ + bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \ + bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \ + bits/std_istream.h bits/istream.tcc bits/std_locale.h \ + bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \ + bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \ + bits/streambuf.tcc bits/basic_file.h \ + bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \ + bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \ + bits/stl_threads.h bits/stl_iterator_base.h \ + backward/algo.h backward/algobase.h backward/alloc.h \ + backward/bvector.h backward/defalloc.h backward/deque.h \ + backward/function.h backward/hash_map.h backward/hash_set.h \ + backward/hashtable.h backward/heap.h backward/iterator.h \ + backward/list.h backward/map.h backward/multimap.h \ + backward/multiset.h backward/pair.h \ + backward/rope.h backward/set.h backward/slist.h backward/stack.h \ + backward/tempbuf.h backward/tree.h backward/vector.h \ + bits/std_bitset.h bits/std_deque.h bits/std_functional.h \ + bits/std_iterator.h bits/std_list.h \ + bits/std_map.h bits/std_memory.h bits/std_numeric.h \ + bits/std_queue.h bits/std_set.h bits/std_stack.h \ + bits/std_stdexcept.h bits/std_vector.h \ + bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \ + bits/stl_deque.h bits/stl_function.h \ + bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \ + bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \ + bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \ + bits/stl_relops.h bits/stl_set.h \ + bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h \ + bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \ + bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \ + bits/std_strstream.h \ + ext/ropeimpl.h ext/stl_rope.h \ + ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h \ + ext/stl_hashtable.h ext/stl_hash_fun.h \ + ext/hash_map ext/hash_set ext/rope ext/slist \ + ext/tree ext/bvector \ + shadow/assert.h shadow/ctype.h shadow/errno.h shadow/float.h \ + shadow/libio.h \ + shadow/limits.h shadow/locale.h shadow/math.h shadow/setjmp.h \ + shadow/signal.h shadow/stdarg.h shadow/stddef.h shadow/stdio.h \ + shadow/stdlib.h shadow/string.h shadow/time.h \ + shadow/unistd.h shadow/wchar.h shadow/wctype.h \ + shadow/bits/std_cassert.h shadow/bits/std_cctype.h \ + shadow/bits/std_cerrno.h shadow/bits/std_cfloat.h \ + shadow/bits/std_climits.h shadow/bits/std_clocale.h \ + shadow/bits/std_cmath.h shadow/bits/std_csetjmp.h \ + shadow/bits/std_csignal.h shadow/bits/std_cstdarg.h \ + shadow/bits/std_cstddef.h shadow/bits/std_cstdio.h \ + shadow/bits/std_cstdlib.h shadow/bits/std_cstring.h \ + shadow/bits/std_ctime.h shadow/bits/std_cwchar.h \ + shadow/bits/std_cwctype.h \ + shadow/bits/wrap_libio.h shadow/bits/wrap_unistd.h \ + shadow/sys/cdefs.h + +std_headers = \ + algorithm bitset cassert cctype cerrno cfloat climits clocale ciso646 \ + cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib \ + cstring ctime cwchar cwctype deque exception fstream functional \ + iomanip ios iosfwd iostream istream iterator limits list locale \ + map memory new numeric ostream queue set sstream stack stdexcept \ + streambuf string strstream typeinfo utility valarray vector + +if GLIBCPP_NEED_LIBIO +libio_headers = \ + $(top_builddir)/libio/_G_config.h $(top_srcdir)/libio/libio.h +else +libio_headers = +endif + +generated_headers = \ + bits/std_limits.h bits/c++config.h bits/c++threads.h bits/c++io.h + +cpu_headers = \ + $(top_srcdir)/@cpu_include_dir@/atomicity.h + +string_sources = \ + stringMAIN.cc stringCTORNC.cc stringCTORAL.cc \ + stringCTORCPR.cc stringCTORCPRAL.cc stringCTORPRAL.cc \ + stringCTORPAL.cc stringCTORDUPAL.cc stringCTORPP.cc stringCTORII.cc \ + stringMUTATE.cc stringRESERVE.cc \ + stringSWAP.cc stringSLOP.cc \ + stringRESIZE.cc stringAPPCOPY.cc stringAPPCPR.cc stringAPPPR.cc \ + stringAPPDUP.cc stringAPPII.cc stringASSCP.cc stringASSII.cc \ + stringINSII.cc stringREPRR.cc stringREPIIDUP.cc stringREPII.cc \ + stringREPIII.cc stringREP4I.cc stringREPIIPP.cc stringREPIIPP2.cc \ + stringCOPY.cc stringCONII.cc stringCONIIF.cc stringCONPPF.cc \ + stringCONPPF2.cc stringCONSC.cc \ + stringFIND.cc stringFINDC.cc stringRFIND.cc \ + stringRFINDC.cc stringFFO.cc stringFLO.cc stringFFNO.cc \ + stringFLNO.cc stringFLNOC.cc stringCOMPARE.cc stringCOMPARE2.cc \ + stringCOMPAREP.cc stringCOMPAREP2.cc stringADDPS.cc stringADDCS.cc \ + stringEXTRACT.cc stringINSERT.cc stringGETLINE.cc stringSCOPY.cc \ + stringEQ.cc + +wstring_sources = \ + wstringMAIN.cc wstringCTORNC.cc wstringCTORAL.cc \ + wstringCTORCPR.cc wstringCTORCPRAL.cc wstringCTORPRAL.cc \ + wstringCTORPAL.cc wstringCTORDUPAL.cc wstringCTORPP.cc \ + wstringCTORII.cc \ + wstringMUTATE.cc wstringRESERVE.cc \ + wstringSWAP.cc wstringSLOP.cc \ + wstringRESIZE.cc wstringAPPCOPY.cc wstringAPPCPR.cc wstringAPPPR.cc \ + wstringAPPDUP.cc wstringAPPII.cc wstringASSCP.cc wstringASSII.cc \ + wstringINSII.cc wstringREPRR.cc wstringREPIIDUP.cc wstringREPII.cc \ + wstringREPIII.cc wstringREP4I.cc wstringREPIIPP.cc wstringREPIIPP2.cc \ + wstringCOPY.cc wstringCONII.cc wstringCONIIF.cc wstringCONPPF.cc \ + wstringCONPPF2.cc wstringCONSC.cc \ + wstringFIND.cc wstringFINDC.cc wstringRFIND.cc \ + wstringRFINDC.cc wstringFFO.cc wstringFLO.cc wstringFFNO.cc \ + wstringFLNO.cc wstringFLNOC.cc wstringCOMPARE.cc wstringCOMPARE2.cc \ + wstringCOMPAREP.cc wstringCOMPAREP2.cc wstringADDPS.cc \ + wstringADDCS.cc wstringEXTRACT.cc wstringINSERT.cc wstringGETLINE.cc \ + wstringSCOPY.cc wstringEQ.cc + +sources = \ + limitsMEMBERS.cc c++io.cc \ + cmath.cc \ + complex.cc complexf.cc complexl.cc complex_io.cc \ + stdexcept.cc ios.cc stdstreams.cc strstream.cc \ + locale.cc localename.cc \ + locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc \ + $(string_sources) $(wstring_sources) + +VPATH += $(top_srcdir) $(top_srcdir)/std $(top_srcdir)/src +VPATH += $(top_srcdir)/@ctype_include_dir@ + + +# Actual sources for the distro, but don't build these. +EXTRA_sources = string-inst.cc + +libstdc___la_SOURCES = $(sources) + +libstdc___la_LIBADD = ../math/libmath.la ../libio/libio.la + +libstdc___la_LDFLAGS = -version-info 3:0:0 -lm + + +# We cannot use the default rules to install headers since we cannot +# statically decide which headers to install. So we have our own special +# installation routine here. +myincludep = $(DESTDIR)$(includedir)/g++-v3/ + +install: myinstallheaders + +# NB: As libio_headers may be empty, need this to make sure bash doesn't +# choke on an empty for... loop by using libio_headers_install + +myinstallheaders: $(headers:%=$(myincludep)%) + if test -z "$(MULTISUBDIR)"; then \ + for i in $(std_headers); do \ + echo "$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep)"; \ + $(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep); \ + done; \ + for i in $(generated_headers); do \ + echo "$(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/"; \ + $(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/; \ + done; \ + libio_headers_install='$(libio_headers)'; \ + for i in $$libio_headers_install; do \ + echo "$(INSTALL_DATA) $$i $(myincludep)"; \ + $(INSTALL_DATA) $$i $(myincludep); \ + done; \ + echo "$(INSTALL_DATA) $(cpu_headers) $(myincludep)"; \ + $(INSTALL_DATA) $(cpu_headers) $(myincludep); \ + fi; + +$(headers:%=$(myincludep)%): $(myincludep)%: % + if test -z "$(MULTISUBDIR)"; then \ + $(mkinstalldirs) $(@D); \ + echo " $(INSTALL_DATA) $^ $@"; \ + $(INSTALL_DATA) $^ $@; \ + fi; + +# For the next time we have to handle misc-inst.cc and locale-inst.cc +# in a special way since we cannot instantiate all classes due to +# missing definitions for things like vptrs, type_info bits, etc. when +# using -fno-implicit-templates. +misc-inst.o: misc-inst.cc + $(CXXCOMPILE) -fimplicit-templates -c $< +misc-inst.lo: misc-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates -c $< +locale-inst.o: locale-inst.cc + $(CXXCOMPILE) -fimplicit-templates -c $< +locale-inst.lo: locale-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates -c $< + +stringMAIN.lo \ +stringCTORNC.lo \ +stringCTORAL.lo \ +stringCTORCPR.lo \ +stringCTORCPRAL.lo \ +stringCTORPRAL.lo \ +stringCTORPAL.lo \ +stringCTORDUPAL.lo \ +stringCTORPP.lo \ +stringCTORII.lo \ +stringMUTATE.lo \ +stringRESERVE.lo \ +stringSWAP.lo \ +stringSLOP.lo \ +stringRESIZE.lo \ +stringAPPCOPY.lo \ +stringAPPCPR.lo \ +stringAPPPR.lo \ +stringAPPDUP.lo \ +stringAPPII.lo \ +stringASSCP.lo \ +stringASSII.lo \ +stringINSII.lo \ +stringREPRR.lo \ +stringREPIIDUP.lo \ +stringREPII.lo \ +stringREPIII.lo \ +stringREP4I.lo \ +stringREPIIPP.lo \ +stringREPIIPP2.lo \ +stringCOPY.lo \ +stringCONII.lo \ +stringCONIIF.lo \ +stringCONPPF.lo \ +stringCONPPF2.lo \ +stringCONSC.lo \ +stringFIND.lo \ +stringFINDC.lo \ +stringRFIND.lo \ +stringRFINDC.lo \ +stringFFO.lo \ +stringFLO.lo \ +stringFFNO.lo \ +stringFLNO.lo \ +stringFLNOC.lo \ +stringCOMPARE.lo \ +stringCOMPARE2.lo \ +stringCOMPAREP.lo \ +stringCOMPAREP2.lo \ +stringADDPS.lo \ +stringADDCS.lo \ +stringEXTRACT.lo \ +stringINSERT.lo \ +stringGETLINE.lo \ +stringSCOPY.lo \ +stringEQ.lo : string-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@ + +wstringMAIN.lo \ +wstringCTORNC.lo \ +wstringCTORAL.lo \ +wstringCTORCPR.lo \ +wstringCTORCPRAL.lo \ +wstringCTORPRAL.lo \ +wstringCTORPAL.lo \ +wstringCTORDUPAL.lo \ +wstringCTORPP.lo \ +wstringCTORII.lo \ +wstringMUTATE.lo \ +wstringRESERVE.lo \ +wstringSWAP.lo \ +wstringSLOP.lo \ +wstringRESIZE.lo \ +wstringAPPCOPY.lo \ +wstringAPPCPR.lo \ +wstringAPPPR.lo \ +wstringAPPDUP.lo \ +wstringAPPII.lo \ +wstringASSCP.lo \ +wstringASSII.lo \ +wstringINSII.lo \ +wstringREPRR.lo \ +wstringREPIIDUP.lo \ +wstringREPII.lo \ +wstringREPIII.lo \ +wstringREP4I.lo \ +wstringREPIIPP.lo \ +wstringREPIIPP2.lo \ +wstringCOPY.lo \ +wstringCONII.lo \ +wstringCONIIF.lo \ +wstringCONPPF.lo \ +wstringCONPPF2.lo \ +wstringCONSC.lo \ +wstringFIND.lo \ +wstringFINDC.lo \ +wstringRFIND.lo \ +wstringRFINDC.lo \ +wstringFFO.lo \ +wstringFLO.lo \ +wstringFFNO.lo \ +wstringFLNO.lo \ +wstringFLNOC.lo \ +wstringCOMPARE.lo \ +wstringCOMPARE2.lo \ +wstringCOMPAREP.lo \ +wstringCOMPAREP2.lo \ +wstringADDPS.lo \ +wstringADDCS.lo \ +wstringEXTRACT.lo \ +wstringINSERT.lo \ +wstringGETLINE.lo \ +wstringSCOPY.lo \ +wstringEQ.lo : string-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@ + +stringMAIN.o \ +stringCTORNC.o \ +stringCTORAL.o \ +stringCTORCPR.o \ +stringCTORCPRAL.o \ +stringCTORPRAL.o \ +stringCTORPAL.o \ +stringCTORDUPAL.o \ +stringCTORPP.o \ +stringCTORII.o \ +stringMUTATE.o \ +stringRESERVE.o \ +stringSWAP.o \ +stringSLOP.o \ +stringRESIZE.o \ +stringAPPCOPY.o \ +stringAPPCPR.o \ +stringAPPPR.o \ +stringAPPDUP.o \ +stringAPPII.o \ +stringASSCP.o \ +stringASSII.o \ +stringINSII.o \ +stringREPRR.o \ +stringREPIIDUP.o \ +stringREPII.o \ +stringREPIII.o \ +stringREP4I.o \ +stringREPIIPP.o \ +stringREPIIPP2.o \ +stringCOPY.o \ +stringCONII.o \ +stringCONIIF.o \ +stringCONPPF.o \ +stringCONPPF2.o \ +stringCONSC.o \ +stringFIND.o \ +stringFINDC.o \ +stringRFIND.o \ +stringRFINDC.o \ +stringFFO.o \ +stringFLO.o \ +stringFFNO.o \ +stringFLNO.o \ +stringFLNOC.o \ +stringCOMPARE.o \ +stringCOMPARE2.o \ +stringCOMPAREP.o \ +stringCOMPAREP2.o \ +stringADDPS.o \ +stringADDCS.o \ +stringEXTRACT.o \ +stringINSERT.o \ +stringGETLINE.o \ +stringSCOPY.o \ +stringEQ.o : string-inst.cc + $(CXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@ + +wstringMAIN.o \ +wstringCTORNC.o \ +wstringCTORAL.o \ +wstringCTORCPR.o \ +wstringCTORCPRAL.o \ +wstringCTORPRAL.o \ +wstringCTORPAL.o \ +wstringCTORDUPAL.o \ +wstringCTORPP.o \ +wstringCTORII.o \ +wstringMUTATE.o \ +wstringRESERVE.o \ +wstringSWAP.o \ +wstringSLOP.o \ +wstringRESIZE.o \ +wstringAPPCOPY.o \ +wstringAPPCPR.o \ +wstringAPPPR.o \ +wstringAPPDUP.o \ +wstringAPPII.o \ +wstringASSCP.o \ +wstringASSII.o \ +wstringINSII.o \ +wstringREPRR.o \ +wstringREPIIDUP.o \ +wstringREPII.o \ +wstringREPIII.o \ +wstringREP4I.o \ +wstringREPIIPP.o \ +wstringREPIIPP2.o \ +wstringCOPY.o \ +wstringCONII.o \ +wstringCONIIF.o \ +wstringCONPPF.o \ +wstringCONPPF2.o \ +wstringCONSC.o \ +wstringFIND.o \ +wstringFINDC.o \ +wstringRFIND.o \ +wstringRFINDC.o \ +wstringFFO.o \ +wstringFLO.o \ +wstringFFNO.o \ +wstringFLNO.o \ +wstringFLNOC.o \ +wstringCOMPARE.o \ +wstringCOMPARE2.o \ +wstringCOMPAREP.o \ +wstringCOMPAREP2.o \ +wstringADDPS.o \ +wstringADDCS.o \ +wstringEXTRACT.o \ +wstringINSERT.o \ +wstringGETLINE.o \ +wstringSCOPY.o \ +wstringEQ.o : string-inst.cc + $(CXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in new file mode 100644 index 0000000..2536173 --- /dev/null +++ b/libstdc++-v3/src/Makefile.in @@ -0,0 +1,858 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AR = @AR@ +AS = @AS@ +BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@ +CC = @CC@ +CPP = @CPP@ +CSTDIO_CC = @CSTDIO_CC@ +CSTDIO_H = @CSTDIO_H@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DEBUGFLAGS = @DEBUGFLAGS@ +DLLTOOL = @DLLTOOL@ +EXEEXT = @EXEEXT@ +GCC_OBJDIR = @GCC_OBJDIR@ +GLIBCPP_CFLAGS = @GLIBCPP_CFLAGS@ +GLIBCPP_CXXFLAGS = @GLIBCPP_CXXFLAGS@ +LIBMATHOBJS = @LIBMATHOBJS@ +LIBSTRINGOBJS = @LIBSTRINGOBJS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NAMESPACES = @NAMESPACES@ +OBJDUMP = @OBJDUMP@ +OPTLEVEL = @OPTLEVEL@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +THREADDEPS = @THREADDEPS@ +THREADINCS = @THREADINCS@ +THREADLIBS = @THREADLIBS@ +THREADOBJS = @THREADOBJS@ +THREADSPEC = @THREADSPEC@ +USE_LONG_DOUBLE = @USE_LONG_DOUBLE@ +VERSION = @VERSION@ +WERRORSUPPRESS = @WERRORSUPPRESS@ +cpu_include_dir = @cpu_include_dir@ +ctype_include_dir = @ctype_include_dir@ +glibcpp_basedir = @glibcpp_basedir@ + +AUTOMAKE_OPTIONS = 1.3 gnits +MAINT_CHARSET = latin1 +@USE_LIBDIR_TRUE@toolexeclibdir = \ +@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR) +@USE_LIBDIR_FALSE@toolexeclibdir = \ +@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR) +@USE_LIBDIR_FALSE@toolexecdir = \ +@USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias) + +toolexeclib_LTLIBRARIES = libstdc++.la + +WERROR = -Werror +# OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fsquangle -fnew-exceptions \ +# -fdata-sections -ffunction-sections \ +# -fvtable-gc -Wl,--gc-sections +# AC_CXXFLAGS = @OPTLEVEL@ @DEBUGFLAGS@ @NAMESPACES@ +AC_CXXFLAGS = @DEBUGFLAGS@ +AM_CXXFLAGS = -fno-implicit-templates \ + -Wall -Wno-format -W -Wwrite-strings -Winline $(WERROR) \ + $(OPTIMIZE_CXXFLAGS) $(AC_CXXFLAGS) + + +# Need to explicitly set this so that AM_CXXFLAGS is last. (That way, +# things like -O2 passed down from the toplevel can be overridden by +# --enable-debug.) +CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) + + +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) + + +# We have a problem when building the shared libstdc++ object if the +# rules automake generates would be used. We cannot allow CXX to be used +# in libtool since this would add -lstdc++ to the link line which of +# course is impossible. +CXXLINK = $(LIBTOOL) --mode=link "$(CC)" $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + +TOPLEVEL_INCLUDES = -I$(includedir) +LIBIO_INCLUDES = @BUILD_LIBIO_INCLUDE@ -I$(top_srcdir)/libio + +CONFIG_INCLUDES = \ + -I$(top_srcdir)/@cpu_include_dir@ \ + -I$(top_srcdir)/@ctype_include_dir@ + + +INCLUDES = \ + -nostdinc++ -I$(top_srcdir) \ + $(LIBIO_INCLUDES) $(CONFIG_INCLUDES) $(TOPLEVEL_INCLUDES) + + +headers = \ + bits/cpp_type_traits.h \ + bits/std_cctype.h bits/ctype_base.h bits/ctype_specializations.h \ + bits/char_traits.h \ + bits/basic_string.h bits/std_string.h bits/string.tcc \ + bits/generic_shadow.h bits/std_utility.h \ + bits/std_complex.h \ + bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \ + bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \ + bits/gslice.h bits/gslice_array.h bits/indirect_array.h \ + bits/std_cassert.h bits/std_cwctype.h bits/std_ciso646.h \ + bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h \ + bits/std_clocale.h bits/std_cmath.h \ + bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h \ + bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h \ + bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h \ + bits/std_typeinfo.h bits/std_new.h \ + bits/std_exception.h bits/exception_support.h \ + bits/std_fstream.h bits/std_iomanip.h \ + bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \ + bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \ + bits/std_istream.h bits/istream.tcc bits/std_locale.h \ + bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \ + bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \ + bits/streambuf.tcc bits/basic_file.h \ + bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \ + bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \ + bits/stl_threads.h bits/stl_iterator_base.h \ + backward/algo.h backward/algobase.h backward/alloc.h \ + backward/bvector.h backward/defalloc.h backward/deque.h \ + backward/function.h backward/hash_map.h backward/hash_set.h \ + backward/hashtable.h backward/heap.h backward/iterator.h \ + backward/list.h backward/map.h backward/multimap.h \ + backward/multiset.h backward/pair.h \ + backward/rope.h backward/set.h backward/slist.h backward/stack.h \ + backward/tempbuf.h backward/tree.h backward/vector.h \ + bits/std_bitset.h bits/std_deque.h bits/std_functional.h \ + bits/std_iterator.h bits/std_list.h \ + bits/std_map.h bits/std_memory.h bits/std_numeric.h \ + bits/std_queue.h bits/std_set.h bits/std_stack.h \ + bits/std_stdexcept.h bits/std_vector.h \ + bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \ + bits/stl_deque.h bits/stl_function.h \ + bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \ + bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \ + bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \ + bits/stl_relops.h bits/stl_set.h \ + bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h \ + bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \ + bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \ + bits/std_strstream.h \ + ext/ropeimpl.h ext/stl_rope.h \ + ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h \ + ext/stl_hashtable.h ext/stl_hash_fun.h \ + ext/hash_map ext/hash_set ext/rope ext/slist \ + ext/tree ext/bvector \ + shadow/assert.h shadow/ctype.h shadow/errno.h shadow/float.h \ + shadow/libio.h \ + shadow/limits.h shadow/locale.h shadow/math.h shadow/setjmp.h \ + shadow/signal.h shadow/stdarg.h shadow/stddef.h shadow/stdio.h \ + shadow/stdlib.h shadow/string.h shadow/time.h \ + shadow/unistd.h shadow/wchar.h shadow/wctype.h \ + shadow/bits/std_cassert.h shadow/bits/std_cctype.h \ + shadow/bits/std_cerrno.h shadow/bits/std_cfloat.h \ + shadow/bits/std_climits.h shadow/bits/std_clocale.h \ + shadow/bits/std_cmath.h shadow/bits/std_csetjmp.h \ + shadow/bits/std_csignal.h shadow/bits/std_cstdarg.h \ + shadow/bits/std_cstddef.h shadow/bits/std_cstdio.h \ + shadow/bits/std_cstdlib.h shadow/bits/std_cstring.h \ + shadow/bits/std_ctime.h shadow/bits/std_cwchar.h \ + shadow/bits/std_cwctype.h \ + shadow/bits/wrap_libio.h shadow/bits/wrap_unistd.h \ + shadow/sys/cdefs.h + + +std_headers = \ + algorithm bitset cassert cctype cerrno cfloat climits clocale ciso646 \ + cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib \ + cstring ctime cwchar cwctype deque exception fstream functional \ + iomanip ios iosfwd iostream istream iterator limits list locale \ + map memory new numeric ostream queue set sstream stack stdexcept \ + streambuf string strstream typeinfo utility valarray vector + +@GLIBCPP_NEED_LIBIO_TRUE@libio_headers = \ +@GLIBCPP_NEED_LIBIO_TRUE@\ +@GLIBCPP_NEED_LIBIO_TRUE@ $(top_builddir)/libio/_G_config.h $(top_srcdir)/libio/libio.h +@GLIBCPP_NEED_LIBIO_FALSE@libio_headers = \ + +generated_headers = \ + bits/std_limits.h bits/c++config.h bits/c++threads.h bits/c++io.h + + +cpu_headers = \ + $(top_srcdir)/@cpu_include_dir@/atomicity.h + + +string_sources = \ + stringMAIN.cc stringCTORNC.cc stringCTORAL.cc \ + stringCTORCPR.cc stringCTORCPRAL.cc stringCTORPRAL.cc \ + stringCTORPAL.cc stringCTORDUPAL.cc stringCTORPP.cc stringCTORII.cc \ + stringMUTATE.cc stringRESERVE.cc \ + stringSWAP.cc stringSLOP.cc \ + stringRESIZE.cc stringAPPCOPY.cc stringAPPCPR.cc stringAPPPR.cc \ + stringAPPDUP.cc stringAPPII.cc stringASSCP.cc stringASSII.cc \ + stringINSII.cc stringREPRR.cc stringREPIIDUP.cc stringREPII.cc \ + stringREPIII.cc stringREP4I.cc stringREPIIPP.cc stringREPIIPP2.cc \ + stringCOPY.cc stringCONII.cc stringCONIIF.cc stringCONPPF.cc \ + stringCONPPF2.cc stringCONSC.cc \ + stringFIND.cc stringFINDC.cc stringRFIND.cc \ + stringRFINDC.cc stringFFO.cc stringFLO.cc stringFFNO.cc \ + stringFLNO.cc stringFLNOC.cc stringCOMPARE.cc stringCOMPARE2.cc \ + stringCOMPAREP.cc stringCOMPAREP2.cc stringADDPS.cc stringADDCS.cc \ + stringEXTRACT.cc stringINSERT.cc stringGETLINE.cc stringSCOPY.cc \ + stringEQ.cc + + +wstring_sources = \ + wstringMAIN.cc wstringCTORNC.cc wstringCTORAL.cc \ + wstringCTORCPR.cc wstringCTORCPRAL.cc wstringCTORPRAL.cc \ + wstringCTORPAL.cc wstringCTORDUPAL.cc wstringCTORPP.cc \ + wstringCTORII.cc \ + wstringMUTATE.cc wstringRESERVE.cc \ + wstringSWAP.cc wstringSLOP.cc \ + wstringRESIZE.cc wstringAPPCOPY.cc wstringAPPCPR.cc wstringAPPPR.cc \ + wstringAPPDUP.cc wstringAPPII.cc wstringASSCP.cc wstringASSII.cc \ + wstringINSII.cc wstringREPRR.cc wstringREPIIDUP.cc wstringREPII.cc \ + wstringREPIII.cc wstringREP4I.cc wstringREPIIPP.cc wstringREPIIPP2.cc \ + wstringCOPY.cc wstringCONII.cc wstringCONIIF.cc wstringCONPPF.cc \ + wstringCONPPF2.cc wstringCONSC.cc \ + wstringFIND.cc wstringFINDC.cc wstringRFIND.cc \ + wstringRFINDC.cc wstringFFO.cc wstringFLO.cc wstringFFNO.cc \ + wstringFLNO.cc wstringFLNOC.cc wstringCOMPARE.cc wstringCOMPARE2.cc \ + wstringCOMPAREP.cc wstringCOMPAREP2.cc wstringADDPS.cc \ + wstringADDCS.cc wstringEXTRACT.cc wstringINSERT.cc wstringGETLINE.cc \ + wstringSCOPY.cc wstringEQ.cc + + +sources = \ + limitsMEMBERS.cc c++io.cc \ + cmath.cc \ + complex.cc complexf.cc complexl.cc complex_io.cc \ + stdexcept.cc ios.cc stdstreams.cc strstream.cc \ + locale.cc localename.cc \ + locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc \ + $(string_sources) $(wstring_sources) + +VPATH = $(top_srcdir) $(top_srcdir)/std $(top_srcdir)/src $(top_srcdir)/@ctype_include_dir@ + +# Actual sources for the distro, but don't build these. +EXTRA_sources = string-inst.cc + +libstdc___la_SOURCES = $(sources) + +libstdc___la_LIBADD = ../math/libmath.la ../libio/libio.la + +libstdc___la_LDFLAGS = -version-info 3:0:0 -lm + +# We cannot use the default rules to install headers since we cannot +# statically decide which headers to install. So we have our own special +# installation routine here. +myincludep = $(DESTDIR)$(includedir)/g++-v3/ +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(toolexeclib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +libstdc___la_DEPENDENCIES = ../math/libmath.la ../libio/libio.la +libstdc___la_OBJECTS = limitsMEMBERS.lo c++io.lo cmath.lo complex.lo \ +complexf.lo complexl.lo complex_io.lo stdexcept.lo ios.lo stdstreams.lo \ +strstream.lo locale.lo localename.lo locale-inst.lo stl-inst.lo \ +misc-inst.lo valarray-inst.lo stringMAIN.lo stringCTORNC.lo \ +stringCTORAL.lo stringCTORCPR.lo stringCTORCPRAL.lo stringCTORPRAL.lo \ +stringCTORPAL.lo stringCTORDUPAL.lo stringCTORPP.lo stringCTORII.lo \ +stringMUTATE.lo stringRESERVE.lo stringSWAP.lo stringSLOP.lo \ +stringRESIZE.lo stringAPPCOPY.lo stringAPPCPR.lo stringAPPPR.lo \ +stringAPPDUP.lo stringAPPII.lo stringASSCP.lo stringASSII.lo \ +stringINSII.lo stringREPRR.lo stringREPIIDUP.lo stringREPII.lo \ +stringREPIII.lo stringREP4I.lo stringREPIIPP.lo stringREPIIPP2.lo \ +stringCOPY.lo stringCONII.lo stringCONIIF.lo stringCONPPF.lo \ +stringCONPPF2.lo stringCONSC.lo stringFIND.lo stringFINDC.lo \ +stringRFIND.lo stringRFINDC.lo stringFFO.lo stringFLO.lo stringFFNO.lo \ +stringFLNO.lo stringFLNOC.lo stringCOMPARE.lo stringCOMPARE2.lo \ +stringCOMPAREP.lo stringCOMPAREP2.lo stringADDPS.lo stringADDCS.lo \ +stringEXTRACT.lo stringINSERT.lo stringGETLINE.lo stringSCOPY.lo \ +stringEQ.lo wstringMAIN.lo wstringCTORNC.lo wstringCTORAL.lo \ +wstringCTORCPR.lo wstringCTORCPRAL.lo wstringCTORPRAL.lo \ +wstringCTORPAL.lo wstringCTORDUPAL.lo wstringCTORPP.lo wstringCTORII.lo \ +wstringMUTATE.lo wstringRESERVE.lo wstringSWAP.lo wstringSLOP.lo \ +wstringRESIZE.lo wstringAPPCOPY.lo wstringAPPCPR.lo wstringAPPPR.lo \ +wstringAPPDUP.lo wstringAPPII.lo wstringASSCP.lo wstringASSII.lo \ +wstringINSII.lo wstringREPRR.lo wstringREPIIDUP.lo wstringREPII.lo \ +wstringREPIII.lo wstringREP4I.lo wstringREPIIPP.lo wstringREPIIPP2.lo \ +wstringCOPY.lo wstringCONII.lo wstringCONIIF.lo wstringCONPPF.lo \ +wstringCONPPF2.lo wstringCONSC.lo wstringFIND.lo wstringFINDC.lo \ +wstringRFIND.lo wstringRFINDC.lo wstringFFO.lo wstringFLO.lo \ +wstringFFNO.lo wstringFLNO.lo wstringFLNOC.lo wstringCOMPARE.lo \ +wstringCOMPARE2.lo wstringCOMPAREP.lo wstringCOMPAREP2.lo \ +wstringADDPS.lo wstringADDCS.lo wstringEXTRACT.lo wstringINSERT.lo \ +wstringGETLINE.lo wstringSCOPY.lo wstringEQ.lo +CXXFLAGS = @CXXFLAGS@ +CXXLD = $(CXX) +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(libstdc___la_SOURCES) +OBJECTS = $(libstdc___la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .cc .lo .o .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus src/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-toolexeclibLTLIBRARIES: + +clean-toolexeclibLTLIBRARIES: + -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES) + +distclean-toolexeclibLTLIBRARIES: + +maintainer-clean-toolexeclibLTLIBRARIES: + +install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir) + @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p; \ + else :; fi; \ + done + +uninstall-toolexeclibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) + $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___la_LDFLAGS) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS) +.cc.o: + $(CXXCOMPILE) -c $< +.cc.lo: + $(LTCXXCOMPILE) -c $< + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: install-toolexeclibLTLIBRARIES +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-toolexeclibLTLIBRARIES +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-toolexeclibLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \ + clean-tags clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-toolexeclibLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-generic \ + clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-toolexeclibLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-toolexeclibLTLIBRARIES \ +distclean-toolexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \ +maintainer-clean-toolexeclibLTLIBRARIES \ +uninstall-toolexeclibLTLIBRARIES install-toolexeclibLTLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-info-am \ +install-info install-exec-am install-exec install-data-am install-data \ +install-am install uninstall-am uninstall all-redirect all-am all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +install: myinstallheaders + +# NB: As libio_headers may be empty, need this to make sure bash doesn't +# choke on an empty for... loop by using libio_headers_install + +myinstallheaders: $(headers:%=$(myincludep)%) + if test -z "$(MULTISUBDIR)"; then \ + for i in $(std_headers); do \ + echo "$(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep)"; \ + $(INSTALL_DATA) $(top_srcdir)/std/$$i $(myincludep); \ + done; \ + for i in $(generated_headers); do \ + echo "$(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/"; \ + $(INSTALL_DATA) $(top_builddir)/$$i $(myincludep)bits/; \ + done; \ + libio_headers_install='$(libio_headers)'; \ + for i in $$libio_headers_install; do \ + echo "$(INSTALL_DATA) $$i $(myincludep)"; \ + $(INSTALL_DATA) $$i $(myincludep); \ + done; \ + echo "$(INSTALL_DATA) $(cpu_headers) $(myincludep)"; \ + $(INSTALL_DATA) $(cpu_headers) $(myincludep); \ + fi; + +$(headers:%=$(myincludep)%): $(myincludep)%: % + if test -z "$(MULTISUBDIR)"; then \ + $(mkinstalldirs) $(@D); \ + echo " $(INSTALL_DATA) $^ $@"; \ + $(INSTALL_DATA) $^ $@; \ + fi; + +# For the next time we have to handle misc-inst.cc and locale-inst.cc +# in a special way since we cannot instantiate all classes due to +# missing definitions for things like vptrs, type_info bits, etc. when +# using -fno-implicit-templates. +misc-inst.o: misc-inst.cc + $(CXXCOMPILE) -fimplicit-templates -c $< +misc-inst.lo: misc-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates -c $< +locale-inst.o: locale-inst.cc + $(CXXCOMPILE) -fimplicit-templates -c $< +locale-inst.lo: locale-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates -c $< + +stringMAIN.lo \ +stringCTORNC.lo \ +stringCTORAL.lo \ +stringCTORCPR.lo \ +stringCTORCPRAL.lo \ +stringCTORPRAL.lo \ +stringCTORPAL.lo \ +stringCTORDUPAL.lo \ +stringCTORPP.lo \ +stringCTORII.lo \ +stringMUTATE.lo \ +stringRESERVE.lo \ +stringSWAP.lo \ +stringSLOP.lo \ +stringRESIZE.lo \ +stringAPPCOPY.lo \ +stringAPPCPR.lo \ +stringAPPPR.lo \ +stringAPPDUP.lo \ +stringAPPII.lo \ +stringASSCP.lo \ +stringASSII.lo \ +stringINSII.lo \ +stringREPRR.lo \ +stringREPIIDUP.lo \ +stringREPII.lo \ +stringREPIII.lo \ +stringREP4I.lo \ +stringREPIIPP.lo \ +stringREPIIPP2.lo \ +stringCOPY.lo \ +stringCONII.lo \ +stringCONIIF.lo \ +stringCONPPF.lo \ +stringCONPPF2.lo \ +stringCONSC.lo \ +stringFIND.lo \ +stringFINDC.lo \ +stringRFIND.lo \ +stringRFINDC.lo \ +stringFFO.lo \ +stringFLO.lo \ +stringFFNO.lo \ +stringFLNO.lo \ +stringFLNOC.lo \ +stringCOMPARE.lo \ +stringCOMPARE2.lo \ +stringCOMPAREP.lo \ +stringCOMPAREP2.lo \ +stringADDPS.lo \ +stringADDCS.lo \ +stringEXTRACT.lo \ +stringINSERT.lo \ +stringGETLINE.lo \ +stringSCOPY.lo \ +stringEQ.lo : string-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@ + +wstringMAIN.lo \ +wstringCTORNC.lo \ +wstringCTORAL.lo \ +wstringCTORCPR.lo \ +wstringCTORCPRAL.lo \ +wstringCTORPRAL.lo \ +wstringCTORPAL.lo \ +wstringCTORDUPAL.lo \ +wstringCTORPP.lo \ +wstringCTORII.lo \ +wstringMUTATE.lo \ +wstringRESERVE.lo \ +wstringSWAP.lo \ +wstringSLOP.lo \ +wstringRESIZE.lo \ +wstringAPPCOPY.lo \ +wstringAPPCPR.lo \ +wstringAPPPR.lo \ +wstringAPPDUP.lo \ +wstringAPPII.lo \ +wstringASSCP.lo \ +wstringASSII.lo \ +wstringINSII.lo \ +wstringREPRR.lo \ +wstringREPIIDUP.lo \ +wstringREPII.lo \ +wstringREPIII.lo \ +wstringREP4I.lo \ +wstringREPIIPP.lo \ +wstringREPIIPP2.lo \ +wstringCOPY.lo \ +wstringCONII.lo \ +wstringCONIIF.lo \ +wstringCONPPF.lo \ +wstringCONPPF2.lo \ +wstringCONSC.lo \ +wstringFIND.lo \ +wstringFINDC.lo \ +wstringRFIND.lo \ +wstringRFINDC.lo \ +wstringFFO.lo \ +wstringFLO.lo \ +wstringFFNO.lo \ +wstringFLNO.lo \ +wstringFLNOC.lo \ +wstringCOMPARE.lo \ +wstringCOMPARE2.lo \ +wstringCOMPAREP.lo \ +wstringCOMPAREP2.lo \ +wstringADDPS.lo \ +wstringADDCS.lo \ +wstringEXTRACT.lo \ +wstringINSERT.lo \ +wstringGETLINE.lo \ +wstringSCOPY.lo \ +wstringEQ.lo : string-inst.cc + $(LTCXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@ + +stringMAIN.o \ +stringCTORNC.o \ +stringCTORAL.o \ +stringCTORCPR.o \ +stringCTORCPRAL.o \ +stringCTORPRAL.o \ +stringCTORPAL.o \ +stringCTORDUPAL.o \ +stringCTORPP.o \ +stringCTORII.o \ +stringMUTATE.o \ +stringRESERVE.o \ +stringSWAP.o \ +stringSLOP.o \ +stringRESIZE.o \ +stringAPPCOPY.o \ +stringAPPCPR.o \ +stringAPPPR.o \ +stringAPPDUP.o \ +stringAPPII.o \ +stringASSCP.o \ +stringASSII.o \ +stringINSII.o \ +stringREPRR.o \ +stringREPIIDUP.o \ +stringREPII.o \ +stringREPIII.o \ +stringREP4I.o \ +stringREPIIPP.o \ +stringREPIIPP2.o \ +stringCOPY.o \ +stringCONII.o \ +stringCONIIF.o \ +stringCONPPF.o \ +stringCONPPF2.o \ +stringCONSC.o \ +stringFIND.o \ +stringFINDC.o \ +stringRFIND.o \ +stringRFINDC.o \ +stringFFO.o \ +stringFLO.o \ +stringFFNO.o \ +stringFLNO.o \ +stringFLNOC.o \ +stringCOMPARE.o \ +stringCOMPARE2.o \ +stringCOMPAREP.o \ +stringCOMPAREP2.o \ +stringADDPS.o \ +stringADDCS.o \ +stringEXTRACT.o \ +stringINSERT.o \ +stringGETLINE.o \ +stringSCOPY.o \ +stringEQ.o : string-inst.cc + $(CXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` $< -o $@ + +wstringMAIN.o \ +wstringCTORNC.o \ +wstringCTORAL.o \ +wstringCTORCPR.o \ +wstringCTORCPRAL.o \ +wstringCTORPRAL.o \ +wstringCTORPAL.o \ +wstringCTORDUPAL.o \ +wstringCTORPP.o \ +wstringCTORII.o \ +wstringMUTATE.o \ +wstringRESERVE.o \ +wstringSWAP.o \ +wstringSLOP.o \ +wstringRESIZE.o \ +wstringAPPCOPY.o \ +wstringAPPCPR.o \ +wstringAPPPR.o \ +wstringAPPDUP.o \ +wstringAPPII.o \ +wstringASSCP.o \ +wstringASSII.o \ +wstringINSII.o \ +wstringREPRR.o \ +wstringREPIIDUP.o \ +wstringREPII.o \ +wstringREPIII.o \ +wstringREP4I.o \ +wstringREPIIPP.o \ +wstringREPIIPP2.o \ +wstringCOPY.o \ +wstringCONII.o \ +wstringCONIIF.o \ +wstringCONPPF.o \ +wstringCONPPF2.o \ +wstringCONSC.o \ +wstringFIND.o \ +wstringFINDC.o \ +wstringRFIND.o \ +wstringRFINDC.o \ +wstringFFO.o \ +wstringFLO.o \ +wstringFFNO.o \ +wstringFLNO.o \ +wstringFLNOC.o \ +wstringCOMPARE.o \ +wstringCOMPARE2.o \ +wstringCOMPAREP.o \ +wstringCOMPAREP2.o \ +wstringADDPS.o \ +wstringADDCS.o \ +wstringEXTRACT.o \ +wstringINSERT.o \ +wstringGETLINE.o \ +wstringSCOPY.o \ +wstringEQ.o : string-inst.cc + $(CXXCOMPILE) -fimplicit-templates \ + -c -D`echo $@ | tr -dc 'A-Z'` -DC=wchar_t $< -o $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libstdc++-v3/src/bitset.cc b/libstdc++-v3/src/bitset.cc new file mode 100644 index 0000000..cd8c71f --- /dev/null +++ b/libstdc++-v3/src/bitset.cc @@ -0,0 +1,107 @@ +/* Low-level implementation of bitset template class from ISO C++. */ + +// Copyright (C) 1997-1999 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. + + +#include <bits/std_bitset.h> +#include <bits/std_climits.h> + + +static const size_t word_bits = sizeof (__bitset_word) * CHAR_BIT; + + +void +__bitset_base_lshift (__bitset_word *arr, size_t n, size_t nlast, + size_t offset, size_t nbits) +{ + arr[n - 1] = arr[n - 1 - offset] << nbits; + + for (size_t cnt = n - 1; cnt > offset; --cnt) + { + arr[cnt] |= arr[cnt - 1 - offset] >> (word_bits - nbits); + arr[cnt - 1] = arr[cnt - 1 - offset] << nbits; + } + + memset (arr, '\0', offset * sizeof (__bitset_word)); +} + + +void +__bitset_base_rshift (__bitset_word *arr, size_t n, size_t nlast, + size_t offset, size_t nbits) +{ + arr[0] = arr[offset] >> nbits; + + for (size_t cnt = offset + 1; cnt < n; ++cnt) + { + arr[cnt - 1 - offset] |= arr[cnt] << (word_bits - nbits); + arr[cnt - offset] = arr[cnt] >> nbits; + } + + memset (&arr[n - offset], '\0', offset * sizeof (__bitset_word)); +} + + +size_t +__bitset_base_count (__bitset_word *arr, size_t n) +{ + size_t result = 0; + + while (n > 0) + { + __bitset_word word = arr[n]; + + if (sizeof (__bitset_word) == 4) + { + word = (word & 0x55555555) + ((word >> 1) & 0x55555555); + word = (word & 0x33333333) + ((word >> 2) & 0x33333333); + word = (word + (word >> 4)) & 0x0f0f0f0f; + word = word + (word >> 8); + word = (word + (word >> 16)) & 0xff; + } + else + { + // The only other possibility is a 64 bit word. + word = ((word & ((0x55555555UL << 16) << 16 | 0x55555555UL)) + + ((word >> 1) + & ((0x55555555UL << 16) << 16 | 0x55555555UL))); + word = ((word & ((0x33333333UL << 16) << 16 | 0x33333333UL)) + + ((word >> 1) + & ((0x33333333UL << 16) << 16 | 0x33333333UL))); + word = ((word + (word >> 4)) + & ((0x0f0f0f0fUL << 16) << 16 | 0x0f0f0f0fUL)); + word = (word + (word >> 8)); + word = (word + (word >> 16)); + word = (word + ((word >> 16) >> 16)) & 0xff; + } + + result += word; + } + + return result; +} diff --git a/libstdc++-v3/src/cmath.cc b/libstdc++-v3/src/cmath.cc new file mode 100644 index 0000000..8134e72 --- /dev/null +++ b/libstdc++-v3/src/cmath.cc @@ -0,0 +1,85 @@ +// -*- C++ -*- C math library. + +// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 26.5 C library +// Code for signatures not found in the C library +// + +#include <bits/std_cmath.h> + +namespace std { + + namespace { + template <typename T> + inline T pow_helper(T x, unsigned int y) + { + T z = y&1? x : 1; + while(y >>= 1) + { + x *= x; + if(y & 1) z *= x; + } + return z; + } + } + + float + pow(float x, int y) + { + if(y < 0) + return 1.0f/pow_helper(x, -y); + else + return pow_helper(x, y); + } + + double + pow(double x, int y) + { + if(y < 0) + return 1.0/pow_helper(x, -y); + else + return pow_helper(x, y); + } + + long double + pow(long double x, int y) + { + if(y < 0) + return 1.0l/pow_helper(x, -y); + else + return pow_helper(x, y); + } + +} // std + + + + + diff --git a/libstdc++-v3/src/complex.cc b/libstdc++-v3/src/complex.cc new file mode 100644 index 0000000..b19a74a --- /dev/null +++ b/libstdc++-v3/src/complex.cc @@ -0,0 +1,274 @@ +// The template and inlines for the -*- C++ -*- complex number classes. + +// Copyright (C) 1997-1999 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. + +#include <bits/std_cmath.h> +#include <bits/std_complex.h> + +// This is a ISO C 9X header. +#include <math/mathconf.h> +#undef complex + +#ifndef FLT +# define FLT double +# define FCT(name) ::name +#endif + +namespace std +{ + + template<> + FLT + abs(const complex<FLT>& __x) + { return FCT(cabs)(__x._M_value); } + + template<> + FLT + arg(const complex<FLT>& __x) + { return FCT(carg)(__x._M_value); } + + template<> + complex<FLT> + polar(const FLT& __rho, const FLT& __theta) + { +#if defined _G_HAVE_SINCOS && !defined __osf__ + // Although sincos does exist on OSF3.2 and OSF4.0 we cannot use it + // since the necessary types are not defined in the headers. + FLT __sinx, __cosx; + FCT(sincos)(__theta, &__sinx, &__cosx); + return complex<FLT>(__rho * __cosx, __rho * __sinx); +#else +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + complex<FLT> __tmpf(__rho * FCT(cos)(__theta), + __rho * FCT(sin)(__theta)); + return __tmpf; +#else + return complex<FLT>(__rho * FCT(cos)(__theta), + __rho * FCT(sin)(__theta)); +#endif +#endif + } + + template<> + complex<FLT> + cos(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(ccos)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(ccos)(__x._M_value)); } +#endif + + template<> + complex<FLT> + cosh(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(ccosh)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(ccosh)(__x._M_value)); } +#endif + + template<> + complex<FLT> + exp(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(cexp)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(cexp)(__x._M_value)); } +#endif + + template<> + complex<FLT> + log(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(c_log)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(c_log)(__x._M_value)); } +#endif + + template<> + complex<FLT> + log10(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(clog10)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(clog10)(__x._M_value)); } +#endif + + template<> + complex<FLT> + pow(const complex<FLT>& __x, int __n) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(cexp) (__n * FCT(c_log)(__x._M_value))); + return __tmpf; + } +#else + { return complex<FLT>(FCT(cexp) (__n * FCT(c_log)(__x._M_value))); } +#endif + + + template<> + complex<FLT> + pow(const complex<FLT>& __x, const FLT& __y) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(cexp) (__y * FCT(c_log)(__x._M_value))); + return __tmpf; + } +#else + { return complex<FLT>(FCT(cexp) (__y * FCT(c_log)(__x._M_value))); } +#endif + + template<> + complex<FLT> + pow(const complex<FLT>& __x, const complex<FLT>& __y) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(cpow)(__x._M_value, __y._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(cpow)(__x._M_value, __y._M_value)); } +#endif + + template<> + complex<FLT> + pow(const FLT& __x, const complex<FLT>& __y) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(cexp)(__y._M_value * FCT(log)(__x))); + return __tmpf; + } +#else + { return complex<FLT>(FCT(cexp)(__y._M_value * FCT(log)(__x))); } +#endif + + template<> + complex<FLT> + sin(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(csin)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(csin)(__x._M_value)); } +#endif + + template<> + complex<FLT> + sinh(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(csinh)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(csinh)(__x._M_value)); } +#endif + + template<> + complex<FLT> + sqrt(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(csqrt)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(csqrt)(__x._M_value)); } +#endif + + template<> + complex<FLT> + tan(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(ctan)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(ctan)(__x._M_value)); } +#endif + + template<> + complex<FLT> + tanh(const complex<FLT>& __x) +#if defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) \ + && defined(_GLIBCPP_FLOAT_SPECIALIZATION) + { + complex<FLT> __tmpf(FCT(ctanh)(__x._M_value)); + return __tmpf; + } +#else + { return complex<FLT>(FCT(ctanh)(__x._M_value)); } +#endif + +} // namespace std + + + + + + + + + + + + + diff --git a/libstdc++-v3/src/complex_io.cc b/libstdc++-v3/src/complex_io.cc new file mode 100644 index 0000000..3733416 --- /dev/null +++ b/libstdc++-v3/src/complex_io.cc @@ -0,0 +1,160 @@ +// The template and inlines for the -*- C++ -*- complex number classes. + +// Copyright (C) 2000 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. + +#include <bits/std_complex.h> +#include <bits/std_istream.h> +#include <bits/std_ostream.h> +#include <bits/std_sstream.h> + + +namespace std +{ + + template<typename _Tp, typename _CharT, class _Traits> + basic_istream <_CharT, _Traits> & + operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) + { +#if !defined(_GLIBCPP_BUGGY_FLOAT_COMPLEX) && !defined(_GLIBCPP_BUGGY_COMPLEX) + _Tp __re_x, __im_x; + _CharT __ch; + __is >> __ch; + if (__ch == '(') + { + __is >> __re_x >> __ch; + if (__ch == ',') + { + __is >> __im_x >> __ch; + if (__ch == ')') + { + __x = complex<_Tp>(__re_x, __im_x); + return __is; + } + } + else if (__ch == ')') + { + __x = complex<_Tp>(__re_x, _Tp(0)); + return __is; + } + } + else + { + __is.putback(__ch); + __is >> __re_x; + __x = complex<_Tp>(__re_x, _Tp(0)); + return __is; + } + __is.setstate(ios_base::failbit); +#else + __x = complex<_Tp>(_Tp(0), _Tp(0)); +#endif + return __is; + } + + template<typename _Tp, typename _CharT, class _Traits> + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) + { + basic_ostringstream<_CharT, _Traits> __s; + __s.flags(__os.flags()); +#ifdef _G_HAVE_LOCALE + __s.imbue(__os.getloc()); +#endif + __s.precision (__os.precision()); + __s << '(' << __x.real() << "," << __x.imag() << ')' << ends; + return __os << __s.str(); + } + + + template + basic_istream< char, char_traits<char> >& + operator>>(basic_istream< char, char_traits<char> >&, + complex<float>&); + + template + basic_ostream< char, char_traits<char> >& + operator<<(basic_ostream< char, char_traits<char> >&, + const complex<float>&); + + template + basic_istream< char, char_traits<char> >& + operator>>(basic_istream< char, char_traits<char> >&, + complex<double>&); + + template + basic_ostream< char, char_traits<char> >& + operator<<(basic_ostream< char, char_traits<char> >&, + const complex<double>&); + + template + basic_istream< char, char_traits<char> >& + operator>>(basic_istream< char, char_traits<char> >&, + complex<long double>&); + + template + basic_ostream< char, char_traits<char> >& + operator<<(basic_ostream< char, char_traits<char> >&, + const complex<long double>&); + + template + basic_istream< wchar_t, char_traits<wchar_t> >& + operator>>(basic_istream< wchar_t, char_traits<wchar_t> >&, + complex<float>&); + + template + basic_ostream< wchar_t, char_traits<wchar_t> >& + operator<<(basic_ostream< wchar_t, char_traits<wchar_t> >&, + const complex<float>&); + + template + basic_istream< wchar_t, char_traits<wchar_t> >& + operator>>(basic_istream< wchar_t, char_traits<wchar_t> >&, + complex<double>&); + + template + basic_ostream< wchar_t, char_traits<wchar_t> >& + operator<<(basic_ostream< wchar_t, char_traits<wchar_t> >&, + const complex<double>&); + + template + basic_istream< wchar_t, char_traits<wchar_t> >& + operator>>(basic_istream< wchar_t, char_traits<wchar_t> >&, + complex<long double>&); + + template + basic_ostream< wchar_t, char_traits<wchar_t> >& + operator<<(basic_ostream< wchar_t, char_traits<wchar_t> >&, + const complex<long double>&); +} + + + + + + + diff --git a/libstdc++-v3/src/complexf.cc b/libstdc++-v3/src/complexf.cc new file mode 100644 index 0000000..5ef12af --- /dev/null +++ b/libstdc++-v3/src/complexf.cc @@ -0,0 +1,5 @@ +#define FLT float +#define FCT(name) ::name##f +// Used in complex.cc to work around GCC's buggy __complex__ float support. +#define _GLIBCPP_FLOAT_SPECIALIZATION 1 +#include "complex.cc" diff --git a/libstdc++-v3/src/complexl.cc b/libstdc++-v3/src/complexl.cc new file mode 100644 index 0000000..4c11abd --- /dev/null +++ b/libstdc++-v3/src/complexl.cc @@ -0,0 +1,8 @@ +#include <bits/c++config.h> +#ifdef _GLIBCPP_HAVE_SINL +/* We compile these functions only when we have the long double functions + available. */ +#define FLT long double +#define FCT(name) ::name##l +#include "complex.cc" +#endif diff --git a/libstdc++-v3/src/gen-num-limits.cc b/libstdc++-v3/src/gen-num-limits.cc new file mode 100644 index 0000000..8dd3a16 --- /dev/null +++ b/libstdc++-v3/src/gen-num-limits.cc @@ -0,0 +1,707 @@ +// Copyright (C) 1999, 2000 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. + +// +// Written by Gabriel Dos Reis <gdr@egcs.cygnus.com> +// +// Note: This program outputs speciliazations of ISO C++ class template +// numeric_limits<> as described in 18.2.1. +// Do not compile with optimization turned on. +// + +#include <bits/c++config.h> + +// +// Force Linux <limits.h> to define the *LONG_LONG* +// +#if __linux__ && _GLIBCPP_USE_LONG_LONG +# ifndef __USE_GNU +# define __USE_GNU 1 +# endif +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +#endif + +#include <limits.h> +#include <float.h> +#include <stdio.h> +#include <signal.h> +#include <setjmp.h> +#include <math.h> +#ifdef _GLIBCPP_USE_WCHAR_T +#include <wchar.h> +#endif + + +const char tab[] = " "; +const char tab2[] = " "; +const char* bool_alpha[] = { "false", "true" }; +const double log10_of_two = .30102999566398119; +const int bits_per_byte = CHAR_BIT; +const int integer_base_rep = 2; + + +// +// numeric_limits members are all static (as it is usually the case for +// traits) and of three kinds: predicates, values and functions. +// Actually there is no harm to think of values and functions as being +// of the same kind. Their main purposes are to denote values. +// + + +// +// Integer types: bool, char, signed char, unsigned char, wchar_t, +// short, unsigned short, int, unsigned, long, unsigned long, +// and possibly long long and unsigned long long +// +// Here ISO 14882 disagrees with LIA-1 in stating bool to be an +// integer type. Therefore itn't suprising to see ambiguity in the +// interpretation of some members. Need to keep track of the discusion +// in LWG on this topic. +// +// Integer types are first promoted to int or long before the actual +// arithmetical operations are carried out. Therefore testing whether +// traps occur amounts -- for integer types -- to test whether traps +// occur for int, unsigned, long, unsigned long. Furthermore +// overflow cannot happen for unsigned integer types. + +jmp_buf env; + +void signal_handler(int sig) +{ +#ifdef __CYGWIN__ + static sigset_t x; + signal (sig, signal_handler); + sigemptyset (&x); + sigprocmask(SIG_SETMASK, &x, NULL); +#endif /* __CYGWIN__ */ + longjmp(env, sig); +} + +template<typename Operation> +bool trapping(const Operation& op) +{ + if (setjmp(env) == 0) op(); + else return true; + return false; +} + +template<typename T> struct division_by_zero { + void operator() () const + { + volatile T zero = T(); + volatile T one = T(1); + volatile T infinity = one / zero; + } +}; + +template<typename T> struct overflow { + void operator() () const + { + T i = T(1); + T j = T(); + while (i>j) { + j = i; + i = i * 2 + 1; + } + } +}; + +template<typename T> struct underflow {}; + +// traps +template<typename T> void traps() +{ + signal(SIGFPE, signal_handler); + bool trap_flag = trapping(division_by_zero<T>()); + signal(SIGFPE, signal_handler); + trap_flag = trap_flag && trapping(overflow<T>()); + const char* p = bool_alpha[trap_flag]; + printf("%s%s = %s;\n", tab2, "static const bool traps", p); +} + +#define SPECIALIZE_TRAPPING(T) \ +template<> void traps< T >() \ +{ \ + signal(SIGFPE, signal_handler); \ + const char* p = bool_alpha[trapping(division_by_zero<T>())]; \ + printf("%s%s = %s;\n", tab2, "static const bool traps", p); \ +} + +SPECIALIZE_TRAPPING(unsigned char); +SPECIALIZE_TRAPPING(unsigned short); +SPECIALIZE_TRAPPING(unsigned int); +SPECIALIZE_TRAPPING(unsigned long); +#if _GLIBCPP_USE_LONG_LONG +SPECIALIZE_TRAPPING(unsigned long long); +#endif + +#undef SPECIALIZE_TRAPPING + +template<typename T> struct type_name_trait { + static const char type_name[]; + static const char trait_name[]; +}; + +#define DEFINED_TYPE_NAME(T) \ +const char type_name_trait< T >::type_name[] = #T; \ +const char type_name_trait< T >::trait_name[] = "numeric_limits<" #T ">"; + +DEFINED_TYPE_NAME(bool); +DEFINED_TYPE_NAME(char); +DEFINED_TYPE_NAME(signed char); +DEFINED_TYPE_NAME(unsigned char); +DEFINED_TYPE_NAME(wchar_t); +DEFINED_TYPE_NAME(short); +DEFINED_TYPE_NAME(unsigned short); +DEFINED_TYPE_NAME(int); +DEFINED_TYPE_NAME(unsigned int); +DEFINED_TYPE_NAME(long); +DEFINED_TYPE_NAME(unsigned long); +#ifdef _GLIBCPP_USE_LONG_LONG +DEFINED_TYPE_NAME(long long); +DEFINED_TYPE_NAME(unsigned long long); +#endif +DEFINED_TYPE_NAME(float); +DEFINED_TYPE_NAME(double); +DEFINED_TYPE_NAME(long double); + +#undef DEFINED_TYPE_NAME + +// declarator +template<typename T> struct declarator : type_name_trait<T> { + typedef type_name_trait<T> base; + static void start() + { + printf("%s%s %s %s\n", tab, "template<> struct", + base::trait_name, "{"); + } + + static void end() + { + printf("%s};\n\n", tab); + } +}; + + +// +// Predicates +// +template<typename T> struct predicate { + static const bool is_signed; + static const bool is_integer; + static const bool is_exact; + + static const bool has_infinity; + static const bool has_quiet_nan; + static const bool has_signaling_nan; + static const bool has_denorm; + static const bool has_denorm_loss; + + static const bool is_iec559; + static const bool is_bounded; + + static const bool traps; +}; + +template<typename T> +const bool predicate<T>::is_signed = T(-1) < 0; + +// Non integer types should specialize this +template<typename T> +const bool predicate<T>::is_integer = true; + +// Non exact types should specialize this; +template<typename T> +const bool predicate<T>::is_exact = true; + +#define SPECIALIZE_EXACTNESS(T) \ +const bool predicate< T >::is_integer = false; \ +const bool predicate< T >::is_exact = false + +SPECIALIZE_EXACTNESS(float); +SPECIALIZE_EXACTNESS(double); +SPECIALIZE_EXACTNESS(long double); + +#undef SPECIALIZE_EXACTNESS + + +template<typename T> +const bool predicate<T>::has_infinity = false; + +template<typename T> +const bool predicate<T>::has_quiet_nan = false; + +template<typename T> +const bool predicate<T>::has_signaling_nan = false; + +template<typename T> +const bool predicate<T>::has_denorm = false; + +template<typename T> +const bool predicate<T>::has_denorm_loss = false; + + + +// Each type conforming to IEC559 specifications should specialize this. +template<typename T> +const bool predicate<T>::is_iec559 = false; + +#define SPECIALIZE_IEC559(T) \ +const bool predicate< T >::is_iec559 = true + +SPECIALIZE_IEC559(bool); +SPECIALIZE_IEC559(int); +SPECIALIZE_IEC559(unsigned int); +SPECIALIZE_IEC559(long); +SPECIALIZE_IEC559(unsigned long); +#ifdef _GLIBCPP_USE_LONG_LONG +SPECIALIZE_IEC559(long long); +SPECIALIZE_IEC559(unsigned long long); +#endif + +#undef SPECIALIZE_IEC559 + +// +// Values +// + +template<typename T> struct value { + static const char min[]; + static const char max[]; + + static const int digits; + static const int digits10; + + static const int radix; + static const char epsilon[]; + static const char round_error[]; + + static const int min_exponent; + static const int min_exponent10; + static const int max_exponent; + static const int max_exponent10; +}; + +#define DEFINE_EXTREMA(T, m, M) DO_DEFINE_EXTREMA(T, m, M) +#define DO_DEFINE_EXTREMA(T, m, M) \ +const char value< T >::min[] = #m; \ +const char value< T >::max[] = #M + +DEFINE_EXTREMA(bool, false, true); +DEFINE_EXTREMA(char, CHAR_MIN, CHAR_MAX); +DEFINE_EXTREMA(signed char, SCHAR_MIN, SCHAR_MAX); +DEFINE_EXTREMA(unsigned char, 0, UCHAR_MAX); +#ifdef _GLIBCPP_USE_WCHAR_T +DEFINE_EXTREMA(wchar_t, WCHAR_MIN, WCHAR_MAX); +#endif +DEFINE_EXTREMA(short, SHRT_MIN, SHRT_MAX); +DEFINE_EXTREMA(unsigned short, 0, USHRT_MAX); +DEFINE_EXTREMA(int, INT_MIN, INT_MAX); +DEFINE_EXTREMA(unsigned int, 0, UINT_MAX); +DEFINE_EXTREMA(long, LONG_MIN, LONG_MAX); +DEFINE_EXTREMA(unsigned long, 0, ULONG_MAX); +#ifdef _GLIBCPP_USE_LONG_LONG +DEFINE_EXTREMA(long long, LONG_LONG_MIN, LONG_LONG_MAX); +DEFINE_EXTREMA(unsigned long long, 0, ULONG_LONG_MAX); +#endif +DEFINE_EXTREMA(float, FLT_MIN, FLT_MAX); +DEFINE_EXTREMA(double, DBL_MIN, DBL_MAX); +DEFINE_EXTREMA(long double, LDBL_MIN, LDBL_MAX); + +#undef DEFINE_EXTREMA +#undef DO_DEFINE_EXTREMA + +// Non integer types should specialize this +template<typename T> +const int value<T>::digits = + bits_per_byte * sizeof(T) - int(predicate<T>::is_signed); + +// Non integer types should specialize this. Alwyas two for +// integer types. +template<typename T> +const int value<T>::radix = 2; + +#define SPECIALIZE_DIGITS(T, D, D10) \ +const int value< T >::digits = D; \ +const int value< T >::digits10 = D10 + +SPECIALIZE_DIGITS(float, FLT_MANT_DIG, FLT_DIG); +SPECIALIZE_DIGITS(double, DBL_MANT_DIG, DBL_DIG); +SPECIALIZE_DIGITS(long double, LDBL_MANT_DIG, LDBL_DIG); + +#undef SPECIALIZE_DIGITS + + +#define SPECIALIZE_RADIX(T, R) const int value< T >::radix = R + +SPECIALIZE_RADIX(float, FLT_RADIX); +SPECIALIZE_RADIX(double, FLT_RADIX); +SPECIALIZE_RADIX(long double, FLT_RADIX); + +#undef SPECIALIZE_RADIX + + +template<typename T> +const char value<T>::epsilon[] = "0"; + +template<typename T> +const char value<T>::round_error[] = "0"; + +#define SPECIALIZE_EPSILON(T, E) DO_SPECIALIZE_EPSILON(T, E) +#define DO_SPECIALIZE_EPSILON(T, E) const char value< T >::epsilon[] = #E + +SPECIALIZE_EPSILON(float, FLT_EPSILON); +SPECIALIZE_EPSILON(double, DBL_EPSILON); +SPECIALIZE_EPSILON(long double, LDBL_EPSILON); + +#undef DO_SPECIALIZE_EPSILON +#undef SPECIALIZE_EPSILON + + +#define SPECIALIZE_ROUND_ERROR(T, R) const char value< T >::round_error[] = #R + +SPECIALIZE_ROUND_ERROR(float, 1.0f); +SPECIALIZE_ROUND_ERROR(double, 1.0); +SPECIALIZE_ROUND_ERROR(long double, 1.0L); + +#undef SPECIALIZE_ROUND_ERROR + + +template<typename T> +const int value<T>::min_exponent = 0; + +template<typename T> +const int value<T>::min_exponent10 = 0; + +template<typename T> +const int value<T>::max_exponent = 0; + +template<typename T> +const int value<T>::max_exponent10 = 0; + +#define SPECIALIZE_EXPONENTS(T, m, m10, M, M10) \ +const int value< T >::min_exponent = m; \ +const int value< T >::min_exponent10 = m10; \ +const int value< T >::max_exponent = M; \ +const int value< T >::max_exponent10 = M10 + +SPECIALIZE_EXPONENTS(float, FLT_MIN_EXP, FLT_MIN_10_EXP, + FLT_MAX_EXP, FLT_MAX_10_EXP); +SPECIALIZE_EXPONENTS(double, DBL_MIN_EXP, DBL_MIN_10_EXP, + DBL_MAX_EXP, DBL_MAX_10_EXP); +SPECIALIZE_EXPONENTS(long double, LDBL_MIN_EXP, LDBL_MIN_10_EXP, + LDBL_MAX_EXP, LDBL_MAX_10_EXP); + +#undef SPECIALIZE_EXPONENTS + +// +// Functions to output predicates and values. +// + +template<typename T> void is_signed() +{ + printf("%s%s = %s;\n", tab2, "static const bool is_signed", + bool_alpha[predicate<T>::is_signed]); +} + +// a fundamental type is modulo iff it isn't signed +template<typename T> void is_modulo() +{ + printf("%s%s = %s;\n", tab2, "static const bool is_modulo", + bool_alpha[! predicate<T>::is_signed]); +} + +template<typename T> +void min() +{ + printf("%s%s%s%s\n%s%s%s%s\n", tab2, "static ", declarator<T>::type_name, + " min() throw()", tab2, "{ return ", value<T>::min, "; }"); +} + +template<typename T> +void max() +{ + printf("%s%s%s%s\n%s%s%s%s\n", tab2, "static ", declarator<T>::type_name, + " max() throw()", tab2, "{ return ", value<T>::max, "; }"); +} + +template<typename T> +void is_integer() +{ + printf("%s%s = %s;\n", tab2, "static const bool is_integer", + bool_alpha[predicate<T>::is_integer]); +} + +template<typename T> +void is_exact() +{ + printf("%s%s = %s;\n", tab2, "static const bool is_exact", + bool_alpha[predicate<T>::is_exact]); +} + +template<typename T> +void digits() +{ + printf("%s%s = %d;\n", tab2, "static const int digits", + value<T>::digits); +} + +template<typename T> +void digits10() +{ + printf("%s%s = %d;\n", tab2, "static const int digits10", + int(log10_of_two * value<T>::digits)); +} + +template<typename T> +void radix() +{ + printf("%s%s = %d;\n", tab2, "static const int radix", + value<T>::radix); +} + +template<typename T> +void epsilon() +{ + printf("%s%s %s %s\n%s%s %s%s\n", tab2, "static", + declarator<T>::type_name, "epsilon() throw()", + tab2, "{ return", value<T>::epsilon, "; }"); +} + +template<typename T> +void round_error() +{ + printf("%s%s %s %s\n%s%s %s%s\n", tab2, "static", + declarator<T>::type_name, "round_error() throw()", + tab2, "{ return", value<T>::round_error, "; }"); +} + +template<typename T> +void min_exponent() +{ + printf("%s%s = %d;\n", tab2, "static const int min_exponent", + value<T>::min_exponent); +} + +template<typename T> +void min_exponent10() +{ + printf("%s%s = %d;\n", tab2, "static const int min_exponent10", + value<T>::min_exponent10); +} + +template<typename T> +void max_exponent() +{ + printf("%s%s = %d;\n", tab2, "static const int max_exponent", + value<T>::max_exponent); +} + +template<typename T> +void max_exponent10() +{ + printf("%s%s = %d;\n", tab2, "static const int max_exponent10", + value<T>::max_exponent10); +} + +template<typename T> +void has_infinity() +{ + printf("%s%s = %s;\n", tab2, "static const bool has_infinity", + bool_alpha[predicate<T>::has_infinity]); +} + +template<typename T> +void has_quiet_nan() +{ + printf("%s%s = %s;\n", tab2, "static const bool has_quiet_NaN", + bool_alpha[predicate<T>::has_quiet_nan]); +} + +template<typename T> +void has_signaling_nan() +{ + printf("%s%s = %s;\n", tab2, "static const bool has_signaling_NaN", + bool_alpha[predicate<T>::has_signaling_nan]); +} + +template<typename T> +void has_denorm_loss() +{ + printf("%s%s = %s;\n", tab2, "static const bool has_denorm_loss", + bool_alpha[predicate<T>::has_denorm_loss]); +} + +template<typename T> struct infinity_trait { + static void has_denorm() + { + printf("%s%s;\n", tab2, "static const float_denorm_style " + "has_denorm = denorm_absent"); + } + + static void infinity() + { + printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static", + declarator<T>::type_name, "infinity() throw()", + tab2, "{ return static_cast<", declarator<T>::type_name, + ">(0); }"); + } + + static void quiet_NaN() + { + printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static", + declarator<T>::type_name, "quiet_NaN() throw()", + tab2, "{ return static_cast<", declarator<T>::type_name, + ">(0); }"); + } + + static void signaling_NaN() + { + printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static", + declarator<T>::type_name, "signaling_NaN() throw()", + tab2, "{ return static_cast<", declarator<T>::type_name, + ">(0); }"); + } + + static void denorm_min() + { + printf("%s%s %s %s\n%s%s%s%s\n", tab2, "static", + declarator<T>::type_name, "denorm_min() throw()", + tab2, "{ return static_cast<", declarator<T>::type_name, + ">(0); }"); + } +}; + + +template<typename T> +void is_iec559() +{ + printf("%s%s = %s;\n", tab2, "static const bool is_iec559", + bool_alpha[predicate<T>::is_iec559]); +} + +// tinyness_before +template<typename T> +void tinyness_before() +{ + printf("%s%s;\n", tab2, "static const bool tinyness_before = false"); +} + +// round style +template<typename T> +void round_style() +{ + printf("%s%s;\n", tab2, "static const float_round_style " + "round_style = round_toward_zero"); +} + + + +// type traits +template<typename T> struct type_trait { + + type_trait() + { + declarator<T>::start(); + printf("%s%s;\n\n", tab2, "static const bool is_specialized = true"); + min<T>(); + max<T>(); + printf("\n"); + digits<T>(); + digits10<T>(); + is_signed<T>(); + is_integer<T>(); + is_exact<T>(); + radix<T>(); + epsilon<T>(); + round_error<T>(); + printf("\n"); + min_exponent<T>(); + min_exponent10<T>(); + max_exponent<T>(); + max_exponent10<T>(); + printf("\n"); + has_infinity<T>(); + has_quiet_nan<T>(); + has_signaling_nan<T>(); + infinity_trait<T>::has_denorm(); + has_denorm_loss<T>(); + printf("\n"); + infinity_trait<T>::infinity(); + infinity_trait<T>::quiet_NaN(); + infinity_trait<T>::signaling_NaN(); + infinity_trait<T>::denorm_min(); + printf("\n"); + is_iec559<T>(); + printf("%s%s;\n", tab2, "static const bool is_bounded = true"); + is_modulo<T>(); + printf("\n"); + traps<T>(); + tinyness_before<T>(); + round_style<T>(); + declarator<T>::end(); + } +}; + +int main() +{ + type_trait<bool>(); + + type_trait<char>(); + type_trait<signed char>(); + type_trait<unsigned char>(); +#if defined( _GLIBCPP_USE_WCHAR_T) && defined(_GLIBCPP_HAS_WCHAR_MIN_MAX) + type_trait<wchar_t>(); +#endif + + type_trait<short>(); + type_trait<unsigned short>(); + + type_trait<int>(); + type_trait<unsigned int>(); + + type_trait<long>(); + type_trait<unsigned long>(); + +#ifdef _GLIBCPP_USE_LONG_LONG + type_trait<long long>(); + type_trait<unsigned long long>(); +#endif + + type_trait<float>(); + type_trait<double>(); + type_trait<long double>(); + + // x86/linux gets this weirdness for the min/max functions: + // static long double min() throw() + // { return (__extension__ ((union __convert_long_double) + // {__convert_long_double_i: {0x0, 0x80000000, 0x1, 0x0}}) + // .__convert_long_double_d); } +} + diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc new file mode 100644 index 0000000..ca13e39 --- /dev/null +++ b/libstdc++-v3/src/ios.cc @@ -0,0 +1,321 @@ +// Iostreams base classes -*- C++ -*- + +// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.4 Iostreams base classes +// + +#include <bits/std_ios.h> +#include <bits/std_iostream.h> +#include <bits/std_fstream.h> + +namespace std { + + // Out-of-line definitions for static const ios_base members. + const ios_base::fmtflags ios_base::boolalpha; + const ios_base::fmtflags ios_base::dec; + const ios_base::fmtflags ios_base::fixed; + const ios_base::fmtflags ios_base::hex; + const ios_base::fmtflags ios_base::internal; + const ios_base::fmtflags ios_base::left; + const ios_base::fmtflags ios_base::oct; + const ios_base::fmtflags ios_base::right; + const ios_base::fmtflags ios_base::scientific; + const ios_base::fmtflags ios_base::showbase; + const ios_base::fmtflags ios_base::showpoint; + const ios_base::fmtflags ios_base::showpos; + const ios_base::fmtflags ios_base::skipws; + const ios_base::fmtflags ios_base::unitbuf; + const ios_base::fmtflags ios_base::uppercase; + const ios_base::fmtflags ios_base::adjustfield; + const ios_base::fmtflags ios_base::basefield; + const ios_base::fmtflags ios_base::floatfield; + + const ios_base::iostate ios_base::badbit; + const ios_base::iostate ios_base::eofbit; + const ios_base::iostate ios_base::failbit; + const ios_base::iostate ios_base::goodbit; + + const ios_base::openmode ios_base::app; + const ios_base::openmode ios_base::ate; + const ios_base::openmode ios_base::binary; + const ios_base::openmode ios_base::in; + const ios_base::openmode ios_base::out; + const ios_base::openmode ios_base::trunc; + + const ios_base::seekdir ios_base::beg; + const ios_base::seekdir ios_base::cur; + const ios_base::seekdir ios_base::end; + + ios_base::failure::failure(const string& __str) + { + strncpy(_M_name, __str.c_str(), _M_bufsize); + _M_name[_M_bufsize - 1] = '\0'; + } + + int ios_base::Init::_M_ios_base_init = 0; + + ios_base::Init::Init() + { + if (++_M_ios_base_init == 1) + { + // NB: std_iostream.h creates the four standard files with + // default buffers. At this point, we swap out the default + // buffers for the properly-constructed ones, and dispose of + // the default buffers. + streambuf* __old; + _M_cout = new filebuf(1, "stdout", ios_base::out); + _M_cin = new filebuf(0, "stdin", ios_base::in); + _M_cerr = new filebuf(2, "stderr", ios_base::out); + __old = cout.rdbuf(_M_cout); + __old->~streambuf(); + __old = cin.rdbuf(_M_cin); + __old->~streambuf(); + cin.tie(&cout); + __old = cerr.rdbuf(_M_cerr); + __old->~streambuf(); + cerr.flags(ios_base::unitbuf); + __old = clog.rdbuf(_M_cerr); + __old->~streambuf(); +#ifdef _GLIBCPP_USE_WCHAR_T + wstreambuf* __wold; + _M_wcout = new wfilebuf(1, "stdout", ios_base::out); + _M_wcin = new wfilebuf(0, "stdin", ios_base::in); + _M_wcerr = new wfilebuf(2, "stderr", ios_base::out); + __wold = wcout.rdbuf(_M_wcout); + __wold->~wstreambuf(); + __wold = wcin.rdbuf(_M_wcin); + __wold->~wstreambuf(); + wcin.tie(&wcout); + __wold = wcerr.rdbuf(_M_wcerr); + __wold->~wstreambuf(); + wcerr.flags(ios_base::unitbuf); + __wold = wclog.rdbuf(_M_wcerr); + __wold->~wstreambuf(); +#endif + } + } + + ios_base::Init::~Init() + { + if (--_M_ios_base_init == 0) + { + cout.flush(); + cerr.flush(); + clog.flush(); + delete _M_cout; + delete _M_cin; + delete _M_cerr; + _M_cout = NULL; + _M_cin = NULL; + _M_cerr = NULL; +#ifdef _GLIBCPP_USE_WCHAR_T + wcout.flush(); + wcerr.flush(); + wclog.flush(); + delete _M_wcout; + delete _M_wcin; + delete _M_wcerr; + _M_wcout = NULL; + _M_wcin = NULL; + _M_wcerr = NULL; +#endif + } + } + + // 27.4.2.5 ios_base storage functions + int + ios_base::xalloc() throw() + { + // XXX MT + // XXX should be a symbol. (Reserve 0..3 for builtins.) + static int top = 4; + return top++; + } + + // 27.4.2.5 iword/pword storage + ios_base::_Words& + ios_base::_M_grow_words(int ix) + { + // Precondition: _M_word_limit <= ix + _Words zero = { 0, 0 }; + int newlimit = _S_local_words; + _Words* words = _M_word_array; + int i = 0; + if (_S_local_words <= ix) + { + newlimit = ix+1; + try + { words = new _Words[ix+1]; } + catch (...) + { + _M_dummy = zero; // XXX MT? Not on "normal" machines. + // XXX now in basic_ios + // _M_clear(_M_rdstate() | badbit); // may throw + return _M_dummy; + } + do { words[i] = _M_words[i]; } while (++i < _M_word_limit); + if (_M_words != _M_word_array) delete [] _M_words; + } + + do { words[i] = zero; } while (++i < newlimit); + _M_words = words; + _M_word_limit = newlimit; + return words[ix]; + } + + // Called only by basic_ios<>::init. + void + ios_base::_M_init() + { + // NB: May be called more than once + _M_flags = skipws | dec; + _M_width = 0; + _M_precision = 6; + _M_callbacks = 0; + _M_words = 0; + _M_word_limit = 0; + _M_locale_ios = locale(); + // No init needed for _M_word_array or _M_dummy. + } + + // 27.4.2.3 ios_base locale functions + locale + ios_base::imbue(const locale& __loc) + { + locale __old = _M_locale_ios; + _M_locale_ios = __loc; + // Make sure there's a callback for the format caches so they will be + // marked dirty. + _Format_cache<char>::_S_get(*this); +#ifdef _GLIBCPP_USE_WCHAR_T + _Format_cache<wchar_t>::_S_get(*this); +#endif + _M_call_callbacks(imbue_event); + return __old; + } + + ios_base::ios_base() + { + // Do nothing; init() does it. Static init to 0 makes everything sane. + } + + // 27.4.2.7 ios_base constructors/destructors + ios_base::~ios_base() + { + _M_call_callbacks(erase_event); + _M_dispose_callbacks(); + if (_M_words != _M_word_array) + delete [] _M_words; + // XXX done? + } + + void + ios_base::register_callback(event_callback __fn, int __index) + { _M_callbacks = new _Callback_list(__fn, __index, _M_callbacks); } + + void + ios_base::_M_call_callbacks(event __e) throw() + { + for (_Callback_list* __p = _M_callbacks; __p; __p = __p->_M_next) + { + try { + (*__p->_M_fn) (__e, *this, __p->_M_index); + } + catch (...) { + } + } + } + + void + ios_base::_M_dispose_callbacks(void) + { + _Callback_list* __p = _M_callbacks; + while (__p && __p->_M_remove_reference() == 0) + { + _Callback_list* __next = __p->_M_next; + delete __p; + __p = __next; + } + _M_callbacks = 0; + } + + bool + ios_base::sync_with_stdio(bool __sync) + { +#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS + // 49. Underspecification of ios_base::sync_with_stdio + bool __retval = __ioinit._M_cin->_M_file->get_fileno() == 0; + + // Turn off sync with C FILE* for cin, cout, cerr, clog. + if (!__sync && __retval) + { + __ioinit._M_cout = new filebuf(); + __ioinit._M_cout->open("stdout", ios_base::out); + __ioinit._M_cin = new filebuf(); + __ioinit._M_cin->open("stdin", ios_base::in); + __ioinit._M_cerr = new filebuf(); + __ioinit._M_cerr->open("stderr", ios_base::out); + cout.rdbuf(__ioinit._M_cout); + cin.rdbuf(__ioinit._M_cin); + cerr.rdbuf(__ioinit._M_cerr); + cerr.flags(ios_base::unitbuf); + clog.rdbuf(__ioinit._M_cerr); +#ifdef _GLIBCPP_USE_WCHAR_T + __ioinit._M_wcout = new wfilebuf(); + __ioinit._M_wcout->open("stdout", ios_base::out); + __ioinit._M_wcin = new wfilebuf(); + __ioinit._M_wcin->open("stdin", ios_base::in); + __ioinit._M_wcerr = new wfilebuf(); + __ioinit._M_wcerr->open("stderr", ios_base::out); + wcout.rdbuf(__ioinit._M_wcout); + wcin.rdbuf(__ioinit._M_wcin); + wcerr.rdbuf(__ioinit._M_wcerr); + wcerr.flags(ios_base::unitbuf); + wclog.rdbuf(__ioinit._M_wcerr); +#endif + } + + return __retval; +#endif + } + +} // namespace std + + + + + + + + + + + + diff --git a/libstdc++-v3/src/limits_generic.cc b/libstdc++-v3/src/limits_generic.cc new file mode 100644 index 0000000..655e365 --- /dev/null +++ b/libstdc++-v3/src/limits_generic.cc @@ -0,0 +1,340 @@ +// Static data members of -*- C++ -*- numeric_limits classes + +// Copyright (C) 2000 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. + +// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr> + +// +// ISO C++ 14882:1998 +// 18.2.1 +// + +#include <bits/std_limits.h> +namespace std { + + const bool numeric_limits<bool>::is_specialized; + const int numeric_limits<bool>::digits; + const int numeric_limits<bool>::digits10; + const bool numeric_limits<bool>::is_signed; + const bool numeric_limits<bool>::is_integer; + const bool numeric_limits<bool>::is_exact; + const int numeric_limits<bool>::radix; + const int numeric_limits<bool>::min_exponent; + const int numeric_limits<bool>::min_exponent10; + const int numeric_limits<bool>::max_exponent; + const int numeric_limits<bool>::max_exponent10; + const bool numeric_limits<bool>::has_infinity; + const bool numeric_limits<bool>::has_quiet_NaN; + const bool numeric_limits<bool>::has_signaling_NaN; + const float_denorm_style numeric_limits<bool>::has_denorm; + const bool numeric_limits<bool>::has_denorm_loss; + const bool numeric_limits<bool>::is_iec559; + const bool numeric_limits<bool>::is_bounded; + const bool numeric_limits<bool>::is_modulo; + const bool numeric_limits<bool>::traps; + const bool numeric_limits<bool>::tinyness_before; + const float_round_style numeric_limits<bool>::round_style; + + const bool numeric_limits<char>::is_specialized; + const int numeric_limits<char>::digits; + const int numeric_limits<char>::digits10; + const bool numeric_limits<char>::is_signed; + const bool numeric_limits<char>::is_integer; + const bool numeric_limits<char>::is_exact; + const int numeric_limits<char>::radix; + const int numeric_limits<char>::min_exponent; + const int numeric_limits<char>::min_exponent10; + const int numeric_limits<char>::max_exponent; + const int numeric_limits<char>::max_exponent10; + const bool numeric_limits<char>::has_infinity; + const bool numeric_limits<char>::has_quiet_NaN; + const bool numeric_limits<char>::has_signaling_NaN; + const float_denorm_style numeric_limits<char>::has_denorm; + const bool numeric_limits<char>::has_denorm_loss; + const bool numeric_limits<char>::is_iec559; + const bool numeric_limits<char>::is_bounded; + const bool numeric_limits<char>::is_modulo; + const bool numeric_limits<char>::traps; + const bool numeric_limits<char>::tinyness_before; + const float_round_style numeric_limits<char>::round_style; + + const bool numeric_limits<signed char>::is_specialized; + const int numeric_limits<signed char>::digits; + const int numeric_limits<signed char>::digits10; + const bool numeric_limits<signed char>::is_signed; + const bool numeric_limits<signed char>::is_integer; + const bool numeric_limits<signed char>::is_exact; + const int numeric_limits<signed char>::radix; + const int numeric_limits<signed char>::min_exponent; + const int numeric_limits<signed char>::min_exponent10; + const int numeric_limits<signed char>::max_exponent; + const int numeric_limits<signed char>::max_exponent10; + const bool numeric_limits<signed char>::has_infinity; + const bool numeric_limits<signed char>::has_quiet_NaN; + const bool numeric_limits<signed char>::has_signaling_NaN; + const float_denorm_style numeric_limits<signed char>::has_denorm; + const bool numeric_limits<signed char>::has_denorm_loss; + const bool numeric_limits<signed char>::is_iec559; + const bool numeric_limits<signed char>::is_bounded; + const bool numeric_limits<signed char>::is_modulo; + const bool numeric_limits<signed char>::traps; + const bool numeric_limits<signed char>::tinyness_before; + const float_round_style numeric_limits<signed char>::round_style; + + const bool numeric_limits<unsigned char>::is_specialized; + const int numeric_limits<unsigned char>::digits; + const int numeric_limits<unsigned char>::digits10; + const bool numeric_limits<unsigned char>::is_signed; + const bool numeric_limits<unsigned char>::is_integer; + const bool numeric_limits<unsigned char>::is_exact; + const int numeric_limits<unsigned char>::radix; + const int numeric_limits<unsigned char>::min_exponent; + const int numeric_limits<unsigned char>::min_exponent10; + const int numeric_limits<unsigned char>::max_exponent; + const int numeric_limits<unsigned char>::max_exponent10; + const bool numeric_limits<unsigned char>::has_infinity; + const bool numeric_limits<unsigned char>::has_quiet_NaN; + const bool numeric_limits<unsigned char>::has_signaling_NaN; + const float_denorm_style numeric_limits<unsigned char>::has_denorm; + const bool numeric_limits<unsigned char>::has_denorm_loss; + const bool numeric_limits<unsigned char>::is_iec559; + const bool numeric_limits<unsigned char>::is_bounded; + const bool numeric_limits<unsigned char>::is_modulo; + const bool numeric_limits<unsigned char>::traps; + const bool numeric_limits<unsigned char>::tinyness_before; + const float_round_style numeric_limits<unsigned char>::round_style; + + const bool numeric_limits<short>::is_specialized; + const int numeric_limits<short>::digits; + const int numeric_limits<short>::digits10; + const bool numeric_limits<short>::is_signed; + const bool numeric_limits<short>::is_integer; + const bool numeric_limits<short>::is_exact; + const int numeric_limits<short>::radix; + const int numeric_limits<short>::min_exponent; + const int numeric_limits<short>::min_exponent10; + const int numeric_limits<short>::max_exponent; + const int numeric_limits<short>::max_exponent10; + const bool numeric_limits<short>::has_infinity; + const bool numeric_limits<short>::has_quiet_NaN; + const bool numeric_limits<short>::has_signaling_NaN; + const float_denorm_style numeric_limits<short>::has_denorm; + const bool numeric_limits<short>::has_denorm_loss; + const bool numeric_limits<short>::is_iec559; + const bool numeric_limits<short>::is_bounded; + const bool numeric_limits<short>::is_modulo; + const bool numeric_limits<short>::traps; + const bool numeric_limits<short>::tinyness_before; + const float_round_style numeric_limits<short>::round_style; + + const bool numeric_limits<unsigned short>::is_specialized; + const int numeric_limits<unsigned short>::digits; + const int numeric_limits<unsigned short>::digits10; + const bool numeric_limits<unsigned short>::is_signed; + const bool numeric_limits<unsigned short>::is_integer; + const bool numeric_limits<unsigned short>::is_exact; + const int numeric_limits<unsigned short>::radix; + const int numeric_limits<unsigned short>::min_exponent; + const int numeric_limits<unsigned short>::min_exponent10; + const int numeric_limits<unsigned short>::max_exponent; + const int numeric_limits<unsigned short>::max_exponent10; + const bool numeric_limits<unsigned short>::has_infinity; + const bool numeric_limits<unsigned short>::has_quiet_NaN; + const bool numeric_limits<unsigned short>::has_signaling_NaN; + const float_denorm_style numeric_limits<unsigned short>::has_denorm; + const bool numeric_limits<unsigned short>::has_denorm_loss; + const bool numeric_limits<unsigned short>::is_iec559; + const bool numeric_limits<unsigned short>::is_bounded; + const bool numeric_limits<unsigned short>::is_modulo; + const bool numeric_limits<unsigned short>::traps; + const bool numeric_limits<unsigned short>::tinyness_before; + const float_round_style numeric_limits<unsigned short>::round_style; + + const bool numeric_limits<int>::is_specialized; + const int numeric_limits<int>::digits; + const int numeric_limits<int>::digits10; + const bool numeric_limits<int>::is_signed; + const bool numeric_limits<int>::is_integer; + const bool numeric_limits<int>::is_exact; + const int numeric_limits<int>::radix; + const int numeric_limits<int>::min_exponent; + const int numeric_limits<int>::min_exponent10; + const int numeric_limits<int>::max_exponent; + const int numeric_limits<int>::max_exponent10; + const bool numeric_limits<int>::has_infinity; + const bool numeric_limits<int>::has_quiet_NaN; + const bool numeric_limits<int>::has_signaling_NaN; + const float_denorm_style numeric_limits<int>::has_denorm; + const bool numeric_limits<int>::has_denorm_loss; + const bool numeric_limits<int>::is_iec559; + const bool numeric_limits<int>::is_bounded; + const bool numeric_limits<int>::is_modulo; + const bool numeric_limits<int>::traps; + const bool numeric_limits<int>::tinyness_before; + const float_round_style numeric_limits<int>::round_style; + + const bool numeric_limits<unsigned int>::is_specialized; + const int numeric_limits<unsigned int>::digits; + const int numeric_limits<unsigned int>::digits10; + const bool numeric_limits<unsigned int>::is_signed; + const bool numeric_limits<unsigned int>::is_integer; + const bool numeric_limits<unsigned int>::is_exact; + const int numeric_limits<unsigned int>::radix; + const int numeric_limits<unsigned int>::min_exponent; + const int numeric_limits<unsigned int>::min_exponent10; + const int numeric_limits<unsigned int>::max_exponent; + const int numeric_limits<unsigned int>::max_exponent10; + const bool numeric_limits<unsigned int>::has_infinity; + const bool numeric_limits<unsigned int>::has_quiet_NaN; + const bool numeric_limits<unsigned int>::has_signaling_NaN; + const float_denorm_style numeric_limits<unsigned int>::has_denorm; + const bool numeric_limits<unsigned int>::has_denorm_loss; + const bool numeric_limits<unsigned int>::is_iec559; + const bool numeric_limits<unsigned int>::is_bounded; + const bool numeric_limits<unsigned int>::is_modulo; + const bool numeric_limits<unsigned int>::traps; + const bool numeric_limits<unsigned int>::tinyness_before; + const float_round_style numeric_limits<unsigned int>::round_style; + + const bool numeric_limits<long>::is_specialized; + const int numeric_limits<long>::digits; + const int numeric_limits<long>::digits10; + const bool numeric_limits<long>::is_signed; + const bool numeric_limits<long>::is_integer; + const bool numeric_limits<long>::is_exact; + const int numeric_limits<long>::radix; + const int numeric_limits<long>::min_exponent; + const int numeric_limits<long>::min_exponent10; + const int numeric_limits<long>::max_exponent; + const int numeric_limits<long>::max_exponent10; + const bool numeric_limits<long>::has_infinity; + const bool numeric_limits<long>::has_quiet_NaN; + const bool numeric_limits<long>::has_signaling_NaN; + const float_denorm_style numeric_limits<long>::has_denorm; + const bool numeric_limits<long>::has_denorm_loss; + const bool numeric_limits<long>::is_iec559; + const bool numeric_limits<long>::is_bounded; + const bool numeric_limits<long>::is_modulo; + const bool numeric_limits<long>::traps; + const bool numeric_limits<long>::tinyness_before; + const float_round_style numeric_limits<long>::round_style; + + const bool numeric_limits<unsigned long>::is_specialized; + const int numeric_limits<unsigned long>::digits; + const int numeric_limits<unsigned long>::digits10; + const bool numeric_limits<unsigned long>::is_signed; + const bool numeric_limits<unsigned long>::is_integer; + const bool numeric_limits<unsigned long>::is_exact; + const int numeric_limits<unsigned long>::radix; + const int numeric_limits<unsigned long>::min_exponent; + const int numeric_limits<unsigned long>::min_exponent10; + const int numeric_limits<unsigned long>::max_exponent; + const int numeric_limits<unsigned long>::max_exponent10; + const bool numeric_limits<unsigned long>::has_infinity; + const bool numeric_limits<unsigned long>::has_quiet_NaN; + const bool numeric_limits<unsigned long>::has_signaling_NaN; + const float_denorm_style numeric_limits<unsigned long>::has_denorm; + const bool numeric_limits<unsigned long>::has_denorm_loss; + const bool numeric_limits<unsigned long>::is_iec559; + const bool numeric_limits<unsigned long>::is_bounded; + const bool numeric_limits<unsigned long>::is_modulo; + const bool numeric_limits<unsigned long>::traps; + const bool numeric_limits<unsigned long>::tinyness_before; + const float_round_style numeric_limits<unsigned long>::round_style; + + const bool numeric_limits<float>::is_specialized; + const int numeric_limits<float>::digits; + const int numeric_limits<float>::digits10; + const bool numeric_limits<float>::is_signed; + const bool numeric_limits<float>::is_integer; + const bool numeric_limits<float>::is_exact; + const int numeric_limits<float>::radix; + const int numeric_limits<float>::min_exponent; + const int numeric_limits<float>::min_exponent10; + const int numeric_limits<float>::max_exponent; + const int numeric_limits<float>::max_exponent10; + const bool numeric_limits<float>::has_infinity; + const bool numeric_limits<float>::has_quiet_NaN; + const bool numeric_limits<float>::has_signaling_NaN; + const float_denorm_style numeric_limits<float>::has_denorm; + const bool numeric_limits<float>::has_denorm_loss; + const bool numeric_limits<float>::is_iec559; + const bool numeric_limits<float>::is_bounded; + const bool numeric_limits<float>::is_modulo; + const bool numeric_limits<float>::traps; + const bool numeric_limits<float>::tinyness_before; + const float_round_style numeric_limits<float>::round_style; + + const bool numeric_limits<double>::is_specialized; + const int numeric_limits<double>::digits; + const int numeric_limits<double>::digits10; + const bool numeric_limits<double>::is_signed; + const bool numeric_limits<double>::is_integer; + const bool numeric_limits<double>::is_exact; + const int numeric_limits<double>::radix; + const int numeric_limits<double>::min_exponent; + const int numeric_limits<double>::min_exponent10; + const int numeric_limits<double>::max_exponent; + const int numeric_limits<double>::max_exponent10; + const bool numeric_limits<double>::has_infinity; + const bool numeric_limits<double>::has_quiet_NaN; + const bool numeric_limits<double>::has_signaling_NaN; + const float_denorm_style numeric_limits<double>::has_denorm; + const bool numeric_limits<double>::has_denorm_loss; + const bool numeric_limits<double>::is_iec559; + const bool numeric_limits<double>::is_bounded; + const bool numeric_limits<double>::is_modulo; + const bool numeric_limits<double>::traps; + const bool numeric_limits<double>::tinyness_before; + const float_round_style numeric_limits<double>::round_style; + + const bool numeric_limits<long double>::is_specialized; + const int numeric_limits<long double>::digits; + const int numeric_limits<long double>::digits10; + const bool numeric_limits<long double>::is_signed; + const bool numeric_limits<long double>::is_integer; + const bool numeric_limits<long double>::is_exact; + const int numeric_limits<long double>::radix; + const int numeric_limits<long double>::min_exponent; + const int numeric_limits<long double>::min_exponent10; + const int numeric_limits<long double>::max_exponent; + const int numeric_limits<long double>::max_exponent10; + const bool numeric_limits<long double>::has_infinity; + const bool numeric_limits<long double>::has_quiet_NaN; + const bool numeric_limits<long double>::has_signaling_NaN; + const float_denorm_style numeric_limits<long double>::has_denorm; + const bool numeric_limits<long double>::has_denorm_loss; + const bool numeric_limits<long double>::is_iec559; + const bool numeric_limits<long double>::is_bounded; + const bool numeric_limits<long double>::is_modulo; + const bool numeric_limits<long double>::traps; + const bool numeric_limits<long double>::tinyness_before; + const float_round_style numeric_limits<long double>::round_style; +} // namespace std + + diff --git a/libstdc++-v3/src/locale-inst.cc b/libstdc++-v3/src/locale-inst.cc new file mode 100644 index 0000000..81fb209 --- /dev/null +++ b/libstdc++-v3/src/locale-inst.cc @@ -0,0 +1,311 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1999, 2000 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +#include <bits/std_clocale.h> +#include <bits/std_cstring.h> +#include <bits/std_cassert.h> +#include <bits/std_limits.h> +#include <bits/std_exception.h> +#include <bits/std_stdexcept.h> +#include <bits/std_locale.h> +#include <bits/locale_facets.tcc> +#include <bits/std_istream.h> +#include <bits/std_ostream.h> + +namespace std { + + typedef ostreambuf_iterator<char, char_traits<char> > obuf_iterator; + typedef istreambuf_iterator<char, char_traits<char> > ibuf_iterator; + typedef ostreambuf_iterator<wchar_t, char_traits<wchar_t> > wobuf_iterator; + typedef istreambuf_iterator<wchar_t, char_traits<wchar_t> > wibuf_iterator; + + // moneypunct, money_get, and money_put + + const money_base::pattern + money_base::__default_pattern = {{symbol, sign, none, value}}; + + template class moneypunct<char, false>; + template class moneypunct<char, true>; + template class moneypunct_byname<char, false>; + template class moneypunct_byname<char, true>; + template class _Moneypunct<char>; + template class money_get<char, obuf_iterator>; + template class money_put<char, obuf_iterator>; + template class money_get<char, ibuf_iterator>; + template class money_put<char, ibuf_iterator>; + template class _Format_cache<char>; + +#ifdef _GLIBCPP_USE_WCHAR_T + template class moneypunct<wchar_t, false>; + template class moneypunct<wchar_t, true>; + template class moneypunct_byname<wchar_t, false>; + template class moneypunct_byname<wchar_t, true>; + template class _Moneypunct<wchar_t>; + template class money_get<wchar_t, wobuf_iterator>; + template class money_put<wchar_t, wobuf_iterator>; + template class money_get<wchar_t, wibuf_iterator>; + template class money_put<wchar_t, wibuf_iterator>; + template class _Format_cache<wchar_t>; +#endif + + // numpunct, numpunct_byname, num_get, and num_put + template class numpunct<char>; + template class numpunct_byname<char>; + template class _Numpunct<char>; + template class num_get<char, ibuf_iterator>; + template class num_put<char, obuf_iterator>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class numpunct<wchar_t>; + template class numpunct_byname<wchar_t>; + template class _Numpunct<wchar_t>; + template class num_get<wchar_t, wibuf_iterator>; + template class num_put<wchar_t, wobuf_iterator>; +#endif + + // _Punct + template class _Punct<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class _Punct<wchar_t>; +#endif + + // time_get and time_put + //template class time_get<char, obuf_iterator>; + template class time_put<char, obuf_iterator>; + template class time_get<char, ibuf_iterator>; + template class time_put<char, ibuf_iterator>; +#ifdef _GLIBCPP_USE_WCHAR_T + //template class time_get<wchar_t, wobuf_iterator>; + template class time_put<wchar_t, wobuf_iterator>; + template class time_get<wchar_t, wibuf_iterator>; + template class time_put<wchar_t, wibuf_iterator>; +#endif + + // messages + template class _Messages<char>; + template class messages<char>; + template class messages_byname<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class _Messages<wchar_t>; + template class messages<wchar_t>; + template class messages_byname<wchar_t>; +#endif + + // ctype + // template class ctype<unsigned char>; // No definitions avail. + // template class ctype<signed char>; // No definitions avail. + template class _Ctype<char>; + template class _Ctype_nois<char>; + template class ctype_byname<char>; + template class _Codecvt<char, char, mbstate_t>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class _Ctype<wchar_t>; + template class _Ctype_nois<wchar_t>; + template class ctype_byname<wchar_t>; + template class _Codecvt<wchar_t, char, mbstate_t>; +#endif + + // collate + template class _Collate<char>; + template class collate_byname<char>; + template class _Weekdaynames<char, int>; + template class _Monthnames<char, int>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class _Collate<wchar_t>; + template class collate_byname<wchar_t>; + template class _Weekdaynames<wchar_t, int>; + template class _Monthnames<wchar_t, int>; +#endif + + // use_facet + 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 ctype<char>& + use_facet<ctype<char> >(const locale& __loc); + template + const codecvt<char, char, mbstate_t>& + use_facet<codecvt<char, char, mbstate_t> >(locale const &); + template + const num_put<char, obuf_iterator>& + _Use_facet_failure_handler<num_put<char, obuf_iterator> > + (const locale &); +#ifdef _GLIBCPP_USE_WCHAR_T + 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 ctype<wchar_t>& + use_facet<ctype<wchar_t> >(const locale& __loc); + template + const codecvt<wchar_t, wchar_t, mbstate_t>& + use_facet<codecvt<wchar_t, wchar_t, mbstate_t> >(locale const &); + template + const codecvt<wchar_t, char, mbstate_t>& + use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const &); + template + const num_put<wchar_t, wobuf_iterator>& + _Use_facet_failure_handler<num_put<wchar_t, wobuf_iterator> > + (const locale &); +#endif + + // has_facet + template + bool + has_facet<numpunct<char> >(const locale &); +#ifdef _GLIBCPP_USE_WCHAR_T + template + bool + has_facet<numpunct<wchar_t> >(const locale &); +#endif + + // + // iterator + // + typedef vector<locale::facet*> vec_pfacet; + template + void + vec_pfacet:: + insert(vec_pfacet::iterator, vec_pfacet::size_type, + const vec_pfacet::value_type&); + + typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter; + typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter; + + + template + istreambuf_iter + __match_parallel<istreambuf_iter, char> + (istreambuf_iter, istreambuf_iter, int, const string*, int*, int&, bool&); + + +#ifdef _GLIBCPP_USE_WCHAR_T + typedef istreambuf_iterator<wchar_t,char_traits<wchar_t> > wistreambuf_iter; + typedef ostreambuf_iterator<wchar_t,char_traits<wchar_t> > wostreambuf_iter; + + template + wistreambuf_iter + __match_parallel<wistreambuf_iter, wchar_t> + (wistreambuf_iter, wistreambuf_iter, int, const wstring*, int*, int&, bool&); +#endif + + + // + // locale + // + template + bool + locale::operator()(const string&, const string&) const; + + template + ostreambuf_iter + _S_fill<char, ostreambuf_iter, output_iterator_tag> + (ostreambuf_iter, char, int, output_iterator_tag); + + template + ostreambuf_iter + _S_pad_numeric<char, ostreambuf_iter> + (ostreambuf_iter, ios_base::fmtflags, char, int, char const*, char const*, + char const*); + + template + char* + _S_group_digits<char>(char*, char, char const*, char const*, + char const*, char const*); + + template + ostreambuf_iter + _S_format<char, ostreambuf_iter, unsigned long> + (ostreambuf_iter, ios_base &, char, bool, unsigned long); + +#ifdef _GLIBCPP_USE_LONG_LONG + template + ostreambuf_iter + _S_format<char, ostreambuf_iter, unsigned long long> + (ostreambuf_iter, ios_base &, char, bool, unsigned long long); +#endif + +#ifdef _GLIBCPP_USE_WCHAR_T + template + bool + locale::operator()(const wstring&, const wstring&) const; + + typedef ostreambuf_iterator<wchar_t> wostreambuf_iter; + + template + wostreambuf_iter + _S_fill<wchar_t, wostreambuf_iter, output_iterator_tag> + (wostreambuf_iter, wchar_t, int, output_iterator_tag); + + template + wostreambuf_iter + _S_pad_numeric<wchar_t, wostreambuf_iter> + (wostreambuf_iter, ios_base::fmtflags, wchar_t __fill, int, wchar_t const*, + wchar_t const*, wchar_t const*); + + template + wchar_t* + _S_group_digits<wchar_t>(wchar_t*, wchar_t, char const*, char const*, + wchar_t const*, wchar_t const*); + + template + wostreambuf_iter + _S_format<wchar_t, wostreambuf_iter, unsigned long> + (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long); + +#ifdef _GLIBCPP_USE_LONG_LONG + template + wostreambuf_iter + _S_format<wchar_t, wostreambuf_iter, unsigned long long> + (wostreambuf_iter, ios_base &, wchar_t, bool, unsigned long long); +#endif +#endif // _GLIBCPP_USE_WCHAR_T + + template + locale::facet** + fill_n<locale::facet**, unsigned int, locale::facet*> + (locale::facet**, unsigned int, locale::facet* const &); + +} //std + + + + + + diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc new file mode 100644 index 0000000..73112fd --- /dev/null +++ b/libstdc++-v3/src/locale.cc @@ -0,0 +1,820 @@ +// Copyright (C) 1997, 1998, 1999, 2000 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. + +#include <bits/std_clocale.h> +#include <bits/std_cstring.h> +#include <bits/std_cassert.h> +#include <bits/std_cctype.h> +#include <bits/std_limits.h> +#include <bits/std_exception.h> +#include <bits/std_stdexcept.h> +#include <bits/std_locale.h> +#include <bits/std_istream.h> +#include <bits/std_ostream.h> +#include <bits/std_vector.h> +#include <bits/std_memory.h> // for auto_ptr + +namespace std { + + // locale::_Impl + locale::_Impl::~_Impl() throw () + { + std::vector<facet*>::iterator it = _M_facets->begin(); + for (; it != _M_facets->end(); ++it) + (*it)->_M_remove_reference(); + delete _M_facets; + delete _M_category_names; + } + + locale::_Impl::_Impl(size_t __numfacets, size_t __refs) + : _M_num_references(__refs - 1) + , _M_facets(0) + , _M_category_names(0) + , _M_has_name(false) + , _M_cached_name_ok(false) + , _M_cached_name(string ("*")) + { + typedef vector<facet*, allocator<facet*> > __vec_facet; + typedef vector<string, allocator<string> > __vec_string; + + auto_ptr<__vec_facet> __pvf(new __vec_facet(__numfacets, (facet*)0)); + auto_ptr<__vec_string> __pcn(new __vec_string(_S_num_categories, + string("*"))); + _M_facets = __pvf.release(); + _M_category_names = __pcn.release(); + } + + locale::_Impl::_Impl(const _Impl& __other, size_t __refs) + : _M_num_references(__refs) + , _M_facets(0) + , _M_category_names(0) + , _M_has_name(__other._M_has_name) + , _M_cached_name_ok(__other._M_cached_name_ok) + , _M_cached_name(__other._M_cached_name) + { + typedef vector<facet*, allocator<facet*> > __vec_facet; + typedef vector<string, allocator<string> > __vec_string; + + auto_ptr<__vec_facet> __pvf(new __vec_facet(*(__other._M_facets))); + auto_ptr<__vec_string> + __pcn(new __vec_string(*(__other._M_category_names))); + + std::vector<facet*>::iterator __it = __pvf->begin(); + for (; __it != __pvf->end(); ++__it) + (*__it)->_M_add_reference(); + + // these must be last since in the presence of an exception, the + // destructor for 'this' won't run until AFTER execution has passed + // the closing brace of the constructor + _M_facets = __pvf.release(); + _M_category_names = __pcn.release(); + } + + void + locale::_Impl::_M_replace_categories(const _Impl* __other, category __cats) + { + assert((__cats & locale::all) && !(__cats & ~locale::all)); + + unsigned mask = (locale::all & -(unsigned)locale::all); + for (unsigned ix = 0; (-mask & __cats) != 0; ++ix, (mask <<= 1)) + { + if (mask & __cats) + { + _M_replace_category(__other, _S_facet_categories[ix]); + (*_M_category_names)[ix] = (*(__other->_M_category_names))[ix]; + } + } + } + + void + locale::_Impl::_M_replace_category(const _Impl* __other, + const locale::id* const* __idpp) + { + for (; *__idpp; ++__idpp) + _M_replace_facet(__other, *__idpp); + } + + void + locale::_Impl::_M_replace_facet(const _Impl* __other, + const locale::id* __idp) + { + size_t __index = __idp->_M_index; + if (__index == 0 + || __other->_M_facets->size() <= __index + || (*(__other->_M_facets))[__index] == 0) + throw runtime_error("no locale facet"); + + _M_install_facet(__idp, (*(__other->_M_facets))[__index]); + } + + void + locale::_Impl::_M_install_facet(const locale::id* __idp, facet* __fp) + { + if (__fp == 0) + return; + + size_t& __index = __idp->_M_index; + if (!__index) + __index = ++locale::id::_S_highwater; // XXX MT + + if (__index >= _M_facets->size()) + _M_facets->resize(__index + 1, 0); // might throw + facet*& __fpr = (*_M_facets)[__index]; + // order matters, here: + __fp->_M_add_reference(); + if (__fpr) + __fpr->_M_remove_reference(); + __fpr = __fp; + } + + // locale facet category descriptions + const locale::id* const + locale::_Impl::_S_id_collate[] = + { + &std::collate<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::collate<wchar_t>::id, +#endif + 0 + }; + + const locale::id* const + locale::_Impl::_S_id_ctype[] = + { + &std::ctype<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::ctype<wchar_t>::id, +#endif + &std::codecvt<char, char, mbstate_t>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::codecvt<wchar_t, char, mbstate_t>::id, +#endif + 0 + }; + + const locale::id* const + locale::_Impl::_S_id_monetary[] = + { + &std::moneypunct<char, false>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::moneypunct<wchar_t, false>::id, +#endif + &std::moneypunct<char,true >::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::moneypunct<wchar_t,true >::id, +#endif + &std::money_get<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::money_get<wchar_t>::id, +#endif + &std::money_put<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::money_put<wchar_t>::id, +#endif + 0 + }; + + const locale::id* const + locale::_Impl::_S_id_numeric[] = + { + &std::numpunct<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::numpunct<wchar_t>::id, +#endif + &std::num_get<char>::id, + #ifdef _GLIBCPP_USE_WCHAR_T + &std::num_get<wchar_t>::id, +#endif + &std::num_put<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::num_put<wchar_t>::id, +#endif + 0 + }; + + const locale::id* const + locale::_Impl::_S_id_time[] = + { + &std::time_get<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::time_get<wchar_t>::id, +#endif + &std::time_put<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::time_put<wchar_t>::id, +#endif + 0 + }; + + const locale::id* const + locale::_Impl::_S_id_messages[] = + { + &std::time_get<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::time_get<wchar_t>::id, +#endif + &std::time_put<char>::id, +#ifdef _GLIBCPP_USE_WCHAR_T + &std::time_put<wchar_t>::id, +#endif + 0 + }; + + const locale::id* const* const + locale::_Impl::_S_facet_categories[] = + { + // order must match the decl order in class locale. + locale::_Impl::_S_id_collate, + locale::_Impl::_S_id_ctype, + locale::_Impl::_S_id_monetary, + locale::_Impl::_S_id_numeric, + locale::_Impl::_S_id_time, + locale::_Impl::_S_id_messages, + 0 + }; + + locale::_Impl* locale::_S_global; // init'd to 0 before static ctors run + locale::_Impl* locale::_S_classic; // init'd to 0 before static ctors run + + locale::locale(_Impl* __ip) throw () + : _M_impl(__ip) + { __ip->_M_add_reference(); } + + locale::locale(const locale& __other, const locale& __one, category __cats) + { + __cats = _S_normalize_category(__cats); // might throw + _M_impl = new _Impl(*__other._M_impl, 1); // might throw + + try { + _M_impl->_M_replace_categories(__one._M_impl, __cats); + } + catch (...) { + _M_impl->_M_remove_reference(); + throw; + } + + _M_impl->_M_cached_name_ok = false; + if (!__other._M_impl->_M_has_name) + _M_impl->_M_has_name = false; + } + + 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(); + locale __keep(_S_global); + __other._M_impl->_M_add_reference(); + _S_global->_M_remove_reference(); + _S_global = __other._M_impl; + if (_S_global->_M_has_name) + setlocale(LC_ALL, __other.name().c_str()); + return __keep; + } + + string + locale::name() const + { + // XXX not done + return "*"; + } + + locale const& + locale::classic() + { + static locale* __classic_locale; + // XXX MT + if (!_S_classic) + { + try { + _S_classic = _S_global = new _Impl(26u, 2u); + // one reference for _M_classic, one for _M_global + // (constructor for (*the_classic_locale) adds a third) + + // collate category + _S_classic->_M_init_facet(new std::collate<char>); + + // ctype category + _S_classic->_M_init_facet(new std::ctype<char>); + _S_classic->_M_init_facet(new std::codecvt<char, char, mbstate_t>); + + // monetary category + _S_classic->_M_init_facet(new std::moneypunct<char, false>); + _S_classic->_M_init_facet(new std::moneypunct<char,true >); + _S_classic->_M_init_facet(new std::money_get<char>); + _S_classic->_M_init_facet(new std::money_put<char>); + + // numeric category + _S_classic->_M_init_facet(new std::numpunct<char>); + _S_classic->_M_init_facet(new std::num_get<char>); + _S_classic->_M_init_facet(new std::num_put<char>); + + // time category + _S_classic->_M_init_facet(new std::time_get<char>); + _S_classic->_M_init_facet(new std::time_put<char>); + + // messages category + _S_classic->_M_init_facet(new std::messages<char>); + +#ifdef _GLIBCPP_USE_WCHAR_T + _S_classic->_M_init_facet(new std::collate<wchar_t>); + _S_classic->_M_init_facet(new std::ctype<wchar_t>); + _S_classic->_M_init_facet(new std::codecvt<wchar_t, char, mbstate_t>); + _S_classic->_M_init_facet(new std::moneypunct<wchar_t, false>); + _S_classic->_M_init_facet(new std::moneypunct<wchar_t,true >); + _S_classic->_M_init_facet(new std::money_get<wchar_t>); + _S_classic->_M_init_facet(new std::money_put<wchar_t>); + _S_classic->_M_init_facet(new std::numpunct<wchar_t>); + _S_classic->_M_init_facet(new std::num_get<wchar_t>); + _S_classic->_M_init_facet(new std::num_put<wchar_t>); + _S_classic->_M_init_facet(new std::time_get<wchar_t>); + _S_classic->_M_init_facet(new std::time_put<wchar_t>); + _S_classic->_M_init_facet(new std::messages<wchar_t>); +#endif + + // finesse static init order hassles + __classic_locale = new locale(_S_classic); + } + catch(...) { + delete __classic_locale; + if (_S_classic) + { + _S_classic->_M_remove_reference(); + _S_global->_M_remove_reference(); + } + _S_classic = _S_global = 0; + // XXX MT + throw; + } + } + return *__classic_locale; + } + + int + locale::_S_normalize_category(int __cats) + { + if ((__cats & all) && !(__cats & ~all)) + return __cats; + + // NB: May be a C-style "LC_ALL" category; convert. + switch (__cats) + { + case LC_COLLATE: return collate; + case LC_CTYPE: return ctype; + case LC_MONETARY: return monetary; + case LC_NUMERIC: return numeric; + case LC_TIME: return time; +#ifdef _GLIBCPP_HAVE_LC_MESSAGES + case LC_MESSAGES: return messages; +#endif + case LC_ALL: return all; + } + + // XXX should throw derived class here + throw runtime_error("bad locale category"); + /* NOTREACHED */ + } + + locale::facet::facet(size_t __refs) throw () + : _M_num_references(__refs - 1) + { } + + void + locale::facet::_M_add_reference() throw () + { + if (this) + ++_M_num_references; + } // XXX MT + + void + locale::facet::_M_remove_reference() throw () + { + if (this && _M_num_references-- == 0) + { + try { + delete this; + } // XXX MT + catch (...) { + } + } + } + + char const* + _Bad_use_facet::what() const throw() + { return "bad_cast thrown from use_facet"; } + + _Bad_use_facet::~_Bad_use_facet() throw() {} + + size_t locale::id::_S_highwater; // init'd to 0 by linker + + + // Platform-specific initialization code for ctype tables. + #include <ctype.cc> + + locale::id ctype<char>::id; + + ctype<char>::~ctype() + { if (_M_del) delete[] table(); } + + char + ctype<char>::do_widen(char __c) const + { return __c; } + + const char* + ctype<char>:: + do_widen(const char* __low, const char* __high, char* __dest) const + { + memcpy(__dest, __low, __high - __low); + return __high; + } + + char + ctype<char>::do_narrow(char __c, char /*__dfault*/) const + { return __c; } + + const char* + ctype<char>:: + do_narrow(const char* __low, const char* __high, char /*__dfault*/, + char* __dest) const + { + memcpy(__dest, __low, __high - __low); + return __high; + } + + ctype_byname<char>::ctype_byname(const char* /*__s*/, size_t __refs) + : ctype<char> (new mask[table_size], true, __refs) + { } + + locale::id codecvt<char, char, mbstate_t>::id; + + codecvt<char, char, mbstate_t>::codecvt(size_t __refs) + : _Codecvt<char, char, mbstate_t> (__refs) + { } + + codecvt<char, char, mbstate_t>::~codecvt() { } + + codecvt_base::result + codecvt<char, char, mbstate_t>:: + do_out(state_type& /*__state*/, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const + { + size_t __sizefrom = __from_end - __from; + size_t __sizeto = __to_end - __to; + size_t __length = __sizefrom <= __sizeto ? __sizefrom : __sizeto; + memcpy(__to, __from, __length); + __from_next = __from; + __to_next = __to; + return noconv; + } + + codecvt_base::result + codecvt<char, char, mbstate_t>:: + do_unshift(state_type& /*__state*/, extern_type* __to, + extern_type* /*__to_limit*/, + extern_type*& __to_next) const + { + __to_next = __to; + return noconv; + } + + codecvt_base::result + codecvt<char, char, mbstate_t>:: + do_in(state_type& /*__state*/, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const + { + size_t __sizefrom = __from_end - __from; + size_t __sizeto = __to_end - __to; + size_t __length = __sizefrom <= __sizeto ? __sizefrom : __sizeto; + memcpy(__to, __from, __length); + __from_next = __from; + __to_next = __to; + return noconv; + } + + + int + codecvt<char, char, mbstate_t>::do_encoding() const throw () + { return 1; } + + bool + codecvt<char, char, mbstate_t>::do_always_noconv() const throw () + { return true; } + + int + codecvt<char, char, mbstate_t>:: + do_length (const state_type& /*__state*/, const extern_type* __from, + const extern_type* __end, size_t __max) const + { return (__max < size_t(__end - __from)) ? __max : __end - __from; } + + int + codecvt<char, char, mbstate_t>::do_max_length() const throw () + { return 1; } + + codecvt_byname<char, char, mbstate_t>:: + codecvt_byname(const char* /*__s*/, size_t __refs) + : codecvt<char, char, mbstate_t>(__refs) + { } + + codecvt_byname<char, char, mbstate_t>::~codecvt_byname() { } + + locale::id collate<char>::id; + + collate<char>::collate(size_t __refs) + : _Collate<char> (__refs) + { } + + collate<char>::~collate() { } + + int + collate<char>::do_compare(const char* __lo1, const char* __hi1, + const char* __lo2, const char* __hi2) const + { + for (; __lo1 < __hi1 && __lo2 < __hi2; ++__lo1, ++__lo2) + if (*__lo1 != *__lo2) + return (*__lo1 < *__lo2) ? -1 : 1; + if (__lo1 < __hi1) + return 1; + else if (__lo2 < __hi2) + return -1; + else + return 0; + } + + string + collate<char>::do_transform(const char* __lo, const char* __hi) const + { return string(__lo, __hi - __lo); } + + long + collate<char>::do_hash(const char* __lo, const char* __hi) const + { + unsigned long __val = 0xdeadbeef; + for (; __lo < __hi; ++__lo) + __val = *__lo ^ ((__val << 7) & + (__val >> (numeric_limits<unsigned long>::digits - 1))); + return __val; + } + + collate_byname<char>::collate_byname(const char* /*__s*/, size_t __refs) + : collate<char> (__refs) + { } + + numpunct_byname<char>::numpunct_byname(const char* /*__s*/, size_t __refs) + : numpunct<char> (__refs) + { } + + moneypunct_byname<char, false>:: + moneypunct_byname(const char* /*__s*/, size_t __refs) + : moneypunct<char, false> (__refs) + { } + + moneypunct_byname<char, true>:: + moneypunct_byname(const char* /*__s*/, size_t __refs) + : moneypunct<char, true> (__refs) + { } + + messages_byname<char>::messages_byname(const char* /*__s*/, size_t __refs) + : messages<char> (__refs) + { } + +#ifdef _GLIBCPP_USE_WCHAR_T + locale::id ctype<wchar_t>::id; + + ctype<wchar_t>::~ctype() { } + + bool + ctype<wchar_t>::do_is(mask __m, char_type __c) const + { + return ((static_cast<__table_type>(__c) < _S_table_size) + && (_M_ctable[__c] & __m)); + } + + const wchar_t* + ctype<wchar_t>::do_is(const wchar_t* __low, const wchar_t* __high, + mask* __vec) const + { + for (; __low < __high; ++__low, ++__vec) + *__vec = ((static_cast<__table_type>(*__low) < _S_table_size) + ? _M_ctable[*__low] : mask(0)); + return __high; + } + + const wchar_t* + ctype<wchar_t>::do_scan_is(mask __m, const wchar_t* __low, + const wchar_t* __high) const + { + while (__low < __high + && (_S_table_size < static_cast<__table_type>(*__low) + || !(_M_ctable[*__low] & __m))) + ++__low; + return __low; + } + + const wchar_t* + ctype<wchar_t>::do_scan_not(mask __m, const char_type* __low, + const char_type* __high) const + { + while (__low < __high + && static_cast<__table_type>(*__low) < _S_table_size + && (_M_ctable[*__low] & __m)) + ++__low; + return __low; + } + + wchar_t + ctype<wchar_t>::do_widen(char __c) const + { return static_cast<wchar_t>((unsigned char)__c); } + + const char* + ctype<wchar_t>::do_widen(const char* __low, const char* __high, + wchar_t* __dest) const + { + while (__low < __high) + *__dest++ = static_cast<wchar_t>((unsigned char)*__low++); + return __high; + } + + char + ctype<wchar_t>::do_narrow(wchar_t __c, char __dfault) const + { + return ((static_cast<__table_type>(__c) < _S_table_size) + ? static_cast<char>(__c) : __dfault); + } + + const wchar_t* + ctype<wchar_t>::do_narrow(const wchar_t* __low, const wchar_t* __high, + char __dfault, char* __dest) const + { + for (; __low < __high; ++__dest, ++__low) + *__dest = (static_cast<__table_type>(*__low) < _S_table_size) + ? static_cast<char>(*__low) : __dfault; + return __high; + } + + ctype_byname<wchar_t>::ctype_byname(const char* /*__s*/, size_t __refs) + : ctype<wchar_t> (__refs) + { } + + locale::id codecvt<wchar_t, char, mbstate_t>::id; + + codecvt<wchar_t, char, mbstate_t>::codecvt (size_t __refs) + : _Codecvt<wchar_t, char, mbstate_t> (__refs) + { } + + codecvt<wchar_t, char, mbstate_t>::~codecvt() { } + + codecvt_base::result + codecvt<wchar_t, char, mbstate_t>:: + do_out(state_type& /*__state*/, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_limit, + extern_type*& __to_next) const + { + for (; __from < __from_end && __to < __to_limit; ++__from, ++__to) + *__to = static_cast<char>(*__from); + __from_next = __from; __to_next = __to; + return __from == __from_end ? ok : partial; + } + + codecvt_base::result + codecvt<wchar_t, char, mbstate_t>:: + do_unshift (state_type& /*__state*/, extern_type* __to, + extern_type* /*__to_limit*/, + extern_type*& __to_next) const + { + __to_next = __to; + return noconv; + } + + codecvt_base::result + codecvt<wchar_t, char, mbstate_t>:: + do_in(state_type& /*__state*/, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_limit, + intern_type*& __to_next) const + { + for (; __from < __from_end && __to < __to_limit; ++__from, ++__to) + *__to = static_cast<wchar_t>(*__from); + __from_next = __from; + __to_next = __to; + return __from == __from_end ? ok : partial; + } + + int codecvt<wchar_t, char, mbstate_t>::do_encoding() const throw () + { return 1; } + + bool + codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const throw () + { return false; } + + int + codecvt<wchar_t, char, mbstate_t>:: + do_length(const state_type& /*__state*/, const extern_type* __from, + const extern_type* __end, size_t __max) const + { return (__max < size_t(__end - __from)) ? __max : __end - __from; } + + int + codecvt<wchar_t, char, mbstate_t>::do_max_length() const throw () + { return 1; } + + codecvt_byname<wchar_t, char, mbstate_t>:: + codecvt_byname(const char* /*__s*/, size_t __refs) + : codecvt<wchar_t, char, mbstate_t> (__refs) + { + } + + codecvt_byname<wchar_t, char, mbstate_t>::~codecvt_byname() {} + + locale::id collate<wchar_t>::id; + + collate<wchar_t>::collate(size_t __refs) + : _Collate<wchar_t> (__refs) + { } + + collate<wchar_t>::~collate() { } + + int collate<wchar_t>:: + do_compare(const wchar_t* /*__lo1*/, const wchar_t* /*__hi1*/, + const wchar_t* /*__lo2*/, const wchar_t* /*__hi2*/) const + { + return 0; // XXX not done + } + + wstring collate<wchar_t>::do_transform(const wchar_t* /*__lo*/, + const wchar_t* /*__hi*/) const + { + return wstring(); // XXX not done + } + + long collate<wchar_t>:: + do_hash(const wchar_t* /*__lo*/, const wchar_t* /*__hi*/) const + { + return 0; // XXX not done + } + + numpunct_byname<wchar_t>::numpunct_byname(const char* /*__s*/, size_t __refs) + : numpunct<wchar_t> (__refs) + { } + + collate_byname<wchar_t>::collate_byname(const char* /*__s*/, size_t __refs) + : collate<wchar_t> (__refs) + { } + + moneypunct_byname<wchar_t, false>:: + moneypunct_byname(const char* /*__s*/, size_t __refs) + : moneypunct<wchar_t, false> (__refs) + { } + + moneypunct_byname<wchar_t, true>:: + moneypunct_byname(const char* /*__s*/, size_t __refs) + : moneypunct<wchar_t, true> (__refs) + { } + + messages_byname<wchar_t>::messages_byname(const char* /*__s*/, size_t __refs) + : messages<wchar_t> (__refs) + { } +#endif // _GLIBCPP_USE_WCHAR_T + +} // namespace std + + + + + + diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc new file mode 100644 index 0000000..0af674e --- /dev/null +++ b/libstdc++-v3/src/localename.cc @@ -0,0 +1,250 @@ + +// Copyright (C) 1997-1999 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. + + +#include <bits/std_clocale.h> +#include <bits/std_locale.h> +#include <bits/std_cstring.h> +#include <bits/std_cassert.h> +#include <bits/std_vector.h> + +namespace std { + +///////////////////////////// +// locale::_Impl constructors +///////////////////////////// + + // construct specific categories, leaving unselected ones alone + ////////// + locale::_Impl::_Impl(const _Impl& other,const string& name, category cats, + size_t refs) + : _M_num_references(refs) + // , _M_facets(other._M_facets) + // , _M_category_names(other._M_category_names) + , _M_has_name(other._M_has_name), _M_cached_name_ok(false) + { +#if 1 + typedef vector<facet*, allocator<facet*> > __vec_facet; + typedef vector<string, allocator<string> > __vec_string; + try { + _M_facets = new __vec_facet(*(other._M_facets)); + } + catch (...) { + delete _M_facets; + throw; + } + try { + _M_category_names = new __vec_string(*(other._M_category_names)); + } + catch (...) { + delete _M_category_names; + throw; + } +#endif + // XXX Nathan what are you doing here? Is this supposed to be const? + // static void(_Impl::* const ctors[]) (const char*) = + static void(_Impl::* ctors[]) (const char*) = + { + // NB: order must match the decl order in class locale. + &locale::_Impl::_M_construct_collate, + &locale::_Impl::_M_construct_ctype, + &locale::_Impl::_M_construct_monetary, + &locale::_Impl::_M_construct_numeric, + &locale::_Impl::_M_construct_time, + &locale::_Impl::_M_construct_messages, + 0 + }; + + _S_initialize(); + std::vector<facet*>::iterator it = _M_facets->begin(); + for (; it != _M_facets->end(); ++it) + (*it)->_M_add_reference(); + + try { + category classix = _S_normalize_category(cats); // might throw + _M_normalize_category_names(name, classix); + + unsigned mask = (locale::all & -(unsigned)locale::all); + for (unsigned ix = 0; (-mask & cats) != 0; ++ix, (mask <<= 1)) + { + if (!(mask & cats)) + continue; + + if (mask & classix) + _M_replace_category(_S_classic, _S_facet_categories[ix]); + else + (this->*ctors[ix]) (name.c_str()); + } + } + catch (...) { + it = _M_facets->begin(); + for (; it != _M_facets->end(); ++it) + (*it)->_M_remove_reference(); + throw; + } + } + + ////////// + locale::category + locale::_Impl::_M_normalize_category_names(const string&, + locale::category cats) + { + + // The problem to be solved here is that locale names + // generally have one of two forms: they might have + // only one component, such as "en_US"; or they might + // have six, such as "en_US fr_FR en_US C C C", where + // each component names a category. Each vendor has + // a different order of categories. Each vendor uses + // a different format: + // AIX uses "C C C C C C" + // Sun uses "/C/C/C/C/C/C" + // HP uses "/0:C;1:C;2:C;3:C;4:C;5:C;6:C;/" + // (where the 0th element is for LC_ALL.) + // Most systems (except AIX) permit the long form only for + // setlocale(LC_ALL,...), and require the short form for + // other calls. All this matters because locale names are + // supposed to be compatible between locale("") and + // setlocale(..., "") constructors. + + return cats; +#if 0 /* XXX not done */ + unsigned mask = (locale::all & -(unsigned)locale::all); + for (unsigned ix = 0; (-mask & cats) != 0; ++ix, (mask <<= 1)) + { + + } +#endif + } + + ////////// + void + locale::_Impl::_M_construct_collate(const char* /*name*/) + { +#if 0 + _M_init_facet(new std::collate_byname<char>(name)); + _M_init_facet(new std::collate_byname<wchar_t>(name)); +#endif + } + + void + locale::_Impl::_M_construct_ctype(const char* /*name*/) + { +#if 0 + _M_init_facet(new std::ctype_byname<char>(name)); + _M_init_facet(new std::ctype_byname<wchar_t>(name)); + _M_init_facet(new std::codecvt_byname<char,char,mbstate_t>(name)); + _M_init_facet(new std::codecvt_byname<wchar_t,char,mbstate_t>(name)); +#endif + } + + void + locale::_Impl::_M_construct_monetary(const char* /*name*/) + { +#if 0 + _M_init_facet(new std::moneypunct_byname<char,false>(name)); + _M_init_facet(new std::moneypunct_byname<wchar_t,false>(name)); + _M_init_facet(new std::moneypunct_byname<char,true >(name)); + _M_init_facet(new std::moneypunct_byname<wchar_t,true >(name)); + + locale::_M_initialize(); + _M_replace_facet(locale::_S_classic, &std::money_get<char>(name)::id); + _M_replace_facet(locale::_S_classic, &std::money_get<wchar_t>(name)::id); + _M_replace_facet(locale::_S_classic, &std::money_put<char>(name)::id); + _M_replace_facet(locale::_S_classic, &std::money_put<wchar_t>(name)::id); +#endif + } + + void + locale::_Impl::_M_construct_numeric(const char* /*name*/) + { +#if 0 + _M_init_facet(new std::numpunct_byname<char>(name)); + _M_init_facet(new std::numpunct_byname<wchar_t>(name)); + + locale::_M_initialize(); + _M_replace_facet(locale::_S_classic, &std::num_get<char>::id); + _M_replace_facet(locale::_S_classic, &std::num_get<wchar_t>::id); + _M_replace_facet(locale::_S_classic, &std::num_put<char>::id); + _M_replace_facet(locale::_S_classic, &std::num_put<wchar_t>::id); +#endif + } + + void + locale::_Impl::_M_construct_time(const char* /*name*/) + { +#if 0 + _M_init_facet(new std::time_get_byname<char>(name)); + _M_init_facet(new std::time_get_byname<wchar_t>(name)); + _M_init_facet(new std::time_put_byname<char>(name)); + _M_init_facet(new std::time_put_byname<wchar_t>(name)); +#endif + } + + void + locale::_Impl::_M_construct_messages(const char* /*name*/) + { +#if 0 + _M_init_facet(new std::messages_byname<char>(name)); + _M_init_facet(new std::messages_byname<wchar_t>(name)); +#endif + } + + ////////////////////// + // locale constructors + ////////////////////// + + //////// + locale::locale(const char* std_name) + { + _S_initialize(); + if (strcmp(std_name, "C") == 0 || strcmp(std_name, "POSIX")) + (_M_impl = _S_classic)->_M_add_reference(); + else + { + // might throw: + _M_impl = new _Impl(*_S_classic, string(std_name), all, 1); + _M_impl->_M_has_name = true; + } + } + + ///////// + locale::locale(const locale& other, const char* std_name, category cats) + : _M_impl(new _Impl(*other._M_impl, string(std_name), + _S_normalize_category(cats), 1)) // might throw + { } + + /////// + bool + locale::operator==(const locale& __rhs) const throw() + { + return(_M_impl == __rhs._M_impl + || (this->name() != "*" && this->name() == __rhs.name())); + } + +} diff --git a/libstdc++-v3/src/misc-inst.cc b/libstdc++-v3/src/misc-inst.cc new file mode 100644 index 0000000..3d31c71 --- /dev/null +++ b/libstdc++-v3/src/misc-inst.cc @@ -0,0 +1,210 @@ +// Explicit instantiation file. + +// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#include <bits/std_string.h> +#include <bits/std_algorithm.h> +#include <bits/std_locale.h> +#include <bits/std_vector.h> +#include <bits/std_iterator.h> +#include <bits/std_streambuf.h> +#include <bits/std_sstream.h> +#include <bits/std_fstream.h> +#include <bits/std_ios.h> +#include <bits/basic_ios.tcc> +#include <bits/std_istream.h> +#include <bits/std_ostream.h> + +// NB: unnecessary if the .h headers include these +#ifndef _GLIBCPP_FULLY_COMPLIANT_HEADERS +#include <bits/sstream.tcc> +#include <bits/fstream.tcc> +#include <bits/streambuf.tcc> +#include <bits/istream.tcc> +#include <bits/ostream.tcc> +#endif + +namespace std { + + // + // streambuf + // + template class basic_streambuf<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_streambuf<wchar_t>; +#endif + + + // + // stringstream + // + template class basic_stringbuf<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_stringbuf<wchar_t>; +#endif + + + // + // fstream + // + template class basic_filebuf<char, char_traits<char> >; +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_filebuf<wchar_t, char_traits<wchar_t> >; +#endif + + + // + // basic_ios + // + template class basic_ios<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_ios<wchar_t>; +#endif + + + // + // istream + // + template class basic_istream<char>; + template istream& ws(istream&); + template istream& operator>>(istream&, char&); + template istream& operator>>(istream&, unsigned char&); + template istream& operator>>(istream&, signed char&); + template istream& operator>>(istream&, char*); + template istream& operator>>(istream&, unsigned char*); + template istream& operator>>(istream&, signed char*); +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_istream<wchar_t>; + template wistream& ws(wistream&); + template wistream& operator>>(wistream&, wchar_t&); + template wistream& operator>>(wistream&, wchar_t*); +#endif + + + // + // ostream + // + template class basic_ostream<char>; + template ostream& endl(ostream&); + template ostream& ends(ostream&); + template ostream& flush(ostream&); + template ostream& operator<<(ostream&, char); + template ostream& operator<<(ostream&, unsigned char); + template ostream& operator<<(ostream&, signed char); + template ostream& operator<<(ostream&, const char*); + template ostream& operator<<(ostream&, const unsigned char*); + template ostream& operator<<(ostream&, const signed char*); + // template ostream& operator<<(ostream&, _Setfill<char>); + // template ostream& operator<<(ostream&, _Setw); + // template _Setfill<char> setfill(char); +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_ostream<wchar_t>; + template wostream& endl(wostream&); + template wostream& ends(wostream&); + template wostream& flush(wostream&); + template wostream& operator<<(wostream&, wchar_t); + template wostream& operator<<(wostream&, char); + template wostream& operator<<(wostream&, const wchar_t*); + template wostream& operator<<(wostream&, const char*); + // template wostream& operator<<(wostream&, _Setfill<wchar_t>); + // template wostream& operator<<(wostream&, _Setw); + // template _Setfill<wchar_t> setfill(wchar_t); +#endif + + + // + // iostream + // + template class basic_iostream<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_iostream<wchar_t>; +#endif + + + // + // istringstream + // + template class basic_istringstream<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_istringstream<wchar_t>; +#endif + + + // + // ostringstream + // + template class basic_ostringstream<char>; +#ifdef _GLIBCPP_USE_WCHAR_T + template class basic_ostringstream<wchar_t>; +#endif + + + // + // algorithm + // + typedef _Char_traits_match<char, char_traits<char> > char_match; + + template + const char* + find_if<const char *, char_match> + (const char *, const char *, char_match, random_access_iterator_tag); + +#ifdef _GLIBCPP_USE_WCHAR_T + typedef _Char_traits_match<wchar_t, char_traits<wchar_t> > wchar_match; + + template const wchar_t* + find_if<const wchar_t*, wchar_match> + (const wchar_t*, const wchar_t*, wchar_match, random_access_iterator_tag); +#endif + + template + string* + __uninitialized_fill_n_aux<string*, size_t, string> + (string*, size_t, string const &, _Bool<false>); + + template + string* + __uninitialized_copy_aux<vector<string>::const_iterator, string *> + (vector<string>::const_iterator, vector<string>::const_iterator, + string*, _Bool<false>); + +} //std + + + + + + + + + + diff --git a/libstdc++-v3/src/stdexcept.cc b/libstdc++-v3/src/stdexcept.cc new file mode 100644 index 0000000..147ff11 --- /dev/null +++ b/libstdc++-v3/src/stdexcept.cc @@ -0,0 +1,74 @@ +// Methods for Exception Support for -*- C++ -*- + +// Copyright (C) 1997-1999 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. + +// Written by Mike Stump based upon the specification in the 20 September 1994 +// C++ working paper, ANSI document X3J16/94-0158. + +// +// ISO C++ 14882: 19.1 Exception classes +// + +#include <bits/std_string.h> +#include <bits/std_stdexcept.h> +#include <bits/stl_range_errors.h> + +// To break the circularity with the <stdexcept> and <string> header we +// define two functions which throw exceptions as a direct call would do. + +namespace std { + + __Named_exception::__Named_exception(const string& __str) + { + strncpy(_M_name, __str.c_str(), _S_bufsize); + _M_name[_S_bufsize - 1] = '\0'; + } + + void + __out_of_range(const char *str) + { throw out_of_range(str); } + + void + __length_error(const char *str) + { throw length_error(str); } + + // XXX: From stl_range_errors.h, eventually these approaches need to + // be merged. + void + __stl_throw_range_error(const char* __msg) + { throw range_error(__msg); } + + void + __stl_throw_length_error(const char* __msg) + { throw length_error(__msg); } + +} //namespace std + + + + diff --git a/libstdc++-v3/src/stdstreams.cc b/libstdc++-v3/src/stdstreams.cc new file mode 100644 index 0000000..cb69541 --- /dev/null +++ b/libstdc++-v3/src/stdstreams.cc @@ -0,0 +1,48 @@ + +// Copyright (C) 1997-1999 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. + +#include <bits/std_istream.h> +#include <bits/std_ostream.h> +#include <bits/std_fstream.h> + +namespace std { + + filebuf __cfileinit; + istream cin(&__cfileinit); + ostream cout(&__cfileinit); + ostream cerr(&__cfileinit); + ostream clog(&__cfileinit); +#ifdef _GLIBCPP_USE_WCHAR_T + wfilebuf __wfileinit; + wistream wcin(&__wfileinit); + wostream wcout(&__wfileinit); + wostream wcerr(&__wfileinit); + wostream wclog(&__wfileinit); +#endif + +} // std diff --git a/libstdc++-v3/src/stl-inst.cc b/libstdc++-v3/src/stl-inst.cc new file mode 100644 index 0000000..643c105 --- /dev/null +++ b/libstdc++-v3/src/stl-inst.cc @@ -0,0 +1,52 @@ +// Explicit instantiation file. + +// Copyright (C) 1999 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#include <bits/c++config.h> +#include <bits/stl_config.h> +#include <bits/stl_alloc.h> +#include <bits/std_vector.h> + +namespace std { + + template class __malloc_alloc_template<0>; + +#ifndef __USE_MALLOC + template class __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>; +#endif + + template + void + vector<unsigned int>:: + _M_insert_aux(vector<unsigned int>::iterator, unsigned int const &); + +} //std diff --git a/libstdc++-v3/src/string-inst.cc b/libstdc++-v3/src/string-inst.cc new file mode 100644 index 0000000..451ffa5 --- /dev/null +++ b/libstdc++-v3/src/string-inst.cc @@ -0,0 +1,406 @@ +// Components for manipulating sequences of characters -*- C++ -*- + +// Copyright (C) 2000, 1999, 1998, 1997 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 21 Strings library +// + +// Written by Jason Merrill based upon the specification by Takanori Adachi +// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers. + +#include <bits/std_string.h> +#include <bits/std_algorithm.h> +#include <bits/std_istream.h> +#include <bits/std_ostream.h> + +// NB: Unnecessary if the .h headers include these +#ifndef _GLIBCPP_FULLY_COMPLIANT_HEADERS +#include <bits/istream.tcc> +#include <bits/ostream.tcc> +#endif + +// Instantiation configuration. +#ifndef C +# define C char +# define _GLIBCPP_INSTANTIATING_CHAR 1 +#endif + +namespace std +{ + typedef basic_string<C> S; + +#ifdef MAIN + template C S::_Rep::_S_terminal; + // XXX Fix me: 2000-04-18 g++ ICE. +// template S::size_type S::_S_max_size; +// template S::allocator_type::size_type S::S_empty_rep_storage[]; + template S::basic_string(S const&); + template S::_Rep* S::_Rep::_S_create(size_t, S::allocator_type const&); + template void S::_Rep::_M_destroy(S::allocator_type const&) throw(); +#endif + +#ifdef CTORNC + template + S::basic_string(S::size_type, C, S::allocator_type const&); +#endif + +#ifdef CTORAL + template + S::basic_string(S::allocator_type const&); +#endif + +#ifdef CTORCPR + template + S::basic_string(S const&, S::size_type, S::size_type); +#endif + +#ifdef CTORCPRAL + template + S::basic_string( + S const&, S::size_type, S::size_type, S::allocator_type const&); +#endif + +#ifdef CTORPRAL + template + S::basic_string( + C const*, S::size_type, S::allocator_type const&); +#endif + +#ifdef CTORPAL + template + S::basic_string( + C const*, S::allocator_type const&); +#endif + +#ifdef CTORDUPAL + template + S::basic_string( + S::size_type, C, S::allocator_type const&); +#endif + +#ifdef CTORPP + template + S::basic_string + (C*, C*, const allocator<C>&); +#endif + +#ifdef CTORII + template + S::basic_string + (S::iterator, S::iterator, const allocator<C>&); +#endif + +#ifdef MUTATE + template + void S::_M_leak_hard(); + template + void S::_M_mutate(S::size_type, S::size_type, S::size_type); + template + C* S::_Rep::_M_clone(S::allocator_type const&, S::size_type); +#endif + +#ifdef RESERVE + template + void S::reserve(S::size_type); +#endif + +#ifdef SWAP + template + void S::swap(S&); +#endif + +#ifdef SLOP +# ifdef _GLIBCPP_ALLOC_CONTROL + template + bool (* S::_Rep::_S_excess_slop)(size_t, size_t); + template + bool S::_Rep::_S_default_excess(size_t, size_t); +# endif +#endif + +#ifdef RESIZE + template + void S::resize(S::size_type, C); +#endif + +#ifdef APPCOPY + template + S& S::append(S const&); +#endif + +#ifdef APPCPR + template + S& S::append(S const&, S::size_type, S::size_type); +#endif + +#ifdef APPPR + template + S& S::append(C const*, S::size_type); +#endif + +#ifdef APPDUP + template + S& S::append(S::size_type, C); +#endif + +#ifdef APPII + template + S& + S::append<S::iterator> + (S::iterator, S::iterator); +#endif + +#ifdef ASSCP + template + S& + S::assign(S const&); +#endif + +#ifdef ASSII + template + S& + S::assign<S::iterator> + (S::iterator, S::iterator); +#endif + +#ifdef INSII + template + void + S::insert<S::iterator> //c* + (S::iterator, S::iterator, S::iterator); //it, c+, c+ and temptype = char* +#endif + +#ifdef REPRR + template + S& S::replace( + S::size_type, S::size_type, S const&, S::size_type, S::size_type); +#endif + +#ifdef REPIIDUP + template + S& S::replace(S::iterator, S::iterator, S::size_type, C); +#endif + +#ifdef REPII + template + S& + S::replace<S::iterator> // c* + (S::iterator, S::iterator, S::iterator, S::iterator); //it, it, c+, c+ +#endif + +#ifdef REPIII + template + S& + S::_M_replace<S::iterator> + (S::iterator, S::iterator, S::iterator, S::iterator, forward_iterator_tag); +#endif + +#ifdef REP4I + template + template + S& + S::_M_replace<S::const_iterator> + (S::iterator, S::iterator, + S::const_iterator, S::const_iterator, forward_iterator_tag); +#endif + +#ifdef REPIIPP + template + S& + S::_M_replace<C*> + (S::iterator, S::iterator, C*, C*, forward_iterator_tag); +#endif + +#ifdef REPIIPP2 + template + S& + S::_M_replace<const C*> + (S::iterator, S::iterator, const C*, const C*, forward_iterator_tag); +#endif + +#ifdef COPY + template + S::size_type S::copy(C*, S::size_type, S::size_type) const; +#endif + +#ifdef CONII + template + C* + S::_S_construct<S::iterator> + (S::iterator, S::iterator, const allocator<C>&); +#endif + +#ifdef CONIIF + template + C* + S::_S_construct<S::iterator> + (S::iterator, S::iterator, const allocator<C>&, forward_iterator_tag); +#endif + +#ifdef CONPPF + template + C* + S::_S_construct<C*> + (C*, C*, const allocator<C>&, forward_iterator_tag); +#endif + +#ifdef CONPPF2 + template + C* + S::_S_construct<const C*> + (const C*, const C*, const allocator<C>&, forward_iterator_tag); +#endif + +#ifdef CONSC + template + C* + S::_S_construct<S::iterator> + (S::size_type, C, const allocator<C>&); +#endif + +#ifdef FIND + // These members are explicitly specialized, and can only be in one + // translation unit or else we get multiple copies. . . +#if _GLIBCPP_INSTANTIATING_CHAR + template<> + const char* + string::_S_find(const char* __beg, const char* __end, char __c) + { + char* __retval = strchr(__beg, __c); + return (__retval ? __retval : __end); + } +#else + template<> + const wchar_t* + wstring::_S_find(const wchar_t* __beg, const wchar_t* __end, wchar_t __c) + { + return find_if(__beg, __end, + _Char_traits_match<wchar_t, traits_type>(__c)); + } +#endif +#endif + +#ifdef FINDC + template + S::size_type S::find(C, S::size_type) const; +#endif + +#ifdef RFIND + template + S::size_type S::rfind(C const*, S::size_type, S::size_type) const; +#endif + +#ifdef RFINDC + template + S::size_type S::rfind(C, S::size_type) const; +#endif + +#ifdef FFO + template + S::size_type S::find_first_of(C const*, S::size_type, S::size_type) const; +#endif + +#ifdef FLO + template + S::size_type S::find_last_of(C const*, S::size_type, S::size_type) const; +#endif + +#ifdef FFNO + template + S::size_type S::find_first_not_of( + C const*, S::size_type, S::size_type) const; +#endif + +#ifdef FLNO + template + S::size_type S::find_last_not_of( + C const*, S::size_type, S::size_type) const; +#endif + +#ifdef FLNOC + template + S::size_type S::find_last_not_of(C, S::size_type) const; +#endif + +#ifdef COMPARE + template + int S::compare(S::size_type, S::size_type, S const&) const; +#endif + +#ifdef COMPARE2 + template + int S::compare(S::size_type, S::size_type, S const&, S::size_type, + S::size_type) const; +#endif + +#ifdef COMPAREP + template + int S::compare(C const*) const; +#endif + +#ifdef COMPAREP2 + template + int S::compare( + S::size_type, S::size_type, C const*, S::size_type) const; +#endif + +#ifdef ADDPS + template S operator+(const C*, const S&); +#endif + +#ifdef ADDCS + template S operator+(C, const S&); +#endif + +#ifdef EQ + template bool operator==(const S::iterator&, const S::iterator&); + template bool operator==(const S::const_iterator&, const S::const_iterator&); +#endif + +#ifdef EXTRACT + template basic_istream<C>& operator>>(basic_istream<C>&, S&); +#endif + +#ifdef INSERT + template basic_ostream<C>& operator<<(basic_ostream<C>&, const S&); +#endif + +#ifdef GETLINE + template basic_istream<C>& getline(basic_istream<C>&, S&, C); + template basic_istream<C>& getline(basic_istream<C>&, S&); +#endif + +#ifdef SCOPY + template void _S_string_copy(const S&, C*, allocator<C>::size_type); +#endif + +} // std + + + diff --git a/libstdc++-v3/src/strstream.cc b/libstdc++-v3/src/strstream.cc new file mode 100644 index 0000000..f1fe40f5 --- /dev/null +++ b/libstdc++-v3/src/strstream.cc @@ -0,0 +1,427 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +// Implementation of the classes in header <strstream>. +// WARNING: The classes defined in <strstream> are DEPRECATED. This +// header is defined in section D.7.1 of the C++ standard, and it +// MAY BE REMOVED in a future standard revision. You should use the +// header <sstream> instead. + +#include <std/strstream> /* HACK HACK HACK */ +#include <std/algorithm> /* DITTO */ +#include <new> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +__STL_BEGIN_NAMESPACE + +// strstreambuf constructor, destructor. + +strstreambuf::strstreambuf(streamsize initial_capacity) + : _Base(), + _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(true), _M_frozen(false), _M_constant(false) +{ + streamsize n = max(initial_capacity, streamsize(16)); + + char* buf = _M_alloc(n); + if (buf) { + setp(buf, buf + n); + setg(buf, buf, buf); + } +} + +strstreambuf::strstreambuf(void* (*alloc_f)(size_t), void (*free_f)(void*)) + : _Base(), + _M_alloc_fun(alloc_f), _M_free_fun(free_f), + _M_dynamic(true), _M_frozen(false), _M_constant(false) +{ + streamsize n = 16; + + char* buf = _M_alloc(n); + if (buf) { + setp(buf, buf + n); + setg(buf, buf, buf); + } +} + +strstreambuf::strstreambuf(char* get, streamsize n, char* put) + : _Base(), + _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(false) +{ + _M_setup(get, put, n); +} + +strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put) + : _Base(), + _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(false) +{ + _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); +} + +strstreambuf::strstreambuf(unsigned char* get, streamsize n, + unsigned char* put) + : _Base(), + _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(false) +{ + _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); +} + +strstreambuf::strstreambuf(const char* get, streamsize n) + : _Base(), + _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(true) +{ + _M_setup(const_cast<char*>(get), 0, n); +} + +strstreambuf::strstreambuf(const signed char* get, streamsize n) + : _Base(), + _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(true) +{ + _M_setup(reinterpret_cast<char*>(const_cast<signed char*>(get)), 0, n); +} + +strstreambuf::strstreambuf(const unsigned char* get, streamsize n) + : _Base(), + _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(true) +{ + _M_setup(reinterpret_cast<char*>(const_cast<unsigned char*>(get)), 0, n); +} + +strstreambuf::~strstreambuf() +{ + if (_M_dynamic && !_M_frozen) + _M_free(eback()); +} + +void strstreambuf::freeze(bool frozenflag) +{ + if (_M_dynamic) + _M_frozen = frozenflag; +} + +char* strstreambuf::str() +{ + freeze(true); + return eback(); +} + +int strstreambuf::pcount() const +{ + return pptr() ? pptr() - pbase() : 0; +} + +strstreambuf::int_type strstreambuf::overflow(int_type c) { + if (c == traits_type::eof()) + return traits_type::not_eof(c); + + // Try to expand the buffer. + if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) { + ptrdiff_t old_size = epptr() - pbase(); + ptrdiff_t new_size = max(2 * old_size, ptrdiff_t(1)); + + char* buf = _M_alloc(new_size); + if (buf) { + memcpy(buf, pbase(), old_size); + + char* old_buffer = pbase(); + bool reposition_get = false; + ptrdiff_t old_get_offset; + if (gptr() != 0) { + reposition_get = true; + old_get_offset = gptr() - eback(); + } + + setp(buf, buf + new_size); + pbump(old_size); + + if (reposition_get) + setg(buf, buf + old_get_offset, buf + max(old_get_offset, old_size)); + + _M_free(old_buffer); + } + } + + if (pptr() != epptr()) { + *pptr() = c; + pbump(1); + return c; + } + else + return traits_type::eof(); +} + +strstreambuf::int_type strstreambuf::pbackfail(int_type c) +{ + if (gptr() != eback()) { + if (c == _Traits::eof()) { + gbump(-1); + return _Traits::not_eof(c); + } + else if (c == (unsigned int)(gptr()[-1])) { // (u int) added KLUDGE + gbump(-1); + return c; + } + else if (!_M_constant) { + gbump(-1); + *gptr() = c; + return c; + } + } + + return _Traits::eof(); +} + +strstreambuf::int_type strstreambuf::underflow() +{ + if (gptr() == egptr() && pptr() && pptr() > egptr()) + setg(eback(), gptr(), pptr()); + + if (gptr() != egptr()) + return (unsigned char) *gptr(); + else + return _Traits::eof(); +} + +basic_streambuf<char, char_traits<char> >* +strstreambuf::setbuf(char*, streamsize) +{ + return this; +} + +strstreambuf::pos_type +strstreambuf::seekoff(off_type off, + ios_base::seekdir dir, ios_base::openmode mode) +{ + bool do_get = false; + bool do_put = false; + + if ((mode & (ios_base::in | ios_base::out)) == + (ios_base::in | ios_base::out) && + (dir == ios_base::beg || dir == ios_base::end)) + do_get = do_put = true; + else if (mode & ios_base::in) + do_get = true; + else if (mode & ios_base::out) + do_put = true; + + // !gptr() is here because, according to D.7.1 paragraph 4, the seekable + // area is undefined if there is no get area. + if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr()) + return pos_type(off_type(-1)); + + char* seeklow = eback(); + char* seekhigh = epptr() ? epptr() : egptr(); + + off_type newoff; + switch(dir) { + case ios_base::beg: + newoff = 0; + break; + case ios_base::end: + newoff = seekhigh - seeklow; + break; + case ios_base::cur: + newoff = do_put ? pptr() - seeklow : gptr() - seeklow; + break; + default: + return pos_type(off_type(-1)); + } + + off += newoff; + if (off < 0 || off > seekhigh - seeklow) + return pos_type(off_type(-1)); + + if (do_put) { + if (seeklow + off < pbase()) { + setp(seeklow, epptr()); + pbump(off); + } + else { + setp(pbase(), epptr()); + pbump(off - (pbase() - seeklow)); + } + } + if (do_get) { + if (off <= egptr() - seeklow) + setg(seeklow, seeklow + off, egptr()); + else if (off <= pptr() - seeklow) + setg(seeklow, seeklow + off, pptr()); + else + setg(seeklow, seeklow + off, epptr()); + } + + return pos_type(newoff); +} + +strstreambuf::pos_type +strstreambuf::seekpos(pos_type pos, ios_base::openmode mode) +{ + return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode); +} + +char* strstreambuf::_M_alloc(size_t n) +{ + if (_M_alloc_fun) + return static_cast<char*>(_M_alloc_fun(n)); + else + return new char[n]; +} + +void strstreambuf::_M_free(char* p) +{ + if (p) + if (_M_free_fun) + _M_free_fun(p); + else + delete[] p; +} + +void strstreambuf::_M_setup(char* get, char* put, streamsize n) +{ + if (get) { + size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX); + + if (put) { + setg(get, get, put); + setp(put, put + N); + } + else { + setg(get, get, get + N); + } + } +} + +//---------------------------------------------------------------------- +// Class istrstream + +istrstream::istrstream(char* s) + : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0) +{ + basic_ios<char>::init(&_M_buf); +} + +istrstream::istrstream(const char* s) + : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0) +{ + basic_ios<char>::init(&_M_buf); +} + +istrstream::istrstream(char* s, streamsize n) + : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n) +{ + basic_ios<char>::init(&_M_buf); +} + +istrstream::istrstream(const char* s, streamsize n) + : basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n) +{ + basic_ios<char>::init(&_M_buf); +} + +istrstream::~istrstream() {} + +strstreambuf* istrstream::rdbuf() const { + return const_cast<strstreambuf*>(&_M_buf); +} + +char* istrstream::str() { return _M_buf.str(); } + +//---------------------------------------------------------------------- +// Class ostrstream + +ostrstream::ostrstream() + : basic_ios<char>(), basic_ostream<char>(0), _M_buf() +{ + basic_ios<char>::init(&_M_buf); +} + +ostrstream::ostrstream(char* s, int n, ios_base::openmode mode) + : basic_ios<char>(), basic_ostream<char>(0), + _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) +{ + basic_ios<char>::init(&_M_buf); +} + +ostrstream::~ostrstream() {} + +strstreambuf* ostrstream::rdbuf() const +{ + return const_cast<strstreambuf*>(&_M_buf); +} + +void ostrstream::freeze(bool freezeflag) +{ + _M_buf.freeze(freezeflag); +} + +char* ostrstream::str() +{ + return _M_buf.str(); +} + +int ostrstream::pcount() const +{ + return _M_buf.pcount(); +} + +//---------------------------------------------------------------------- +// Class strstream + +strstream::strstream() + : basic_ios<char>(), basic_iostream<char>(0), _M_buf() +{ + basic_ios<char>::init(&_M_buf); +} + +strstream::strstream(char* s, int n, ios_base::openmode mode) + : basic_ios<char>(), basic_iostream<char>(0), + _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) +{ + basic_ios<char>::init(&_M_buf); +} + +strstream::~strstream() {} + +strstreambuf* strstream::rdbuf() const +{ + return const_cast<strstreambuf*>(&_M_buf); +} + +void strstream::freeze(bool freezeflag) +{ + _M_buf.freeze(freezeflag); +} + +int strstream::pcount() const +{ + return _M_buf.pcount(); +} + +char* strstream::str() +{ + return _M_buf.str(); +} + +__STL_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/libstdc++-v3/src/valarray-inst.cc b/libstdc++-v3/src/valarray-inst.cc new file mode 100644 index 0000000..ce0f86f --- /dev/null +++ b/libstdc++-v3/src/valarray-inst.cc @@ -0,0 +1,64 @@ +#include <bits/std_valarray.h> + +namespace std +{ + // Some explicit instanciations. + template void + __valarray_fill(size_t* __restrict__, size_t, const size_t&); + + template void + __valarray_copy(const size_t* __restrict__, size_t, size_t* __restrict__); + + template size_t + __valarray_product(const size_t* __restrict__, const size_t* __restrict__); + + template valarray<size_t>::valarray(size_t); + template valarray<size_t>::valarray(const valarray<size_t>&); + template valarray<size_t>::~valarray(); + template size_t valarray<size_t>::size() const; + template size_t& valarray<size_t>::operator[](size_t); + + + inline size_t + __valarray_product(const valarray<size_t>& __a) + { + // XXX: This ugly cast is necessary because + // valarray::operator[]() const return a VALUE! + // Try to get the committee to correct that gross error. + typedef const size_t* __restrict__ _Tp; + size_t __n = __a.size() - 1; + valarray<size_t>& __t = const_cast<valarray<size_t>&>(__a); + return __valarray_product(static_cast<_Tp>(&__t[0]), + static_cast<_Tp>(&__t[__n])); + } + + void __gslice_to_index(size_t __o, const valarray<size_t>& __l, + const valarray<size_t>& __s, + valarray<size_t>& __i) + { + size_t __n = __l.size(); + size_t* const __t = static_cast<size_t*> + (__builtin_alloca(__n*sizeof(size_t))); + __valarray_fill(__t, __n, size_t(0)); + const size_t __z = __i.size(); + __valarray_fill(&__i[0], __z, __o); + for (size_t __j=0; __j<__z; ++__j) { + for (size_t __k=0; __k<__n; ++__k) + __i[__j] += __s[__k]*__t[__k]; + ++__t[__n-1]; + for (size_t __k=__n-1; __k; --__k) { + if (__t[__k] >= __l[__k]) { + __t[__k] = 0; + ++__t[__k-1]; + } + } + } + } + + gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __s, + const valarray<size_t>& __l) + : _M_count(1), _M_start(__o), _M_size(__s), _M_stride(__l), + _M_index(__l.size() ? __valarray_product(__l) : 0) + { __gslice_to_index(__o, __l, __s, _M_index); } + +} |