summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/src
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-05-28 16:16:03 +0000
committerobrien <obrien@FreeBSD.org>2002-05-28 16:16:03 +0000
commit0895e1acb698e05d503c26bec5471de2e88b7d93 (patch)
tree7b14e1142a8f8cf48f311f5246aa3b355f2380b6 /contrib/libstdc++/src
parentefbfe7b228c18b8cc364aabaefd6f8253bc6b5ad (diff)
downloadFreeBSD-src-0895e1acb698e05d503c26bec5471de2e88b7d93.zip
FreeBSD-src-0895e1acb698e05d503c26bec5471de2e88b7d93.tar.gz
Gcc 3.1.0 pre-release's C++ support bits from the FSF anoncvs repo
on 9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/libstdc++/src')
-rw-r--r--contrib/libstdc++/src/Makefile.am151
-rw-r--r--contrib/libstdc++/src/Makefile.in521
-rw-r--r--contrib/libstdc++/src/bitset.cc219
-rw-r--r--contrib/libstdc++/src/cmath.cc47
-rw-r--r--contrib/libstdc++/src/codecvt.cc202
-rw-r--r--contrib/libstdc++/src/complex_io.cc93
-rw-r--r--contrib/libstdc++/src/concept-inst.cc112
-rw-r--r--contrib/libstdc++/src/ext-inst.cc40
-rw-r--r--contrib/libstdc++/src/functexcept.cc151
-rw-r--r--contrib/libstdc++/src/globals.cc226
-rw-r--r--contrib/libstdc++/src/ios.cc359
-rw-r--r--contrib/libstdc++/src/limits.cc449
-rw-r--r--contrib/libstdc++/src/locale-inst.cc480
-rw-r--r--contrib/libstdc++/src/locale.cc588
-rw-r--r--contrib/libstdc++/src/localename.cc292
-rw-r--r--contrib/libstdc++/src/misc-inst.cc274
-rw-r--r--contrib/libstdc++/src/stdexcept.cc78
-rw-r--r--contrib/libstdc++/src/stl-inst.cc47
-rw-r--r--contrib/libstdc++/src/string-inst.cc135
-rw-r--r--contrib/libstdc++/src/strstream.cc458
-rw-r--r--contrib/libstdc++/src/valarray-inst.cc118
-rw-r--r--contrib/libstdc++/src/vterminate.cc83
-rw-r--r--contrib/libstdc++/src/wstring-inst.cc6
23 files changed, 5129 insertions, 0 deletions
diff --git a/contrib/libstdc++/src/Makefile.am b/contrib/libstdc++/src/Makefile.am
new file mode 100644
index 0000000..dde80dd
--- /dev/null
+++ b/contrib/libstdc++/src/Makefile.am
@@ -0,0 +1,151 @@
+## Makefile for the src subdirectory of the GNU C++ Standard library.
+##
+## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+## 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
+
+mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+
+# Cross compiler and multilib support.
+CXX = @glibcpp_CXX@
+toolexecdir = @glibcpp_toolexecdir@
+toolexeclibdir = @glibcpp_toolexeclibdir@
+toolexeclib_LTLIBRARIES = libstdc++.la
+
+# Compile flags that should be constant throughout the build, both for
+# SUBDIRS and for libstdc++-v3 in general.
+OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
+
+# These bits are all figured out from configure. Look in acinclude.m4
+# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
+# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
+CONFIG_CXXFLAGS = \
+ @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@
+
+# Warning flags to use.
+WARN_CXXFLAGS = \
+ @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
+
+# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
+GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
+LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
+LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
+LIBIO_INCLUDES = @LIBIO_INCLUDES@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+
+INCLUDES = \
+ -nostdinc++ \
+ $(GLIBCPP_INCLUDES) \
+ $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
+ $(TOPLEVEL_INCLUDES)
+
+sources = \
+ globals.cc limits.cc \
+ basic_file.cc complex_io.cc ios.cc strstream.cc \
+ cmath.cc bitset.cc \
+ functexcept.cc stdexcept.cc vterminate.cc \
+ c++locale.cc locale.cc localename.cc codecvt.cc \
+ collate.cc ctype.cc messages.cc monetary.cc numeric.cc time.cc \
+ concept-inst.cc locale-inst.cc misc-inst.cc stl-inst.cc \
+ string-inst.cc wstring-inst.cc valarray-inst.cc ext-inst.cc
+
+VPATH = $(top_srcdir)/src:$(top_srcdir)
+
+libstdc___la_SOURCES = $(sources)
+
+libstdc___la_LIBADD = \
+ ../libmath/libmath.la @libio_la@ \
+ ../libsupc++/libsupc++convenience.la
+
+if GLIBCPP_BUILD_VERSIONED_SHLIB
+version_arg=-Wl,--version-script=linker.map
+else
+version_arg=
+endif
+
+libstdc___la_LDFLAGS = \
+ -version-info @libtool_VERSION@ ${version_arg} \
+ -lm @LIBUNWIND_FLAG@
+
+libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD) linker.map
+
+# Use special rules for the deprecated source files so that they find
+# deprecated include files.
+GLIBCPP_INCLUDE_DIR=@glibcpp_builddir@/include
+strstream.lo: strstream.cc
+ $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+strstream.o: strstream.cc
+ $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+
+# Use special rules for the concept-checking instantiations so that all
+# the generated template functions are also instantiated. Force the checks
+# to be on so that the instantiations are actually seen.
+concept-inst.lo: concept-inst.cc
+ $(LTCXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
+concept-inst.o: concept-inst.cc
+ $(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
+
+
+# AM_CXXFLAGS needs to be in each subdirectory so that it can be
+# modified in a per-library or per-sub-library way. Need to manually
+# set this option because CONFIG_CXXFLAGS has to be after
+# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+# as the occasion call for it. (ie, --enable-debug)
+AM_CXXFLAGS = \
+ -fno-implicit-templates \
+ $(LIBSUPCXX_CXXFLAGS) \
+ $(WARN_CXXFLAGS) \
+ $(OPTIMIZE_CXXFLAGS) \
+ $(CONFIG_CXXFLAGS)
+
+
+# libstdc++ libtool notes
+
+# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
+# last. (That way, things like -O2 passed down from the toplevel can
+# be overridden by --enable-debug.)
+
+# 2) In general, libtool expects an argument such as `--tag=CXX' when
+# using the C++ compiler, because that will enable the settings
+# detected when C++ support was being configured. However, when no
+# such flag is given in the command line, libtool attempts to figure
+# it out by matching the compiler name in each configuration section
+# against a prefix of the command line. The problem is that, if the
+# compiler name and its initial flags stored in the libtool
+# configuration file don't match those in the command line, libtool
+# can't decide which configuration to use, and it gives up. The
+# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
+# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
+# attempt to infer which configuration to use
+LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
+
+# 3) We'd have a problem when building the shared libstdc++ object if
+# the rules automake generates would be used. We cannot allow g++ to
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point. So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
+ @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
diff --git a/contrib/libstdc++/src/Makefile.in b/contrib/libstdc++/src/Makefile.in
new file mode 100644
index 0000000..51e25be
--- /dev/null
+++ b/contrib/libstdc++/src/Makefile.in
@@ -0,0 +1,521 @@
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# 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@
+ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
+AWK = @AWK@
+BASIC_FILE_H = @BASIC_FILE_H@
+BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCODECVT_C = @CCODECVT_C@
+CCODECVT_H = @CCODECVT_H@
+CLOCALE_H = @CLOCALE_H@
+CMESSAGES_H = @CMESSAGES_H@
+CPP = @CPP@
+CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@
+CSHADOW_FLAGS = @CSHADOW_FLAGS@
+CSTDIO_H = @CSTDIO_H@
+CXXCPP = @CXXCPP@
+C_INCLUDE_DIR = @C_INCLUDE_DIR@
+DATADIRNAME = @DATADIRNAME@
+DEBUG_FLAGS = @DEBUG_FLAGS@
+DLLTOOL = @DLLTOOL@
+EXEEXT = @EXEEXT@
+EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
+GENCAT = @GENCAT@
+GLIBC21 = @GLIBC21@
+GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+INSTOBJEXT = @INSTOBJEXT@
+INTLBISON = @INTLBISON@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
+LIBICONV = @LIBICONV@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
+LIBTOOL = @LIBTOOL@
+LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
+LN_S = @LN_S@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+OS_INC_SRCDIR = @OS_INC_SRCDIR@
+PACKAGE = @PACKAGE@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SECTION_FLAGS = @SECTION_FLAGS@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+STRIP = @STRIP@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_FLAGS = @WARN_FLAGS@
+WERROR = @WERROR@
+check_msgfmt = @check_msgfmt@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+glibcpp_CXX = @glibcpp_CXX@
+glibcpp_MOFILES = @glibcpp_MOFILES@
+glibcpp_POFILES = @glibcpp_POFILES@
+glibcpp_basedir = @glibcpp_basedir@
+glibcpp_builddir = @glibcpp_builddir@
+glibcpp_localedir = @glibcpp_localedir@
+glibcpp_prefixdir = @glibcpp_prefixdir@
+glibcpp_srcdir = @glibcpp_srcdir@
+glibcpp_thread_h = @glibcpp_thread_h@
+glibcpp_toolexecdir = @glibcpp_toolexecdir@
+glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
+gxx_include_dir = @gxx_include_dir@
+ifGNUmake = @ifGNUmake@
+libio_la = @libio_la@
+libtool_VERSION = @libtool_VERSION@
+release_VERSION = @release_VERSION@
+toplevel_srcdir = @toplevel_srcdir@
+
+AUTOMAKE_OPTIONS = 1.3 gnits
+MAINT_CHARSET = latin1
+
+mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+
+# Cross compiler and multilib support.
+CXX = @glibcpp_CXX@
+toolexecdir = @glibcpp_toolexecdir@
+toolexeclibdir = @glibcpp_toolexeclibdir@
+toolexeclib_LTLIBRARIES = libstdc++.la
+
+# Compile flags that should be constant throughout the build, both for
+# SUBDIRS and for libstdc++-v3 in general.
+OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
+
+# These bits are all figured out from configure. Look in acinclude.m4
+# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
+# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
+CONFIG_CXXFLAGS = \
+ @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@
+
+
+# Warning flags to use.
+WARN_CXXFLAGS = \
+ @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
+
+
+# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
+GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
+LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
+LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
+LIBIO_INCLUDES = @LIBIO_INCLUDES@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+
+INCLUDES = \
+ -nostdinc++ \
+ $(GLIBCPP_INCLUDES) \
+ $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
+ $(TOPLEVEL_INCLUDES)
+
+
+sources = \
+ globals.cc limits.cc \
+ basic_file.cc complex_io.cc ios.cc strstream.cc \
+ cmath.cc bitset.cc \
+ functexcept.cc stdexcept.cc vterminate.cc \
+ c++locale.cc locale.cc localename.cc codecvt.cc \
+ collate.cc ctype.cc messages.cc monetary.cc numeric.cc time.cc \
+ concept-inst.cc locale-inst.cc misc-inst.cc stl-inst.cc \
+ string-inst.cc wstring-inst.cc valarray-inst.cc ext-inst.cc
+
+
+VPATH = $(top_srcdir)/src:$(top_srcdir)
+
+libstdc___la_SOURCES = $(sources)
+
+libstdc___la_LIBADD = \
+ ../libmath/libmath.la @libio_la@ \
+ ../libsupc++/libsupc++convenience.la
+
+@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@version_arg = @GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@-Wl,--version-script=linker.map
+@GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE@version_arg =
+
+libstdc___la_LDFLAGS = \
+ -version-info @libtool_VERSION@ ${version_arg} \
+ -lm @LIBUNWIND_FLAG@
+
+
+libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD) linker.map
+
+# Use special rules for the deprecated source files so that they find
+# deprecated include files.
+GLIBCPP_INCLUDE_DIR = @glibcpp_builddir@/include
+
+# AM_CXXFLAGS needs to be in each subdirectory so that it can be
+# modified in a per-library or per-sub-library way. Need to manually
+# set this option because CONFIG_CXXFLAGS has to be after
+# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+# as the occasion call for it. (ie, --enable-debug)
+AM_CXXFLAGS = \
+ -fno-implicit-templates \
+ $(LIBSUPCXX_CXXFLAGS) \
+ $(WARN_CXXFLAGS) \
+ $(OPTIMIZE_CXXFLAGS) \
+ $(CONFIG_CXXFLAGS)
+
+
+# libstdc++ libtool notes
+
+# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
+# last. (That way, things like -O2 passed down from the toplevel can
+# be overridden by --enable-debug.)
+
+# 2) In general, libtool expects an argument such as `--tag=CXX' when
+# using the C++ compiler, because that will enable the settings
+# detected when C++ support was being configured. However, when no
+# such flag is given in the command line, libtool attempts to figure
+# it out by matching the compiler name in each configuration section
+# against a prefix of the command line. The problem is that, if the
+# compiler name and its initial flags stored in the libtool
+# configuration file don't match those in the command line, libtool
+# can't decide which configuration to use, and it gives up. The
+# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
+# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
+# attempt to infer which configuration to use
+LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
+
+
+# 3) We'd have a problem when building the shared libstdc++ object if
+# the rules automake generates would be used. We cannot allow g++ to
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point. So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
+ @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
+
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libstdc___la_OBJECTS = globals.lo limits.lo basic_file.lo complex_io.lo \
+ios.lo strstream.lo cmath.lo bitset.lo functexcept.lo stdexcept.lo \
+vterminate.lo c++locale.lo locale.lo localename.lo codecvt.lo \
+collate.lo ctype.lo messages.lo monetary.lo numeric.lo time.lo \
+concept-inst.lo locale-inst.lo misc-inst.lo stl-inst.lo string-inst.lo \
+wstring-inst.lo valarray-inst.lo ext-inst.lo
+CXXFLAGS = @CXXFLAGS@
+CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_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 .obj .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 $<
+
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+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.obj:
+ $(CXXCOMPILE) -c `cygpath -w $<`
+.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
+
+strstream.lo: strstream.cc
+ $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+strstream.o: strstream.cc
+ $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+
+# Use special rules for the concept-checking instantiations so that all
+# the generated template functions are also instantiated. Force the checks
+# to be on so that the instantiations are actually seen.
+concept-inst.lo: concept-inst.cc
+ $(LTCXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
+concept-inst.o: concept-inst.cc
+ $(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
+
+# 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/contrib/libstdc++/src/bitset.cc b/contrib/libstdc++/src/bitset.cc
new file mode 100644
index 0000000..244f308
--- /dev/null
+++ b/contrib/libstdc++/src/bitset.cc
@@ -0,0 +1,219 @@
+// Bitset definitions -*- C++ -*-
+
+// Copyright (C) 2001, 2002 Free Software Foundation
+//
+// This file is part of GNU CC.
+//
+// GNU CC 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.
+//
+// GNU CC 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 GNU CC; 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.
+
+/*
+ * 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.
+ */
+
+#include <bitset>
+
+//
+// Definitions of non-inline functions from the single-word version of
+// _Base_bitset.
+//
+
+std::size_t
+std::_Base_bitset<1>::_M_do_find_first(std::size_t __not_found) const
+{
+ _WordT __thisword = _M_w;
+
+ if ( __thisword != static_cast<_WordT>(0) ) {
+ // find byte within word
+ for (std::size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
+ if ( __this_byte )
+ return __j * CHAR_BIT + _S_first_one[__this_byte];
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+ // not found, so return a value that indicates failure.
+ return __not_found;
+}
+
+std::size_t
+std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev,
+ std::size_t __not_found) const
+{
+ // make bound inclusive
+ ++__prev;
+
+ // check out of bounds
+ if ( __prev >= _GLIBCPP_BITSET_BITS_PER_WORD )
+ return __not_found;
+
+ // search first (and only) word
+ _WordT __thisword = _M_w;
+
+ // mask off bits below bound
+ __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);
+
+ if ( __thisword != static_cast<_WordT>(0) ) {
+ // find byte within word
+ // get first byte into place
+ __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
+ for ( std::size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) {
+ unsigned char __this_byte
+ = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
+ if ( __this_byte )
+ return __j * CHAR_BIT + _S_first_one[__this_byte];
+
+ __thisword >>= CHAR_BIT;
+ }
+ }
+
+ // not found, so return a value that indicates failure.
+ return __not_found;
+} // end _M_do_find_next
+
+
+// Lookup tables for find and count operations.
+unsigned char std::_S_bit_count[256] =
+{
+ 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */
+ 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */
+ 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */
+ 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */
+ 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */
+ 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */
+ 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */
+ 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */
+ 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */
+ 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */
+ 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */
+ 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */
+ 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */
+ 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */
+ 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */
+ 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */
+ 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */
+ 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */
+ 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */
+ 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */
+ 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */
+ 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */
+ 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */
+ 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */
+ 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */
+ 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */
+ 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */
+ 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */
+ 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */
+ 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */
+ 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */
+ 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */
+ 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */
+ 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */
+ 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */
+ 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */
+ 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */
+ 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */
+ 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */
+ 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */
+ 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */
+ 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */
+ 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */
+ 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */
+ 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */
+ 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */
+ 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */
+ 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */
+ 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */
+ 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */
+ 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */
+ 8 /* 255 */
+}; // end _S_bit_count
+
+unsigned char std::_S_first_one[256] =
+{
+ 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */
+ 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */
+ 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */
+ 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */
+ 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */
+ 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */
+ 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */
+ 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */
+ 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */
+ 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */
+ 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */
+ 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */
+ 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */
+ 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */
+ 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */
+ 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */
+ 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */
+ 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */
+ 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */
+ 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */
+ 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */
+ 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */
+ 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */
+ 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */
+ 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */
+ 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */
+ 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */
+ 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */
+ 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */
+ 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */
+ 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */
+ 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */
+ 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */
+ 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */
+ 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */
+ 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */
+ 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */
+ 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */
+ 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */
+ 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */
+ 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */
+ 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */
+ 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */
+ 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */
+ 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */
+ 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */
+ 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */
+ 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */
+ 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */
+ 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */
+ 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */
+ 0, /* 255 */
+}; // end _S_first_one
+
diff --git a/contrib/libstdc++/src/cmath.cc b/contrib/libstdc++/src/cmath.cc
new file mode 100644
index 0000000..7a7433a
--- /dev/null
+++ b/contrib/libstdc++/src/cmath.cc
@@ -0,0 +1,47 @@
+// Explicit instantiation file for -*- C++ -*- math library.
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+// These are explicit instantiations of the behind-the-scenes internal
+// helper functions used in the math routines of libstdc++.
+
+
+#include <cmath>
+
+namespace std
+{
+ // This function is only declared/used in the cheaders=c_std case.
+ template float
+ __cmath_power<float>(float, unsigned int);
+ template double
+ __cmath_power<double>(double, unsigned int);
+ template long double
+ __cmath_power<long double>(long double, unsigned int);
+
+} // namespace std
diff --git a/contrib/libstdc++/src/codecvt.cc b/contrib/libstdc++/src/codecvt.cc
new file mode 100644
index 0000000..032667e
--- /dev/null
+++ b/contrib/libstdc++/src/codecvt.cc
@@ -0,0 +1,202 @@
+// Copyright (C) 2000, 2002 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 Benjamin Kosnik <bkoz@cygnus.com>
+
+#include <locale>
+
+namespace std
+{
+#ifdef _GLIBCPP_USE___ENC_TRAITS
+ // Definitions for static const data members of __enc_traits.
+ const int __enc_traits::_S_max_size;
+#endif
+
+ codecvt<char, char, mbstate_t>::
+ codecvt(size_t __refs)
+ : __codecvt_abstract_base<char, char, mbstate_t>(__refs)
+ { }
+
+ codecvt<char, char, mbstate_t>::
+ ~codecvt() { }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_out(state_type&, 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 __len = min(__from_end - __from, __to_end - __to);
+ memcpy(__to, __from, __len);
+ __from_next = __from;
+ __to_next = __to;
+ return noconv;
+ }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_unshift(state_type&, extern_type* __to,
+ extern_type*, extern_type*& __to_next) const
+ {
+ __to_next = __to;
+ return noconv;
+ }
+
+ codecvt_base::result
+ codecvt<char, char, mbstate_t>::
+ do_in(state_type&, 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 __len = min(__from_end - __from, __to_end - __to);
+ memcpy(__to, __from, __len);
+ __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&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return min(__max, static_cast<size_t>(__end - __from)); }
+
+ int
+ codecvt<char, char, mbstate_t>::
+ do_max_length() const throw()
+ { return 1; }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ // codecvt<wchar_t, char, mbstate_t> required specialization
+ codecvt<wchar_t, char, mbstate_t>::
+ codecvt(size_t __refs)
+ : __codecvt_abstract_base<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_end,
+ extern_type*& __to_next) const
+ {
+ result __ret = error;
+ size_t __len = min(__from_end - __from, __to_end - __to);
+ size_t __conv = wcsrtombs(__to, &__from, __len, &__state);
+
+ if (__conv == __len)
+ {
+ __from_next = __from;
+ __to_next = __to + __conv;
+ __ret = ok;
+ }
+ else if (__conv > 0 && __conv < __len)
+ {
+ __from_next = __from;
+ __to_next = __to + __conv;
+ __ret = partial;
+ }
+ else
+ __ret = error;
+
+ return __ret;
+ }
+
+ codecvt_base::result
+ codecvt<wchar_t, char, mbstate_t>::
+ do_unshift(state_type&, extern_type* __to,
+ extern_type*, 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_end,
+ intern_type*& __to_next) const
+ {
+ result __ret = error;
+ size_t __len = min(__from_end - __from, __to_end - __to);
+ size_t __conv = mbsrtowcs(__to, &__from, __len, &__state);
+
+ if (__conv == __len)
+ {
+ __from_next = __from;
+ __to_next = __to + __conv;
+ __ret = ok;
+ }
+ else if (__conv > 0 && __conv < __len)
+ {
+ __from_next = __from;
+ __to_next = __to + __conv;
+ __ret = partial;
+ }
+ else
+ __ret = error;
+
+ return __ret;
+ }
+
+ int
+ codecvt<wchar_t, char, mbstate_t>::
+ do_encoding() const throw()
+ { return sizeof(wchar_t); }
+
+ 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&, const extern_type* __from,
+ const extern_type* __end, size_t __max) const
+ { return min(__max, static_cast<size_t>(__end - __from)); }
+
+ int
+ codecvt<wchar_t, char, mbstate_t>::
+ do_max_length() const throw()
+ { return 1; }
+#endif // _GLIBCPP_USE_WCHAR_T
+} // namespace std
diff --git a/contrib/libstdc++/src/complex_io.cc b/contrib/libstdc++/src/complex_io.cc
new file mode 100644
index 0000000..a6d502f
--- /dev/null
+++ b/contrib/libstdc++/src/complex_io.cc
@@ -0,0 +1,93 @@
+// The template and inlines for the -*- C++ -*- complex number classes.
+
+// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// 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 <complex>
+
+namespace std
+{
+ 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>&);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ 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>&);
+#endif //_GLIBCPP_USE_WCHAR_T
+} // namespace std
diff --git a/contrib/libstdc++/src/concept-inst.cc b/contrib/libstdc++/src/concept-inst.cc
new file mode 100644
index 0000000..01cc030
--- /dev/null
+++ b/contrib/libstdc++/src/concept-inst.cc
@@ -0,0 +1,112 @@
+// Concept checking instantiations -*- C++ -*-
+
+// Copyright (C) 2001, 2002 Free Software Foundation
+//
+// This file is part of GNU CC.
+//
+// GNU CC 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.
+//
+// GNU CC 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 GNU CC; 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.
+
+// The implementation of some of the more complex checks uses the simple
+// checks (good reuse of code), thereby requiring that the simple checks
+// be instantiated somewhere. The simple checks use other simple checks,
+// and so on, until a couple hundred symbols all need instantiations. We
+// explicitly instantiate the initial set of symbols; compiling this file
+// with -fimplicit-templates will take care of the rest for us.
+
+#include <bits/concept_check.h>
+
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+
+#include <memory>
+#include <ostream>
+
+#define _Instantiate(...) template void __function_requires< __VA_ARGS__ > ()
+
+namespace __gnu_cxx
+{
+ template void __aux_require_boolean_expr<bool>(bool const&);
+
+ _Instantiate(_ConvertibleConcept<unsigned, unsigned> );
+
+ _Instantiate(_InputIteratorConcept<char*> );
+
+ _Instantiate(_InputIteratorConcept<char const*> );
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ _Instantiate(_InputIteratorConcept<wchar_t*> );
+
+ _Instantiate(_InputIteratorConcept<wchar_t const*> );
+
+ _Instantiate(_LessThanComparableConcept<wchar_t*> );
+#endif
+
+ _Instantiate(_LessThanComparableConcept<char*> );
+
+ _Instantiate(_LessThanComparableConcept<int> );
+
+ _Instantiate(_LessThanComparableConcept<long> );
+
+ _Instantiate(_LessThanComparableConcept<long long> );
+
+ _Instantiate(_LessThanComparableConcept<unsigned> );
+
+ _Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator<
+ char, std::char_traits<char> >, char> );
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ _Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator<
+ wchar_t, std::char_traits<wchar_t> >, wchar_t> );
+#endif
+
+ _Instantiate(_RandomAccessIteratorConcept<char*> );
+
+ _Instantiate(_RandomAccessIteratorConcept<char const*> );
+
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<char const*, std::string> > );
+
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<char*, std::string> > );
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<wchar_t const*,
+ std::basic_string<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t> > > > );
+
+ _Instantiate(_RandomAccessIteratorConcept<
+ __normal_iterator<wchar_t*,
+ std::basic_string<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t> > > > );
+
+ _Instantiate(_RandomAccessIteratorConcept<wchar_t*> );
+
+ _Instantiate(_RandomAccessIteratorConcept<wchar_t const*> );
+#endif
+} // namespace __gnu_cxx
+
+#undef _Instantiate
+
+#endif
diff --git a/contrib/libstdc++/src/ext-inst.cc b/contrib/libstdc++/src/ext-inst.cc
new file mode 100644
index 0000000..21b98c8
--- /dev/null
+++ b/contrib/libstdc++/src/ext-inst.cc
@@ -0,0 +1,40 @@
+// Explicit instantiation file.
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ext/rope>
+
+namespace std
+{
+ template
+ const unsigned long __gnu_cxx::rope<char, std::allocator<char> >::_S_min_len;
+} // namespace std
diff --git a/contrib/libstdc++/src/functexcept.cc b/contrib/libstdc++/src/functexcept.cc
new file mode 100644
index 0000000..dab6f2f
--- /dev/null
+++ b/contrib/libstdc++/src/functexcept.cc
@@ -0,0 +1,151 @@
+// Copyright (C) 2001, 2002 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/functexcept.h>
+#include <cstdlib>
+#include <exception>
+#include <stdexcept>
+#include <new>
+#include <typeinfo>
+#include <ios>
+
+namespace std
+{
+#if __EXCEPTIONS
+ void
+ __throw_bad_exception(void)
+ { throw bad_exception(); }
+
+ void
+ __throw_bad_alloc(void)
+ { throw bad_alloc(); }
+
+ void
+ __throw_bad_cast(void)
+ { throw bad_cast(); }
+
+ void
+ __throw_bad_typeid(void)
+ { throw bad_typeid(); }
+
+ void
+ __throw_logic_error(const char* __s)
+ { throw logic_error(__s); }
+
+ void
+ __throw_domain_error(const char* __s)
+ { throw domain_error(__s); }
+
+ void
+ __throw_invalid_argument(const char* __s)
+ { throw invalid_argument(__s); }
+
+ void
+ __throw_length_error(const char* __s)
+ { throw length_error(__s); }
+
+ void
+ __throw_out_of_range(const char* __s)
+ { throw out_of_range(__s); }
+
+ void
+ __throw_runtime_error(const char* __s)
+ { throw runtime_error(__s); }
+
+ void
+ __throw_range_error(const char* __s)
+ { throw range_error(__s); }
+
+ void
+ __throw_overflow_error(const char* __s)
+ { throw overflow_error(__s); }
+
+ void
+ __throw_underflow_error(const char* __s)
+ { throw underflow_error(__s); }
+
+ void
+ __throw_ios_failure(const char* __s)
+ { throw ios_base::failure(__s); }
+#else
+ void
+ __throw_bad_exception(void)
+ { abort(); }
+
+ void
+ __throw_bad_alloc(void)
+ { abort(); }
+
+ void
+ __throw_bad_cast(void)
+ { abort(); }
+
+ void
+ __throw_bad_typeid(void)
+ { abort(); }
+
+ void
+ __throw_logic_error(const char*)
+ { abort(); }
+
+ void
+ __throw_domain_error(const char*)
+ { abort(); }
+
+ void
+ __throw_invalid_argument(const char*)
+ { abort(); }
+
+ void
+ __throw_length_error(const char*)
+ { abort(); }
+
+ void
+ __throw_out_of_range(const char*)
+ { abort(); }
+
+ void
+ __throw_runtime_error(const char*)
+ { abort(); }
+
+ void
+ __throw_range_error(const char*)
+ { abort(); }
+
+ void
+ __throw_overflow_error(const char*)
+ { abort(); }
+
+ void
+ __throw_underflow_error(const char*)
+ { abort(); }
+
+ void
+ __throw_ios_failure(const char*)
+ { abort(); }
+#endif //__EXCEPTIONS
+}
diff --git a/contrib/libstdc++/src/globals.cc b/contrib/libstdc++/src/globals.cc
new file mode 100644
index 0000000..36d193f
--- /dev/null
+++ b/contrib/libstdc++/src/globals.cc
@@ -0,0 +1,226 @@
+// Copyright (C) 2001, 2002 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/c++config.h"
+#include "bits/gthr.h"
+#include <fstream>
+#include <istream>
+#include <ostream>
+#include <locale>
+#include <ext/stdio_filebuf.h>
+
+// On AIX, and perhaps other systems, library initialization order is
+// not guaranteed. For example, the static initializers for the main
+// program might run before the static initializers for this library.
+// That means that we cannot rely on static initialization in the
+// library; there is no guarantee that things will get initialized in
+// time. This file contains definitions of all global variables that
+// require initialization as arrays of characters.
+
+// Because <iostream> declares the standard streams to be [io]stream
+// types instead of say [io]fstream types, it is also necessary to
+// allocate the actual file buffers in this file.
+namespace std
+{
+ // Standard "C" locale.
+ typedef char fake_locale[sizeof(locale)]
+ __attribute__ ((aligned(__alignof__(locale))));
+ fake_locale c_locale;
+
+ typedef char fake_locale_Impl[sizeof(locale::_Impl)]
+ __attribute__ ((aligned(__alignof__(locale::_Impl))));
+ fake_locale_Impl c_locale_impl;
+
+ typedef char fake_facet_vec[sizeof(locale::facet*)]
+ __attribute__ ((aligned(__alignof__(locale::facet*))));
+ fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS];
+
+ typedef char fake_ctype_c[sizeof(std::ctype<char>)]
+ __attribute__ ((aligned(__alignof__(std::ctype<char>))));
+ fake_ctype_c ctype_c;
+
+ typedef char fake_collate_c[sizeof(std::collate<char>)]
+ __attribute__ ((aligned(__alignof__(std::collate<char>))));
+ fake_collate_c collate_c;
+
+ typedef char fake_numpunct_c[sizeof(numpunct<char>)]
+ __attribute__ ((aligned(__alignof__(numpunct<char>))));
+ fake_numpunct_c numpunct_c;
+
+ typedef char fake_num_get_c[sizeof(num_get<char>)]
+ __attribute__ ((aligned(__alignof__(num_get<char>))));
+ fake_num_get_c num_get_c;
+
+ typedef char fake_num_put_c[sizeof(num_put<char>)]
+ __attribute__ ((aligned(__alignof__(num_put<char>))));
+ fake_num_put_c num_put_c;
+
+ typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)]
+ __attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>))));
+ fake_codecvt_c codecvt_c;
+
+ typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
+ __attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
+ fake_moneypunct_c moneypunct_tc;
+ fake_moneypunct_c moneypunct_fc;
+
+ typedef char fake_money_get_c[sizeof(money_get<char>)]
+ __attribute__ ((aligned(__alignof__(money_get<char>))));
+ fake_money_get_c money_get_c;
+
+ typedef char fake_money_put_c[sizeof(money_put<char>)]
+ __attribute__ ((aligned(__alignof__(money_put<char>))));
+ fake_money_put_c money_put_c;
+
+ typedef char fake_timepunct_c[sizeof(__timepunct<char>)]
+ __attribute__ ((aligned(__alignof__(__timepunct<char>))));
+ fake_timepunct_c timepunct_c;
+
+ typedef char fake_time_get_c[sizeof(time_get<char>)]
+ __attribute__ ((aligned(__alignof__(time_get<char>))));
+ fake_time_get_c time_get_c;
+
+ typedef char fake_time_put_c[sizeof(time_put<char>)]
+ __attribute__ ((aligned(__alignof__(time_put<char>))));
+ fake_time_put_c time_put_c;
+
+ typedef char fake_messages_c[sizeof(messages<char>)]
+ __attribute__ ((aligned(__alignof__(messages<char>))));
+ fake_messages_c messages_c;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(std::ctype<wchar_t>))));
+ fake_wtype_w ctype_w;
+
+ typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
+ fake_wollate_w collate_w;
+
+ typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
+ fake_numpunct_w numpunct_w;
+
+ typedef char fake_num_get_w[sizeof(num_get<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(num_get<wchar_t>))));
+ fake_num_get_w num_get_w;
+
+ typedef char fake_num_put_w[sizeof(num_put<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(num_put<wchar_t>))));
+ fake_num_put_w num_put_w;
+
+ typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)]
+ __attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>))));
+ fake_wodecvt_w codecvt_w;
+
+ typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
+ __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
+ fake_moneypunct_w moneypunct_tw;
+ fake_moneypunct_w moneypunct_fw;
+
+ typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
+ fake_money_get_w money_get_w;
+
+ typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
+ fake_money_put_w money_put_w;
+
+ typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(__timepunct<wchar_t>))));
+ fake_timepunct_w timepunct_w;
+
+ typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
+ fake_time_get_w time_get_w;
+
+ typedef char fake_time_put_w[sizeof(time_put<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(time_put<wchar_t>))));
+ fake_time_put_w time_put_w;
+
+ typedef char fake_messages_w[sizeof(messages<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(messages<wchar_t>))));
+ fake_messages_w messages_w;
+#endif
+
+ // Standard stream objects.
+ typedef char fake_istream[sizeof(istream)]
+ __attribute__ ((aligned(__alignof__(istream))));
+ typedef char fake_ostream[sizeof(ostream)]
+ __attribute__ ((aligned(__alignof__(ostream))));
+ fake_istream cin;
+ fake_ostream cout;
+ fake_ostream cerr;
+ fake_ostream clog;
+
+ typedef char fake_filebuf[sizeof(__gnu_cxx::stdio_filebuf<char>)]
+ __attribute__ ((aligned(__alignof__(__gnu_cxx::stdio_filebuf<char>))));
+ fake_filebuf buf_cout;
+ fake_filebuf buf_cin;
+ fake_filebuf buf_cerr;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ typedef char fake_wistream[sizeof(wistream)]
+ __attribute__ ((aligned(__alignof__(wistream))));
+ typedef char fake_wostream[sizeof(wostream)]
+ __attribute__ ((aligned(__alignof__(wostream))));
+ fake_wistream wcin;
+ fake_wostream wcout;
+ fake_wostream wcerr;
+ fake_wostream wclog;
+
+ typedef char fake_wfilebuf[sizeof(__gnu_cxx::stdio_filebuf<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(__gnu_cxx::stdio_filebuf<wchar_t>))));
+ fake_wfilebuf buf_wcout;
+ fake_wfilebuf buf_wcin;
+ fake_wfilebuf buf_wcerr;
+#endif
+
+
+ // Globals for once-only runtime initialization of mutex objects. This
+ // allows static initialization of these objects on systems that need a
+ // function call to initialize a mutex. For example, see stl_threads.h.
+#ifdef __GTHREAD_MUTEX_INIT
+ // Need to provide explicit instantiations of static data for
+ // systems with broken weak linkage support.
+ template __gthread_mutex_t _Swap_lock_struct<0>::_S_swap_lock;
+#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
+ __gthread_once_t _GLIBCPP_once = __GTHREAD_ONCE_INIT;
+ __gthread_mutex_t _GLIBCPP_mutex;
+ __gthread_mutex_t *_GLIBCPP_mutex_address;
+
+ // Once-only initializer function for _GLIBCPP_mutex.
+ void
+ _GLIBCPP_mutex_init ()
+ { __GTHREAD_MUTEX_INIT_FUNCTION (&_GLIBCPP_mutex); }
+
+ // Once-only initializer function for _GLIBCPP_mutex_address.
+ void
+ _GLIBCPP_mutex_address_init ()
+ { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address); }
+#endif
+}
diff --git a/contrib/libstdc++/src/ios.cc b/contrib/libstdc++/src/ios.cc
new file mode 100644
index 0000000..c1167f8
--- /dev/null
+++ b/contrib/libstdc++/src/ios.cc
@@ -0,0 +1,359 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// 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 <ios>
+#include <ostream>
+#include <istream>
+#include <fstream>
+#include <bits/atomicity.h>
+#include <ext/stdio_filebuf.h>
+
+namespace std
+{
+ // Extern declarations for global objects in src/globals.cc.
+ extern istream cin;
+ extern ostream cout;
+ extern ostream cerr;
+ extern ostream clog;
+
+ using __gnu_cxx::stdio_filebuf;
+ extern stdio_filebuf<char> buf_cout;
+ extern stdio_filebuf<char> buf_cin;
+ extern stdio_filebuf<char> buf_cerr;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ extern wistream wcin;
+ extern wostream wcout;
+ extern wostream wcerr;
+ extern wostream wclog;
+
+ extern stdio_filebuf<wchar_t> buf_wcout;
+ extern stdio_filebuf<wchar_t> buf_wcin;
+ extern stdio_filebuf<wchar_t> buf_wcerr;
+#endif
+
+ // Definitions for static const data members of __ios_flags.
+ const __ios_flags::__int_type __ios_flags::_S_boolalpha;
+ const __ios_flags::__int_type __ios_flags::_S_dec;
+ const __ios_flags::__int_type __ios_flags::_S_fixed;
+ const __ios_flags::__int_type __ios_flags::_S_hex;
+ const __ios_flags::__int_type __ios_flags::_S_internal;
+ const __ios_flags::__int_type __ios_flags::_S_left;
+ const __ios_flags::__int_type __ios_flags::_S_oct;
+ const __ios_flags::__int_type __ios_flags::_S_right;
+ const __ios_flags::__int_type __ios_flags::_S_scientific;
+ const __ios_flags::__int_type __ios_flags::_S_showbase;
+ const __ios_flags::__int_type __ios_flags::_S_showpoint;
+ const __ios_flags::__int_type __ios_flags::_S_showpos;
+ const __ios_flags::__int_type __ios_flags::_S_skipws;
+ const __ios_flags::__int_type __ios_flags::_S_unitbuf;
+ const __ios_flags::__int_type __ios_flags::_S_uppercase;
+ const __ios_flags::__int_type __ios_flags::_S_adjustfield;
+ const __ios_flags::__int_type __ios_flags::_S_basefield;
+ const __ios_flags::__int_type __ios_flags::_S_floatfield;
+
+ const __ios_flags::__int_type __ios_flags::_S_badbit;
+ const __ios_flags::__int_type __ios_flags::_S_eofbit;
+ const __ios_flags::__int_type __ios_flags::_S_failbit;
+
+ const __ios_flags::__int_type __ios_flags::_S_app;
+ const __ios_flags::__int_type __ios_flags::_S_ate;
+ const __ios_flags::__int_type __ios_flags::_S_bin;
+ const __ios_flags::__int_type __ios_flags::_S_in;
+ const __ios_flags::__int_type __ios_flags::_S_out;
+ const __ios_flags::__int_type __ios_flags::_S_trunc;
+
+ // Definitions for static const members of ios_base.
+ 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;
+
+ const int ios_base::_S_local_word_size;
+ int ios_base::Init::_S_ios_base_init = 0;
+ bool ios_base::Init::_S_synced_with_stdio = true;
+
+ ios_base::failure::failure(const string& __str) throw()
+ {
+ strncpy(_M_name, __str.c_str(), _M_bufsize);
+ _M_name[_M_bufsize - 1] = '\0';
+ }
+
+ ios_base::failure::~failure() throw()
+ { }
+
+ const char*
+ ios_base::failure::what() const throw()
+ { return _M_name; }
+
+ void
+ ios_base::Init::_S_ios_create(bool __sync)
+ {
+ int __out_size = __sync ? 0 : static_cast<int>(BUFSIZ);
+ int __in_size = __sync ? 1 : static_cast<int>(BUFSIZ);
+
+ // NB: The file globals.cc creates the four standard files
+ // with NULL buffers. At this point, we swap out the dummy NULL
+ // [io]stream objects and buffers with the real deal.
+ new (&buf_cout) stdio_filebuf<char>(stdout, ios_base::out, __out_size);
+ new (&buf_cin) stdio_filebuf<char>(stdin, ios_base::in, __in_size);
+ new (&buf_cerr) stdio_filebuf<char>(stderr, ios_base::out, __out_size);
+ new (&cout) ostream(&buf_cout);
+ new (&cin) istream(&buf_cin);
+ new (&cerr) ostream(&buf_cerr);
+ new (&clog) ostream(&buf_cerr);
+ cin.tie(&cout);
+ cerr.flags(ios_base::unitbuf);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ new (&buf_wcout) stdio_filebuf<wchar_t>(stdout, ios_base::out, __out_size);
+ new (&buf_wcin) stdio_filebuf<wchar_t>(stdin, ios_base::in, __in_size);
+ new (&buf_wcerr) stdio_filebuf<wchar_t>(stderr, ios_base::out, __out_size);
+ new (&wcout) wostream(&buf_wcout);
+ new (&wcin) wistream(&buf_wcin);
+ new (&wcerr) wostream(&buf_wcerr);
+ new (&wclog) wostream(&buf_wcerr);
+ wcin.tie(&wcout);
+ wcerr.flags(ios_base::unitbuf);
+#endif
+ }
+
+ void
+ ios_base::Init::_S_ios_destroy()
+ {
+ // Explicitly call dtors to free any memory that is dynamically
+ // allocated by filebuf ctor or member functions, but don't
+ // deallocate all memory by calling operator delete.
+ buf_cout.~stdio_filebuf();
+ buf_cin.~stdio_filebuf();
+ buf_cerr.~stdio_filebuf();
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ buf_wcout.~stdio_filebuf();
+ buf_wcin.~stdio_filebuf();
+ buf_wcerr.~stdio_filebuf();
+#endif
+ }
+
+ ios_base::Init::Init()
+ {
+ if (_S_ios_base_init == 0)
+ {
+ // Standard streams default to synced with "C" operations.
+ ios_base::Init::_S_synced_with_stdio = true;
+ _S_ios_create(ios_base::Init::_S_synced_with_stdio);
+ }
+ ++_S_ios_base_init;
+ }
+
+ ios_base::Init::~Init()
+ {
+ if (--_S_ios_base_init == 0)
+ _S_ios_destroy();
+ }
+
+ // 27.4.2.5 ios_base storage functions
+ int
+ ios_base::xalloc() throw()
+ {
+ // Implementation note: Initialize top to zero to ensure that
+ // initialization occurs before main() is started.
+ static _Atomic_word _S_top = 0;
+ return __exchange_and_add(&_S_top, 1) + 4;
+ }
+
+ // 27.4.2.5 iword/pword storage
+ ios_base::_Words&
+ ios_base::_M_grow_words(int ix)
+ {
+ // Precondition: _M_word_size <= ix
+ int newsize = _S_local_word_size;
+ _Words* words = _M_local_word;
+ if (ix > _S_local_word_size - 1)
+ {
+ if (ix < numeric_limits<int>::max())
+ {
+ newsize = ix + 1;
+ try
+ { words = new _Words[newsize]; }
+ catch (...)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ _M_streambuf_state |= badbit;
+ if (_M_streambuf_state & _M_exception)
+ __throw_ios_failure("ios_base::_M_grow_words failure");
+ return _M_word_zero;
+ }
+ for (int i = 0; i < _M_word_size; i++)
+ words[i] = _M_word[i];
+ if (_M_word && _M_word != _M_local_word)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ }
+ }
+ else
+ {
+ _M_streambuf_state |= badbit;
+ return _M_word_zero;
+ }
+ }
+ _M_word = words;
+ _M_word_size = newsize;
+ return _M_word[ix];
+ }
+
+ // Called only by basic_ios<>::init.
+ void
+ ios_base::_M_init()
+ {
+ // NB: May be called more than once
+ _M_precision = 6;
+ _M_width = 0;
+ _M_flags = skipws | dec;
+ _M_callbacks = 0;
+ _M_word_size = 0;
+ _M_ios_locale = locale();
+ }
+
+ // 27.4.2.3 ios_base locale functions
+ locale
+ ios_base::imbue(const locale& __loc)
+ {
+ locale __old = _M_ios_locale;
+ _M_ios_locale = __loc;
+ _M_call_callbacks(imbue_event);
+ return __old;
+ }
+
+ ios_base::ios_base() : _M_callbacks(0), _M_word(0)
+ {
+ // Do nothing: basic_ios::init() does it.
+ // NB: _M_callbacks and _M_word must be zero for non-initialized
+ // ios_base to go through ~ios_base gracefully.
+ }
+
+ // 27.4.2.7 ios_base constructors/destructors
+ ios_base::~ios_base()
+ {
+ _M_call_callbacks(erase_event);
+ _M_dispose_callbacks();
+ if (_M_word && _M_word != _M_local_word)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ }
+ }
+
+ 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()
+ {
+ _Callback_list* __p = _M_callbacks;
+ while (__p)
+ {
+ try
+ { (*__p->_M_fn) (__e, *this, __p->_M_index); }
+ catch (...)
+ { }
+ __p = __p->_M_next;
+ }
+ }
+
+ 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 __ret = ios_base::Init::_S_synced_with_stdio;
+#endif
+
+ // Turn off sync with C FILE* for cin, cout, cerr, clog iff
+ // currently synchronized.
+ if (!__sync && __ret)
+ {
+ ios_base::Init::_S_synced_with_stdio = false;
+ ios_base::Init::_S_ios_destroy();
+ ios_base::Init::_S_ios_create(ios_base::Init::_S_synced_with_stdio);
+ }
+ return __ret;
+ }
+} // namespace std
diff --git a/contrib/libstdc++/src/limits.cc b/contrib/libstdc++/src/limits.cc
new file mode 100644
index 0000000..294673e
--- /dev/null
+++ b/contrib/libstdc++/src/limits.cc
@@ -0,0 +1,449 @@
+// Static data members of -*- C++ -*- numeric_limits classes
+
+// Copyright (C) 1999, 2001, 2002 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 <limits>
+
+namespace std
+{
+ const bool __numeric_limits_base::is_specialized;
+ const int __numeric_limits_base::digits;
+ const int __numeric_limits_base::digits10;
+ const bool __numeric_limits_base::is_signed;
+ const bool __numeric_limits_base::is_integer;
+ const bool __numeric_limits_base::is_exact;
+ const int __numeric_limits_base::radix;
+ const int __numeric_limits_base::min_exponent;
+ const int __numeric_limits_base::min_exponent10;
+ const int __numeric_limits_base::max_exponent;
+ const int __numeric_limits_base::max_exponent10;
+ const bool __numeric_limits_base::has_infinity;
+ const bool __numeric_limits_base::has_quiet_NaN;
+ const bool __numeric_limits_base::has_signaling_NaN;
+ const float_denorm_style __numeric_limits_base::has_denorm;
+ const bool __numeric_limits_base::has_denorm_loss;
+ const bool __numeric_limits_base::is_iec559;
+ const bool __numeric_limits_base::is_bounded;
+ const bool __numeric_limits_base::is_modulo;
+ const bool __numeric_limits_base::traps;
+ const bool __numeric_limits_base::tinyness_before;
+ const float_round_style __numeric_limits_base::round_style;
+
+ // bool
+ 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;
+
+ // char
+ 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;
+
+ // signed char
+ 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;
+
+ // unsigned char
+ 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;
+
+ // wchar_t
+ // This used to be problematic...
+#ifdef _GLIBCPP_USE_WCHAR_T
+ const bool numeric_limits<wchar_t>::is_specialized;
+ const int numeric_limits<wchar_t>::digits;
+ const int numeric_limits<wchar_t>::digits10;
+ const bool numeric_limits<wchar_t>::is_signed;
+ const bool numeric_limits<wchar_t>::is_integer;
+ const bool numeric_limits<wchar_t>::is_exact;
+ const int numeric_limits<wchar_t>::radix;
+ const int numeric_limits<wchar_t>::min_exponent;
+ const int numeric_limits<wchar_t>::min_exponent10;
+ const int numeric_limits<wchar_t>::max_exponent;
+ const int numeric_limits<wchar_t>::max_exponent10;
+ const bool numeric_limits<wchar_t>::has_infinity;
+ const bool numeric_limits<wchar_t>::has_quiet_NaN;
+ const bool numeric_limits<wchar_t>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<wchar_t>::has_denorm;
+ const bool numeric_limits<wchar_t>::has_denorm_loss;
+ const bool numeric_limits<wchar_t>::is_iec559;
+ const bool numeric_limits<wchar_t>::is_bounded;
+ const bool numeric_limits<wchar_t>::is_modulo;
+ const bool numeric_limits<wchar_t>::traps;
+ const bool numeric_limits<wchar_t>::tinyness_before;
+ const float_round_style numeric_limits<wchar_t>::round_style;
+#endif // _GLIBCPP_USE_WCHAR_T
+
+ // short
+ 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;
+
+ // unsigned short
+ 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;
+
+ // int
+ 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;
+
+ // unsigned int
+ 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;
+
+ // long
+ 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;
+
+ // unsigned long
+ 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;
+
+ // NOTA BENE: long long is an extension
+ const bool numeric_limits<long long>::is_specialized;
+ const int numeric_limits<long long>::digits;
+ const int numeric_limits<long long>::digits10;
+ const bool numeric_limits<long long>::is_signed;
+ const bool numeric_limits<long long>::is_integer;
+ const bool numeric_limits<long long>::is_exact;
+ const int numeric_limits<long long>::radix;
+ const int numeric_limits<long long>::min_exponent;
+ const int numeric_limits<long long>::min_exponent10;
+ const int numeric_limits<long long>::max_exponent;
+ const int numeric_limits<long long>::max_exponent10;
+ const bool numeric_limits<long long>::has_infinity;
+ const bool numeric_limits<long long>::has_quiet_NaN;
+ const bool numeric_limits<long long>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<long long>::has_denorm;
+ const bool numeric_limits<long long>::has_denorm_loss;
+ const bool numeric_limits<long long>::is_iec559;
+ const bool numeric_limits<long long>::is_bounded;
+ const bool numeric_limits<long long>::is_modulo;
+ const bool numeric_limits<long long>::traps;
+ const bool numeric_limits<long long>::tinyness_before;
+ const float_round_style numeric_limits<long long>::round_style;
+
+ const bool numeric_limits<unsigned long long>::is_specialized;
+ const int numeric_limits<unsigned long long>::digits;
+ const int numeric_limits<unsigned long long>::digits10;
+ const bool numeric_limits<unsigned long long>::is_signed;
+ const bool numeric_limits<unsigned long long>::is_integer;
+ const bool numeric_limits<unsigned long long>::is_exact;
+ const int numeric_limits<unsigned long long>::radix;
+ const int numeric_limits<unsigned long long>::min_exponent;
+ const int numeric_limits<unsigned long long>::min_exponent10;
+ const int numeric_limits<unsigned long long>::max_exponent;
+ const int numeric_limits<unsigned long long>::max_exponent10;
+ const bool numeric_limits<unsigned long long>::has_infinity;
+ const bool numeric_limits<unsigned long long>::has_quiet_NaN;
+ const bool numeric_limits<unsigned long long>::has_signaling_NaN;
+ const float_denorm_style numeric_limits<unsigned long long>::has_denorm;
+ const bool numeric_limits<unsigned long long>::has_denorm_loss;
+ const bool numeric_limits<unsigned long long>::is_iec559;
+ const bool numeric_limits<unsigned long long>::is_bounded;
+ const bool numeric_limits<unsigned long long>::is_modulo;
+ const bool numeric_limits<unsigned long long>::traps;
+ const bool numeric_limits<unsigned long long>::tinyness_before;
+ const float_round_style numeric_limits<unsigned long long>::round_style;
+
+ // float
+ 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;
+
+ // double
+ 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;
+
+ // long double
+ 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/contrib/libstdc++/src/locale-inst.cc b/contrib/libstdc++/src/locale-inst.cc
new file mode 100644
index 0000000..7ac147f
--- /dev/null
+++ b/contrib/libstdc++/src/locale-inst.cc
@@ -0,0 +1,480 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002 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 <cstdlib>
+#include <clocale>
+#include <cstring>
+#include <cassert>
+#include <limits>
+#include <exception>
+#include <locale>
+#include <istream>
+#include <ostream>
+
+namespace std
+{
+ // moneypunct, money_get, and money_put
+ template class moneypunct<char, false>;
+ template class moneypunct<char, true>;
+ template class moneypunct_byname<char, false>;
+ template class moneypunct_byname<char, true>;
+ template class money_get<char, istreambuf_iterator<char> >;
+ template class money_put<char, ostreambuf_iterator<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 money_get<wchar_t, istreambuf_iterator<wchar_t> >;
+ template class money_put<wchar_t, ostreambuf_iterator<wchar_t> >;
+#endif
+
+ // numpunct, numpunct_byname, num_get, and num_put
+ template class numpunct<char>;
+ template class numpunct_byname<char>;
+ template class num_get<char, istreambuf_iterator<char> >;
+ template class num_put<char, ostreambuf_iterator<char> >;
+ template
+ ostreambuf_iterator<char>
+ num_put<char, ostreambuf_iterator<char> >::
+ _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
+ long) const;
+
+ template
+ ostreambuf_iterator<char>
+ num_put<char, ostreambuf_iterator<char> >::
+ _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
+ unsigned long) const;
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template
+ ostreambuf_iterator<char>
+ num_put<char, ostreambuf_iterator<char> >::
+ _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
+ long long) const;
+
+ template
+ ostreambuf_iterator<char>
+ num_put<char, ostreambuf_iterator<char> >::
+ _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
+ unsigned long long) const;
+#endif
+
+ template
+ ostreambuf_iterator<char>
+ num_put<char, ostreambuf_iterator<char> >::
+ _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char,
+ double) const;
+
+ template
+ ostreambuf_iterator<char>
+ num_put<char, ostreambuf_iterator<char> >::
+ _M_convert_float(ostreambuf_iterator<char>, ios_base&, char, char,
+ long double) const;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class numpunct<wchar_t>;
+ template class numpunct_byname<wchar_t>;
+ template class num_get<wchar_t, istreambuf_iterator<wchar_t> >;
+ template class num_put<wchar_t, ostreambuf_iterator<wchar_t> >;
+
+ template
+ ostreambuf_iterator<wchar_t>
+ num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
+ _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
+ char, long) const;
+
+ template
+ ostreambuf_iterator<wchar_t>
+ num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
+ _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
+ char, unsigned long) const;
+
+#ifdef _GLIBCPP_USE_LONG_LONG
+ template
+ ostreambuf_iterator<wchar_t>
+ num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
+ _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
+ char, long long) const;
+
+ template
+ ostreambuf_iterator<wchar_t>
+ num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
+ _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
+ char, unsigned long long) const;
+#endif
+
+ template
+ ostreambuf_iterator<wchar_t>
+ num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
+ _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
+ double) const;
+
+ template
+ ostreambuf_iterator<wchar_t>
+ num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
+ _M_convert_float(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t, char,
+ long double) const;
+#endif
+
+ // time_get and time_put
+ template class __timepunct<char>;
+ template class time_put<char, ostreambuf_iterator<char> >;
+ template class time_put_byname<char, ostreambuf_iterator<char> >;
+ template class time_get<char, istreambuf_iterator<char> >;
+ template class time_get_byname<char, istreambuf_iterator<char> >;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class __timepunct<wchar_t>;
+ template class time_put<wchar_t, ostreambuf_iterator<wchar_t> >;
+ template class time_put_byname<wchar_t, ostreambuf_iterator<wchar_t> >;
+ template class time_get<wchar_t, istreambuf_iterator<wchar_t> >;
+ template class time_get_byname<wchar_t, istreambuf_iterator<wchar_t> >;
+#endif
+
+ // messages
+ template class messages<char>;
+ template class messages_byname<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class messages<wchar_t>;
+ template class messages_byname<wchar_t>;
+#endif
+
+ // ctype
+ inline template class __ctype_abstract_base<char>;
+ template class ctype_byname<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ inline template class __ctype_abstract_base<wchar_t>;
+ template class ctype_byname<wchar_t>;
+#endif
+
+ // codecvt
+ inline template class __codecvt_abstract_base<char, char, mbstate_t>;
+ inline template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
+ template class codecvt_byname<char, char, mbstate_t>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class codecvt_byname<wchar_t, char, mbstate_t>;
+#endif
+
+ // collate
+ template class collate<char>;
+ template class collate_byname<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class collate<wchar_t>;
+ template class collate_byname<wchar_t>;
+#endif
+
+ // use_facet
+ // NB: use_facet<ctype> is specialized
+ template
+ const codecvt<char, char, mbstate_t>&
+ use_facet<codecvt<char, char, mbstate_t> >(const locale&);
+
+ template
+ const collate<char>&
+ use_facet<collate<char> >(const locale&);
+
+ template
+ const numpunct<char>&
+ use_facet<numpunct<char> >(const locale&);
+
+ template
+ const num_put<char>&
+ use_facet<num_put<char> >(const locale&);
+
+ template
+ const num_get<char>&
+ use_facet<num_get<char> >(const locale&);
+
+ template
+ const moneypunct<char, true>&
+ use_facet<moneypunct<char, true> >(const locale&);
+
+ template
+ const moneypunct<char, false>&
+ use_facet<moneypunct<char, false> >(const locale&);
+
+ template
+ const money_put<char>&
+ use_facet<money_put<char> >(const locale&);
+
+ template
+ const money_get<char>&
+ use_facet<money_get<char> >(const locale&);
+
+ template
+ const __timepunct<char>&
+ use_facet<__timepunct<char> >(const locale&);
+
+ template
+ const time_put<char>&
+ use_facet<time_put<char> >(const locale&);
+
+ template
+ const time_get<char>&
+ use_facet<time_get<char> >(const locale&);
+
+ template
+ const messages<char>&
+ use_facet<messages<char> >(const locale&);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ const codecvt<wchar_t, char, mbstate_t>&
+ use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);
+
+ template
+ const collate<wchar_t>&
+ use_facet<collate<wchar_t> >(const locale&);
+
+ template
+ const numpunct<wchar_t>&
+ use_facet<numpunct<wchar_t> >(const locale&);
+
+ template
+ const num_put<wchar_t>&
+ use_facet<num_put<wchar_t> >(const locale&);
+
+ template
+ const num_get<wchar_t>&
+ use_facet<num_get<wchar_t> >(const locale&);
+
+ template
+ const moneypunct<wchar_t, true>&
+ use_facet<moneypunct<wchar_t, true> >(const locale&);
+
+ template
+ const moneypunct<wchar_t, false>&
+ use_facet<moneypunct<wchar_t, false> >(const locale&);
+
+ template
+ const money_put<wchar_t>&
+ use_facet<money_put<wchar_t> >(const locale&);
+
+ template
+ const money_get<wchar_t>&
+ use_facet<money_get<wchar_t> >(const locale&);
+
+ template
+ const __timepunct<wchar_t>&
+ use_facet<__timepunct<wchar_t> >(const locale&);
+
+ template
+ const time_put<wchar_t>&
+ use_facet<time_put<wchar_t> >(const locale&);
+
+ template
+ const time_get<wchar_t>&
+ use_facet<time_get<wchar_t> >(const locale&);
+
+ template
+ const messages<wchar_t>&
+ use_facet<messages<wchar_t> >(const locale&);
+#endif
+
+ // has_facet
+ template
+ bool
+ has_facet<ctype<char> >(const locale&);
+
+ template
+ bool
+ has_facet<codecvt<char, char, mbstate_t> >(const locale&);
+
+ template
+ bool
+ has_facet<collate<char> >(const locale&);
+
+ template
+ bool
+ has_facet<numpunct<char> >(const locale&);
+
+ template
+ bool
+ has_facet<num_put<char> >(const locale&);
+
+ template
+ bool
+ has_facet<num_get<char> >(const locale&);
+
+ template
+ bool
+ has_facet<moneypunct<char> >(const locale&);
+
+ template
+ bool
+ has_facet<money_put<char> >(const locale&);
+
+ template
+ bool
+ has_facet<money_get<char> >(const locale&);
+
+ template
+ bool
+ has_facet<__timepunct<char> >(const locale&);
+
+ template
+ bool
+ has_facet<time_put<char> >(const locale&);
+
+ template
+ bool
+ has_facet<time_get<char> >(const locale&);
+
+ template
+ bool
+ has_facet<messages<char> >(const locale&);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ bool
+ has_facet<ctype<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
+
+ template
+ bool
+ has_facet<collate<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<numpunct<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<num_put<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<num_get<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<moneypunct<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<money_put<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<money_get<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<__timepunct<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<time_put<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<time_get<wchar_t> >(const locale&);
+
+ template
+ bool
+ has_facet<messages<wchar_t> >(const locale&);
+#endif
+
+ // locale
+ template
+ char*
+ __add_grouping<char>(char*, char, char const*, char const*,
+ char const*, char const*);
+
+ template
+ bool
+ __verify_grouping<char>(const basic_string<char>&, basic_string<char>&);
+
+ template
+ void
+ __pad<char>(ios_base&, char, char*, const char *, streamsize,
+ streamsize, const bool);
+
+ template
+ void
+ __pad<char, char_traits<char> >(ios_base&, char, char*, const char *,
+ streamsize, streamsize, const bool);
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ wchar_t*
+ __add_grouping<wchar_t>(wchar_t*, wchar_t, char const*, char const*,
+ wchar_t const*, wchar_t const*);
+ template
+ bool
+ __verify_grouping<wchar_t>(const basic_string<wchar_t>&,
+ basic_string<wchar_t>&);
+
+ template
+ void
+ __pad<wchar_t>(ios_base&, wchar_t, wchar_t*, const wchar_t*,
+ streamsize, streamsize, const bool);
+
+ template
+ void
+ __pad<wchar_t, char_traits<wchar_t> >(ios_base&, wchar_t, wchar_t*,
+ const wchar_t*, streamsize,
+ streamsize, const bool);
+#endif // _GLIBCPP_USE_WCHAR_T
+
+ template
+ int
+ __convert_from_v(char*, const int, const char*, double, const __c_locale&, int);
+
+ template
+ int
+ __convert_from_v(char*, const int, const char*, long double, const __c_locale&, int);
+
+ template
+ int
+ __convert_from_v(char*, const int, const char*, long, const __c_locale&, int);
+
+ template
+ int
+ __convert_from_v(char*, const int, const char*, unsigned long,
+ const __c_locale&, int);
+
+ template
+ int
+ __convert_from_v(char*, const int, const char*, long long, const __c_locale&, int);
+
+ template
+ int
+ __convert_from_v(char*, const int, const char*, unsigned long long,
+ const __c_locale&, int);
+} // namespace std
diff --git a/contrib/libstdc++/src/locale.cc b/contrib/libstdc++/src/locale.cc
new file mode 100644
index 0000000..26c2834
--- /dev/null
+++ b/contrib/libstdc++/src/locale.cc
@@ -0,0 +1,588 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// 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 <clocale>
+#include <cstring>
+#include <cassert>
+#include <cctype>
+#include <cwctype> // For towupper, etc.
+#include <limits>
+#include <exception>
+#include <locale>
+#include <istream>
+#include <ostream>
+#include <bits/atomicity.h>
+
+namespace std
+{
+ // Defined in globals.cc.
+ extern locale c_locale;
+ extern locale::_Impl c_locale_impl;
+ extern locale::facet** facet_vec;
+
+ // Definitions for static const data members of locale.
+ const locale::category locale::none;
+ const locale::category locale::ctype;
+ const locale::category locale::numeric;
+ const locale::category locale::collate;
+ const locale::category locale::time;
+ const locale::category locale::monetary;
+ const locale::category locale::messages;
+ const locale::category locale::all;
+
+ locale::_Impl* locale::_S_classic;
+ locale::_Impl* locale::_S_global;
+ const size_t locale::_S_num_categories;
+
+ // Definitions for locale::id of standard facets that are specialized.
+ locale::id ctype<char>::id;
+ locale::id codecvt<char, char, mbstate_t>::id;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ locale::id ctype<wchar_t>::id;
+ locale::id codecvt<wchar_t, char, mbstate_t>::id;
+#endif
+
+ // Definitions for static const data members of locale::id
+ _Atomic_word locale::id::_S_highwater; // init'd to 0 by linker
+
+ // Definitions for static const data members of locale::_Impl
+ const locale::id* const
+ locale::_Impl::_S_id_ctype[] =
+ {
+ &std::ctype<char>::id,
+ &codecvt<char, char, mbstate_t>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::ctype<wchar_t>::id,
+ &codecvt<wchar_t, char, mbstate_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_numeric[] =
+ {
+ &num_get<char>::id,
+ &num_put<char>::id,
+ &numpunct<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &num_get<wchar_t>::id,
+ &num_put<wchar_t>::id,
+ &numpunct<wchar_t>::id,
+#endif
+ 0
+ };
+
+ 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_time[] =
+ {
+ &__timepunct<char>::id,
+ &time_get<char>::id,
+ &time_put<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &__timepunct<wchar_t>::id,
+ &time_get<wchar_t>::id,
+ &time_put<wchar_t>::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_monetary[] =
+ {
+ &money_get<char>::id,
+ &money_put<char>::id,
+ &moneypunct<char, false>::id,
+ &moneypunct<char, true >::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &money_get<wchar_t>::id,
+ &money_put<wchar_t>::id,
+ &moneypunct<wchar_t, false>::id,
+ &moneypunct<wchar_t, true >::id,
+#endif
+ 0
+ };
+
+ const locale::id* const
+ locale::_Impl::_S_id_messages[] =
+ {
+ &std::messages<char>::id,
+#ifdef _GLIBCPP_USE_WCHAR_T
+ &std::messages<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_ctype,
+ locale::_Impl::_S_id_numeric,
+ locale::_Impl::_S_id_collate,
+ locale::_Impl::_S_id_monetary,
+ locale::_Impl::_S_id_time,
+ locale::_Impl::_S_id_messages,
+ 0
+ };
+
+ locale::~locale() throw()
+ { _M_impl->_M_remove_reference(); }
+
+ void
+ locale::_M_coalesce(const locale& __base, const locale& __add,
+ category __cat)
+ {
+ __cat = _S_normalize_category(__cat);
+ _M_impl = new _Impl(*__base._M_impl, 1);
+
+ try
+ { _M_impl->_M_replace_categories(__add._M_impl, __cat); }
+ catch (...)
+ {
+ _M_impl->_M_remove_reference();
+ __throw_exception_again;
+ }
+ }
+
+ locale::locale() throw()
+ {
+ _S_initialize();
+ (_M_impl = _S_global)->_M_add_reference();
+ }
+
+ locale::locale(const locale& __other) throw()
+ { (_M_impl = __other._M_impl)->_M_add_reference(); }
+
+ // This is used to initialize global and classic locales, and
+ // assumes that the _Impl objects are constructed correctly.
+ locale::locale(_Impl* __ip) throw() : _M_impl(__ip)
+ { }
+
+ locale::locale(const char* __s)
+ {
+ if (__s)
+ {
+ _S_initialize();
+ if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
+ (_M_impl = _S_classic)->_M_add_reference();
+ else if (strcmp(__s, "") == 0)
+ _M_impl = new _Impl(setlocale(LC_ALL, __s), 1);
+ else
+ _M_impl = new _Impl(__s, 1);
+ }
+ else
+ __throw_runtime_error("attempt to create locale from NULL name");
+ }
+
+ locale::locale(const locale& __base, const char* __s, category __cat)
+ {
+ // NB: There are complicated, yet more efficient ways to do
+ // this. Building up locales on a per-category way is tedious, so
+ // let's do it this way until people complain.
+ locale __add(__s);
+ _M_coalesce(__base, __add, __cat);
+ }
+
+ locale::locale(const locale& __base, const locale& __add, category __cat)
+ { _M_coalesce(__base, __add, __cat); }
+
+ bool
+ locale::operator==(const locale& __rhs) const throw()
+ {
+ string __name = this->name();
+ return (_M_impl == __rhs._M_impl
+ || (__name != "*" && __name == __rhs.name()));
+ }
+
+ const locale&
+ locale::operator=(const locale& __other) throw()
+ {
+ __other._M_impl->_M_add_reference();
+ _M_impl->_M_remove_reference();
+ _M_impl = __other._M_impl;
+ return *this;
+ }
+
+ locale
+ locale::global(const locale& __other)
+ {
+ // XXX MT
+ _S_initialize();
+ _Impl* __old = _S_global;
+ __other._M_impl->_M_add_reference();
+ _S_global = __other._M_impl;
+ if (_S_global->_M_check_same_name()
+ && (strcmp(_S_global->_M_names[0], "*") != 0))
+ setlocale(LC_ALL, __other.name().c_str());
+
+ // Reference count sanity check: one reference removed for the
+ // subsition of __other locale, one added by return-by-value. Net
+ // difference: zero. When the returned locale object's destrutor
+ // is called, then the reference count is decremented and possibly
+ // destroyed.
+ return locale(__old);
+ }
+
+ string
+ locale::name() const
+ {
+ // Need some kind of separator character. This one was pretty much
+ // arbitrarily chosen as to not conflict with glibc locales: the
+ // exact formatting is not set in stone.
+ const char __separator = '|';
+
+ string __ret;
+ if (_M_impl->_M_check_same_name())
+ __ret = _M_impl->_M_names[0];
+ else
+ {
+ for (size_t i = 0; i < _S_num_categories; ++i)
+ {
+ __ret += __separator;
+ __ret += _M_impl->_M_names[i];
+ }
+ }
+ return __ret;
+ }
+
+ const locale&
+ locale::classic()
+ {
+ static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER;
+ _STL_auto_lock __auto(__lock);
+
+ if (!_S_classic)
+ {
+ try
+ {
+ // 26 Standard facets, 2 references.
+ // One reference for _M_classic, one for _M_global
+ facet** f = new(&facet_vec) facet*[_GLIBCPP_NUM_FACETS];
+ for (size_t __i = 0; __i < _GLIBCPP_NUM_FACETS; ++__i)
+ f[__i] = 0;
+
+ _S_classic = new (&c_locale_impl) _Impl(f, 2, true);
+ _S_global = _S_classic;
+ new (&c_locale) locale(_S_classic);
+ }
+ catch(...)
+ {
+ // Just call destructor, so that locale_impl_c's memory is
+ // not deallocated via a call to delete.
+ if (_S_classic)
+ _S_classic->~_Impl();
+ _S_classic = _S_global = 0;
+ __throw_exception_again;
+ }
+ }
+ return c_locale;
+ }
+
+ locale::category
+ locale::_S_normalize_category(category __cat)
+ {
+ int __ret = 0;
+ if (__cat == none || (__cat & all) && !(__cat & ~all))
+ __ret = __cat;
+ else
+ {
+ // NB: May be a C-style "LC_ALL" category; convert.
+ switch (__cat)
+ {
+ case LC_COLLATE:
+ __ret = collate;
+ break;
+ case LC_CTYPE:
+ __ret = ctype;
+ break;
+ case LC_MONETARY:
+ __ret = monetary;
+ break;
+ case LC_NUMERIC:
+ __ret = numeric;
+ break;
+ case LC_TIME:
+ __ret = time;
+ break;
+#ifdef _GLIBCPP_HAVE_LC_MESSAGES
+ case LC_MESSAGES:
+ __ret = messages;
+ break;
+#endif
+ case LC_ALL:
+ __ret = all;
+ break;
+ default:
+ __throw_runtime_error("bad locale category");
+ }
+ }
+ return __ret;
+ }
+
+ __c_locale
+ locale::facet::_S_c_locale;
+
+ locale::facet::
+ ~facet() { }
+
+ locale::facet::
+ facet(size_t __refs) throw() : _M_references(__refs)
+ {
+ if (!_S_c_locale)
+ _S_create_c_locale(_S_c_locale, "C");
+ }
+
+ void
+ locale::facet::
+ _M_add_reference() throw()
+ { __atomic_add(&_M_references, 1); }
+
+ void
+ locale::facet::
+ _M_remove_reference() throw()
+ {
+ if (__exchange_and_add(&_M_references, -1) == 0)
+ {
+ try
+ { delete this; }
+ catch (...)
+ { }
+ }
+ }
+
+ locale::id::id()
+ { }
+
+ // Definitions for static const data members of ctype_base.
+ const ctype_base::mask ctype_base::space;
+ const ctype_base::mask ctype_base::print;
+ const ctype_base::mask ctype_base::cntrl;
+ const ctype_base::mask ctype_base::upper;
+ const ctype_base::mask ctype_base::lower;
+ const ctype_base::mask ctype_base::alpha;
+ const ctype_base::mask ctype_base::digit;
+ const ctype_base::mask ctype_base::punct;
+ const ctype_base::mask ctype_base::xdigit;
+ const ctype_base::mask ctype_base::alnum;
+ const ctype_base::mask ctype_base::graph;
+
+ // Platform-specific initialization code for ctype tables.
+ #include <bits/ctype_noninline.h>
+
+ const size_t ctype<char>::table_size;
+
+ ctype<char>::~ctype()
+ {
+ if (_M_c_locale_ctype != _S_c_locale)
+ _S_destroy_c_locale(_M_c_locale_ctype);
+ if (_M_del)
+ delete[] this->table();
+ }
+
+ // These are dummy placeholders as these virtual functions are never called.
+ bool
+ ctype<char>::do_is(mask, char_type) const
+ { return false; }
+
+ const char*
+ ctype<char>::do_is(const char_type* __c, const char_type*, mask*) const
+ { return __c; }
+
+ const char*
+ ctype<char>::do_scan_is(mask, const char_type* __c, const char_type*) const
+ { return __c; }
+
+ const char*
+ ctype<char>::do_scan_not(mask, const char_type* __c, const char_type*) const
+ { return __c; }
+
+ char
+ ctype<char>::do_widen(char __c) const
+ { return __c; }
+
+ const char*
+ ctype<char>::do_widen(const char* __lo, const char* __hi, char* __dest) const
+ {
+ memcpy(__dest, __lo, __hi - __lo);
+ return __hi;
+ }
+
+ char
+ ctype<char>::do_narrow(char __c, char /*__dfault*/) const
+ { return __c; }
+
+ const char*
+ ctype<char>::do_narrow(const char* __lo, const char* __hi,
+ char /*__dfault*/, char* __dest) const
+ {
+ memcpy(__dest, __lo, __hi - __lo);
+ return __hi;
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ ctype<wchar_t>::ctype(size_t __refs)
+ : __ctype_abstract_base<wchar_t>(__refs)
+ { _M_c_locale_ctype = _S_c_locale; }
+
+ ctype<wchar_t>::ctype(__c_locale __cloc, size_t __refs)
+ : __ctype_abstract_base<wchar_t>(__refs)
+ { _M_c_locale_ctype = _S_clone_c_locale(__cloc); }
+
+ ctype<wchar_t>::~ctype()
+ {
+ if (_M_c_locale_ctype != _S_c_locale)
+ _S_destroy_c_locale(_M_c_locale_ctype);
+ }
+
+ template<>
+ ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
+ : ctype<wchar_t>(__refs)
+ {
+ if (_M_c_locale_ctype != _S_c_locale)
+ _S_destroy_c_locale(_M_c_locale_ctype);
+ _S_create_c_locale(_M_c_locale_ctype, __s);
+ }
+#endif
+
+ // Definitions for static const data members of time_base
+ template<>
+ const char*
+ __timepunct<char>::_S_timezones[14] =
+ {
+ "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
+ "IST", "EET", "CST", "JST"
+ };
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ const wchar_t*
+ __timepunct<wchar_t>::_S_timezones[14] =
+ {
+ L"GMT", L"HST", L"AKST", L"PST", L"MST", L"CST", L"EST", L"AST",
+ L"NST", L"CET", L"IST", L"EET", L"CST", L"JST"
+ };
+#endif
+
+ // Definitions for static const data members of money_base
+ const money_base::pattern
+ money_base::_S_default_pattern = { {symbol, sign, none, value} };
+
+ template<>
+ const ctype<char>&
+ use_facet<ctype<char> >(const locale& __loc)
+ {
+ size_t __i = ctype<char>::id._M_id();
+ const locale::_Impl* __tmp = __loc._M_impl;
+ return static_cast<const ctype<char>&>(*(__tmp->_M_facets[__i]));
+ }
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template<>
+ const ctype<wchar_t>&
+ use_facet<ctype<wchar_t> >(const locale& __loc)
+ {
+ size_t __i = ctype<wchar_t>::id._M_id();
+ const locale::_Impl* __tmp = __loc._M_impl;
+ return static_cast<const ctype<wchar_t>&>(*(__tmp->_M_facets[__i]));
+ }
+#endif
+
+ const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF";
+
+ bool
+ __num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod,
+ streamsize __prec)
+ {
+ bool __incl_prec = false;
+ ios_base::fmtflags __flags = __io.flags();
+ *__fptr++ = '%';
+ // [22.2.2.2.2] Table 60
+ if (__flags & ios_base::showpos)
+ *__fptr++ = '+';
+ if (__flags & ios_base::showpoint)
+ *__fptr++ = '#';
+ // As per [22.2.2.2.2.11]
+ if (__flags & ios_base::fixed || __prec > 0)
+ {
+ *__fptr++ = '.';
+ *__fptr++ = '*';
+ __incl_prec = true;
+ }
+ if (__mod)
+ *__fptr++ = __mod;
+ ios_base::fmtflags __fltfield = __flags & ios_base::floatfield;
+ // [22.2.2.2.2] Table 58
+ if (__fltfield == ios_base::fixed)
+ *__fptr++ = 'f';
+ else if (__fltfield == ios_base::scientific)
+ *__fptr++ = (__flags & ios_base::uppercase) ? 'E' : 'e';
+ else
+ *__fptr++ = (__flags & ios_base::uppercase) ? 'G' : 'g';
+ *__fptr = '\0';
+ return __incl_prec;
+ }
+
+ void
+ __num_base::_S_format_int(const ios_base& __io, char* __fptr, char __mod,
+ char __modl)
+ {
+ ios_base::fmtflags __flags = __io.flags();
+ *__fptr++ = '%';
+ // [22.2.2.2.2] Table 60
+ if (__flags & ios_base::showpos)
+ *__fptr++ = '+';
+ if (__flags & ios_base::showbase)
+ *__fptr++ = '#';
+ *__fptr++ = 'l';
+
+ // For long long types.
+ if (__modl)
+ *__fptr++ = __modl;
+
+ ios_base::fmtflags __bsefield = __flags & ios_base::basefield;
+ if (__bsefield == ios_base::hex)
+ *__fptr++ = (__flags & ios_base::uppercase) ? 'X' : 'x';
+ else if (__bsefield == ios_base::oct)
+ *__fptr++ = 'o';
+ else
+ *__fptr++ = __mod;
+ *__fptr = '\0';
+ }
+} // namespace std
+
diff --git a/contrib/libstdc++/src/localename.cc b/contrib/libstdc++/src/localename.cc
new file mode 100644
index 0000000..1b40e0c
--- /dev/null
+++ b/contrib/libstdc++/src/localename.cc
@@ -0,0 +1,292 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// 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 <clocale>
+#include <cstring>
+#include <locale>
+
+namespace std
+{
+ // Defined in globals.cc.
+ extern std::ctype<char> ctype_c;
+ extern std::collate<char> collate_c;
+ extern numpunct<char> numpunct_c;
+ extern num_get<char> num_get_c;
+ extern num_put<char> num_put_c;
+ extern codecvt<char, char, mbstate_t> codecvt_c;
+ extern moneypunct<char, false> moneypunct_fc;
+ extern moneypunct<char, true> moneypunct_tc;
+ extern money_get<char> money_get_c;
+ extern money_put<char> money_put_c;
+ extern __timepunct<char> timepunct_c;
+ extern time_get<char> time_get_c;
+ extern time_put<char> time_put_c;
+ extern std::messages<char> messages_c;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ extern std::ctype<wchar_t> ctype_w;
+ extern std::collate<wchar_t> collate_w;
+ extern numpunct<wchar_t> numpunct_w;
+ extern num_get<wchar_t> num_get_w;
+ extern num_put<wchar_t> num_put_w;
+ extern codecvt<wchar_t, char, mbstate_t> codecvt_w;
+ extern moneypunct<wchar_t, false> moneypunct_fw;
+ extern moneypunct<wchar_t, true> moneypunct_tw;
+ extern money_get<wchar_t> money_get_w;
+ extern money_put<wchar_t> money_put_w;
+ extern __timepunct<wchar_t> timepunct_w;
+ extern time_get<wchar_t> time_get_w;
+ extern time_put<wchar_t> time_put_w;
+ extern std::messages<wchar_t> messages_w;
+#endif
+
+ locale::_Impl::
+ ~_Impl() throw()
+ {
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ if (_M_facets[__i])
+ _M_facets[__i]->_M_remove_reference();
+ delete [] _M_facets;
+ }
+
+ // Clone existing _Impl object.
+ locale::_Impl::
+ _Impl(const _Impl& __imp, size_t __refs)
+ : _M_references(__refs), _M_facets_size(__imp._M_facets_size) // XXX
+ {
+ try
+ {
+ _M_facets = new facet*[_M_facets_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ _M_facets[__i] = 0;
+ }
+ catch(...)
+ {
+ delete [] _M_facets;
+ __throw_exception_again;
+ }
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ {
+ _M_facets[__i] = __imp._M_facets[__i];
+ if (_M_facets[__i])
+ _M_facets[__i]->_M_add_reference();
+ }
+ for (size_t __i = 0; __i < _S_num_categories; ++__i)
+ _M_names[__i] = __imp._M_names[__i];
+ }
+
+ // Construct named _Impl.
+ locale::_Impl::
+ _Impl(const char* __s, size_t __refs)
+ : _M_references(__refs), _M_facets_size(_GLIBCPP_NUM_FACETS) // XXX
+ {
+ // Initialize the underlying locale model, which also checks
+ // to see if the given name is valid.
+ __c_locale __cloc;
+ locale::facet::_S_create_c_locale(__cloc, __s);
+
+ try
+ {
+ _M_facets = new facet*[_M_facets_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ _M_facets[__i] = 0;
+ }
+ catch(...)
+ {
+ delete [] _M_facets;
+ __throw_exception_again;
+ }
+
+ // Name all the categories.
+ for (size_t i = 0; i < _S_num_categories; ++i)
+ _M_names[i] = __s;
+
+ // Construct all standard facets and add them to _M_facets.
+ _M_init_facet(new std::ctype<char>(__cloc));
+ _M_init_facet(new codecvt<char, char, mbstate_t>);
+ _M_init_facet(new numpunct<char>(__cloc));
+ _M_init_facet(new num_get<char>);
+ _M_init_facet(new num_put<char>);
+ _M_init_facet(new std::collate<char>(__cloc));
+ _M_init_facet(new moneypunct<char, false>(__cloc));
+ _M_init_facet(new moneypunct<char, true>(__cloc));
+ _M_init_facet(new money_get<char>);
+ _M_init_facet(new money_put<char>);
+ _M_init_facet(new __timepunct<char>(__cloc, __s));
+ _M_init_facet(new time_get<char>);
+ _M_init_facet(new time_put<char>);
+ _M_init_facet(new std::messages<char>(__cloc, __s));
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+ _M_init_facet(new std::ctype<wchar_t>(__cloc));
+ _M_init_facet(new codecvt<wchar_t, char, mbstate_t>);
+ _M_init_facet(new numpunct<wchar_t>(__cloc));
+ _M_init_facet(new num_get<wchar_t>);
+ _M_init_facet(new num_put<wchar_t>);
+ _M_init_facet(new std::collate<wchar_t>(__cloc));
+ _M_init_facet(new moneypunct<wchar_t, false>(__cloc));
+ _M_init_facet(new moneypunct<wchar_t, true>(__cloc));
+ _M_init_facet(new money_get<wchar_t>);
+ _M_init_facet(new money_put<wchar_t>);
+ _M_init_facet(new __timepunct<wchar_t>(__cloc, __s));
+ _M_init_facet(new time_get<wchar_t>);
+ _M_init_facet(new time_put<wchar_t>);
+ _M_init_facet(new std::messages<wchar_t>(__cloc, __s));
+#endif
+ locale::facet::_S_destroy_c_locale(__cloc);
+ }
+
+ // Construct "C" _Impl.
+ locale::_Impl::
+ _Impl(facet** __f, size_t __refs, bool)
+ : _M_references(__refs), _M_facets(__f), _M_facets_size(_GLIBCPP_NUM_FACETS)
+ {
+ // Name all the categories.
+ for (size_t i = 0; i < _S_num_categories; ++i)
+ _M_names[i] = "C";
+
+ // This is needed as presently the C++ version of "C" locales
+ // != data in the underlying locale model for __timepunct,
+ // numpunct, and moneypunct. Also, the "C" locales must be
+ // constructed in a way such that they are pre-allocated.
+ _M_init_facet(new (&ctype_c) std::ctype<char>);
+ _M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>);
+ _M_init_facet(new (&numpunct_c) numpunct<char>);
+ _M_init_facet(new (&num_get_c) num_get<char>);
+ _M_init_facet(new (&num_put_c) num_put<char>);
+ _M_init_facet(new (&collate_c) std::collate<char>);
+ _M_init_facet(new (&moneypunct_fc) moneypunct<char, false>);
+ _M_init_facet(new (&moneypunct_tc) moneypunct<char, true>);
+ _M_init_facet(new (&money_get_c) money_get<char>);
+ _M_init_facet(new (&money_put_c) money_put<char>);
+ _M_init_facet(new (&timepunct_c) __timepunct<char>);
+ _M_init_facet(new (&time_get_c) time_get<char>);
+ _M_init_facet(new (&time_put_c) time_put<char>);
+ _M_init_facet(new (&messages_c) std::messages<char>);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ _M_init_facet(new (&ctype_w) std::ctype<wchar_t>);
+ _M_init_facet(new (&codecvt_w) codecvt<wchar_t, char, mbstate_t>);
+ _M_init_facet(new (&numpunct_w) numpunct<wchar_t>);
+ _M_init_facet(new (&num_get_w) num_get<wchar_t>);
+ _M_init_facet(new (&num_put_w) num_put<wchar_t>);
+ _M_init_facet(new (&collate_w) std::collate<wchar_t>);
+ _M_init_facet(new (&moneypunct_fw) moneypunct<wchar_t, false>);
+ _M_init_facet(new (&moneypunct_tw) moneypunct<wchar_t, true>);
+ _M_init_facet(new (&money_get_w) money_get<wchar_t>);
+ _M_init_facet(new (&money_put_w) money_put<wchar_t>);
+ _M_init_facet(new (&timepunct_w) __timepunct<wchar_t>);
+ _M_init_facet(new (&time_get_w) time_get<wchar_t>);
+ _M_init_facet(new (&time_put_w) time_put<wchar_t>);
+ _M_init_facet(new (&messages_w) std::messages<wchar_t>);
+#endif
+ }
+
+ void
+ locale::_Impl::
+ _M_replace_categories(const _Impl* __imp, category __cat)
+ {
+ category __mask;
+ for (unsigned int __ix = 0; __ix < _S_num_categories; ++__ix)
+ {
+ __mask = 1 << __ix;
+ if (__mask & __cat)
+ {
+ // Need to replace entry in _M_facets with other locale's info.
+ _M_replace_category(__imp, _S_facet_categories[__ix]);
+ // If both have names, go ahead and mangle.
+ if (strcmp(_M_names[__ix], "*") != 0
+ && strcmp(__imp->_M_names[__ix], "*") != 0)
+ _M_names[__ix] = __imp->_M_names[__ix];
+ }
+ }
+ }
+
+ void
+ locale::_Impl::
+ _M_replace_category(const _Impl* __imp, const locale::id* const* __idpp)
+ {
+ for (; *__idpp; ++__idpp)
+ _M_replace_facet(__imp, *__idpp);
+ }
+
+ void
+ locale::_Impl::
+ _M_replace_facet(const _Impl* __imp, const locale::id* __idp)
+ {
+ size_t __index = __idp->_M_id();
+ if ((__index > (__imp->_M_facets_size - 1)) || !__imp->_M_facets[__index])
+ __throw_runtime_error("no locale facet");
+ _M_install_facet(__idp, __imp->_M_facets[__index]);
+ }
+
+ void
+ locale::_Impl::
+ _M_install_facet(const locale::id* __idp, facet* __fp)
+ {
+ if (__fp)
+ {
+ size_t __index = __idp->_M_id();
+ if (__index > _M_facets_size - 1)
+ {
+ facet** __old = _M_facets;
+ facet** __new;
+ const size_t __new_size = __index + 4;
+ try
+ { __new = new facet*[__new_size]; }
+ catch(...)
+ {
+ delete [] __new;
+ __throw_exception_again;
+ }
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ __new[__i] = _M_facets[__i];
+ for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2)
+ __new[__i2] = 0;
+
+ _M_facets_size = __new_size;
+ _M_facets = __new;
+ delete [] __old;
+ }
+
+ facet*& __fpr = _M_facets[__index];
+ if (__fpr)
+ {
+ // Replacing an existing facet. Order matters.
+ __fp->_M_add_reference();
+ __fpr->_M_remove_reference();
+ __fpr = __fp;
+ }
+ else
+ {
+ // Installing a newly created facet into an empty
+ // _M_facets container, say a newly-constructed,
+ // swanky-fresh _Impl.
+ _M_facets[__index] = __fp;
+ }
+ }
+ }
+} // namespace std
diff --git a/contrib/libstdc++/src/misc-inst.cc b/contrib/libstdc++/src/misc-inst.cc
new file mode 100644
index 0000000..07a4b1a
--- /dev/null
+++ b/contrib/libstdc++/src/misc-inst.cc
@@ -0,0 +1,274 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// 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 <string>
+#include <algorithm>
+#include <locale>
+#include <vector>
+#include <iterator>
+#include <streambuf>
+#include <sstream>
+#include <fstream>
+#include <ios>
+#include <istream>
+#include <ostream>
+#include <iomanip>
+#include <ext/stdio_filebuf.h>
+
+// NB: Unnecessary if the .h headers already 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
+
+ // stringbuf
+ template class basic_stringbuf<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_stringbuf<wchar_t>;
+#endif
+
+ // filebuf
+ 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
+
+ // iomanip
+ template class _Setfill<char>;
+ template _Setfill<char> setfill(char);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class _Setfill<wchar_t>;
+ template _Setfill<wchar_t> setfill(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*);
+
+ template istream& operator>>(istream&, _Setfill<char>);
+ template istream& operator>>(istream&, _Setiosflags);
+ template istream& operator>>(istream&, _Resetiosflags);
+ template istream& operator>>(istream&, _Setbase);
+ template istream& operator>>(istream&, _Setprecision);
+ template istream& operator>>(istream&, _Setw);
+
+#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*);
+
+ template wistream& operator>>(wistream&, _Setfill<wchar_t>);
+ template wistream& operator>>(wistream&, _Setiosflags);
+ template wistream& operator>>(wistream&, _Resetiosflags);
+ template wistream& operator>>(wistream&, _Setbase);
+ template wistream& operator>>(wistream&, _Setprecision);
+ template wistream& operator>>(wistream&, _Setw);
+#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&, _Setiosflags);
+ template ostream& operator<<(ostream&, _Resetiosflags);
+ template ostream& operator<<(ostream&, _Setbase);
+ template ostream& operator<<(ostream&, _Setprecision);
+ template ostream& operator<<(ostream&, _Setw);
+
+#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&, _Setiosflags);
+ template wostream& operator<<(wostream&, _Resetiosflags);
+ template wostream& operator<<(wostream&, _Setbase);
+ template wostream& operator<<(wostream&, _Setprecision);
+ template wostream& operator<<(wostream&, _Setw);
+#endif
+
+
+ // iostream
+ template class basic_iostream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_iostream<wchar_t>;
+#endif
+
+ // ifstream
+ template class basic_ifstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_ifstream<wchar_t>;
+#endif
+
+ // ofstream
+ template class basic_ofstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_ofstream<wchar_t>;
+#endif
+
+ // fstream
+ template class basic_fstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_fstream<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
+
+ // stringstream
+ template class basic_stringstream<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class basic_stringstream<wchar_t>;
+#endif
+
+ // string related to iostreams
+ template
+ basic_istream<char>&
+ operator>>(basic_istream<char>&, string&);
+ template
+ basic_ostream<char>&
+ operator<<(basic_ostream<char>&, const string&);
+ template
+ basic_istream<char>&
+ getline(basic_istream<char>&, string&, char);
+ template
+ basic_istream<char>&
+ getline(basic_istream<char>&, string&);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ basic_istream<wchar_t>&
+ operator>>(basic_istream<wchar_t>&, wstring&);
+ template
+ basic_ostream<wchar_t>&
+ operator<<(basic_ostream<wchar_t>&, const wstring&);
+ template
+ basic_istream<wchar_t>&
+ getline(basic_istream<wchar_t>&, wstring&, wchar_t);
+ template
+ basic_istream<wchar_t>&
+ getline(basic_istream<wchar_t>&, wstring&);
+#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 &, __false_type);
+
+ template
+ string*
+ __uninitialized_copy_aux<vector<string>::const_iterator, string *>
+ (vector<string>::const_iterator, vector<string>::const_iterator,
+ string*, __false_type);
+
+ template
+ streamsize
+ __copy_streambufs(basic_ios<char>&, basic_streambuf<char>*,
+ basic_streambuf<char>*);
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template
+ streamsize
+ __copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*,
+ basic_streambuf<wchar_t>*);
+#endif
+
+ using __gnu_cxx::stdio_filebuf;
+ template class stdio_filebuf<char>;
+#ifdef _GLIBCPP_USE_WCHAR_T
+ template class stdio_filebuf<wchar_t>;
+#endif
+} //std
diff --git a/contrib/libstdc++/src/stdexcept.cc b/contrib/libstdc++/src/stdexcept.cc
new file mode 100644
index 0000000..d39d41f
--- /dev/null
+++ b/contrib/libstdc++/src/stdexcept.cc
@@ -0,0 +1,78 @@
+// Methods for Exception Support for -*- C++ -*-
+
+// Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// 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: 19.1 Exception classes
+//
+
+#include <string>
+#include <stdexcept>
+
+namespace std
+{
+ logic_error::logic_error(const string& __arg)
+ : exception(), _M_msg(__arg) { }
+
+ logic_error::~logic_error() throw() { };
+
+ const char*
+ logic_error::what() const throw()
+ { return _M_msg.c_str(); }
+
+ domain_error::domain_error(const string& __arg)
+ : logic_error(__arg) { }
+
+ invalid_argument::invalid_argument(const string& __arg)
+ : logic_error(__arg) { }
+
+ length_error::length_error(const string& __arg)
+ : logic_error(__arg) { }
+
+ out_of_range::out_of_range(const string& __arg)
+ : logic_error(__arg) { }
+
+ runtime_error::runtime_error(const string& __arg)
+ : exception(), _M_msg(__arg) { }
+
+ runtime_error::~runtime_error() throw() { };
+
+ const char*
+ runtime_error::what() const throw()
+ { return _M_msg.c_str(); }
+
+ range_error::range_error(const string& __arg)
+ : runtime_error(__arg) { }
+
+ overflow_error::overflow_error(const string& __arg)
+ : runtime_error(__arg) { }
+
+ underflow_error::underflow_error(const string& __arg)
+ : runtime_error(__arg) { }
+} // namespace std
+
diff --git a/contrib/libstdc++/src/stl-inst.cc b/contrib/libstdc++/src/stl-inst.cc
new file mode 100644
index 0000000..d8879a7
--- /dev/null
+++ b/contrib/libstdc++/src/stl-inst.cc
@@ -0,0 +1,47 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1999, 2001, 2002 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 <memory>
+
+namespace std
+{
+ template class allocator<char>;
+ template class allocator<wchar_t>;
+
+#ifdef __USE_MALLOC
+ template class __malloc_alloc_template<0>;
+#else
+ template class __default_alloc_template<true, 0>;
+#endif
+} // namespace std
diff --git a/contrib/libstdc++/src/string-inst.cc b/contrib/libstdc++/src/string-inst.cc
new file mode 100644
index 0000000..e812aa0
--- /dev/null
+++ b/contrib/libstdc++/src/string-inst.cc
@@ -0,0 +1,135 @@
+// Components for manipulating sequences of characters -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// 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 <string>
+
+// Instantiation configuration.
+#ifndef C
+# define C char
+#endif
+
+namespace std
+{
+ typedef basic_string<C> S;
+
+ template class basic_string<C>;
+ template S operator+(const C*, const S&);
+ template S operator+(C, const S&);
+} // namespace std
+
+namespace __gnu_cxx
+{
+ using std::S;
+ template bool operator==(const S::iterator&, const S::iterator&);
+ template bool operator==(const S::const_iterator&, const S::const_iterator&);
+}
+
+namespace std
+{
+ // Only one template keyword allowed here.
+ // See core issue #46 (NAD)
+ // http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_closed.html#46
+ template
+ S::basic_string(C*, C*, const allocator<C>&);
+
+ template
+ S::basic_string(const C*, const C*, const allocator<C>&);
+
+ template
+ S::basic_string(S::iterator, S::iterator, const allocator<C>&);
+
+ template
+ S::basic_string(S::const_iterator, S::const_iterator, const allocator<C>&);
+
+ template
+ S&
+ S::_M_replace(S::iterator, S::iterator, S::iterator, S::iterator,
+ input_iterator_tag);
+
+ template
+ S&
+ S::_M_replace(S::iterator, S::iterator, S::const_iterator,
+ S::const_iterator, input_iterator_tag);
+
+ template
+ S&
+ S::_M_replace(S::iterator, S::iterator, C*, C*, input_iterator_tag);
+
+ template
+ S&
+ S::_M_replace(S::iterator, S::iterator, const C*, const C*,
+ input_iterator_tag);
+
+ template
+ S&
+ S::_M_replace_safe(S::iterator, S::iterator, S::iterator, S::iterator);
+
+ template
+ S&
+ S::_M_replace_safe(S::iterator, S::iterator, S::const_iterator,
+ S::const_iterator);
+
+ template
+ S&
+ S::_M_replace_safe(S::iterator, S::iterator, C*, C*);
+
+ template
+ S&
+ S::_M_replace_safe(S::iterator, S::iterator, const C*, const C*);
+
+ template
+ C*
+ S::_S_construct(S::iterator, S::iterator,
+ const allocator<C>&, forward_iterator_tag);
+
+ template
+ C*
+ S::_S_construct(S::const_iterator, S::const_iterator,
+ const allocator<C>&, forward_iterator_tag);
+
+ template
+ C*
+ S::_S_construct(C*, C*, const allocator<C>&, forward_iterator_tag);
+
+ template
+ C*
+ S::_S_construct(const C*, const C*, const allocator<C>&,
+ forward_iterator_tag);
+
+ template
+ void
+ __destroy_aux<S*>(S*, S*, __false_type);
+} // namespace std
diff --git a/contrib/libstdc++/src/strstream.cc b/contrib/libstdc++/src/strstream.cc
new file mode 100644
index 0000000..2160c44
--- /dev/null
+++ b/contrib/libstdc++/src/strstream.cc
@@ -0,0 +1,458 @@
+// strstream definitions -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation
+//
+// This file is part of GNU CC.
+//
+// GNU CC 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.
+//
+// GNU CC 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 GNU CC; 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.
+
+/*
+ * 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 <strstream.h>
+#include <algorithm>
+#include <new>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+namespace std
+{
+
+// 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 == static_cast<int_type>(gptr()[-1])) { // 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();
+}
+
+} // namespace std
+
+// Local Variables:
+// mode:C++
+// End:
diff --git a/contrib/libstdc++/src/valarray-inst.cc b/contrib/libstdc++/src/valarray-inst.cc
new file mode 100644
index 0000000..b56a911
--- /dev/null
+++ b/contrib/libstdc++/src/valarray-inst.cc
@@ -0,0 +1,118 @@
+// Explicit instantiation file.
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882:
+//
+
+#include <valarray>
+
+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 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)
+ {
+ typedef const size_t* __restrict__ _Tp;
+ const size_t __n = __a.size();
+ // XXX: This ugly cast is necessary because
+ // valarray::operator[]() const return a VALUE!
+ // Try to get the committee to correct that gross error.
+ valarray<size_t>& __t = const_cast<valarray<size_t>&>(__a);
+ return __valarray_product(&__t[0], &__t[0] + __n);
+ }
+
+ // Map a gslice, described by its multidimensional LENGTHS
+ // and corresponding STRIDES, to a linear array of INDEXES
+ // for the purpose of indexing a flat, one-dimensional array
+ // representation of a gslice_array.
+ void
+ __gslice_to_index(size_t __o, const valarray<size_t>& __l,
+ const valarray<size_t>& __s, valarray<size_t>& __i)
+ {
+ // There are as much as dimensions as there are strides.
+ size_t __n = __l.size();
+
+ // Get a buffer to hold current multi-index as we go through
+ // the gslice for the purpose of computing its linear-image.
+ size_t* const __t = static_cast<size_t*>
+ (__builtin_alloca(__n * sizeof (size_t)));
+ __valarray_fill(__t, __n, size_t(0));
+
+ // Note that this should match the product of all numbers appearing
+ // in __l which describes the multidimensional sizes of the
+ // the generalized slice.
+ const size_t __z = __i.size();
+
+ for (size_t __j = 0; __j < __z; ++__j)
+ {
+ // Compute the linear-index image of (t_0, ... t_{n-1}).
+ // Normaly, we should use inner_product<>(), but we do it the
+ // the hard way here to avoid link-time can of worms.
+ size_t __a = __o;
+ for (size_t __k = 0; __k < __n; ++__k)
+ __a += __s[__k] * __t[__k];
+
+ __i[__j] = __a;
+
+ // Process the next multi-index. The loop ought to be
+ // backward since we're making a lexicagraphical visit.
+ ++__t[__n - 1];
+ for (size_t __k2 = __n - 1; __k2; --__k2)
+ {
+ if (__t[__k2] >= __l[__k2])
+ {
+ __t[__k2] = 0;
+ ++__t[__k2 - 1];
+ }
+ }
+ }
+ }
+
+ gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __l,
+ const valarray<size_t>& __s)
+ : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s),
+ _M_index(__l.size() == 0 ? 0 : __valarray_product(__l))
+ { __gslice_to_index(__o, __l, __s, _M_index); }
+
+} // namespace std
+
diff --git a/contrib/libstdc++/src/vterminate.cc b/contrib/libstdc++/src/vterminate.cc
new file mode 100644
index 0000000..a3543c9
--- /dev/null
+++ b/contrib/libstdc++/src/vterminate.cc
@@ -0,0 +1,83 @@
+// Verbose terminate_handler -*- C++ -*-
+
+// Copyright (C) 2001, 2002 Free Software Foundation
+//
+// This file is part of GNU CC.
+//
+// GNU CC 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.
+//
+// GNU CC 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 GNU CC; 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 <cstdlib>
+#include <cstdio>
+#include <exception>
+#include <exception_defines.h>
+#include <cxxabi.h>
+
+using namespace std;
+using namespace abi;
+
+namespace __gnu_cxx
+{
+ /* A replacement for the standard terminate_handler which prints
+ more information about the terminating exception (if any) on
+ stderr. */
+ void __verbose_terminate_handler()
+ {
+ // Make sure there was an exception; terminate is also called for an
+ // attempt to rethrow when there is no suitable exception.
+ type_info *t = __cxa_current_exception_type();
+ if (t)
+ {
+ char const *name = t->name();
+ // Note that "name" is the mangled name.
+
+ {
+ int status = -1;
+ char *dem = 0;
+
+ // Disabled until __cxa_demangle gets the runtime GPL exception.
+ dem = __cxa_demangle(name, 0, 0, &status);
+
+ printf("terminate called after throwing a `%s'\n",
+ status == 0 ? dem : name);
+
+ if (status == 0)
+ free(dem);
+ }
+
+ // If the exception is derived from std::exception, we can give more
+ // information.
+ try { __throw_exception_again; }
+#ifdef __EXCEPTIONS
+ catch (exception &exc)
+ { fprintf(stderr, " what(): %s\n", exc.what()); }
+#endif
+ catch (...) { }
+ }
+ else
+ fprintf(stderr, "terminate called without an active exception\n");
+
+ abort();
+ }
+} // namespace __gnu_cxx
diff --git a/contrib/libstdc++/src/wstring-inst.cc b/contrib/libstdc++/src/wstring-inst.cc
new file mode 100644
index 0000000..0200fd4
--- /dev/null
+++ b/contrib/libstdc++/src/wstring-inst.cc
@@ -0,0 +1,6 @@
+#include <bits/c++config.h>
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+#define C wchar_t
+#include "string-inst.cc"
+#endif
OpenPOWER on IntegriCloud