summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/src
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2004-07-28 03:12:05 +0000
committerkan <kan@FreeBSD.org>2004-07-28 03:12:05 +0000
commit96bad46eee8bf907dceb152bbb9d128bed5a4956 (patch)
tree75ef0e6da73746d6849e25a0996ae34e1aeff51d /contrib/libstdc++/src
parent5e00ec74d8ce58f99801200d4d3d0412c7cc1b28 (diff)
downloadFreeBSD-src-96bad46eee8bf907dceb152bbb9d128bed5a4956.zip
FreeBSD-src-96bad46eee8bf907dceb152bbb9d128bed5a4956.tar.gz
Gcc 3.4.2 20040728 C++ support bits.
Diffstat (limited to 'contrib/libstdc++/src')
-rw-r--r--contrib/libstdc++/src/Makefile.am186
-rw-r--r--contrib/libstdc++/src/Makefile.in741
-rw-r--r--contrib/libstdc++/src/allocator-inst.cc51
-rw-r--r--contrib/libstdc++/src/allocator.cc169
-rw-r--r--contrib/libstdc++/src/codecvt.cc63
-rw-r--r--contrib/libstdc++/src/complex_io.cc4
-rw-r--r--contrib/libstdc++/src/concept-inst.cc8
-rw-r--r--contrib/libstdc++/src/ctype.cc100
-rw-r--r--contrib/libstdc++/src/debug.cc660
-rw-r--r--contrib/libstdc++/src/debug_list.cc34
-rw-r--r--contrib/libstdc++/src/ext-inst.cc17
-rw-r--r--contrib/libstdc++/src/fstream-inst.cc8
-rw-r--r--contrib/libstdc++/src/functexcept.cc28
-rw-r--r--contrib/libstdc++/src/globals_io.cc129
-rw-r--r--contrib/libstdc++/src/globals_locale.cc210
-rw-r--r--contrib/libstdc++/src/io-inst.cc9
-rw-r--r--contrib/libstdc++/src/ios.cc228
-rw-r--r--contrib/libstdc++/src/ios_failure.cc48
-rw-r--r--contrib/libstdc++/src/ios_init.cc196
-rw-r--r--contrib/libstdc++/src/ios_locale.cc60
-rw-r--r--contrib/libstdc++/src/istream-inst.cc2
-rw-r--r--contrib/libstdc++/src/limits.cc4
-rw-r--r--contrib/libstdc++/src/list.cc141
-rw-r--r--contrib/libstdc++/src/locale-inst.cc555
-rw-r--r--contrib/libstdc++/src/locale-misc-inst.cc47
-rw-r--r--contrib/libstdc++/src/locale.cc626
-rw-r--r--contrib/libstdc++/src/locale_facets.cc93
-rw-r--r--contrib/libstdc++/src/locale_init.cc347
-rw-r--r--contrib/libstdc++/src/localename.cc518
-rw-r--r--contrib/libstdc++/src/misc-inst.cc39
-rw-r--r--contrib/libstdc++/src/ostream-inst.cc2
-rw-r--r--contrib/libstdc++/src/sstream-inst.cc8
-rw-r--r--contrib/libstdc++/src/stdexcept.cc6
-rw-r--r--contrib/libstdc++/src/streambuf-inst.cc8
-rw-r--r--contrib/libstdc++/src/string-inst.cc69
-rw-r--r--contrib/libstdc++/src/strstream.cc8
-rw-r--r--contrib/libstdc++/src/tree.cc431
-rw-r--r--contrib/libstdc++/src/wlocale-inst.cc39
-rw-r--r--contrib/libstdc++/src/wstring-inst.cc35
39 files changed, 3956 insertions, 1971 deletions
diff --git a/contrib/libstdc++/src/Makefile.am b/contrib/libstdc++/src/Makefile.am
index 304c035..ed4c710 100644
--- a/contrib/libstdc++/src/Makefile.am
+++ b/contrib/libstdc++/src/Makefile.am
@@ -22,175 +22,161 @@
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
-AUTOMAKE_OPTIONS = 1.3 cygnus
-MAINT_CHARSET = latin1
-
-mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+include $(top_srcdir)/fragment.am
# Cross compiler support.
-CXX = @glibcpp_CXX@
-glibcpp_srcdir=@glibcpp_srcdir@
-glibcpp_builddir=@glibcpp_builddir@
-toolexecdir = @glibcpp_toolexecdir@
-toolexeclibdir = @glibcpp_toolexeclibdir@
toolexeclib_LTLIBRARIES = libstdc++.la
# Symbol versioning for shared libraries.
-if GLIBCPP_BUILD_VERSIONED_SHLIB
+if GLIBCXX_BUILD_VERSIONED_SHLIB
version_arg = -Wl,--version-script=libstdc++-symbol.ver
-libstdc++-symbol.ver: ${glibcpp_srcdir}/@SYMVER_MAP@
- @LN_S@ ${glibcpp_srcdir}/@SYMVER_MAP@ ./libstdc++-symbol.ver || true
+version_dep = libstdc++-symbol.ver
+libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
+ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
+ if test "x$(port_specific_symbol_files)" != x; then \
+ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
+ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
+ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
+ rm tmp.top tmp.bottom; \
+ fi
else
version_arg =
-libstdc++-symbol.ver:
+version_dep =
endif
-# 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
-CONFIG_CXXFLAGS = \
- @SECTION_FLAGS@ @EXTRA_CXX_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)
# Source files linked in via configuration/make substitution for a
-# particular target.
-target_sources = \
+# particular host.
+host_sources = \
+ atomicity.cc \
codecvt_members.cc \
collate_members.cc \
ctype_members.cc \
messages_members.cc \
monetary_members.cc \
numeric_members.cc \
- time_members.cc
+ time_members.cc
+
+codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
-codecvt_members.cc: ${glibcpp_srcdir}/@CCODECVT_CC@
- @LN_S@ ${glibcpp_srcdir}/@CCODECVT_CC@ . || true
+collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
-collate_members.cc: ${glibcpp_srcdir}/@CCOLLATE_CC@
- @LN_S@ ${glibcpp_srcdir}/@CCOLLATE_CC@ . || true
+ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
-ctype_members.cc: ${glibcpp_srcdir}/@CCTYPE_CC@
- @LN_S@ ${glibcpp_srcdir}/@CCTYPE_CC@ . || true
+messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
-messages_members.cc: ${glibcpp_srcdir}/@CMESSAGES_CC@
- @LN_S@ ${glibcpp_srcdir}/@CMESSAGES_CC@ . || true
+monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
-monetary_members.cc: ${glibcpp_srcdir}/@CMONEY_CC@
- @LN_S@ ${glibcpp_srcdir}/@CMONEY_CC@ . || true
+numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
-numeric_members.cc: ${glibcpp_srcdir}/@CNUMERIC_CC@
- @LN_S@ ${glibcpp_srcdir}/@CNUMERIC_CC@ . || true
+time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
-time_members.cc: ${glibcpp_srcdir}/@CTIME_CC@
- @LN_S@ ${glibcpp_srcdir}/@CTIME_CC@ . || true
+atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
+atomicity.cc: ${atomicity_file}
+ $(LN_S) ${atomicity_file} ./atomicity.cc || true
# Source files linked in via configuration/make substitution for a
-# particular target, but with ad hoc naming rules.
-target_sources_extra = \
+# particular host, but with ad hoc naming rules.
+host_sources_extra = \
basic_file.cc \
- c++locale.cc
+ c++locale.cc
-c++locale.cc: ${glibcpp_srcdir}/@CLOCALE_CC@
- @LN_S@ ${glibcpp_srcdir}/@CLOCALE_CC@ ./$@ || true
+c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
-basic_file.cc: ${glibcpp_srcdir}/@BASIC_FILE_CC@
- @LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_CC@ ./$@ || true
+basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
# Sources present in the src directory.
sources = \
- bitset.cc \
+ allocator.cc \
codecvt.cc \
complex_io.cc \
- concept-inst.cc \
ctype.cc \
- ext-inst.cc \
- fstream.cc \
- fstream-inst.cc \
+ debug.cc \
+ debug_list.cc \
functexcept.cc \
- globals.cc \
- io-inst.cc \
+ globals_locale.cc \
+ globals_io.cc \
ios.cc \
- istream-inst.cc \
+ ios_failure.cc \
+ ios_init.cc \
+ ios_locale.cc \
limits.cc \
+ list.cc \
locale.cc \
- locale-inst.cc \
+ locale_init.cc \
+ locale_facets.cc \
localename.cc \
+ stdexcept.cc \
+ strstream.cc \
+ tree.cc \
+ allocator-inst.cc \
+ concept-inst.cc \
+ fstream-inst.cc \
+ ext-inst.cc \
+ io-inst.cc \
+ istream-inst.cc \
+ locale-inst.cc \
+ locale-misc-inst.cc \
misc-inst.cc \
ostream-inst.cc \
sstream-inst.cc \
- stdexcept.cc \
- stl-inst.cc \
streambuf-inst.cc \
string-inst.cc \
- strstream.cc \
valarray-inst.cc \
- vterminate.cc \
+ wlocale-inst.cc \
wstring-inst.cc \
- ${target_sources} \
- ${target_sources_extra}
+ ${host_sources} \
+ ${host_sources_extra}
VPATH = $(top_srcdir)/src:$(top_srcdir)
libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = \
- $(top_builddir)/libmath/libmath.la @libio_la@ \
+ $(top_builddir)/libmath/libmath.la \
$(top_builddir)/libsupc++/libsupc++convenience.la
-libstdc___la_DEPENDENCIES = libstdc++-symbol.ver $(libstdc___la_LIBADD)
+libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
libstdc___la_LDFLAGS = \
- -version-info @libtool_VERSION@ ${version_arg} \
- -lm @LIBUNWIND_FLAG@
+ -version-info $(libtool_VERSION) ${version_arg} -lm
# Use special rules for the deprecated source files so that they find
# deprecated include files.
-GLIBCPP_INCLUDE_DIR=@glibcpp_builddir@/include
+GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
strstream.lo: strstream.cc
- $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+ $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
strstream.o: strstream.cc
- $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+ $(CXXCOMPILE) -I$(GLIBCXX_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 $<
+ $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
concept-inst.o: concept-inst.cc
- $(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
-
+ $(CXXCOMPILE) -D_GLIBCXX_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.
+# as the occasion calls for it.
AM_CXXFLAGS = \
-fno-implicit-templates \
- $(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
- $(CONFIG_CXXFLAGS)
+ $(CONFIG_CXXFLAGS)
# libstdc++ libtool notes
@@ -212,7 +198,7 @@ AM_CXXFLAGS = \
# 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)
+ $(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
@@ -221,38 +207,38 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
# 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 $@
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
# Added bits to build debug library.
-if GLIBCPP_BUILD_DEBUG
+if GLIBCXX_BUILD_DEBUG
all-local: build_debug
install-data-local: install_debug
else
all-local:
-install-data-local:
+install-data-local:
endif
debugdir = debug
# Build parallel set of debug objects here.
-stamp-debug:
+stamp-debug:
if test ! -d ${debugdir}; then \
mkdir -p ${debugdir}; \
(cd ${debugdir}; \
sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
-e 's/srcdir = \.\./srcdir = ..\/../' \
- -e 's/glibcpp_basedir = \.\./glibcpp_basedir = ..\/../' \
+ -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
-e 's/all-local: build_debug/all-local:/' \
-e 's/install-data-local: install_debug/install-data-local:/' \
< ../Makefile > Makefile) ; \
fi; \
- echo `date` > stamp-debug;
+ echo `date` > stamp-debug;
build_debug: stamp-debug
- (cd ${debugdir} && $(MAKE) CXXFLAGS='@DEBUG_FLAGS@' all)
+ (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
# Install debug library here.
-install_debug:
+install_debug:
(cd ${debugdir} && $(MAKE) \
- toolexeclibdir=@glibcpp_toolexeclibdir@/debug install)
+ toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
diff --git a/contrib/libstdc++/src/Makefile.in b/contrib/libstdc++/src/Makefile.in
index 95c1cf8..1fae145 100644
--- a/contrib/libstdc++/src/Makefile.in
+++ b/contrib/libstdc++/src/Makefile.in
@@ -1,6 +1,8 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+# Makefile.in generated by automake 1.7.8 from Makefile.am.
+# @configure_input@
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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.
@@ -10,70 +12,53 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-
-SHELL = @SHELL@
+@SET_MAKE@
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@
-
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+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@
+
+VPATH = $(top_srcdir)/src:$(top_srcdir)
+ACLOCAL = @ACLOCAL@
+ALLOCATOR_H = @ALLOCATOR_H@
+ALLOCATOR_NAME = @ALLOCATOR_NAME@
+AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
-ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
+ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@
+ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASIC_FILE_CC = @BASIC_FILE_CC@
BASIC_FILE_H = @BASIC_FILE_H@
CC = @CC@
-CCODECVT_C = @CCODECVT_C@
CCODECVT_CC = @CCODECVT_CC@
CCODECVT_H = @CCODECVT_H@
CCOLLATE_CC = @CCOLLATE_CC@
CCTYPE_CC = @CCTYPE_CC@
+CFLAGS = @CFLAGS@
CLOCALE_CC = @CLOCALE_CC@
CLOCALE_H = @CLOCALE_H@
CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@
@@ -82,186 +67,261 @@ CMESSAGES_H = @CMESSAGES_H@
CMONEY_CC = @CMONEY_CC@
CNUMERIC_CC = @CNUMERIC_CC@
CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
CSTDIO_H = @CSTDIO_H@
CTIME_CC = @CTIME_CC@
CTIME_H = @CTIME_H@
+CXX = @CXX@
CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
C_INCLUDE_DIR = @C_INCLUDE_DIR@
DEBUG_FLAGS = @DEBUG_FLAGS@
-DLLTOOL = @DLLTOOL@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
-GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
+GLIBCXX_BUILD_DEBUG_FALSE = @GLIBCXX_BUILD_DEBUG_FALSE@
+GLIBCXX_BUILD_DEBUG_TRUE = @GLIBCXX_BUILD_DEBUG_TRUE@
+GLIBCXX_BUILD_PCH_FALSE = @GLIBCXX_BUILD_PCH_FALSE@
+GLIBCXX_BUILD_PCH_TRUE = @GLIBCXX_BUILD_PCH_TRUE@
+GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE = @GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@
+GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE = @GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@
+GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE = @GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@
+GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE = @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@
+GLIBCXX_C_HEADERS_C_FALSE = @GLIBCXX_C_HEADERS_C_FALSE@
+GLIBCXX_C_HEADERS_C_STD_FALSE = @GLIBCXX_C_HEADERS_C_STD_FALSE@
+GLIBCXX_C_HEADERS_C_STD_TRUE = @GLIBCXX_C_HEADERS_C_STD_TRUE@
+GLIBCXX_C_HEADERS_C_TRUE = @GLIBCXX_C_HEADERS_C_TRUE@
+GLIBCXX_HOSTED_FALSE = @GLIBCXX_HOSTED_FALSE@
+GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
+GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
+GLIBCXX_TEST_ABI_FALSE = @GLIBCXX_TEST_ABI_FALSE@
+GLIBCXX_TEST_ABI_TRUE = @GLIBCXX_TEST_ABI_TRUE@
+GLIBCXX_TEST_WCHAR_T_FALSE = @GLIBCXX_TEST_WCHAR_T_FALSE@
+GLIBCXX_TEST_WCHAR_T_TRUE = @GLIBCXX_TEST_WCHAR_T_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBMATHOBJS = @LIBMATHOBJS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
LIBTOOL = @LIBTOOL@
-LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
OPT_LDFLAGS = @OPT_LDFLAGS@
OS_INC_SRCDIR = @OS_INC_SRCDIR@
PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SECTION_FLAGS = @SECTION_FLAGS@
SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
STRIP = @STRIP@
SYMVER_MAP = @SYMVER_MAP@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARN_FLAGS = @WARN_FLAGS@
WERROR = @WERROR@
-baseline_file = @baseline_file@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+baseline_dir = @baseline_dir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
check_msgfmt = @check_msgfmt@
+datadir = @datadir@
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_localedir = @glibcpp_localedir@
-glibcpp_prefixdir = @glibcpp_prefixdir@
-glibcpp_thread_h = @glibcpp_thread_h@
-glibcpp_toolexecdir = @glibcpp_toolexecdir@
-glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
+exec_prefix = @exec_prefix@
+glibcxx_MOFILES = @glibcxx_MOFILES@
+glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
+glibcxx_POFILES = @glibcxx_POFILES@
+glibcxx_builddir = @glibcxx_builddir@
+glibcxx_localedir = @glibcxx_localedir@
+glibcxx_prefixdir = @glibcxx_prefixdir@
+glibcxx_srcdir = @glibcxx_srcdir@
+glibcxx_thread_h = @glibcxx_thread_h@
+glibcxx_toolexecdir = @glibcxx_toolexecdir@
+glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@
gxx_include_dir = @gxx_include_dir@
-ifGNUmake = @ifGNUmake@
-libio_la = @libio_la@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
libtool_VERSION = @libtool_VERSION@
+localstatedir = @localstatedir@
+mandir = @mandir@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+port_specific_symbol_files = @port_specific_symbol_files@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
toplevel_srcdir = @toplevel_srcdir@
-AUTOMAKE_OPTIONS = 1.3 cygnus
MAINT_CHARSET = latin1
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+PWD_COMMAND = $${PWDCMD-pwd}
+STAMP = echo timestamp >
-# Cross compiler support.
-CXX = @glibcpp_CXX@
-glibcpp_srcdir = @glibcpp_srcdir@
-glibcpp_builddir = @glibcpp_builddir@
-toolexecdir = @glibcpp_toolexecdir@
-toolexeclibdir = @glibcpp_toolexeclibdir@
-toolexeclib_LTLIBRARIES = libstdc++.la
-@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@version_arg = @GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@-Wl,--version-script=libstdc++-symbol.ver
-@GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE@version_arg =
-
-# Compile flags that should be constant throughout the build, both for
-# SUBDIRS and for libstdc++-v3 in general.
-OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
+toolexecdir = $(glibcxx_toolexecdir)
+toolexeclibdir = $(glibcxx_toolexeclibdir)
-# 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
+# These bits are all figured out from configure. Look in acinclude.m4
+# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS.
CONFIG_CXXFLAGS = \
- @SECTION_FLAGS@ @EXTRA_CXX_FLAGS@
-
+ $(SECTION_FLAGS) $(EXTRA_CXX_FLAGS)
-# Warning flags to use.
WARN_CXXFLAGS = \
- @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
+ $(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@
+# -I/-D flags to pass when compiling.
+AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
-INCLUDES = \
- -nostdinc++ \
- $(GLIBCPP_INCLUDES) \
- $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
- $(TOPLEVEL_INCLUDES)
+# Cross compiler support.
+toolexeclib_LTLIBRARIES = libstdc++.la
+# Symbol versioning for shared libraries.
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver
+@GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_arg =
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@version_dep = libstdc++-symbol.ver
+@GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE@version_dep =
# Source files linked in via configuration/make substitution for a
-# particular target.
-target_sources = \
+# particular host.
+host_sources = \
+ atomicity.cc \
codecvt_members.cc \
collate_members.cc \
ctype_members.cc \
messages_members.cc \
monetary_members.cc \
numeric_members.cc \
- time_members.cc
+ time_members.cc
+atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
+
# Source files linked in via configuration/make substitution for a
-# particular target, but with ad hoc naming rules.
-target_sources_extra = \
+# particular host, but with ad hoc naming rules.
+host_sources_extra = \
basic_file.cc \
- c++locale.cc
+ c++locale.cc
# Sources present in the src directory.
sources = \
- bitset.cc \
+ allocator.cc \
codecvt.cc \
complex_io.cc \
- concept-inst.cc \
ctype.cc \
- ext-inst.cc \
- fstream.cc \
- fstream-inst.cc \
+ debug.cc \
+ debug_list.cc \
functexcept.cc \
- globals.cc \
- io-inst.cc \
+ globals_locale.cc \
+ globals_io.cc \
ios.cc \
- istream-inst.cc \
+ ios_failure.cc \
+ ios_init.cc \
+ ios_locale.cc \
limits.cc \
+ list.cc \
locale.cc \
- locale-inst.cc \
+ locale_init.cc \
+ locale_facets.cc \
localename.cc \
+ stdexcept.cc \
+ strstream.cc \
+ tree.cc \
+ allocator-inst.cc \
+ concept-inst.cc \
+ fstream-inst.cc \
+ ext-inst.cc \
+ io-inst.cc \
+ istream-inst.cc \
+ locale-inst.cc \
+ locale-misc-inst.cc \
misc-inst.cc \
ostream-inst.cc \
sstream-inst.cc \
- stdexcept.cc \
- stl-inst.cc \
streambuf-inst.cc \
string-inst.cc \
- strstream.cc \
valarray-inst.cc \
- vterminate.cc \
+ wlocale-inst.cc \
wstring-inst.cc \
- ${target_sources} \
- ${target_sources_extra}
-
+ ${host_sources} \
+ ${host_sources_extra}
-VPATH = $(top_srcdir)/src:$(top_srcdir)
libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = \
- $(top_builddir)/libmath/libmath.la @libio_la@ \
+ $(top_builddir)/libmath/libmath.la \
$(top_builddir)/libsupc++/libsupc++convenience.la
-libstdc___la_DEPENDENCIES = libstdc++-symbol.ver $(libstdc___la_LIBADD)
+libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
libstdc___la_LDFLAGS = \
- -version-info @libtool_VERSION@ ${version_arg} \
- -lm @LIBUNWIND_FLAG@
+ -version-info $(libtool_VERSION) ${version_arg} -lm
# Use special rules for the deprecated source files so that they find
# deprecated include files.
-GLIBCPP_INCLUDE_DIR = @glibcpp_builddir@/include
+GLIBCXX_INCLUDE_DIR = $(glibcxx_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.
+# as the occasion calls for it.
AM_CXXFLAGS = \
-fno-implicit-templates \
- $(LIBSUPCXX_CXXFLAGS) \
$(WARN_CXXFLAGS) \
$(OPTIMIZE_CXXFLAGS) \
- $(CONFIG_CXXFLAGS)
+ $(CONFIG_CXXFLAGS)
# libstdc++ libtool notes
@@ -283,7 +343,7 @@ AM_CXXFLAGS = \
# 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)
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
# 3) We'd have a problem when building the shared libstdc++ object if
@@ -293,110 +353,98 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
# 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 $@
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
debugdir = debug
-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 = bitset.lo codecvt.lo complex_io.lo \
-concept-inst.lo ctype.lo ext-inst.lo fstream.lo fstream-inst.lo \
-functexcept.lo globals.lo io-inst.lo ios.lo istream-inst.lo limits.lo \
-locale.lo locale-inst.lo localename.lo misc-inst.lo ostream-inst.lo \
-sstream-inst.lo stdexcept.lo stl-inst.lo streambuf-inst.lo \
-string-inst.lo strstream.lo valarray-inst.lo vterminate.lo \
-wstring-inst.lo codecvt_members.lo collate_members.lo ctype_members.lo \
-messages_members.lo monetary_members.lo numeric_members.lo \
-time_members.lo basic_file.lo c++locale.lo
-CXXFLAGS = @CXXFLAGS@
-CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+
+am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
+ ctype_members.lo messages_members.lo monetary_members.lo \
+ numeric_members.lo time_members.lo
+am__objects_2 = basic_file.lo c++locale.lo
+am__objects_3 = allocator.lo codecvt.lo complex_io.lo ctype.lo debug.lo \
+ debug_list.lo functexcept.lo globals_locale.lo globals_io.lo \
+ ios.lo ios_failure.lo ios_init.lo ios_locale.lo limits.lo \
+ list.lo locale.lo locale_init.lo locale_facets.lo localename.lo \
+ stdexcept.lo strstream.lo tree.lo allocator-inst.lo \
+ concept-inst.lo fstream-inst.lo ext-inst.lo io-inst.lo \
+ istream-inst.lo locale-inst.lo locale-misc-inst.lo misc-inst.lo \
+ ostream-inst.lo sstream-inst.lo streambuf-inst.lo \
+ string-inst.lo valarray-inst.lo wlocale-inst.lo wstring-inst.lo \
+ $(am__objects_1) $(am__objects_2)
+am_libstdc___la_OBJECTS = $(am__objects_3)
+libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
+
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(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
+DIST_SOURCES = $(libstdc___la_SOURCES)
+DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/fragment.am \
+ Makefile.am
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:
+all: all-am
+.SUFFIXES:
+.SUFFIXES: .cc .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/fragment.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
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; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(toolexeclibdir)/$$f"; \
+ $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(toolexeclibdir)/$$f; \
else :; fi; \
done
uninstall-toolexeclibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p"; \
+ $(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 $<
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(toolexeclibdir) $(libstdc___la_LDFLAGS) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS)
mostlyclean-compile:
- -rm -f *.o core *.core
- -rm -f *.$(OBJEXT)
-
-clean-compile:
+ -rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
-maintainer-clean-compile:
-
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.cc.o:
+ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
-.s.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.cc.obj:
+ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
-.S.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+.cc.lo:
+ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
mostlyclean-libtool:
-rm -f *.lo
@@ -405,213 +453,262 @@ clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
-maintainer-clean-libtool:
+ETAGS = etags
+ETAGSFLAGS =
-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 $<
+CTAGS = ctags
+CTAGSFLAGS =
tags: TAGS
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
+ mkid -fID $$unique
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ 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)
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
-mostlyclean-tags:
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
-clean-tags:
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = src
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ $(mkinstalldirs) $(distdir)/..
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
fi; \
done
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am:
+check-am: all-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
+all-am: Makefile $(LTLIBRARIES) all-local
-install-data-am: install-data-local
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
+install: install-am
+install-exec: install-exec-am
install-data: install-data-am
+uninstall: uninstall-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-local
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
-
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
-mostlyclean-am: mostlyclean-toolexeclibLTLIBRARIES mostlyclean-compile \
- mostlyclean-libtool mostlyclean-tags \
- mostlyclean-generic
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
-mostlyclean: mostlyclean-am
+clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
+ mostlyclean-am
-clean-am: clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \
- clean-tags clean-generic mostlyclean-am
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
-clean: clean-am
+dvi: dvi-am
-distclean-am: distclean-toolexeclibLTLIBRARIES distclean-compile \
- distclean-libtool distclean-tags distclean-generic \
- clean-am
- -rm -f libtool
+dvi-am:
-distclean: distclean-am
+info: info-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."
+info-am:
+
+install-data-am: install-data-local
+
+install-exec-am: install-toolexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-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-local \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-local all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
+pdf-am:
-@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcpp_srcdir}/@SYMVER_MAP@
-@GLIBCPP_BUILD_VERSIONED_SHLIB_TRUE@ @LN_S@ ${glibcpp_srcdir}/@SYMVER_MAP@ ./libstdc++-symbol.ver || true
-@GLIBCPP_BUILD_VERSIONED_SHLIB_FALSE@libstdc++-symbol.ver:
+ps: ps-am
-codecvt_members.cc: ${glibcpp_srcdir}/@CCODECVT_CC@
- @LN_S@ ${glibcpp_srcdir}/@CCODECVT_CC@ . || true
+ps-am:
-collate_members.cc: ${glibcpp_srcdir}/@CCOLLATE_CC@
- @LN_S@ ${glibcpp_srcdir}/@CCOLLATE_CC@ . || true
+uninstall-am: uninstall-info-am uninstall-toolexeclibLTLIBRARIES
-ctype_members.cc: ${glibcpp_srcdir}/@CCTYPE_CC@
- @LN_S@ ${glibcpp_srcdir}/@CCTYPE_CC@ . || true
+.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
+ clean-generic clean-libtool clean-toolexeclibLTLIBRARIES ctags \
+ distclean distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-data-local \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip install-toolexeclibLTLIBRARIES \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-toolexeclibLTLIBRARIES
-messages_members.cc: ${glibcpp_srcdir}/@CMESSAGES_CC@
- @LN_S@ ${glibcpp_srcdir}/@CMESSAGES_CC@ . || true
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ if test "x$(port_specific_symbol_files)" != x; then \
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ rm tmp.top tmp.bottom; \
+@GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE@ fi
-monetary_members.cc: ${glibcpp_srcdir}/@CMONEY_CC@
- @LN_S@ ${glibcpp_srcdir}/@CMONEY_CC@ . || true
+codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
-numeric_members.cc: ${glibcpp_srcdir}/@CNUMERIC_CC@
- @LN_S@ ${glibcpp_srcdir}/@CNUMERIC_CC@ . || true
+collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
-time_members.cc: ${glibcpp_srcdir}/@CTIME_CC@
- @LN_S@ ${glibcpp_srcdir}/@CTIME_CC@ . || true
+ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
-c++locale.cc: ${glibcpp_srcdir}/@CLOCALE_CC@
- @LN_S@ ${glibcpp_srcdir}/@CLOCALE_CC@ ./$@ || true
+messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
-basic_file.cc: ${glibcpp_srcdir}/@BASIC_FILE_CC@
- @LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_CC@ ./$@ || true
+monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
+
+numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
+
+time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
+atomicity.cc: ${atomicity_file}
+ $(LN_S) ${atomicity_file} ./atomicity.cc || true
+
+c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
+
+basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
+ $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
strstream.lo: strstream.cc
- $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+ $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
strstream.o: strstream.cc
- $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
+ $(CXXCOMPILE) -I$(GLIBCXX_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 $<
+ $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
concept-inst.o: concept-inst.cc
- $(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
+ $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
# Added bits to build debug library.
-@GLIBCPP_BUILD_DEBUG_TRUE@all-local: build_debug
-@GLIBCPP_BUILD_DEBUG_TRUE@install-data-local: install_debug
-@GLIBCPP_BUILD_DEBUG_FALSE@all-local:
-@GLIBCPP_BUILD_DEBUG_FALSE@install-data-local:
+@GLIBCXX_BUILD_DEBUG_TRUE@all-local: build_debug
+@GLIBCXX_BUILD_DEBUG_TRUE@install-data-local: install_debug
+@GLIBCXX_BUILD_DEBUG_FALSE@all-local:
+@GLIBCXX_BUILD_DEBUG_FALSE@install-data-local:
# Build parallel set of debug objects here.
-stamp-debug:
+stamp-debug:
if test ! -d ${debugdir}; then \
mkdir -p ${debugdir}; \
(cd ${debugdir}; \
sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
-e 's/srcdir = \.\./srcdir = ..\/../' \
- -e 's/glibcpp_basedir = \.\./glibcpp_basedir = ..\/../' \
+ -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
-e 's/all-local: build_debug/all-local:/' \
-e 's/install-data-local: install_debug/install-data-local:/' \
< ../Makefile > Makefile) ; \
fi; \
- echo `date` > stamp-debug;
+ echo `date` > stamp-debug;
build_debug: stamp-debug
- (cd ${debugdir} && $(MAKE) CXXFLAGS='@DEBUG_FLAGS@' all)
+ (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
# Install debug library here.
-install_debug:
+install_debug:
(cd ${debugdir} && $(MAKE) \
- toolexeclibdir=@glibcpp_toolexeclibdir@/debug install)
-
+ toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
# 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/allocator-inst.cc b/contrib/libstdc++/src/allocator-inst.cc
new file mode 100644
index 0000000..40d7049
--- /dev/null
+++ b/contrib/libstdc++/src/allocator-inst.cc
@@ -0,0 +1,51 @@
+// Explicit instantiation file.
+
+// Copyright (C) 1999, 2001, 2002, 2003, 2004 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 <memory>
+#include <ext/mt_allocator.h>
+#include <ext/pool_allocator.h>
+
+namespace std
+{
+ template class allocator<char>;
+ template class allocator<wchar_t>;
+} // namespace std
+
+namespace __gnu_cxx
+{
+ template class __mt_alloc<char>;
+ template class __mt_alloc<wchar_t>;
+
+ template class __pool_alloc<char>;
+ template class __pool_alloc<wchar_t>;
+} // namespace __gnu_cxx
diff --git a/contrib/libstdc++/src/allocator.cc b/contrib/libstdc++/src/allocator.cc
new file mode 100644
index 0000000..e35aa3e
--- /dev/null
+++ b/contrib/libstdc++/src/allocator.cc
@@ -0,0 +1,169 @@
+// Allocator details.
+
+// Copyright (C) 2004 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>
+#include <ext/mt_allocator.h>
+#include <ext/pool_allocator.h>
+
+namespace __gnu_internal
+{
+ __glibcxx_mutex_define_initialized(palloc_init_mutex);
+}
+
+namespace __gnu_cxx
+{
+ // Definitions for __pool_alloc_base.
+ __pool_base::_Obj* volatile*
+ __pool_base::_M_get_free_list(size_t __bytes)
+ {
+ size_t __i = ((__bytes + (size_t)_S_align - 1) / (size_t)_S_align - 1);
+ return _S_free_list + __i;
+ }
+
+ mutex_type&
+ __pool_base::_M_get_mutex()
+ { return __gnu_internal::palloc_init_mutex; }
+
+ // Allocate memory in large chunks in order to avoid fragmenting the
+ // heap too much. Assume that __n is properly aligned. We hold the
+ // allocation lock.
+ char*
+ __pool_base::_M_allocate_chunk(size_t __n, int& __nobjs)
+ {
+ char* __result;
+ size_t __total_bytes = __n * __nobjs;
+ size_t __bytes_left = _S_end_free - _S_start_free;
+
+ if (__bytes_left >= __total_bytes)
+ {
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result ;
+ }
+ else if (__bytes_left >= __n)
+ {
+ __nobjs = (int)(__bytes_left / __n);
+ __total_bytes = __n * __nobjs;
+ __result = _S_start_free;
+ _S_start_free += __total_bytes;
+ return __result;
+ }
+ else
+ {
+ // Try to make use of the left-over piece.
+ if (__bytes_left > 0)
+ {
+ _Obj* volatile* __free_list = _M_get_free_list(__bytes_left);
+ ((_Obj*)(void*)_S_start_free)->_M_free_list_link = *__free_list;
+ *__free_list = (_Obj*)(void*)_S_start_free;
+ }
+
+ size_t __bytes_to_get = (2 * __total_bytes
+ + _M_round_up(_S_heap_size >> 4));
+ _S_start_free = static_cast<char*>(::operator new(__bytes_to_get));
+ if (_S_start_free == 0)
+ {
+ // Try to make do with what we have. That can't hurt. We
+ // do not try smaller requests, since that tends to result
+ // in disaster on multi-process machines.
+ size_t __i = __n;
+ for (; __i <= (size_t) _S_max_bytes; __i += (size_t) _S_align)
+ {
+ _Obj* volatile* __free_list = _M_get_free_list(__i);
+ _Obj* __p = *__free_list;
+ if (__p != 0)
+ {
+ *__free_list = __p->_M_free_list_link;
+ _S_start_free = (char*)__p;
+ _S_end_free = _S_start_free + __i;
+ return _M_allocate_chunk(__n, __nobjs);
+ // Any leftover piece will eventually make it to the
+ // right free list.
+ }
+ }
+ _S_end_free = 0; // In case of exception.
+
+ // This should either throw an exception or remedy the situation.
+ // Thus we assume it succeeded.
+ _S_start_free = static_cast<char*>(::operator new(__bytes_to_get));
+ }
+ _S_heap_size += __bytes_to_get;
+ _S_end_free = _S_start_free + __bytes_to_get;
+ return _M_allocate_chunk(__n, __nobjs);
+ }
+ }
+
+ // Returns an object of size __n, and optionally adds to "size
+ // __n"'s free list. We assume that __n is properly aligned. We
+ // hold the allocation lock.
+ void*
+ __pool_base::_M_refill(size_t __n)
+ {
+ int __nobjs = 20;
+ char* __chunk = _M_allocate_chunk(__n, __nobjs);
+ _Obj* volatile* __free_list;
+ _Obj* __result;
+ _Obj* __current_obj;
+ _Obj* __next_obj;
+
+ if (__nobjs == 1)
+ return __chunk;
+ __free_list = _M_get_free_list(__n);
+
+ // Build free list in chunk.
+ __result = (_Obj*)(void*)__chunk;
+ *__free_list = __next_obj = (_Obj*)(void*)(__chunk + __n);
+ for (int __i = 1; ; __i++)
+ {
+ __current_obj = __next_obj;
+ __next_obj = (_Obj*)(void*)((char*)__next_obj + __n);
+ if (__nobjs - 1 == __i)
+ {
+ __current_obj->_M_free_list_link = 0;
+ break;
+ }
+ else
+ __current_obj->_M_free_list_link = __next_obj;
+ }
+ return __result;
+ }
+
+ __pool_base::_Obj* volatile __pool_base::_S_free_list[_S_free_list_size];
+
+ char* __pool_base::_S_start_free = 0;
+
+ char* __pool_base::_S_end_free = 0;
+
+ size_t __pool_base::_S_heap_size = 0;
+} // namespace __gnu_cxx
diff --git a/contrib/libstdc++/src/codecvt.cc b/contrib/libstdc++/src/codecvt.cc
index bc5508a..2010593 100644
--- a/contrib/libstdc++/src/codecvt.cc
+++ b/contrib/libstdc++/src/codecvt.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2002, 2004 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
@@ -34,23 +34,30 @@ namespace std
// Definitions for locale::id of standard facets that are specialized.
locale::id codecvt<char, char, mbstate_t>::id;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
locale::id codecvt<wchar_t, char, mbstate_t>::id;
#endif
-#ifdef _GLIBCPP_USE___ENC_TRAITS
+#ifdef _GLIBCXX_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_abstract_base<char, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_get_c_locale())
{ }
codecvt<char, char, mbstate_t>::
- ~codecvt()
+ codecvt(__c_locale __cloc, size_t __refs)
+ : __codecvt_abstract_base<char, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_clone_c_locale(__cloc))
{ }
+
+ codecvt<char, char, mbstate_t>::
+ ~codecvt()
+ { _S_destroy_c_locale(_M_c_locale_codecvt); }
codecvt_base::result
codecvt<char, char, mbstate_t>::
@@ -59,7 +66,7 @@ namespace std
extern_type* __to, extern_type*,
extern_type*& __to_next) const
{
- // _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
// According to the resolution of DR19, "If returns noconv [...]
// there are no changes to the values in [to, to_limit)."
__from_next = __from;
@@ -80,10 +87,9 @@ namespace std
codecvt<char, char, mbstate_t>::
do_in(state_type&, const extern_type* __from,
const extern_type*, const extern_type*& __from_next,
- intern_type* __to, intern_type*,
- intern_type*& __to_next) const
+ intern_type* __to, intern_type*, intern_type*& __to_next) const
{
- // _GLIBCPP_RESOLVE_LIB_DEFECTS
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
// According to the resolution of DR19, "If returns noconv [...]
// there are no changes to the values in [to, to_limit)."
__from_next = __from;
@@ -103,54 +109,49 @@ namespace std
int
codecvt<char, char, mbstate_t>::
- do_length (const state_type&, const extern_type* __from,
+ do_length (state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
- { return min(__max, static_cast<size_t>(__end - __from)); }
+ {
+ size_t __d = static_cast<size_t>(__end - __from);
+ return std::min(__max, __d);
+ }
int
codecvt<char, char, mbstate_t>::
do_max_length() const throw()
{ return 1; }
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_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_abstract_base<wchar_t, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_get_c_locale())
{ }
codecvt<wchar_t, char, mbstate_t>::
- ~codecvt()
+ codecvt(__c_locale __cloc, size_t __refs)
+ : __codecvt_abstract_base<wchar_t, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_clone_c_locale(__cloc))
{ }
+
+ codecvt<wchar_t, char, mbstate_t>::
+ ~codecvt()
+ { _S_destroy_c_locale(_M_c_locale_codecvt); }
codecvt_base::result
codecvt<wchar_t, char, mbstate_t>::
do_unshift(state_type&, extern_type* __to,
extern_type*, extern_type*& __to_next) const
{
+ // XXX Probably wrong for stateful encodings
__to_next = __to;
return noconv;
}
- 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
+#endif // _GLIBCXX_USE_WCHAR_T
} // namespace std
diff --git a/contrib/libstdc++/src/complex_io.cc b/contrib/libstdc++/src/complex_io.cc
index a6d502f..6d2ca56 100644
--- a/contrib/libstdc++/src/complex_io.cc
+++ b/contrib/libstdc++/src/complex_io.cc
@@ -59,7 +59,7 @@ namespace std
operator<<(basic_ostream<char, char_traits<char> >&,
const complex<long double>&);
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template
basic_istream<wchar_t, char_traits<wchar_t> >&
operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&,
@@ -89,5 +89,5 @@ namespace std
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
+#endif //_GLIBCXX_USE_WCHAR_T
} // namespace std
diff --git a/contrib/libstdc++/src/concept-inst.cc b/contrib/libstdc++/src/concept-inst.cc
index e173549..c8a3dd4 100644
--- a/contrib/libstdc++/src/concept-inst.cc
+++ b/contrib/libstdc++/src/concept-inst.cc
@@ -36,7 +36,7 @@
#include <bits/concept_check.h>
-#ifdef _GLIBCPP_CONCEPT_CHECKS
+#ifdef _GLIBCXX_CONCEPT_CHECKS
#include <memory>
#include <iterator>
@@ -54,7 +54,7 @@ namespace __gnu_cxx
_Instantiate(_InputIteratorConcept<char const*> );
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
_Instantiate(_InputIteratorConcept<wchar_t*> );
_Instantiate(_InputIteratorConcept<wchar_t const*> );
@@ -75,7 +75,7 @@ namespace __gnu_cxx
_Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator<
char, std::char_traits<char> >, char> );
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
_Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator<
wchar_t, std::char_traits<wchar_t> >, wchar_t> );
#endif
@@ -90,7 +90,7 @@ namespace __gnu_cxx
_Instantiate(_RandomAccessIteratorConcept<
__normal_iterator<char*, std::string> > );
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
_Instantiate(_RandomAccessIteratorConcept<
__normal_iterator<wchar_t const*,
std::basic_string<wchar_t, std::char_traits<wchar_t>,
diff --git a/contrib/libstdc++/src/ctype.cc b/contrib/libstdc++/src/ctype.cc
index 3d5ee61..777ff41 100644
--- a/contrib/libstdc++/src/ctype.cc
+++ b/contrib/libstdc++/src/ctype.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -30,15 +30,23 @@
namespace std
{
- // XXX At some point, just rename this file to ctype_members_char.cc
- // and compile it as a separate file instead of including it here.
- // Platform-specific initialization code for ctype tables.
- #include <bits/ctype_noninline.h>
+ // 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;
// Definitions for locale::id of standard facets that are specialized.
locale::id ctype<char>::id;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
locale::id ctype<wchar_t>::id;
#endif
@@ -51,7 +59,7 @@ namespace std
return static_cast<const ctype<char>&>(*(__tmp->_M_facets[__i]));
}
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template<>
const ctype<wchar_t>&
use_facet<ctype<wchar_t> >(const locale& __loc)
@@ -62,18 +70,10 @@ namespace std
}
#endif
- // 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;
+ // XXX At some point, just rename this file to ctype_configure_char.cc
+ // and compile it as a separate file instead of including it here.
+ // Platform-specific initialization code for ctype tables.
+ #include <bits/ctype_noninline.h>
const size_t ctype<char>::table_size;
@@ -84,54 +84,16 @@ namespace std
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
+#ifdef _GLIBCXX_USE_WCHAR_T
ctype<wchar_t>::ctype(size_t __refs)
- : __ctype_abstract_base<wchar_t>(__refs)
- { _M_c_locale_ctype = _S_c_locale; }
+ : __ctype_abstract_base<wchar_t>(__refs),
+ _M_c_locale_ctype(_S_get_c_locale()), _M_narrow_ok(false)
+ { _M_initialize_ctype(); }
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_abstract_base<wchar_t>(__refs),
+ _M_c_locale_ctype(_S_clone_c_locale(__cloc)), _M_narrow_ok(false)
+ { _M_initialize_ctype(); }
ctype<wchar_t>::~ctype()
{ _S_destroy_c_locale(_M_c_locale_ctype); }
@@ -139,9 +101,13 @@ namespace std
template<>
ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs)
: ctype<wchar_t>(__refs)
- {
- _S_destroy_c_locale(_M_c_locale_ctype);
- _S_create_c_locale(_M_c_locale_ctype, __s);
+ {
+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
+ {
+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
+ this->_M_initialize_ctype();
+ }
}
#endif
} // namespace std
diff --git a/contrib/libstdc++/src/debug.cc b/contrib/libstdc++/src/debug.cc
new file mode 100644
index 0000000..05ebc2f
--- /dev/null
+++ b/contrib/libstdc++/src/debug.cc
@@ -0,0 +1,660 @@
+// Debugging mode support code -*- C++ -*-
+
+// Copyright (C) 2003, 2004
+// 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 <debug/debug.h>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <algorithm>
+#include <cstdlib>
+#include <cassert>
+#include <cstring>
+#include <cstdio>
+#include <cctype>
+
+using namespace std;
+
+namespace __gnu_debug
+{
+ const char* _S_debug_messages[] =
+ {
+ "function requires a valid iterator range [%1.name;, %2.name;)",
+ "attempt to insert into container with a singular iterator",
+ "attempt to insert into container with an iterator"
+ " from a different container",
+ "attempt to erase from container with a %2.state; iterator",
+ "attempt to erase from container with an iterator"
+ " from a different container",
+ "attempt to subscript container with out-of-bounds index %2;,"
+ " but container only holds %3; elements",
+ "attempt to access an element in an empty container",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not partitioned by the value %3;",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not partitioned by the predicate %3; and value %4;",
+ "elements in iterator range [%1.name;, %2.name;) are not sorted",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not sorted according to the predicate %3;",
+ "elements in iterator range [%1.name;, %2.name;) do not form a heap",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " do not form a heap with respect to the predicate %3;",
+ "attempt to write through a singular bitset reference",
+ "attempt to read from a singular bitset reference",
+ "attempt to flip a singular bitset reference",
+ "attempt to splice a list into itself",
+ "attempt to splice lists with inequal allocators",
+ "attempt to splice elements referenced by a %1.state; iterator",
+ "attempt to splice an iterator from a different container",
+ "splice destination %1.name;"
+ " occurs within source range [%2.name;, %3.name;)",
+ "attempt to initialize an iterator that will immediately become singular",
+ "attempt to copy-construct an iterator from a singular iterator",
+ "attempt to construct a constant iterator"
+ " from a singular mutable iterator",
+ "attempt to copy from a singular iterator",
+ "attempt to dereference a %1.state; iterator",
+ "attempt to increment a %1.state; iterator",
+ "attempt to decrement a %1.state; iterator",
+ "attempt to subscript a %1.state; iterator %2; step from"
+ " its current position, which falls outside its dereferenceable range",
+ "attempt to advance a %1.state; iterator %2; steps,"
+ " which falls outside its valid range",
+ "attempt to retreat a %1.state; iterator %2; steps,"
+ " which falls outside its valid range",
+ "attempt to compare a %1.state; iterator to a %2.state; iterator",
+ "attempt to compare iterators from different sequences",
+ "attempt to order a %1.state; iterator to a %2.state; iterator",
+ "attempt to order iterators from different sequences",
+ "attempt to compute the difference between a %1.state;"
+ " iterator to a %2.state; iterator",
+ "attempt to compute the different between two iterators"
+ " from different sequences",
+ "attempt to dereference an end-of-stream istream_iterator",
+ "attempt to increment an end-of-stream istream_iterator",
+ "attempt to output via an ostream_iterator with no associated stream",
+ "attempt to dereference an end-of-stream istreambuf_iterator"
+ " (this is a GNU extension)",
+ "attempt to increment an end-of-stream istreambuf_iterator"
+ };
+
+ void
+ _Safe_sequence_base::
+ _M_detach_all()
+ {
+ for (_Safe_iterator_base* __iter = _M_iterators; __iter; )
+ {
+ _Safe_iterator_base* __old = __iter;
+ __iter = __iter->_M_next;
+ __old->_M_attach(0, false);
+ }
+
+ for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; )
+ {
+ _Safe_iterator_base* __old = __iter2;
+ __iter2 = __iter2->_M_next;
+ __old->_M_attach(0, true);
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_detach_singular()
+ {
+ for (_Safe_iterator_base* __iter = _M_iterators; __iter; )
+ {
+ _Safe_iterator_base* __old = __iter;
+ __iter = __iter->_M_next;
+ if (__old->_M_singular())
+ __old->_M_attach(0, false);
+ }
+
+ for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2; )
+ {
+ _Safe_iterator_base* __old = __iter2;
+ __iter2 = __iter2->_M_next;
+ if (__old->_M_singular())
+ __old->_M_attach(0, true);
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_revalidate_singular()
+ {
+ _Safe_iterator_base* __iter;
+ for (__iter = _M_iterators; __iter; __iter = __iter->_M_next)
+ {
+ __iter->_M_version = _M_version;
+ __iter = __iter->_M_next;
+ }
+
+ for (__iter = _M_const_iterators; __iter; __iter = __iter->_M_next)
+ {
+ __iter->_M_version = _M_version;
+ __iter = __iter->_M_next;
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_swap(_Safe_sequence_base& __x)
+ {
+ swap(_M_iterators, __x._M_iterators);
+ swap(_M_const_iterators, __x._M_const_iterators);
+ swap(_M_version, __x._M_version);
+ _Safe_iterator_base* __iter;
+ for (__iter = _M_iterators; __iter; __iter = __iter->_M_next)
+ __iter->_M_sequence = this;
+ for (__iter = __x._M_iterators; __iter; __iter = __iter->_M_next)
+ __iter->_M_sequence = &__x;
+ for (__iter = _M_const_iterators; __iter; __iter = __iter->_M_next)
+ __iter->_M_sequence = this;
+ for (__iter = __x._M_const_iterators; __iter; __iter = __iter->_M_next)
+ __iter->_M_sequence = &__x;
+ }
+
+ void
+ _Safe_iterator_base::
+ _M_attach(_Safe_sequence_base* __seq, bool __constant)
+ {
+ _M_detach();
+
+ // Attach to the new sequence (if there is one)
+ if (__seq)
+ {
+ _M_sequence = __seq;
+ _M_version = _M_sequence->_M_version;
+ _M_prior = 0;
+ if (__constant)
+ {
+ _M_next = _M_sequence->_M_const_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_const_iterators = this;
+ }
+ else
+ {
+ _M_next = _M_sequence->_M_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_iterators = this;
+ }
+ }
+ }
+
+ void
+ _Safe_iterator_base::
+ _M_detach()
+ {
+ if (_M_sequence)
+ {
+ // Remove us from this sequence's list
+ if (_M_prior)
+ _M_prior->_M_next = _M_next;
+ if (_M_next)
+ _M_next->_M_prior = _M_prior;
+
+ if (_M_sequence->_M_const_iterators == this)
+ _M_sequence->_M_const_iterators = _M_next;
+ if (_M_sequence->_M_iterators == this)
+ _M_sequence->_M_iterators = _M_next;
+ }
+
+ _M_sequence = 0;
+ _M_version = 0;
+ _M_prior = 0;
+ _M_next = 0;
+ }
+
+ bool
+ _Safe_iterator_base::
+ _M_singular() const
+ { return !_M_sequence || _M_version != _M_sequence->_M_version; }
+
+ bool
+ _Safe_iterator_base::
+ _M_can_compare(const _Safe_iterator_base& __x) const
+ {
+ return (!_M_singular() && !__x._M_singular()
+ && _M_sequence == __x._M_sequence);
+ }
+
+ void
+ _Error_formatter::_Parameter::
+ _M_print_field(const _Error_formatter* __formatter, const char* __name) const
+ {
+ assert(this->_M_kind != _Parameter::__unused_param);
+ const int __bufsize = 64;
+ char __buf[__bufsize];
+
+ if (_M_kind == __iterator)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_iterator._M_name);
+ __formatter->_M_print_word(_M_variant._M_iterator._M_name);
+ }
+ else if (strcmp(__name, "address") == 0)
+ {
+ __formatter->_M_format_word(__buf, __bufsize, "%p",
+ _M_variant._M_iterator._M_address);
+ __formatter->_M_print_word(__buf);
+ }
+ else if (strcmp(__name, "type") == 0)
+ {
+ assert(_M_variant._M_iterator._M_type);
+ // TBD: demangle!
+ __formatter->_M_print_word(_M_variant._M_iterator._M_type->name());
+ }
+ else if (strcmp(__name, "constness") == 0)
+ {
+ static const char* __constness_names[__last_constness] =
+ {
+ "<unknown>",
+ "constant",
+ "mutable"
+ };
+ __formatter->_M_print_word(__constness_names[_M_variant._M_iterator._M_constness]);
+ }
+ else if (strcmp(__name, "state") == 0)
+ {
+ static const char* __state_names[__last_state] =
+ {
+ "<unknown>",
+ "singular",
+ "dereferenceable (start-of-sequence)",
+ "dereferenceable",
+ "past-the-end"
+ };
+ __formatter->_M_print_word(__state_names[_M_variant._M_iterator._M_state]);
+ }
+ else if (strcmp(__name, "sequence") == 0)
+ {
+ assert(_M_variant._M_iterator._M_sequence);
+ __formatter->_M_format_word(__buf, __bufsize, "%p",
+ _M_variant._M_iterator._M_sequence);
+ __formatter->_M_print_word(__buf);
+ }
+ else if (strcmp(__name, "seq_type") == 0)
+ {
+ // TBD: demangle!
+ assert(_M_variant._M_iterator._M_seq_type);
+ __formatter->_M_print_word(_M_variant._M_iterator._M_seq_type->name());
+ }
+ else
+ assert(false);
+ }
+ else if (_M_kind == __sequence)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_sequence._M_name);
+ __formatter->_M_print_word(_M_variant._M_sequence._M_name);
+ }
+ else if (strcmp(__name, "address") == 0)
+ {
+ assert(_M_variant._M_sequence._M_address);
+ __formatter->_M_format_word(__buf, __bufsize, "%p",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(__buf);
+ }
+ else if (strcmp(__name, "type") == 0)
+ {
+ // TBD: demangle!
+ assert(_M_variant._M_sequence._M_type);
+ __formatter->_M_print_word(_M_variant._M_sequence._M_type->name());
+ }
+ else
+ assert(false);
+ }
+ else if (_M_kind == __integer)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_integer._M_name);
+ __formatter->_M_print_word(_M_variant._M_integer._M_name);
+ }
+ else
+ assert(false);
+ }
+ else if (_M_kind == __string)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_string._M_name);
+ __formatter->_M_print_word(_M_variant._M_string._M_name);
+ }
+ else
+ assert(false);
+ }
+ else
+ {
+ assert(false);
+ }
+ }
+
+ void
+ _Error_formatter::_Parameter::
+ _M_print_description(const _Error_formatter* __formatter) const
+ {
+ const int __bufsize = 128;
+ char __buf[__bufsize];
+
+ if (_M_kind == __iterator)
+ {
+ __formatter->_M_print_word("iterator ");
+ if (_M_variant._M_iterator._M_name)
+ {
+ __formatter->_M_format_word(__buf, __bufsize, "\"%s\" ",
+ _M_variant._M_iterator._M_name);
+ __formatter->_M_print_word(__buf);
+ }
+
+ __formatter->_M_format_word(__buf, __bufsize, "@ 0x%p {\n",
+ _M_variant._M_iterator._M_address);
+ __formatter->_M_print_word(__buf);
+ if (_M_variant._M_iterator._M_type)
+ {
+ __formatter->_M_print_word("type = ");
+ _M_print_field(__formatter, "type");
+
+ if (_M_variant._M_iterator._M_constness != __unknown_constness)
+ {
+ __formatter->_M_print_word(" (");
+ _M_print_field(__formatter, "constness");
+ __formatter->_M_print_word(" iterator)");
+ }
+ __formatter->_M_print_word(";\n");
+ }
+
+ if (_M_variant._M_iterator._M_state != __unknown_state)
+ {
+ __formatter->_M_print_word(" state = ");
+ _M_print_field(__formatter, "state");
+ __formatter->_M_print_word(";\n");
+ }
+
+ if (_M_variant._M_iterator._M_sequence)
+ {
+ __formatter->_M_print_word(" references sequence ");
+ if (_M_variant._M_iterator._M_seq_type)
+ {
+ __formatter->_M_print_word("with type `");
+ _M_print_field(__formatter, "seq_type");
+ __formatter->_M_print_word("' ");
+ }
+
+ __formatter->_M_format_word(__buf, __bufsize, "@ 0x%p\n",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(__buf);
+ }
+ __formatter->_M_print_word("}\n");
+ }
+ else if (_M_kind == __sequence)
+ {
+ __formatter->_M_print_word("sequence ");
+ if (_M_variant._M_sequence._M_name)
+ {
+ __formatter->_M_format_word(__buf, __bufsize, "\"%s\" ",
+ _M_variant._M_sequence._M_name);
+ __formatter->_M_print_word(__buf);
+ }
+
+ __formatter->_M_format_word(__buf, __bufsize, "@ 0x%p {\n",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(__buf);
+
+ if (_M_variant._M_sequence._M_type)
+ {
+ __formatter->_M_print_word(" type = ");
+ _M_print_field(__formatter, "type");
+ __formatter->_M_print_word(";\n");
+ }
+ __formatter->_M_print_word("}\n");
+ }
+ }
+
+ const _Error_formatter&
+ _Error_formatter::_M_message(_Debug_msg_id __id) const
+ { return this->_M_message(_S_debug_messages[__id]); }
+
+ void
+ _Error_formatter::_M_error() const
+ {
+ const int __bufsize = 128;
+ char __buf[__bufsize];
+
+ // Emit file & line number information
+ _M_column = 1;
+ _M_wordwrap = false;
+ if (_M_file)
+ {
+ _M_format_word(__buf, __bufsize, "%s:", _M_file);
+ _M_print_word(__buf);
+ _M_column += strlen(__buf);
+ }
+
+ if (_M_line > 0)
+ {
+ _M_format_word(__buf, __bufsize, "%u:", _M_line);
+ _M_print_word(__buf);
+ _M_column += strlen(__buf);
+ }
+
+ _M_wordwrap = true;
+ _M_print_word("error: ");
+
+ // Print the error message
+ assert(_M_text);
+ _M_print_string(_M_text);
+ _M_print_word(".\n");
+
+ // Emit descriptions of the objects involved in the operation
+ _M_wordwrap = false;
+ bool __has_noninteger_parameters = false;
+ for (unsigned int __i = 0; __i < _M_num_parameters; ++__i)
+ {
+ if (_M_parameters[__i]._M_kind == _Parameter::__iterator
+ || _M_parameters[__i]._M_kind == _Parameter::__sequence)
+ {
+ if (!__has_noninteger_parameters)
+ {
+ _M_first_line = true;
+ _M_print_word("\nObjects involved in the operation:\n");
+ __has_noninteger_parameters = true;
+ }
+ _M_parameters[__i]._M_print_description(this);
+ }
+ }
+
+ abort();
+ }
+
+ template<typename _Tp>
+ void
+ _Error_formatter::_M_format_word(char* __buf,
+ int __n __attribute__((__unused__)),
+ const char* __fmt, _Tp __s) const
+ {
+#ifdef _GLIBCXX_USE_C99
+ std::snprintf(__buf, __n, __fmt, __s);
+#else
+ std::sprintf(__buf, __fmt, __s);
+#endif
+ }
+
+
+ void
+ _Error_formatter::_M_print_word(const char* __word) const
+ {
+ if (!_M_wordwrap)
+ {
+ fprintf(stderr, "%s", __word);
+ return;
+ }
+
+ size_t __length = strlen(__word);
+ if (__length == 0)
+ return;
+
+ if ((_M_column + __length < _M_max_length)
+ || (__length >= _M_max_length && _M_column == 1))
+ {
+ // If this isn't the first line, indent
+ if (_M_column == 1 && !_M_first_line)
+ {
+ char __spacing[_M_indent + 1];
+ for (int i = 0; i < _M_indent; ++i)
+ __spacing[i] = ' ';
+ __spacing[_M_indent] = '\0';
+ fprintf(stderr, "%s", __spacing);
+ _M_column += _M_indent;
+ }
+
+ fprintf(stderr, "%s", __word);
+ _M_column += __length;
+
+ if (__word[__length - 1] == '\n')
+ {
+ _M_first_line = false;
+ _M_column = 1;
+ }
+ }
+ else
+ {
+ _M_column = 1;
+ _M_print_word("\n");
+ _M_print_word(__word);
+ }
+ }
+
+ void
+ _Error_formatter::
+ _M_print_string(const char* __string) const
+ {
+ const char* __start = __string;
+ const char* __end = __start;
+ const int __bufsize = 128;
+ char __buf[__bufsize];
+
+ while (*__start)
+ {
+ if (*__start != '%')
+ {
+ // [__start, __end) denotes the next word
+ __end = __start;
+ while (isalnum(*__end)) ++__end;
+ if (__start == __end) ++__end;
+ if (isspace(*__end)) ++__end;
+
+ assert(__end - __start + 1< __bufsize);
+ _M_format_word(__buf, __end - __start + 1, "%s", __start);
+ _M_print_word(__buf);
+ __start = __end;
+
+ // Skip extra whitespace
+ while (*__start == ' ')
+ ++__start;
+
+ continue;
+ }
+
+ ++__start;
+ assert(*__start);
+ if (*__start == '%')
+ {
+ _M_print_word("%");
+ ++__start;
+ continue;
+ }
+
+ // Get the parameter number
+ assert(*__start >= '1' && *__start <= '9');
+ size_t __param = *__start - '0';
+ --__param;
+ assert(__param < _M_num_parameters);
+
+ // '.' separates the parameter number from the field
+ // name, if there is one.
+ ++__start;
+ if (*__start != '.')
+ {
+ assert(*__start == ';');
+ ++__start;
+ __buf[0] = '\0';
+ if (_M_parameters[__param]._M_kind == _Parameter::__integer)
+ {
+ _M_format_word(__buf, __bufsize, "%ld",
+ _M_parameters[__param]._M_variant._M_integer._M_value);
+ _M_print_word(__buf);
+ }
+ else if (_M_parameters[__param]._M_kind == _Parameter::__string)
+ _M_print_string(_M_parameters[__param]._M_variant._M_string._M_value);
+ continue;
+ }
+
+ // Extract the field name we want
+ enum { __max_field_len = 16 };
+ char __field[__max_field_len];
+ int __field_idx = 0;
+ ++__start;
+ while (*__start != ';')
+ {
+ assert(*__start);
+ assert(__field_idx < __max_field_len-1);
+ __field[__field_idx++] = *__start++;
+ }
+ ++__start;
+ __field[__field_idx] = 0;
+
+ _M_parameters[__param]._M_print_field(this, __field);
+ }
+ }
+
+ // Instantiations.
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ const void* __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ long __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ std::size_t __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ const char* __s) const;
+} // namespace __gnu_debug
diff --git a/contrib/libstdc++/src/debug_list.cc b/contrib/libstdc++/src/debug_list.cc
new file mode 100644
index 0000000..3d14b28
--- /dev/null
+++ b/contrib/libstdc++/src/debug_list.cc
@@ -0,0 +1,34 @@
+// Debugging mode support code for list -*- C++ -*-
+
+// Copyright (C) 2004 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.
+
+#define _GLIBCXX_DEBUG
+
+#include <bits/c++config.h>
+
+#include "list.cc"
diff --git a/contrib/libstdc++/src/ext-inst.cc b/contrib/libstdc++/src/ext-inst.cc
index 4896b11..4be3fed6 100644
--- a/contrib/libstdc++/src/ext-inst.cc
+++ b/contrib/libstdc++/src/ext-inst.cc
@@ -1,6 +1,6 @@
// Explicit instantiation file.
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2004 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
@@ -34,11 +34,18 @@
#include <ext/rope>
#include <ext/stdio_filebuf.h>
+namespace __gnu_internal
+{
+ const int min_len = __gnu_cxx::_Rope_constants::_S_max_rope_depth + 1;
+}
+
namespace __gnu_cxx
{
+ using namespace __gnu_internal;
+
template
const unsigned long
- rope<char, std::allocator<char> >::_S_min_len;
+ rope<char, std::allocator<char> >::_S_min_len[min_len];
template
char
@@ -47,10 +54,10 @@ namespace __gnu_cxx
template class stdio_filebuf<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template
- const unsigned long
- rope<wchar_t, std::allocator<wchar_t> >::_S_min_len;
+ const unsigned long
+ rope<wchar_t, std::allocator<wchar_t> >::_S_min_len[min_len];
template
wchar_t
diff --git a/contrib/libstdc++/src/fstream-inst.cc b/contrib/libstdc++/src/fstream-inst.cc
index 8b866c0..4d9eae5 100644
--- a/contrib/libstdc++/src/fstream-inst.cc
+++ b/contrib/libstdc++/src/fstream-inst.cc
@@ -38,25 +38,25 @@ namespace std
{
// filebuf
template class basic_filebuf<char, char_traits<char> >;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_filebuf<wchar_t, char_traits<wchar_t> >;
#endif
// ifstream
template class basic_ifstream<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_ifstream<wchar_t>;
#endif
// ofstream
template class basic_ofstream<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_ofstream<wchar_t>;
#endif
// fstream
template class basic_fstream<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_fstream<wchar_t>;
#endif
} // namespace std
diff --git a/contrib/libstdc++/src/functexcept.cc b/contrib/libstdc++/src/functexcept.cc
index dab6f2f..fb158a6 100644
--- a/contrib/libstdc++/src/functexcept.cc
+++ b/contrib/libstdc++/src/functexcept.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 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
@@ -32,6 +32,12 @@
#include <new>
#include <typeinfo>
#include <ios>
+#ifdef _GLIBCXX_USE_NLS
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+#else
+# define _(msgid) (msgid)
+#endif
namespace std
{
@@ -54,43 +60,43 @@ namespace std
void
__throw_logic_error(const char* __s)
- { throw logic_error(__s); }
+ { throw logic_error(_(__s)); }
void
__throw_domain_error(const char* __s)
- { throw domain_error(__s); }
+ { throw domain_error(_(__s)); }
void
__throw_invalid_argument(const char* __s)
- { throw invalid_argument(__s); }
+ { throw invalid_argument(_(__s)); }
void
__throw_length_error(const char* __s)
- { throw length_error(__s); }
+ { throw length_error(_(__s)); }
void
__throw_out_of_range(const char* __s)
- { throw out_of_range(__s); }
+ { throw out_of_range(_(__s)); }
void
__throw_runtime_error(const char* __s)
- { throw runtime_error(__s); }
+ { throw runtime_error(_(__s)); }
void
__throw_range_error(const char* __s)
- { throw range_error(__s); }
+ { throw range_error(_(__s)); }
void
__throw_overflow_error(const char* __s)
- { throw overflow_error(__s); }
+ { throw overflow_error(_(__s)); }
void
__throw_underflow_error(const char* __s)
- { throw underflow_error(__s); }
+ { throw underflow_error(_(__s)); }
void
__throw_ios_failure(const char* __s)
- { throw ios_base::failure(__s); }
+ { throw ios_base::failure(_(__s)); }
#else
void
__throw_bad_exception(void)
diff --git a/contrib/libstdc++/src/globals_io.cc b/contrib/libstdc++/src/globals_io.cc
new file mode 100644
index 0000000..bf70f47c
--- /dev/null
+++ b/contrib/libstdc++/src/globals_io.cc
@@ -0,0 +1,129 @@
+// Copyright (C) 2001, 2002, 2003, 2004 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 <ext/stdio_filebuf.h>
+#include <ext/stdio_sync_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.
+
+// NB: asm directives can rename these non-exported, namespace
+// __gnu_cxx symbols into exported, namespace std symbols with the
+// appropriate symbol version name.
+// The rename syntax is
+// asm (".symver currentname,oldname@@GLIBCXX_3.2")
+// In macro form:
+// _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2)
+
+namespace std
+{
+ // Standard stream objects.
+ // NB: Iff <iostream> is included, these definitions become wonky.
+ 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;
+
+#ifdef _GLIBCXX_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;
+#endif
+} // namespace std
+
+namespace __gnu_internal
+{
+ using namespace std;
+ using namespace __gnu_cxx;
+
+ // We use different stream buffer types depending on whether
+ // ios_base::sync_with_stdio(false) has been called.
+ typedef char fake_stdiobuf[sizeof(stdio_sync_filebuf<char>)]
+ __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<char>))));
+ fake_stdiobuf buf_cout_sync;
+ fake_stdiobuf buf_cin_sync;
+ fake_stdiobuf buf_cerr_sync;
+
+ typedef char fake_filebuf[sizeof(stdio_filebuf<char>)]
+ __attribute__ ((aligned(__alignof__(stdio_filebuf<char>))));
+ fake_filebuf buf_cout;
+ fake_filebuf buf_cin;
+ fake_filebuf buf_cerr;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef char fake_wstdiobuf[sizeof(stdio_sync_filebuf<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<wchar_t>))));
+ fake_wstdiobuf buf_wcout_sync;
+ fake_wstdiobuf buf_wcin_sync;
+ fake_wstdiobuf buf_wcerr_sync;
+
+ typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(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
+#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
+ __gthread_once_t _GLIBCXX_once = __GTHREAD_ONCE_INIT;
+ __gthread_mutex_t _GLIBCXX_mutex;
+ __gthread_mutex_t *_GLIBCXX_mutex_address;
+
+ // Once-only initializer function for _GLIBCXX_mutex.
+ void
+ _GLIBCXX_mutex_init ()
+ { __GTHREAD_MUTEX_INIT_FUNCTION (&_GLIBCXX_mutex); }
+
+ // Once-only initializer function for _GLIBCXX_mutex_address.
+ void
+ _GLIBCXX_mutex_address_init ()
+ { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCXX_mutex_address); }
+#endif
+} // namespace __gnu_internal
diff --git a/contrib/libstdc++/src/globals_locale.cc b/contrib/libstdc++/src/globals_locale.cc
new file mode 100644
index 0000000..67192c4
--- /dev/null
+++ b/contrib/libstdc++/src/globals_locale.cc
@@ -0,0 +1,210 @@
+// Copyright (C) 2001, 2002, 2003, 2004 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 <locale>
+
+// 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.
+
+// NB: asm directives can rename these non-exported, namespace
+// __gnu_cxx symbols into exported, namespace std symbols with the
+// appropriate symbol version name.
+// The rename syntax is
+// asm (".symver currentname,oldname@@GLIBCXX_3.2")
+// In macro form:
+// _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2)
+
+namespace __gnu_internal
+{
+ using namespace std;
+
+ typedef char fake_locale_Impl[sizeof(locale::_Impl)]
+ __attribute__ ((aligned(__alignof__(locale::_Impl))));
+ fake_locale_Impl c_locale_impl;
+
+ typedef char fake_locale[sizeof(locale)]
+ __attribute__ ((aligned(__alignof__(locale))));
+ fake_locale c_locale;
+
+ typedef char fake_name_vec[sizeof(char*)]
+ __attribute__ ((aligned(__alignof__(char*))));
+ fake_name_vec name_vec[6 + _GLIBCXX_NUM_CATEGORIES];
+
+ typedef char fake_names[sizeof(char[2])]
+ __attribute__ ((aligned(__alignof__(char[2]))));
+ fake_names name_c[6 + _GLIBCXX_NUM_CATEGORIES];
+
+ typedef char fake_facet_vec[sizeof(locale::facet*)]
+ __attribute__ ((aligned(__alignof__(locale::facet*))));
+ fake_facet_vec facet_vec[_GLIBCXX_NUM_FACETS];
+
+ typedef char fake_cache_vec[sizeof(locale::facet*)]
+ __attribute__ ((aligned(__alignof__(locale::facet*))));
+ fake_cache_vec cache_vec[_GLIBCXX_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_ct;
+ fake_moneypunct_c moneypunct_cf;
+
+ 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 _GLIBCXX_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_wt;
+ fake_moneypunct_w moneypunct_wf;
+
+ 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
+
+ // Storage for "C" locale caches.
+ typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
+ __attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
+ fake_num_cache_c numpunct_cache_c;
+
+ typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char, true>)]
+ __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char, true>))));
+ fake_money_cache_c moneypunct_cache_ct;
+ fake_money_cache_c moneypunct_cache_cf;
+
+ typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)]
+ __attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>))));
+ fake_time_cache_c timepunct_cache_c;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
+ fake_num_cache_w numpunct_cache_w;
+
+ typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t,true>)]
+ __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t,true>))));
+ fake_money_cache_w moneypunct_cache_wt;
+ fake_money_cache_w moneypunct_cache_wf;
+
+ typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)]
+ __attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>))));
+ fake_time_cache_w timepunct_cache_w;
+#endif
+} // namespace __gnu_internal
diff --git a/contrib/libstdc++/src/io-inst.cc b/contrib/libstdc++/src/io-inst.cc
index 31f53b4..0b407ef 100644
--- a/contrib/libstdc++/src/io-inst.cc
+++ b/contrib/libstdc++/src/io-inst.cc
@@ -1,6 +1,6 @@
// Explicit instantiation file.
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -34,27 +34,26 @@
#include <ios>
#include <iomanip>
-#include <iostream>
namespace std
{
// basic_ios
template class basic_ios<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_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
+#ifdef _GLIBCXX_USE_WCHAR_T
template class _Setfill<wchar_t>;
template _Setfill<wchar_t> setfill(wchar_t);
#endif
// iostream
template class basic_iostream<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_iostream<wchar_t>;
#endif
} // namespace std
diff --git a/contrib/libstdc++/src/ios.cc b/contrib/libstdc++/src/ios.cc
index 00dbe12..12ffe2f 100644
--- a/contrib/libstdc++/src/ios.cc
+++ b/contrib/libstdc++/src/ios.cc
@@ -1,6 +1,6 @@
// Iostreams base classes -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -33,45 +33,11 @@
//
#include <ios>
-#include <ostream>
-#include <istream>
-#include <fstream>
+#include <limits>
#include <bits/atomicity.h>
-#include <ext/stdio_filebuf.h>
-#ifdef _GLIBCPP_HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-namespace __gnu_cxx
-{
- // Extern declarations for global objects in src/globals.cc.
- extern stdio_filebuf<char> buf_cout;
- extern stdio_filebuf<char> buf_cin;
- extern stdio_filebuf<char> buf_cerr;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- extern stdio_filebuf<wchar_t> buf_wcout;
- extern stdio_filebuf<wchar_t> buf_wcin;
- extern stdio_filebuf<wchar_t> buf_wcerr;
-#endif
-} // namespace __gnu_cxx
namespace std
{
- using namespace __gnu_cxx;
-
- extern istream cin;
- extern ostream cout;
- extern ostream cerr;
- extern ostream clog;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- extern wistream wcin;
- extern wostream wcout;
- extern wostream wcerr;
- extern wostream wclog;
-#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;
@@ -140,102 +106,33 @@ namespace std
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';
- }
+ _Atomic_word ios_base::Init::_S_refcount;
- 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)
- {
- size_t __out_size = __sync ? 0 : static_cast<size_t>(BUFSIZ);
-#ifdef _GLIBCPP_HAVE_ISATTY
- size_t __in_size =
- (__sync || isatty (0)) ? 1 : static_cast<size_t>(BUFSIZ);
-#else
- size_t __in_size = 1;
-#endif
-
- // 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);
- cout.init(&buf_cout);
- cin.init(&buf_cin);
- cerr.init(&buf_cerr);
- clog.init(&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);
- wcout.init(&buf_wcout);
- wcin.init(&buf_wcin);
- wcerr.init(&buf_wcerr);
- wclog.init(&buf_wcerr);
- wcin.tie(&wcout);
- wcerr.flags(ios_base::unitbuf);
-#endif
- }
+ bool ios_base::Init::_S_synced_with_stdio = true;
- void
- ios_base::Init::_S_ios_destroy()
+ ios_base::ios_base()
+ : _M_precision(), _M_width(), _M_flags(), _M_exception(),
+ _M_streambuf_state(), _M_callbacks(0), _M_word_zero(),
+ _M_word_size(_S_local_word_size), _M_word(_M_local_word), _M_ios_locale()
{
- // 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
+ // 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.
}
-
- ios_base::Init::Init()
+
+ // 27.4.2.7 ios_base constructors/destructors
+ ios_base::~ios_base()
{
- if (_S_ios_base_init == 0)
+ _M_call_callbacks(erase_event);
+ _M_dispose_callbacks();
+ if (_M_word != _M_local_word)
{
- // 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);
+ delete [] _M_word;
+ _M_word = 0;
}
- ++_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()
@@ -243,12 +140,16 @@ namespace std
// 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;
+ return __gnu_cxx::__exchange_and_add(&_S_top, 1) + 4;
}
+ void
+ ios_base::register_callback(event_callback __fn, int __index)
+ { _M_callbacks = new _Callback_list(__fn, __index, _M_callbacks); }
+
// 27.4.2.5 iword/pword storage
ios_base::_Words&
- ios_base::_M_grow_words(int ix)
+ ios_base::_M_grow_words(int ix, bool iword)
{
// Precondition: _M_word_size <= ix
int newsize = _S_local_word_size;
@@ -264,7 +165,12 @@ namespace std
{
_M_streambuf_state |= badbit;
if (_M_streambuf_state & _M_exception)
- __throw_ios_failure("ios_base::_M_grow_words failure");
+ __throw_ios_failure(__N("ios_base::_M_grow_words "
+ "allocation failed"));
+ if (iword)
+ _M_word_zero._M_iword = 0;
+ else
+ _M_word_zero._M_pword = 0;
return _M_word_zero;
}
for (int i = 0; i < _M_word_size; i++)
@@ -279,7 +185,11 @@ namespace std
{
_M_streambuf_state |= badbit;
if (_M_streambuf_state & _M_exception)
- __throw_ios_failure("ios_base::_M_grow_words failure");
+ __throw_ios_failure(__N("ios_base::_M_grow_words is not valid"));
+ if (iword)
+ _M_word_zero._M_iword = 0;
+ else
+ _M_word_zero._M_pword = 0;
return _M_word_zero;
}
}
@@ -287,51 +197,6 @@ namespace std
_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_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_size(_S_local_word_size),
- _M_word(_M_local_word)
- {
- // 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_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()
@@ -359,23 +224,4 @@ namespace std
}
_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
+} // namespace std
diff --git a/contrib/libstdc++/src/ios_failure.cc b/contrib/libstdc++/src/ios_failure.cc
new file mode 100644
index 0000000..0d99ba3
--- /dev/null
+++ b/contrib/libstdc++/src/ios_failure.cc
@@ -0,0 +1,48 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// 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.2.1.1 Class ios_base::failure
+//
+
+#include <ios>
+
+namespace std
+{
+ ios_base::failure::failure(const string& __str) throw()
+ : _M_msg(__str) { }
+
+ ios_base::failure::~failure() throw()
+ { }
+
+ const char*
+ ios_base::failure::what() const throw()
+ { return _M_msg.c_str(); }
+} // namespace std
diff --git a/contrib/libstdc++/src/ios_init.cc b/contrib/libstdc++/src/ios_init.cc
new file mode 100644
index 0000000..ae7b8e1
--- /dev/null
+++ b/contrib/libstdc++/src/ios_init.cc
@@ -0,0 +1,196 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// 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>
+#include <ext/stdio_sync_filebuf.h>
+
+namespace __gnu_internal
+{
+ using namespace __gnu_cxx;
+
+ // Extern declarations for global objects in src/globals.cc.
+ extern stdio_sync_filebuf<char> buf_cout_sync;
+ extern stdio_sync_filebuf<char> buf_cin_sync;
+ extern stdio_sync_filebuf<char> buf_cerr_sync;
+
+ extern stdio_filebuf<char> buf_cout;
+ extern stdio_filebuf<char> buf_cin;
+ extern stdio_filebuf<char> buf_cerr;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern stdio_sync_filebuf<wchar_t> buf_wcout_sync;
+ extern stdio_sync_filebuf<wchar_t> buf_wcin_sync;
+ extern stdio_sync_filebuf<wchar_t> buf_wcerr_sync;
+
+ extern stdio_filebuf<wchar_t> buf_wcout;
+ extern stdio_filebuf<wchar_t> buf_wcin;
+ extern stdio_filebuf<wchar_t> buf_wcerr;
+#endif
+} // namespace __gnu_internal
+
+namespace std
+{
+ using namespace __gnu_internal;
+
+ extern istream cin;
+ extern ostream cout;
+ extern ostream cerr;
+ extern ostream clog;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern wistream wcin;
+ extern wostream wcout;
+ extern wostream wcerr;
+ extern wostream wclog;
+#endif
+
+ ios_base::Init::Init()
+ {
+ if (__gnu_cxx::__exchange_and_add(&_S_refcount, 1) == 0)
+ {
+ // Standard streams default to synced with "C" operations.
+ _S_synced_with_stdio = true;
+
+ new (&buf_cout_sync) stdio_sync_filebuf<char>(stdout);
+ new (&buf_cin_sync) stdio_sync_filebuf<char>(stdin);
+ new (&buf_cerr_sync) stdio_sync_filebuf<char>(stderr);
+
+ // The standard streams are constructed once only and never
+ // destroyed.
+ new (&cout) ostream(&buf_cout_sync);
+ new (&cin) istream(&buf_cin_sync);
+ new (&cerr) ostream(&buf_cerr_sync);
+ new (&clog) ostream(&buf_cerr_sync);
+ cin.tie(&cout);
+ cerr.flags(ios_base::unitbuf);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ new (&buf_wcout_sync) stdio_sync_filebuf<wchar_t>(stdout);
+ new (&buf_wcin_sync) stdio_sync_filebuf<wchar_t>(stdin);
+ new (&buf_wcerr_sync) stdio_sync_filebuf<wchar_t>(stderr);
+
+ new (&wcout) wostream(&buf_wcout_sync);
+ new (&wcin) wistream(&buf_wcin_sync);
+ new (&wcerr) wostream(&buf_wcerr_sync);
+ new (&wclog) wostream(&buf_wcerr_sync);
+ wcin.tie(&wcout);
+ wcerr.flags(ios_base::unitbuf);
+#endif
+
+ // NB: Have to set refcount above one, so that standard
+ // streams are not re-initialized with uses of ios_base::Init
+ // besides <iostream> static object, ie just using <ios> with
+ // ios_base::Init objects.
+ __gnu_cxx::__atomic_add(&_S_refcount, 1);
+ }
+ }
+
+ ios_base::Init::~Init()
+ {
+ if (__gnu_cxx::__exchange_and_add(&_S_refcount, -1) == 2)
+ {
+ // Catch any exceptions thrown by basic_ostream::flush()
+ try
+ {
+ // Flush standard output streams as required by 27.4.2.1.6
+ cout.flush();
+ cerr.flush();
+ clog.flush();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ wcout.flush();
+ wcerr.flush();
+ wclog.flush();
+#endif
+ }
+ catch (...)
+ { }
+ }
+ }
+
+ bool
+ ios_base::sync_with_stdio(bool __sync)
+ {
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 49. Underspecification of ios_base::sync_with_stdio
+ bool __ret = ios_base::Init::_S_synced_with_stdio;
+
+ // Turn off sync with C FILE* for cin, cout, cerr, clog iff
+ // currently synchronized.
+ if (!__sync && __ret)
+ {
+ ios_base::Init::_S_synced_with_stdio = __sync;
+
+ // 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_sync.~stdio_sync_filebuf<char>();
+ buf_cin_sync.~stdio_sync_filebuf<char>();
+ buf_cerr_sync.~stdio_sync_filebuf<char>();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ buf_wcout_sync.~stdio_sync_filebuf<wchar_t>();
+ buf_wcin_sync.~stdio_sync_filebuf<wchar_t>();
+ buf_wcerr_sync.~stdio_sync_filebuf<wchar_t>();
+#endif
+
+ // Create stream buffers for the standard streams and use
+ // those buffers without destroying and recreating the
+ // streams.
+ new (&buf_cout) stdio_filebuf<char>(stdout, ios_base::out);
+ new (&buf_cin) stdio_filebuf<char>(stdin, ios_base::in);
+ new (&buf_cerr) stdio_filebuf<char>(stderr, ios_base::out);
+ cout.rdbuf(&buf_cout);
+ cin.rdbuf(&buf_cin);
+ cerr.rdbuf(&buf_cerr);
+ clog.rdbuf(&buf_cerr);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ new (&buf_wcout) stdio_filebuf<wchar_t>(stdout, ios_base::out);
+ new (&buf_wcin) stdio_filebuf<wchar_t>(stdin, ios_base::in);
+ new (&buf_wcerr) stdio_filebuf<wchar_t>(stderr, ios_base::out);
+ wcout.rdbuf(&buf_wcout);
+ wcin.rdbuf(&buf_wcin);
+ wcerr.rdbuf(&buf_wcerr);
+ wclog.rdbuf(&buf_wcerr);
+#endif
+ }
+ return __ret;
+ }
+} // namespace std
diff --git a/contrib/libstdc++/src/ios_locale.cc b/contrib/libstdc++/src/ios_locale.cc
new file mode 100644
index 0000000..008a485
--- /dev/null
+++ b/contrib/libstdc++/src/ios_locale.cc
@@ -0,0 +1,60 @@
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// 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 <locale>
+
+namespace std
+{
+ // 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_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;
+ }
+} // namespace std
diff --git a/contrib/libstdc++/src/istream-inst.cc b/contrib/libstdc++/src/istream-inst.cc
index f2c72fd..6b454ee 100644
--- a/contrib/libstdc++/src/istream-inst.cc
+++ b/contrib/libstdc++/src/istream-inst.cc
@@ -54,7 +54,7 @@ namespace std
template istream& operator>>(istream&, _Setprecision);
template istream& operator>>(istream&, _Setw);
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_istream<wchar_t>;
template wistream& ws(wistream&);
template wistream& operator>>(wistream&, wchar_t&);
diff --git a/contrib/libstdc++/src/limits.cc b/contrib/libstdc++/src/limits.cc
index 294673e..700009c 100644
--- a/contrib/libstdc++/src/limits.cc
+++ b/contrib/libstdc++/src/limits.cc
@@ -159,7 +159,7 @@ namespace std
// wchar_t
// This used to be problematic...
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_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;
@@ -182,7 +182,7 @@ namespace std
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
+#endif // _GLIBCXX_USE_WCHAR_T
// short
const bool numeric_limits<short>::is_specialized;
diff --git a/contrib/libstdc++/src/list.cc b/contrib/libstdc++/src/list.cc
new file mode 100644
index 0000000..ec94053
--- /dev/null
+++ b/contrib/libstdc++/src/list.cc
@@ -0,0 +1,141 @@
+// std::list utilities implementation -*- C++ -*-
+
+// Copyright (C) 2003 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.
+
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * 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. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1996,1997
+ * 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 <list>
+
+namespace _GLIBCXX_STD
+{
+ void
+ _List_node_base::swap(_List_node_base& __x, _List_node_base& __y)
+ {
+ if ( __x._M_next != &__x )
+ {
+ if ( __y._M_next != &__y )
+ {
+ // Both __x and __y are not empty.
+ std::swap(__x._M_next,__y._M_next);
+ std::swap(__x._M_prev,__y._M_prev);
+ __x._M_next->_M_prev = __x._M_prev->_M_next = &__x;
+ __y._M_next->_M_prev = __y._M_prev->_M_next = &__y;
+ }
+ else
+ {
+ // __x is not empty, __y is empty.
+ __y._M_next = __x._M_next;
+ __y._M_prev = __x._M_prev;
+ __y._M_next->_M_prev = __y._M_prev->_M_next = &__y;
+ __x._M_next = __x._M_prev = &__x;
+ }
+ }
+ else if ( __y._M_next != &__y )
+ {
+ // __x is empty, __y is not empty.
+ __x._M_next = __y._M_next;
+ __x._M_prev = __y._M_prev;
+ __x._M_next->_M_prev = __x._M_prev->_M_next = &__x;
+ __y._M_next = __y._M_prev = &__y;
+ }
+ }
+
+ void
+ _List_node_base::transfer(_List_node_base * const __first,
+ _List_node_base * const __last)
+ {
+ if (this != __last)
+ {
+ // Remove [first, last) from its old position.
+ __last->_M_prev->_M_next = this;
+ __first->_M_prev->_M_next = __last;
+ this->_M_prev->_M_next = __first;
+
+ // Splice [first, last) into its new position.
+ _List_node_base* const __tmp = this->_M_prev;
+ this->_M_prev = __last->_M_prev;
+ __last->_M_prev = __first->_M_prev;
+ __first->_M_prev = __tmp;
+ }
+ }
+
+ void
+ _List_node_base::reverse()
+ {
+ _List_node_base* __tmp = this;
+ do
+ {
+ std::swap(__tmp->_M_next, __tmp->_M_prev);
+ __tmp = __tmp->_M_prev; // Old next node is now prev.
+ }
+ while (__tmp != this);
+ }
+
+ void
+ _List_node_base::hook(_List_node_base* const __position)
+ {
+ this->_M_next = __position;
+ this->_M_prev = __position->_M_prev;
+ __position->_M_prev->_M_next = this;
+ __position->_M_prev = this;
+ }
+
+ void
+ _List_node_base::unhook()
+ {
+ _List_node_base* const __next_node = this->_M_next;
+ _List_node_base* const __prev_node = this->_M_prev;
+ __prev_node->_M_next = __next_node;
+ __next_node->_M_prev = __prev_node;
+ }
+} // namespace std
+
diff --git a/contrib/libstdc++/src/locale-inst.cc b/contrib/libstdc++/src/locale-inst.cc
index 8da410f..3aeb553 100644
--- a/contrib/libstdc++/src/locale-inst.cc
+++ b/contrib/libstdc++/src/locale-inst.cc
@@ -1,6 +1,7 @@
// Locale support -*- C++ -*-
-// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+// 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
@@ -31,531 +32,285 @@
// ISO C++ 14882: 22.1 Locales
//
-#include <cstdlib>
-#include <clocale>
-#include <cstring>
#include <locale>
+// Instantiation configuration.
+#ifndef C
+# define C char
+#endif
+
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> >;
- template class __locale_cache<numpunct<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> >;
- template class __locale_cache<numpunct<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 class moneypunct<C, false>;
+ template class moneypunct<C, true>;
+ template struct __moneypunct_cache<C, false>;
+ template struct __moneypunct_cache<C, true>;
+ template class moneypunct_byname<C, false>;
+ template class moneypunct_byname<C, true>;
+ template class money_get<C, istreambuf_iterator<C> >;
+ template class money_put<C, ostreambuf_iterator<C> >;
template
- ostreambuf_iterator<char>
- num_put<char, ostreambuf_iterator<char> >::
- _M_convert_int(ostreambuf_iterator<char>, ios_base&, char,
- long) const;
+ istreambuf_iterator<C>
+ money_get<C, istreambuf_iterator<C> >::
+ _M_extract<true>(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&, string&) const;
template
- ostreambuf_iterator<char>
- num_put<char, ostreambuf_iterator<char> >::
- _M_convert_int(ostreambuf_iterator<char>, ios_base&, char,
- unsigned long) const;
+ istreambuf_iterator<C>
+ money_get<C, istreambuf_iterator<C> >::
+ _M_extract<false>(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&, string&) 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,
- long long) const;
+ ostreambuf_iterator<C>
+ money_put<C, ostreambuf_iterator<C> >::
+ _M_insert<true>(ostreambuf_iterator<C>, ios_base&, C,
+ const string_type&) const;
template
- ostreambuf_iterator<char>
- num_put<char, ostreambuf_iterator<char> >::
- _M_convert_int(ostreambuf_iterator<char>, ios_base&, 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> >;
+ ostreambuf_iterator<C>
+ money_put<C, ostreambuf_iterator<C> >::
+ _M_insert<false>(ostreambuf_iterator<C>, ios_base&, C,
+ const string_type&) const;
+ // numpunct, numpunct_byname, num_get, and num_put
+ template class numpunct<C>;
+ template struct __numpunct_cache<C>;
+ template class numpunct_byname<C>;
+ template class num_get<C, istreambuf_iterator<C> >;
+ template class num_put<C, ostreambuf_iterator<C> >;
template
- ostreambuf_iterator<wchar_t>
- num_put<wchar_t, ostreambuf_iterator<wchar_t> >::
- _M_convert_int(ostreambuf_iterator<wchar_t>, ios_base&, wchar_t,
- long) const;
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ 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,
- unsigned long) const;
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned short&) 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,
- long long) const;
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned int&) 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,
- unsigned long long) const;
-#endif
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned long&) const;
+#ifdef _GLIBCXX_USE_LONG_LONG
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;
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ long long&) 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;
+ istreambuf_iterator<C>
+ num_get<C, istreambuf_iterator<C> >::
+ _M_extract_int(istreambuf_iterator<C>, istreambuf_iterator<C>,
+ ios_base&, ios_base::iostate&,
+ unsigned long long&) const;
#endif
-#if 1
- // XXX GLIBCXX_ABI Deprecated, compatibility only.
template
- ostreambuf_iterator<char>
- num_put<char, ostreambuf_iterator<char> >::
- _M_convert_int(ostreambuf_iterator<char>, ios_base&, char, char, char,
- long) const;
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ 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;
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ unsigned long) const;
-#ifdef _GLIBCPP_USE_LONG_LONG
+#ifdef _GLIBCXX_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;
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ 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;
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_int(ostreambuf_iterator<C>, ios_base&, C,
+ unsigned long long) const;
#endif
-#ifdef _GLIBCPP_USE_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;
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
+ double) 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
-#endif
-
-#endif
-
+ ostreambuf_iterator<C>
+ num_put<C, ostreambuf_iterator<C> >::
+ _M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char,
+ long double) const;
+
// 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
+ template class __timepunct<C>;
+ template struct __timepunct_cache<C>;
+ template class time_put<C, ostreambuf_iterator<C> >;
+ template class time_put_byname<C, ostreambuf_iterator<C> >;
+ template class time_get<C, istreambuf_iterator<C> >;
+ template class time_get_byname<C, istreambuf_iterator<C> >;
// 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
+ template class messages<C>;
+ template class messages_byname<C>;
// 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
+ inline template class __ctype_abstract_base<C>;
+ template class ctype_byname<C>;
// codecvt
- inline template class __codecvt_abstract_base<char, char, mbstate_t>;
- template class codecvt_byname<char, char, mbstate_t>;
-#ifdef _GLIBCPP_USE_WCHAR_T
- inline template class __codecvt_abstract_base<wchar_t, char, mbstate_t>;
- template class codecvt_byname<wchar_t, char, mbstate_t>;
-#endif
+ inline template class __codecvt_abstract_base<C, char, mbstate_t>;
+ template class codecvt_byname<C, char, mbstate_t>;
// 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
+ template class collate<C>;
+ template class collate_byname<C>;
// use_facet
// NB: use_facet<ctype> is specialized
template
- const codecvt<char, char, mbstate_t>&
- use_facet<codecvt<char, char, mbstate_t> >(const locale&);
+ const codecvt<C, char, mbstate_t>&
+ use_facet<codecvt<C, char, mbstate_t> >(const locale&);
template
- const collate<char>&
- use_facet<collate<char> >(const locale&);
+ const collate<C>&
+ use_facet<collate<C> >(const locale&);
template
- const numpunct<char>&
- use_facet<numpunct<char> >(const locale&);
+ const numpunct<C>&
+ use_facet<numpunct<C> >(const locale&);
template
- const num_put<char>&
- use_facet<num_put<char> >(const locale&);
+ const num_put<C>&
+ use_facet<num_put<C> >(const locale&);
template
- const num_get<char>&
- use_facet<num_get<char> >(const locale&);
+ const num_get<C>&
+ use_facet<num_get<C> >(const locale&);
template
- const moneypunct<char, true>&
- use_facet<moneypunct<char, true> >(const locale&);
+ const moneypunct<C, true>&
+ use_facet<moneypunct<C, true> >(const locale&);
template
- const moneypunct<char, false>&
- use_facet<moneypunct<char, false> >(const locale&);
+ const moneypunct<C, false>&
+ use_facet<moneypunct<C, false> >(const locale&);
template
- const money_put<char>&
- use_facet<money_put<char> >(const locale&);
+ const money_put<C>&
+ use_facet<money_put<C> >(const locale&);
template
- const money_get<char>&
- use_facet<money_get<char> >(const locale&);
+ const money_get<C>&
+ use_facet<money_get<C> >(const locale&);
template
- const __timepunct<char>&
- use_facet<__timepunct<char> >(const locale&);
+ const __timepunct<C>&
+ use_facet<__timepunct<C> >(const locale&);
template
- const time_put<char>&
- use_facet<time_put<char> >(const locale&);
+ const time_put<C>&
+ use_facet<time_put<C> >(const locale&);
template
- const time_get<char>&
- use_facet<time_get<char> >(const locale&);
+ const time_get<C>&
+ use_facet<time_get<C> >(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
+ const messages<C>&
+ use_facet<messages<C> >(const locale&);
// 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&);
+ has_facet<ctype<C> >(const locale&);
template
bool
- has_facet<num_put<char> >(const locale&);
+ has_facet<codecvt<C, char, mbstate_t> >(const locale&);
template
bool
- has_facet<num_get<char> >(const locale&);
+ has_facet<collate<C> >(const locale&);
template
bool
- has_facet<moneypunct<char> >(const locale&);
+ has_facet<numpunct<C> >(const locale&);
template
bool
- has_facet<money_put<char> >(const locale&);
+ has_facet<num_put<C> >(const locale&);
template
bool
- has_facet<money_get<char> >(const locale&);
+ has_facet<num_get<C> >(const locale&);
template
bool
- has_facet<__timepunct<char> >(const locale&);
+ has_facet<moneypunct<C> >(const locale&);
template
bool
- has_facet<time_put<char> >(const locale&);
+ has_facet<money_put<C> >(const locale&);
template
bool
- has_facet<time_get<char> >(const locale&);
+ has_facet<money_get<C> >(const locale&);
template
bool
- has_facet<messages<char> >(const locale&);
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- template
- bool
- has_facet<ctype<wchar_t> >(const locale&);
+ has_facet<__timepunct<C> >(const locale&);
template
bool
- has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
+ has_facet<time_put<C> >(const locale&);
template
bool
- has_facet<collate<wchar_t> >(const locale&);
+ has_facet<time_get<C> >(const locale&);
template
bool
- has_facet<numpunct<wchar_t> >(const locale&);
+ has_facet<messages<C> >(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
-
- // __use_cache
- template
- const __locale_cache<numpunct<char> >&
- __use_cache<numpunct<char> >(const locale& __loc);
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- template
- const __locale_cache<numpunct<wchar_t> >&
- __use_cache<numpunct<wchar_t> >(const locale& __loc);
-#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 class __pad<char, char_traits<char> >;
-
-#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*);
+ // locale functions.
template
- bool
- __verify_grouping<wchar_t>(const basic_string<wchar_t>&,
- basic_string<wchar_t>&);
+ C*
+ __add_grouping<C>(C*, C, char const*, size_t,
+ C const*, C const*);
- template class __pad<wchar_t, char_traits<wchar_t> >;
-#endif
+ template class __pad<C, char_traits<C> >;
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);
-
-#ifdef _GLIBCPP_USE_LONG_LONG
- 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);
-#endif
-
- template
- int
- __int_to_char(char*, const int, unsigned long, const char*,
- ios_base::fmtflags, bool);
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- template
- int
- __int_to_char(wchar_t*, const int, unsigned long, const wchar_t*,
- ios_base::fmtflags, bool);
-#endif
-
-#ifdef _GLIBCPP_USE_LONG_LONG
- template
- int
- __int_to_char(char*, const int, unsigned long long, const char*,
+ __int_to_char(C*, unsigned long, const C*,
ios_base::fmtflags, bool);
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_LONG_LONG
template
int
- __int_to_char(wchar_t*, const int, unsigned long long, const wchar_t*,
+ __int_to_char(C*, unsigned long long, const C*,
ios_base::fmtflags, bool);
#endif
-#endif
} // namespace std
diff --git a/contrib/libstdc++/src/locale-misc-inst.cc b/contrib/libstdc++/src/locale-misc-inst.cc
new file mode 100644
index 0000000..e7ecb03
--- /dev/null
+++ b/contrib/libstdc++/src/locale-misc-inst.cc
@@ -0,0 +1,47 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 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 <locale>
+
+namespace std
+{
+ 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);
+} // namespace std
diff --git a/contrib/libstdc++/src/locale.cc b/contrib/libstdc++/src/locale.cc
index 17ccdc2..623eb26 100644
--- a/contrib/libstdc++/src/locale.cc
+++ b/contrib/libstdc++/src/locale.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -28,22 +28,14 @@
#include <clocale>
#include <cstring>
+#include <cstdlib> // For getenv
#include <cctype>
#include <cwctype> // For towupper, etc.
#include <locale>
#include <bits/atomicity.h>
-namespace __gnu_cxx
-{
- // Defined in globals.cc.
- extern std::locale c_locale;
- extern std::locale::_Impl c_locale_impl;
-} // namespace __gnu_cxx
-
namespace std
{
- using namespace __gnu_cxx;
-
// Definitions for static const data members of locale.
const locale::category locale::none;
const locale::category locale::ctype;
@@ -54,116 +46,18 @@ namespace std
const locale::category locale::messages;
const locale::category locale::all;
- // In the future, GLIBCXX_ABI > 5 should remove all uses of
- // _GLIBCPP_ASM_SYMVER in this file, and remove exports of any
- // static data members of locale.
- locale::_Impl* locale::_S_classic;
+ // These are no longer exported.
+ locale::_Impl* locale::_S_classic;
locale::_Impl* locale::_S_global;
const size_t locale::_S_categories_size;
- _GLIBCPP_ASM_SYMVER(_ZNSt6locale18_S_categories_sizeE, _ZNSt6locale17_S_num_categoriesE, GLIBCPP_3.2)
- const size_t locale::_S_extra_categories_size;
-
- // 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,
+#ifdef __GTHREADS
+ __gthread_once_t locale::_S_once = __GTHREAD_ONCE_INIT;
#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_time,
- locale::_Impl::_S_id_monetary,
- locale::_Impl::_S_id_messages,
- 0
- };
-
- 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(); }
+ : _M_impl(__other._M_impl)
+ { _M_impl->_M_add_reference(); }
// This is used to initialize global and classic locales, and
// assumes that the _Impl objects are constructed correctly.
@@ -171,141 +65,22 @@ namespace std
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(__s, 1);
- else
- {
- // Get it from the environment.
- char* __env = getenv("LC_ALL");
- // If LC_ALL is set we are done.
- if (__env && strcmp(__env, "") != 0)
- {
- if (strcmp(__env, "C") == 0 || strcmp(__env, "POSIX") == 0)
- (_M_impl = _S_classic)->_M_add_reference();
- else
- _M_impl = new _Impl(__env, 1);
- }
- else
- {
- char* __res;
- // LANG may set a default different from "C".
- char* __env = getenv("LANG");
- if (!__env || strcmp(__env, "") == 0 || strcmp(__env, "C") == 0
- || strcmp(__env, "POSIX") == 0)
- __res = strdup("C");
- else
- __res = strdup(__env);
-
- // Scan the categories looking for the first one
- // different from LANG.
- size_t __i = 0;
- if (strcmp(__res, "C") == 0)
- for (; __i < _S_categories_size
- + _S_extra_categories_size; ++__i)
- {
- __env = getenv(_S_categories[__i]);
- if (__env && strcmp(__env, "") != 0
- && strcmp(__env, "C") != 0
- && strcmp(__env, "POSIX") != 0)
- break;
- }
- else
- for (; __i < _S_categories_size
- + _S_extra_categories_size; ++__i)
- {
- __env = getenv(_S_categories[__i]);
- if (__env && strcmp(__env, "") != 0
- && strcmp(__env, __res) != 0)
- break;
- }
-
- // If one is found, build the complete string of
- // the form LC_CTYPE=xxx;LC_NUMERIC=yyy; and so on...
- if (__i < _S_categories_size + _S_extra_categories_size)
- {
- string __str;
- for (size_t __j = 0; __j < __i; ++__j)
- {
- __str += _S_categories[__j];
- __str += '=';
- __str += __res;
- __str += ';';
- }
- __str += _S_categories[__i];
- __str += '=';
- __str += __env;
- __str += ';';
- __i++;
- for (; __i < _S_categories_size
- + _S_extra_categories_size; ++__i)
- {
- __env = getenv(_S_categories[__i]);
- if (!__env || strcmp(__env, "") == 0)
- {
- __str += _S_categories[__i];
- __str += '=';
- __str += __res;
- __str += ';';
- }
- else if (strcmp(__env, "C") == 0
- || strcmp(__env, "POSIX") == 0)
- {
- __str += _S_categories[__i];
- __str += "=C;";
- }
- else
- {
- __str += _S_categories[__i];
- __str += '=';
- __str += __env;
- __str += ';';
- }
- }
- __str.erase(__str.end() - 1);
- _M_impl = new _Impl(__str.c_str(), 1);
- }
- // ... otherwise either an additional instance of
- // the "C" locale or LANG.
- else if (strcmp(__res, "C") == 0)
- (_M_impl = _S_classic)->_M_add_reference();
- else
- _M_impl = new _Impl(__res, 1);
- free(__res);
- }
- }
- }
- 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); }
-
locale::~locale() throw()
{ _M_impl->_M_remove_reference(); }
bool
locale::operator==(const locale& __rhs) const throw()
{
- string __name = this->name();
- return (_M_impl == __rhs._M_impl
- || (__name != "*" && __name == __rhs.name()));
+ bool __ret = false;
+ if (_M_impl == __rhs._M_impl)
+ __ret = true;
+ else
+ {
+ const string __name = this->name();
+ if (__name != "*" && __name == __rhs.name())
+ __ret = true;
+ }
+ return __ret;
}
const locale&
@@ -317,26 +92,6 @@ namespace std
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
{
@@ -348,9 +103,7 @@ namespace std
__ret += _S_categories[0];
__ret += '=';
__ret += _M_impl->_M_names[0];
- for (size_t __i = 1;
- __i < _S_categories_size + _S_extra_categories_size;
- ++__i)
+ for (size_t __i = 1; __i < _S_categories_size; ++__i)
{
__ret += ';';
__ret += _S_categories[__i];
@@ -361,49 +114,6 @@ namespace std
return __ret;
}
- const locale&
- locale::classic()
- {
- // Locking protocol: singleton-called-before-threading-starts
- if (!_S_classic)
- {
- try
- {
- // 26 Standard facets, 2 references.
- // One reference for _S_classic, one for _S_global
- _S_classic = new (&c_locale_impl) _Impl(0, 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;
- }
-
- 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::category
locale::_S_normalize_category(category __cat)
{
@@ -430,7 +140,7 @@ namespace std
case LC_TIME:
__ret = time;
break;
-#ifdef _GLIBCPP_HAVE_LC_MESSAGES
+#ifdef _GLIBCXX_HAVE_LC_MESSAGES
case LC_MESSAGES:
__ret = messages;
break;
@@ -439,129 +149,225 @@ namespace std
__ret = all;
break;
default:
- __throw_runtime_error("bad locale category");
+ __throw_runtime_error(__N("locale::_S_normalize_category "
+ "category not found"));
}
}
return __ret;
}
- __c_locale
- locale::facet::_S_c_locale;
-
- char locale::facet::_S_c_name[2];
+ // locale::facet
+ __c_locale locale::facet::_S_c_locale;
- locale::facet::
- ~facet() { }
+ const char locale::facet::_S_c_name[2] = "C";
- locale::facet::
- facet(size_t __refs) throw() : _M_references(__refs ? 1 : 0)
- { }
+#ifdef __GTHREADS
+ __gthread_once_t locale::facet::_S_once = __GTHREAD_ONCE_INIT;
+#endif
- void
- locale::facet::
- _M_add_reference() throw()
- { __atomic_add(&_M_references, 1); }
+ void
+ locale::facet::_S_initialize_once()
+ {
+ // Initialize the underlying locale model.
+ _S_create_c_locale(_S_c_locale, _S_c_name);
+ }
- void
- locale::facet::
- _M_remove_reference() throw()
+ __c_locale
+ locale::facet::_S_get_c_locale()
{
- if (__exchange_and_add(&_M_references, -1) == 1)
+#ifdef __GHTREADS
+ if (__gthread_active_p())
+ __gthread_once(&_S_once, _S_initialize_once);
+ else
+#endif
{
- try
- { delete this; }
- catch (...)
- { }
+ if (!_S_c_locale)
+ _S_initialize_once();
}
+ return _S_c_locale;
}
-
- locale::id::id()
- { }
- // 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
+ const char*
+ locale::facet::_S_get_c_name()
+ { return _S_c_name; }
+
+ locale::facet::
+ ~facet() { }
- // Definitions for static const data members of money_base
- const money_base::pattern
- money_base::_S_default_pattern = { {symbol, sign, none, value} };
+ // locale::_Impl
+ locale::_Impl::
+ ~_Impl() throw()
+ {
+ if (_M_facets)
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ if (_M_facets[__i])
+ _M_facets[__i]->_M_remove_reference();
+ delete [] _M_facets;
+
+ if (_M_caches)
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ if (_M_caches[__i])
+ _M_caches[__i]->_M_remove_reference();
+ delete [] _M_caches;
+
+ if (_M_names)
+ for (size_t __i = 0; __i < _S_categories_size; ++__i)
+ delete [] _M_names[__i];
+ delete [] _M_names;
+ }
- const char* __num_base::_S_atoms_in = "0123456789eEabcdfABCDF";
- const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF";
+ // Clone existing _Impl object.
+ locale::_Impl::
+ _Impl(const _Impl& __imp, size_t __refs)
+ : _M_refcount(__refs), _M_facets(0), _M_facets_size(__imp._M_facets_size),
+ _M_caches(0), _M_names(0)
+ {
+ try
+ {
+ _M_facets = new const facet*[_M_facets_size];
+ 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();
+ }
+ _M_caches = new const facet*[_M_facets_size];
+ for (size_t __j = 0; __j < _M_facets_size; ++__j)
+ {
+ _M_caches[__j] = __imp._M_caches[__j];
+ if (_M_caches[__j])
+ _M_caches[__j]->_M_add_reference();
+ }
+ _M_names = new char*[_S_categories_size];
+ for (size_t __k = 0; __k < _S_categories_size; ++__k)
+ _M_names[__k] = 0;
+
+ // Name all the categories.
+ for (size_t __l = 0; __l < _S_categories_size; ++__l)
+ {
+ char* __new = new char[std::strlen(__imp._M_names[__l]) + 1];
+ std::strcpy(__new, __imp._M_names[__l]);
+ _M_names[__l] = __new;
+ }
+ }
+ catch(...)
+ {
+ this->~_Impl();
+ __throw_exception_again;
+ }
+ }
- // _GLIBCPP_RESOLVE_LIB_DEFECTS
- // According to the resolution of DR 231, about 22.2.2.2.2, p11,
- // "str.precision() is specified in the conversion specification".
void
- __num_base::_S_format_float(const ios_base& __io, char* __fptr,
- char __mod, streamsize/* unused post DR 231 */)
+ locale::_Impl::
+ _M_replace_category(const _Impl* __imp,
+ const locale::id* const* __idpp)
{
- 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 DR 231: _always_, not only when
- // __flags & ios_base::fixed || __prec > 0
- *__fptr++ = '.';
- *__fptr++ = '*';
-
- 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';
+ for (; *__idpp; ++__idpp)
+ _M_replace_facet(__imp, *__idpp);
}
void
- __num_base::_S_format_int(const ios_base& __io, char* __fptr, char __mod,
- char __modl)
+ locale::_Impl::
+ _M_replace_facet(const _Impl* __imp, const locale::id* __idp)
{
- 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';
+ size_t __index = __idp->_M_id();
+ if ((__index > (__imp->_M_facets_size - 1))
+ || !__imp->_M_facets[__index])
+ __throw_runtime_error(__N("locale::_Impl::_M_replace_facet"));
+ _M_install_facet(__idp, __imp->_M_facets[__index]);
+ }
+
+ void
+ locale::_Impl::
+ _M_install_facet(const locale::id* __idp, const facet* __fp)
+ {
+ if (__fp)
+ {
+ size_t __index = __idp->_M_id();
+
+ // Check size of facet vector to ensure adequate room.
+ if (__index > _M_facets_size - 1)
+ {
+ const size_t __new_size = __index + 4;
+
+ // New facet array.
+ const facet** __oldf = _M_facets;
+ const facet** __newf;
+ __newf = new const facet*[__new_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ __newf[__i] = _M_facets[__i];
+ for (size_t __l = _M_facets_size; __l < __new_size; ++__l)
+ __newf[__l] = 0;
+
+ // New cache array.
+ const facet** __oldc = _M_caches;
+ const facet** __newc;
+ try
+ {
+ __newc = new const facet*[__new_size];
+ }
+ catch(...)
+ {
+ delete [] __newf;
+ __throw_exception_again;
+ }
+ for (size_t __j = 0; __j < _M_facets_size; ++__j)
+ __newc[__j] = _M_caches[__j];
+ for (size_t __k = _M_facets_size; __k < __new_size; ++__k)
+ __newc[__k] = 0;
+
+ _M_facets_size = __new_size;
+ _M_facets = __newf;
+ _M_caches = __newc;
+ delete [] __oldf;
+ delete [] __oldc;
+ }
+
+ __fp->_M_add_reference();
+ const facet*& __fpr = _M_facets[__index];
+ if (__fpr)
+ {
+ // Replacing an existing facet. Order matters.
+ __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;
+ }
+
+ // Ideally, it would be nice to only remove the caches that
+ // are now incorrect. However, some of the caches depend on
+ // multiple facets, and we only know about one facet
+ // here. It's no great loss: the first use of the new facet
+ // will create a new, correctly cached facet anyway.
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ {
+ const facet* __cpr = _M_caches[__i];
+ if (__cpr)
+ {
+ __cpr->_M_remove_reference();
+ _M_caches[__i] = 0;
+ }
+ }
+ }
+ }
+
+
+ // locale::id
+ // Definitions for static const data members of locale::id
+ _Atomic_word locale::id::_S_refcount; // init'd to 0 by linker
+
+ size_t
+ locale::id::_M_id() const
+ {
+ if (!_M_index)
+ _M_index = 1 + __gnu_cxx::__exchange_and_add(&_S_refcount, 1);
+ return _M_index - 1;
}
} // namespace std
+
diff --git a/contrib/libstdc++/src/locale_facets.cc b/contrib/libstdc++/src/locale_facets.cc
new file mode 100644
index 0000000..db8c9e0
--- /dev/null
+++ b/contrib/libstdc++/src/locale_facets.cc
@@ -0,0 +1,93 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// 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 <locale>
+
+namespace std
+{
+ // Definitions for static const data members of time_base.
+ template<>
+ const char*
+ __timepunct_cache<char>::_S_timezones[14] =
+ {
+ "GMT", "HST", "AKST", "PST", "MST", "CST", "EST", "AST", "NST", "CET",
+ "IST", "EET", "CST", "JST"
+ };
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template<>
+ const wchar_t*
+ __timepunct_cache<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} };
+
+ const char* money_base::_S_atoms = "-0123456789";
+
+ const char* __num_base::_S_atoms_in = "-+xX0123456789abcdefABCDEF";
+ const char* __num_base::_S_atoms_out ="-+xX0123456789abcdef0123456789ABCDEF";
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // According to the resolution of DR 231, about 22.2.2.2.2, p11,
+ // "str.precision() is specified in the conversion specification".
+ void
+ __num_base::_S_format_float(const ios_base& __io, char* __fptr, char __mod)
+ {
+ 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 DR 231: _always_, not only when
+ // __flags & ios_base::fixed || __prec > 0
+ *__fptr++ = '.';
+ *__fptr++ = '*';
+
+ 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';
+ }
+} // namespace std
+
diff --git a/contrib/libstdc++/src/locale_init.cc b/contrib/libstdc++/src/locale_init.cc
new file mode 100644
index 0000000..7252bc5
--- /dev/null
+++ b/contrib/libstdc++/src/locale_init.cc
@@ -0,0 +1,347 @@
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// 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 <cstdlib> // For getenv, free.
+#include <cctype>
+#include <cwctype> // For towupper, etc.
+#include <locale>
+#include <bits/atomicity.h>
+#include <bits/concurrence.h>
+
+namespace __gnu_internal
+{
+ // Defined in globals.cc.
+ extern std::locale c_locale;
+ extern std::locale::_Impl c_locale_impl;
+
+ extern std::locale::facet* facet_vec[_GLIBCXX_NUM_FACETS];
+ extern char* name_vec[6 + _GLIBCXX_NUM_CATEGORIES];
+ extern char name_c[6 + _GLIBCXX_NUM_CATEGORIES][2];
+
+ extern std::ctype<char> ctype_c;
+ extern std::collate<char> collate_c;
+ extern std::numpunct<char> numpunct_c;
+ extern std::num_get<char> num_get_c;
+ extern std::num_put<char> num_put_c;
+ extern std::codecvt<char, char, mbstate_t> codecvt_c;
+ extern std::moneypunct<char, false> moneypunct_cf;
+ extern std::moneypunct<char, true> moneypunct_ct;
+ extern std::money_get<char> money_get_c;
+ extern std::money_put<char> money_put_c;
+ extern std::__timepunct<char> timepunct_c;
+ extern std::time_get<char> time_get_c;
+ extern std::time_put<char> time_put_c;
+ extern std::messages<char> messages_c;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern std::ctype<wchar_t> ctype_w;
+ extern std::collate<wchar_t> collate_w;
+ extern std::numpunct<wchar_t> numpunct_w;
+ extern std::num_get<wchar_t> num_get_w;
+ extern std::num_put<wchar_t> num_put_w;
+ extern std::codecvt<wchar_t, char, mbstate_t> codecvt_w;
+ extern std::moneypunct<wchar_t, false> moneypunct_wf;
+ extern std::moneypunct<wchar_t, true> moneypunct_wt;
+ extern std::money_get<wchar_t> money_get_w;
+ extern std::money_put<wchar_t> money_put_w;
+ extern std::__timepunct<wchar_t> timepunct_w;
+ extern std::time_get<wchar_t> time_get_w;
+ extern std::time_put<wchar_t> time_put_w;
+ extern std::messages<wchar_t> messages_w;
+#endif
+
+ // And the caches....
+ extern std::locale::facet* cache_vec[_GLIBCXX_NUM_FACETS];
+ extern std::__numpunct_cache<char> numpunct_cache_c;
+ extern std::__moneypunct_cache<char, false> moneypunct_cache_cf;
+ extern std::__moneypunct_cache<char, true> moneypunct_cache_ct;
+ extern std::__timepunct_cache<char> timepunct_cache_c;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ extern std::__numpunct_cache<wchar_t> numpunct_cache_w;
+ extern std::__moneypunct_cache<wchar_t, false> moneypunct_cache_wf;
+ extern std::__moneypunct_cache<wchar_t, true> moneypunct_cache_wt;
+ extern std::__timepunct_cache<wchar_t> timepunct_cache_w;
+#endif
+
+ // Mutex objects for locale initialization.
+ __glibcxx_mutex_define_initialized(locale_cons_mutex);
+ __glibcxx_mutex_define_initialized(locale_global_mutex);
+} // namespace __gnu_internal
+
+namespace std
+{
+ using namespace __gnu_internal;
+
+ locale::locale() throw() : _M_impl(0)
+ {
+ _S_initialize();
+ __glibcxx_mutex_lock(__gnu_internal::locale_cons_mutex);
+ _S_global->_M_add_reference();
+ _M_impl = _S_global;
+ __glibcxx_mutex_unlock(__gnu_internal::locale_cons_mutex);
+ }
+
+ locale
+ locale::global(const locale& __other)
+ {
+ _S_initialize();
+ __glibcxx_mutex_lock(__gnu_internal::locale_global_mutex);
+ _Impl* __old = _S_global;
+ __other._M_impl->_M_add_reference();
+ _S_global = __other._M_impl;
+ if (__other.name() != "*")
+ setlocale(LC_ALL, __other.name().c_str());
+ __glibcxx_mutex_unlock(__gnu_internal::locale_global_mutex);
+
+ // 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);
+ }
+
+ const locale&
+ locale::classic()
+ {
+ _S_initialize();
+ return c_locale;
+ }
+
+ void
+ locale::_S_initialize_once()
+ {
+ // 2 references.
+ // One reference for _S_classic, one for _S_global
+ _S_classic = new (&c_locale_impl) _Impl(2);
+ _S_global = _S_classic;
+ new (&c_locale) locale(_S_classic);
+ }
+
+ void
+ locale::_S_initialize()
+ {
+#ifdef __GTHREADS
+ if (__gthread_active_p())
+ __gthread_once(&_S_once, _S_initialize_once);
+#endif
+ if (!_S_classic)
+ _S_initialize_once();
+ }
+
+ // 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 _GLIBCXX_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 _GLIBCXX_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 _GLIBCXX_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 _GLIBCXX_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 _GLIBCXX_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 _GLIBCXX_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_time,
+ locale::_Impl::_S_id_monetary,
+ locale::_Impl::_S_id_messages,
+ 0
+ };
+
+ // Construct "C" _Impl.
+ locale::_Impl::
+ _Impl(size_t __refs) throw()
+ : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
+ _M_caches(0), _M_names(0)
+ {
+ _M_facets = new (&facet_vec) const facet*[_M_facets_size];
+ _M_caches = new (&cache_vec) const facet*[_M_facets_size];
+ for (size_t __i = 0; __i < _M_facets_size; ++__i)
+ _M_facets[__i] = _M_caches[__i] = 0;
+
+ // Name all the categories.
+ _M_names = new (&name_vec) char*[_S_categories_size];
+ for (size_t __j = 0; __j < _S_categories_size; ++__j)
+ {
+ _M_names[__j] = new (&name_c[__j]) char[2];
+ std::strcpy(_M_names[__j], locale::facet::_S_get_c_name());
+ }
+
+ // 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.
+ // NB: Set locale::facets(ref) count to one so that each individual
+ // facet is not destroyed when the locale (and thus locale::_Impl) is
+ // destroyed.
+ _M_init_facet(new (&ctype_c) std::ctype<char>(0, false, 1));
+ _M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>(1));
+
+ typedef __numpunct_cache<char> num_cache_c;
+ num_cache_c* __npc = new (&numpunct_cache_c) num_cache_c(2);
+ _M_init_facet(new (&numpunct_c) numpunct<char>(__npc, 1));
+
+ _M_init_facet(new (&num_get_c) num_get<char>(1));
+ _M_init_facet(new (&num_put_c) num_put<char>(1));
+ _M_init_facet(new (&collate_c) std::collate<char>(1));
+
+ typedef __moneypunct_cache<char, false> money_cache_cf;
+ typedef __moneypunct_cache<char, true> money_cache_ct;
+ money_cache_cf* __mpcf = new (&moneypunct_cache_cf) money_cache_cf(2);
+ _M_init_facet(new (&moneypunct_cf) moneypunct<char, false>(__mpcf, 1));
+ money_cache_ct* __mpct = new (&moneypunct_cache_ct) money_cache_ct(2);
+ _M_init_facet(new (&moneypunct_ct) moneypunct<char, true>(__mpct, 1));
+
+ _M_init_facet(new (&money_get_c) money_get<char>(1));
+ _M_init_facet(new (&money_put_c) money_put<char>(1));
+
+ typedef __timepunct_cache<char> time_cache_c;
+ time_cache_c* __tpc = new (&timepunct_cache_c) time_cache_c(2);
+ _M_init_facet(new (&timepunct_c) __timepunct<char>(__tpc, 1));
+
+ _M_init_facet(new (&time_get_c) time_get<char>(1));
+ _M_init_facet(new (&time_put_c) time_put<char>(1));
+ _M_init_facet(new (&messages_c) std::messages<char>(1));
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _M_init_facet(new (&ctype_w) std::ctype<wchar_t>(1));
+ _M_init_facet(new (&codecvt_w) codecvt<wchar_t, char, mbstate_t>(1));
+
+ typedef __numpunct_cache<wchar_t> num_cache_w;
+ num_cache_w* __npw = new (&numpunct_cache_w) num_cache_w(2);
+ _M_init_facet(new (&numpunct_w) numpunct<wchar_t>(__npw, 1));
+
+ _M_init_facet(new (&num_get_w) num_get<wchar_t>(1));
+ _M_init_facet(new (&num_put_w) num_put<wchar_t>(1));
+ _M_init_facet(new (&collate_w) std::collate<wchar_t>(1));
+
+ typedef __moneypunct_cache<wchar_t, false> money_cache_wf;
+ typedef __moneypunct_cache<wchar_t, true> money_cache_wt;
+ money_cache_wf* __mpwf = new (&moneypunct_cache_wf) money_cache_wf(2);
+ _M_init_facet(new (&moneypunct_wf) moneypunct<wchar_t, false>(__mpwf, 1));
+ money_cache_wt* __mpwt = new (&moneypunct_cache_wt) money_cache_wt(2);
+ _M_init_facet(new (&moneypunct_wt) moneypunct<wchar_t, true>(__mpwt, 1));
+
+ _M_init_facet(new (&money_get_w) money_get<wchar_t>(1));
+ _M_init_facet(new (&money_put_w) money_put<wchar_t>(1));
+
+ typedef __timepunct_cache<wchar_t> time_cache_w;
+ time_cache_w* __tpw = new (&timepunct_cache_w) time_cache_w(2);
+ _M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(__tpw, 1));
+
+ _M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
+ _M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
+ _M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
+#endif
+
+ // This locale is safe to pre-cache, after all the facets have
+ // been created and installed.
+ _M_caches[numpunct<char>::id._M_id()] = __npc;
+ _M_caches[moneypunct<char, false>::id._M_id()] = __mpcf;
+ _M_caches[moneypunct<char, true>::id._M_id()] = __mpct;
+ _M_caches[__timepunct<char>::id._M_id()] = __tpc;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _M_caches[numpunct<wchar_t>::id._M_id()] = __npw;
+ _M_caches[moneypunct<wchar_t, false>::id._M_id()] = __mpwf;
+ _M_caches[moneypunct<wchar_t, true>::id._M_id()] = __mpwt;
+ _M_caches[__timepunct<wchar_t>::id._M_id()] = __tpw;
+#endif
+ }
+} // namespace std
diff --git a/contrib/libstdc++/src/localename.cc b/contrib/libstdc++/src/localename.cc
index ec35fdb..503d055 100644
--- a/contrib/libstdc++/src/localename.cc
+++ b/contrib/libstdc++/src/localename.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -30,361 +30,265 @@
#include <cstring>
#include <locale>
-namespace __gnu_cxx
-{
- using namespace std;
-
- // Defined in globals.cc.
- extern locale::facet* facet_vec[_GLIBCPP_NUM_FACETS];
- extern locale::facet* facet_cache_vec[2 * _GLIBCPP_NUM_FACETS];
- extern char* facet_name[6 + _GLIBCPP_NUM_CATEGORIES];
-
- 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
-
- extern std::__locale_cache<numpunct<char> > locale_cache_np_c;
-#ifdef _GLIBCPP_USE_WCHAR_T
- extern std::__locale_cache<numpunct<wchar_t> > locale_cache_np_w;
-#endif
-} // namespace __gnu_cxx
-
namespace std
{
using namespace __gnu_cxx;
- locale::_Impl::
- ~_Impl() throw()
+
+ locale::locale(const char* __s) : _M_impl(0)
{
- // Clean up facets, then caches. No cache refcounts for now.
- for (size_t __i = 0; __i < _M_facets_size; ++__i)
- if (_M_facets[__i])
- _M_facets[__i]->_M_remove_reference();
- for (size_t __i = _M_facets_size; __i < 2*_M_facets_size; ++__i)
- if (_M_facets[__i])
- delete (__locale_cache_base*)_M_facets[__i];
- delete [] _M_facets;
+ if (__s)
+ {
+ _S_initialize();
+ if (std::strcmp(__s, "C") == 0 || std::strcmp(__s, "POSIX") == 0)
+ (_M_impl = _S_classic)->_M_add_reference();
+ else if (std::strcmp(__s, "") != 0)
+ _M_impl = new _Impl(__s, 1);
+ else
+ {
+ // Get it from the environment.
+ char* __env = std::getenv("LC_ALL");
+ // If LC_ALL is set we are done.
+ if (__env && std::strcmp(__env, "") != 0)
+ {
+ if (std::strcmp(__env, "C") == 0
+ || std::strcmp(__env, "POSIX") == 0)
+ (_M_impl = _S_classic)->_M_add_reference();
+ else
+ _M_impl = new _Impl(__env, 1);
+ }
+ else
+ {
+ // LANG may set a default different from "C".
+ string __res;
+ char* __env = std::getenv("LANG");
+ if (!__env || std::strcmp(__env, "") == 0
+ || std::strcmp(__env, "C") == 0
+ || std::strcmp(__env, "POSIX") == 0)
+ __res = "C";
+ else
+ __res = __env;
+
+ // Scan the categories looking for the first one
+ // different from LANG.
+ size_t __i = 0;
+ if (__res == "C")
+ for (; __i < _S_categories_size; ++__i)
+ {
+ __env = std::getenv(_S_categories[__i]);
+ if (__env && std::strcmp(__env, "") != 0
+ && std::strcmp(__env, "C") != 0
+ && std::strcmp(__env, "POSIX") != 0)
+ break;
+ }
+ else
+ for (; __i < _S_categories_size; ++__i)
+ {
+ __env = std::getenv(_S_categories[__i]);
+ if (__env && std::strcmp(__env, "") != 0
+ && __res != __env)
+ break;
+ }
+
+ // If one is found, build the complete string of
+ // the form LC_CTYPE=xxx;LC_NUMERIC=yyy; and so on...
+ if (__i < _S_categories_size)
+ {
+ string __str;
+ for (size_t __j = 0; __j < __i; ++__j)
+ {
+ __str += _S_categories[__j];
+ __str += '=';
+ __str += __res;
+ __str += ';';
+ }
+ __str += _S_categories[__i];
+ __str += '=';
+ __str += __env;
+ __str += ';';
+ __i++;
+ for (; __i < _S_categories_size; ++__i)
+ {
+ __env = std::getenv(_S_categories[__i]);
+ if (!__env || std::strcmp(__env, "") == 0)
+ {
+ __str += _S_categories[__i];
+ __str += '=';
+ __str += __res;
+ __str += ';';
+ }
+ else if (std::strcmp(__env, "C") == 0
+ || std::strcmp(__env, "POSIX") == 0)
+ {
+ __str += _S_categories[__i];
+ __str += "=C;";
+ }
+ else
+ {
+ __str += _S_categories[__i];
+ __str += '=';
+ __str += __env;
+ __str += ';';
+ }
+ }
+ __str.erase(__str.end() - 1);
+ _M_impl = new _Impl(__str.c_str(), 1);
+ }
+ // ... otherwise either an additional instance of
+ // the "C" locale or LANG.
+ else if (__res == "C")
+ (_M_impl = _S_classic)->_M_add_reference();
+ else
+ _M_impl = new _Impl(__res.c_str(), 1);
+ }
+ }
+ }
+ else
+ __throw_runtime_error(__N("locale::locale NULL not valid"));
+ }
- for (size_t __i = 0;
- __i < _S_categories_size + _S_extra_categories_size; ++__i)
- delete [] _M_names[__i];
+ locale::locale(const locale& __base, const char* __s, category __cat)
+ : _M_impl(0)
+ {
+ // 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);
}
- // Clone existing _Impl object.
- locale::_Impl::
- _Impl(const _Impl& __imp, size_t __refs)
- : _M_references(__refs), _M_facets_size(__imp._M_facets_size) // XXX
+ locale::locale(const locale& __base, const locale& __add, category __cat)
+ : _M_impl(0)
+ { _M_coalesce(__base, __add, __cat); }
+
+ void
+ locale::_M_coalesce(const locale& __base, const locale& __add,
+ category __cat)
{
- try
+ __cat = _S_normalize_category(__cat);
+ _M_impl = new _Impl(*__base._M_impl, 1);
+
+ try
+ { _M_impl->_M_replace_categories(__add._M_impl, __cat); }
+ catch (...)
{
- // Space for facets and matching caches
- _M_facets = new facet*[2*_M_facets_size];
- for (size_t __i = 0; __i < 2*_M_facets_size; ++__i)
- _M_facets[__i] = 0;
- }
- catch(...)
- {
- delete [] _M_facets;
+ _M_impl->_M_remove_reference();
__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_categories_size + _S_extra_categories_size; ++__i)
- {
- char* __new = new char[strlen(__imp._M_names[__i]) + 1];
- strcpy(__new, __imp._M_names[__i]);
- _M_names[__i] = __new;
- }
}
// Construct named _Impl.
locale::_Impl::
_Impl(const char* __s, size_t __refs)
- : _M_references(__refs), _M_facets_size(_GLIBCPP_NUM_FACETS)
+ : _M_refcount(__refs), _M_facets(0), _M_facets_size(_GLIBCXX_NUM_FACETS),
+ _M_caches(0), _M_names(0)
{
- // Initialize the underlying locale model, which also checks
- // to see if the given name is valid.
+ // 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
{
- // Space for facets and matching caches
- _M_facets = new facet*[2*_M_facets_size];
- for (size_t __i = 0; __i < 2*_M_facets_size; ++__i)
+ _M_facets = new const 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;
- }
+ _M_caches = new const facet*[_M_facets_size];
+ for (size_t __j = 0; __j < _M_facets_size; ++__j)
+ _M_caches[__j] = 0;
+ _M_names = new char*[_S_categories_size];
+ for (size_t __k = 0; __k < _S_categories_size; ++__k)
+ _M_names[__k] = 0;
- // Name all the categories.
- size_t __len = strlen(__s);
- if (!strchr(__s, ';'))
- {
- for (size_t __i = 0;
- __i < _S_categories_size + _S_extra_categories_size; ++__i)
+ // Name all the categories.
+ const size_t __len = std::strlen(__s);
+ if (!std::strchr(__s, ';'))
{
- _M_names[__i] = new char[__len + 1];
- strcpy(_M_names[__i], __s);
+ for (size_t __i = 0; __i < _S_categories_size; ++__i)
+ {
+ _M_names[__i] = new char[__len + 1];
+ std::strcpy(_M_names[__i], __s);
+ }
}
- }
- else
- {
- const char* __beg = __s;
- for (size_t __i = 0;
- __i < _S_categories_size + _S_extra_categories_size; ++__i)
+ else
{
- __beg = strchr(__beg, '=') + 1;
- const char* __end = strchr(__beg, ';');
- if (!__end)
- __end = __s + __len;
- char* __new = new char[__end - __beg + 1];
- memcpy(__new, __beg, __end - __beg);
- __new[__end - __beg] = '\0';
- _M_names[__i] = __new;
+ const char* __beg = __s;
+ for (size_t __i = 0; __i < _S_categories_size; ++__i)
+ {
+ __beg = std::strchr(__beg, '=') + 1;
+ const char* __end = std::strchr(__beg, ';');
+ if (!__end)
+ __end = __s + __len;
+ char* __new = new char[__end - __beg + 1];
+ std::memcpy(__new, __beg, __end - __beg);
+ __new[__end - __beg] = '\0';
+ _M_names[__i] = __new;
+ }
}
- }
-
- // Construct all standard facets and add them to _M_facets.
- _M_init_facet(new std::ctype<char>(__cloc, 0, false));
- _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, __s));
- _M_init_facet(new moneypunct<char, true>(__cloc, __s));
- _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));
+
+ // Construct all standard facets and add them to _M_facets.
+ _M_init_facet(new std::ctype<char>(__cloc, 0, false));
+ _M_init_facet(new codecvt<char, char, mbstate_t>(__cloc));
+ _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, __s));
+ _M_init_facet(new moneypunct<char, true>(__cloc, __s));
+ _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, __s));
- _M_init_facet(new moneypunct<wchar_t, true>(__cloc, __s));
- _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));
+#ifdef _GLIBCXX_USE_WCHAR_T
+ _M_init_facet(new std::ctype<wchar_t>(__cloc));
+ _M_init_facet(new codecvt<wchar_t, char, mbstate_t>(__cloc));
+ _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, __s));
+ _M_init_facet(new moneypunct<wchar_t, true>(__cloc, __s));
+ _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**, size_t __refs, bool)
- : _M_references(__refs), _M_facets_size(_GLIBCPP_NUM_FACETS)
- {
- // Initialize the underlying locale model.
- locale::facet::_S_c_name[0] = 'C';
- locale::facet::_S_c_name[1] = '\0';
- locale::facet::_S_create_c_locale(locale::facet::_S_c_locale,
- locale::facet::_S_c_name);
-
- // Space for facets and matching caches
- _M_facets = new(&facet_cache_vec) facet*[2*_M_facets_size];
- for (size_t __i = 0; __i < 2*_M_facets_size; ++__i)
- _M_facets[__i] = 0;
-
- // Name all the categories.
- for (size_t __i = 0;
- __i < _S_categories_size + _S_extra_categories_size; ++__i)
- {
- _M_names[__i] = new (&facet_name[__i]) char[2];
- strcpy(_M_names[__i], locale::facet::_S_c_name);
+ locale::facet::_S_destroy_c_locale(__cloc);
}
-
- // 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.
- // NB: Set locale::facets(ref) count to one so that each individual
- // facet is not destroyed when the locale (and thus locale::_Impl) is
- // destroyed.
- _M_init_facet(new (&ctype_c) std::ctype<char>(0, false, 1));
- _M_init_facet(new (&codecvt_c) codecvt<char, char, mbstate_t>(1));
- _M_init_facet(new (&numpunct_c) numpunct<char>(1));
- _M_init_facet(new (&num_get_c) num_get<char>(1));
- _M_init_facet(new (&num_put_c) num_put<char>(1));
- _M_init_facet(new (&collate_c) std::collate<char>(1));
- _M_init_facet(new (&moneypunct_fc) moneypunct<char, false>(1));
- _M_init_facet(new (&moneypunct_tc) moneypunct<char, true>(1));
- _M_init_facet(new (&money_get_c) money_get<char>(1));
- _M_init_facet(new (&money_put_c) money_put<char>(1));
- _M_init_facet(new (&timepunct_c) __timepunct<char>(1));
- _M_init_facet(new (&time_get_c) time_get<char>(1));
- _M_init_facet(new (&time_put_c) time_put<char>(1));
- _M_init_facet(new (&messages_c) std::messages<char>(1));
-#ifdef _GLIBCPP_USE_WCHAR_T
- _M_init_facet(new (&ctype_w) std::ctype<wchar_t>(1));
- _M_init_facet(new (&codecvt_w) codecvt<wchar_t, char, mbstate_t>(1));
- _M_init_facet(new (&numpunct_w) numpunct<wchar_t>(1));
- _M_init_facet(new (&num_get_w) num_get<wchar_t>(1));
- _M_init_facet(new (&num_put_w) num_put<wchar_t>(1));
- _M_init_facet(new (&collate_w) std::collate<wchar_t>(1));
- _M_init_facet(new (&moneypunct_fw) moneypunct<wchar_t, false>(1));
- _M_init_facet(new (&moneypunct_tw) moneypunct<wchar_t, true>(1));
- _M_init_facet(new (&money_get_w) money_get<wchar_t>(1));
- _M_init_facet(new (&money_put_w) money_put<wchar_t>(1));
- _M_init_facet(new (&timepunct_w) __timepunct<wchar_t>(1));
- _M_init_facet(new (&time_get_w) time_get<wchar_t>(1));
- _M_init_facet(new (&time_put_w) time_put<wchar_t>(1));
- _M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
-#endif
-
- // Initialize the static locale caches for C locale.
-
- locale ltmp(this); // Doesn't bump refcount
- _M_add_reference(); // Bump so destructor doesn't trash us
-
- // These need to be built in static allocated memory. There must
- // be a better way to do this!
- __locale_cache<numpunct<char> >* __lc =
- new (&locale_cache_np_c) __locale_cache<numpunct<char> >(ltmp, true);
- _M_facets[numpunct<char>::id._M_id() + _M_facets_size] =
- reinterpret_cast<locale::facet*>(__lc);
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- __locale_cache<numpunct<wchar_t> >* __wlc =
- new (&locale_cache_np_w) __locale_cache<numpunct<wchar_t> >(ltmp, true);
- _M_facets[numpunct<wchar_t>::id._M_id() + _M_facets_size] =
- reinterpret_cast<locale::facet*>(__wlc);
-#endif
+ catch(...)
+ {
+ locale::facet::_S_destroy_c_locale(__cloc);
+ this->~_Impl();
+ __throw_exception_again;
+ }
}
-
+
void
locale::_Impl::
_M_replace_categories(const _Impl* __imp, category __cat)
{
- category __mask;
for (size_t __ix = 0; __ix < _S_categories_size; ++__ix)
{
- __mask = 1 << __ix;
+ const category __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)
+ if (std::strcmp(_M_names[__ix], "*") != 0
+ && std::strcmp(__imp->_M_names[__ix], "*") != 0)
{
+ char* __new = new char[std::strlen(__imp->_M_names[__ix]) + 1];
+ std::strcpy(__new, __imp->_M_names[__ix]);
delete [] _M_names[__ix];
- char* __new = new char[strlen(__imp->_M_names[__ix]) + 1];
- strcpy(__new, __imp->_M_names[__ix]);
_M_names[__ix] = __new;
}
}
}
}
-
- 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();
-
- // Check size of facet vector to ensure adequate room.
- if (__index > _M_facets_size - 1)
- {
- facet** __old = _M_facets;
- facet** __new;
- const size_t __new_size = __index + 4;
- __new = new facet*[2 * __new_size];
- 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;
- // Also copy caches and clear extra space
- for (size_t __i = 0; __i < _M_facets_size; ++__i)
- __new[__i + __new_size] = _M_facets[__i + _M_facets_size];
- for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2)
- __new[__i2 + __new_size] = 0;
-
- _M_facets_size = __new_size;
- _M_facets = __new;
- delete [] __old;
- }
-
- __fp->_M_add_reference();
- facet*& __fpr = _M_facets[__index];
- if (__fpr)
- {
- // Replacing an existing facet. Order matters.
- __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
index 61cb1b3..b9bc298 100644
--- a/contrib/libstdc++/src/misc-inst.cc
+++ b/contrib/libstdc++/src/misc-inst.cc
@@ -1,6 +1,6 @@
// Explicit instantiation file.
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -38,6 +38,7 @@
#include <algorithm>
#include <vector>
#include <bits/atomicity.h>
+#include <ext/stdio_sync_filebuf.h>
namespace std
{
@@ -54,7 +55,7 @@ namespace std
template
basic_istream<char>&
getline(basic_istream<char>&, string&);
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template
basic_istream<wchar_t>&
operator>>(basic_istream<wchar_t>&, wstring&);
@@ -68,40 +69,14 @@ namespace std
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&);
#endif
-#ifdef _GLIBCPP_INST_ATOMICITY_LOCK
- template volatile int __Atomicity_lock<0>::_S_atomicity_lock;
-#endif
-
-#if 1
- // XXX
- // 2002-05-24 These are no longer needed and should eventually be deleted.
- 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);
-#endif
} // namespace std
-#ifdef _GLIBCPP_NEED_GENERIC_MUTEX
namespace __gnu_cxx
{
-#ifdef __GTHREAD_MUTEX_INIT
- __gthread_mutex_t _Atomic_add_mutex = __GTHREAD_MUTEX_INIT;
-#else
- // generic atomicity.h without static initialization
- __gthread_mutex_t _Atomic_add_mutex;
- __gthread_once_t _Atomic_add_mutex_once = __GTHREAD_ONCE_INIT;
- void __gthread_atomic_add_mutex_once()
- {
- __GTHREAD_MUTEX_INIT_FUNCTION (&_Atomic_add_mutex);
- }
+ template class stdio_sync_filebuf<char>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class stdio_sync_filebuf<wchar_t>;
#endif
} // namespace __gnu_cxx
-#endif // _GLIBCPP_NEED_GLOBAL_MUTEX
+
diff --git a/contrib/libstdc++/src/ostream-inst.cc b/contrib/libstdc++/src/ostream-inst.cc
index b834640..c4e2394 100644
--- a/contrib/libstdc++/src/ostream-inst.cc
+++ b/contrib/libstdc++/src/ostream-inst.cc
@@ -56,7 +56,7 @@ namespace std
template ostream& operator<<(ostream&, _Setprecision);
template ostream& operator<<(ostream&, _Setw);
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_ostream<wchar_t>;
template wostream& endl(wostream&);
template wostream& ends(wostream&);
diff --git a/contrib/libstdc++/src/sstream-inst.cc b/contrib/libstdc++/src/sstream-inst.cc
index 6c0272b..3295c2f 100644
--- a/contrib/libstdc++/src/sstream-inst.cc
+++ b/contrib/libstdc++/src/sstream-inst.cc
@@ -38,25 +38,25 @@ namespace std
{
// stringbuf
template class basic_stringbuf<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_stringbuf<wchar_t>;
#endif
// istringstream
template class basic_istringstream<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_istringstream<wchar_t>;
#endif
// ostringstream
template class basic_ostringstream<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_ostringstream<wchar_t>;
#endif
// stringstream
template class basic_stringstream<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_stringstream<wchar_t>;
#endif
} // namespace std
diff --git a/contrib/libstdc++/src/stdexcept.cc b/contrib/libstdc++/src/stdexcept.cc
index d39d41f..5db7c68 100644
--- a/contrib/libstdc++/src/stdexcept.cc
+++ b/contrib/libstdc++/src/stdexcept.cc
@@ -1,6 +1,6 @@
// Methods for Exception Support for -*- C++ -*-
-// Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1997, 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
@@ -39,7 +39,7 @@ namespace std
logic_error::logic_error(const string& __arg)
: exception(), _M_msg(__arg) { }
- logic_error::~logic_error() throw() { };
+ logic_error::~logic_error() throw() { }
const char*
logic_error::what() const throw()
@@ -60,7 +60,7 @@ namespace std
runtime_error::runtime_error(const string& __arg)
: exception(), _M_msg(__arg) { }
- runtime_error::~runtime_error() throw() { };
+ runtime_error::~runtime_error() throw() { }
const char*
runtime_error::what() const throw()
diff --git a/contrib/libstdc++/src/streambuf-inst.cc b/contrib/libstdc++/src/streambuf-inst.cc
index 438752e..5d1879a 100644
--- a/contrib/libstdc++/src/streambuf-inst.cc
+++ b/contrib/libstdc++/src/streambuf-inst.cc
@@ -39,18 +39,18 @@ namespace std
{
// streambuf
template class basic_streambuf<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template class basic_streambuf<wchar_t>;
#endif
template
streamsize
- __copy_streambufs(basic_ios<char>&, basic_streambuf<char>*,
+ __copy_streambufs(basic_streambuf<char>*,
basic_streambuf<char>*);
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
template
streamsize
- __copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*,
+ __copy_streambufs(basic_streambuf<wchar_t>*,
basic_streambuf<wchar_t>*);
#endif
} //std
diff --git a/contrib/libstdc++/src/string-inst.cc b/contrib/libstdc++/src/string-inst.cc
index 3fcaf51..e01dbca 100644
--- a/contrib/libstdc++/src/string-inst.cc
+++ b/contrib/libstdc++/src/string-inst.cc
@@ -1,6 +1,6 @@
// Components for manipulating sequences of characters -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -42,7 +42,7 @@
# define C char
#endif
-namespace std
+namespace std
{
typedef basic_string<C> S;
@@ -50,17 +50,7 @@ namespace std
template S operator+(const C*, const S&);
template S operator+(C, const S&);
template S operator+(const S&, 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
@@ -74,54 +64,10 @@ namespace std
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);
@@ -130,8 +76,11 @@ namespace std
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
+
+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 __gnu_cxx
diff --git a/contrib/libstdc++/src/strstream.cc b/contrib/libstdc++/src/strstream.cc
index 00f5b73..832a19c 100644
--- a/contrib/libstdc++/src/strstream.cc
+++ b/contrib/libstdc++/src/strstream.cc
@@ -59,7 +59,7 @@ namespace std
: _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));
+ streamsize n = std::max(initial_capacity, streamsize(16));
char* buf = _M_alloc(n);
if (buf)
@@ -148,7 +148,7 @@ namespace std
if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant)
{
ptrdiff_t old_size = epptr() - pbase();
- ptrdiff_t new_size = max(ptrdiff_t(2 * old_size), ptrdiff_t(1));
+ ptrdiff_t new_size = std::max(ptrdiff_t(2 * old_size), ptrdiff_t(1));
char* buf = _M_alloc(new_size);
if (buf)
@@ -168,7 +168,7 @@ namespace std
if (reposition_get)
setg(buf, buf + old_get_offset, buf +
- max(old_get_offset, old_size));
+ std::max(old_get_offset, old_size));
_M_free(old_buffer);
}
@@ -194,7 +194,7 @@ namespace std
gbump(-1);
return _Traits::not_eof(c);
}
- else if (c == static_cast<int_type>(gptr()[-1]))
+ else if (c == _Traits::to_int_type(gptr()[-1]))
{ // KLUDGE
gbump(-1);
return c;
diff --git a/contrib/libstdc++/src/tree.cc b/contrib/libstdc++/src/tree.cc
new file mode 100644
index 0000000..0cef30c
--- /dev/null
+++ b/contrib/libstdc++/src/tree.cc
@@ -0,0 +1,431 @@
+// RB tree utilities implementation -*- C++ -*-
+
+// Copyright (C) 2003 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.
+
+/*
+ *
+ * Copyright (c) 1996,1997
+ * 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.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * 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. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ */
+
+#include <bits/stl_tree.h>
+
+namespace std
+{
+ _Rb_tree_node_base*
+ _Rb_tree_increment(_Rb_tree_node_base* __x)
+ {
+ if (__x->_M_right != 0)
+ {
+ __x = __x->_M_right;
+ while (__x->_M_left != 0)
+ __x = __x->_M_left;
+ }
+ else
+ {
+ _Rb_tree_node_base* __y = __x->_M_parent;
+ while (__x == __y->_M_right)
+ {
+ __x = __y;
+ __y = __y->_M_parent;
+ }
+ if (__x->_M_right != __y)
+ __x = __y;
+ }
+ return __x;
+ }
+
+ const _Rb_tree_node_base*
+ _Rb_tree_increment(const _Rb_tree_node_base* __x)
+ {
+ return _Rb_tree_increment(const_cast<_Rb_tree_node_base*>(__x));
+ }
+
+ _Rb_tree_node_base*
+ _Rb_tree_decrement(_Rb_tree_node_base* __x)
+ {
+ if (__x->_M_color == _S_red
+ && __x->_M_parent->_M_parent == __x)
+ __x = __x->_M_right;
+ else if (__x->_M_left != 0)
+ {
+ _Rb_tree_node_base* __y = __x->_M_left;
+ while (__y->_M_right != 0)
+ __y = __y->_M_right;
+ __x = __y;
+ }
+ else
+ {
+ _Rb_tree_node_base* __y = __x->_M_parent;
+ while (__x == __y->_M_left)
+ {
+ __x = __y;
+ __y = __y->_M_parent;
+ }
+ __x = __y;
+ }
+ return __x;
+ }
+
+ const _Rb_tree_node_base*
+ _Rb_tree_decrement(const _Rb_tree_node_base* __x)
+ {
+ return _Rb_tree_decrement(const_cast<_Rb_tree_node_base*>(__x));
+ }
+
+ void
+ _Rb_tree_rotate_left(_Rb_tree_node_base* const __x,
+ _Rb_tree_node_base*& __root)
+ {
+ _Rb_tree_node_base* const __y = __x->_M_right;
+
+ __x->_M_right = __y->_M_left;
+ if (__y->_M_left !=0)
+ __y->_M_left->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_left)
+ __x->_M_parent->_M_left = __y;
+ else
+ __x->_M_parent->_M_right = __y;
+ __y->_M_left = __x;
+ __x->_M_parent = __y;
+ }
+
+ void
+ _Rb_tree_rotate_right(_Rb_tree_node_base* const __x,
+ _Rb_tree_node_base*& __root)
+ {
+ _Rb_tree_node_base* const __y = __x->_M_left;
+
+ __x->_M_left = __y->_M_right;
+ if (__y->_M_right != 0)
+ __y->_M_right->_M_parent = __x;
+ __y->_M_parent = __x->_M_parent;
+
+ if (__x == __root)
+ __root = __y;
+ else if (__x == __x->_M_parent->_M_right)
+ __x->_M_parent->_M_right = __y;
+ else
+ __x->_M_parent->_M_left = __y;
+ __y->_M_right = __x;
+ __x->_M_parent = __y;
+ }
+
+ void
+ _Rb_tree_insert_and_rebalance(const bool __insert_left,
+ _Rb_tree_node_base* __x,
+ _Rb_tree_node_base* __p,
+ _Rb_tree_node_base& __header)
+ {
+ _Rb_tree_node_base *& __root = __header._M_parent;
+
+ // Initialize fields in new node to insert.
+ __x->_M_parent = __p;
+ __x->_M_left = 0;
+ __x->_M_right = 0;
+ __x->_M_color = _S_red;
+
+ // Insert.
+ // Make new node child of parent and maintain root, leftmost and
+ // rightmost nodes.
+ // N.B. First node is always inserted left.
+ if (__insert_left)
+ {
+ __p->_M_left = __x; // also makes leftmost = __x when __p == &__header
+
+ if (__p == &__header)
+ {
+ __header._M_parent = __x;
+ __header._M_right = __x;
+ }
+ else if (__p == __header._M_left)
+ __header._M_left = __x; // maintain leftmost pointing to min node
+ }
+ else
+ {
+ __p->_M_right = __x;
+
+ if (__p == __header._M_right)
+ __header._M_right = __x; // maintain rightmost pointing to max node
+ }
+ // Rebalance.
+ while (__x != __root
+ && __x->_M_parent->_M_color == _S_red)
+ {
+ _Rb_tree_node_base* const __xpp = __x->_M_parent->_M_parent;
+
+ if (__x->_M_parent == __xpp->_M_left)
+ {
+ _Rb_tree_node_base* const __y = __xpp->_M_right;
+ if (__y && __y->_M_color == _S_red)
+ {
+ __x->_M_parent->_M_color = _S_black;
+ __y->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ __x = __xpp;
+ }
+ else
+ {
+ if (__x == __x->_M_parent->_M_right)
+ {
+ __x = __x->_M_parent;
+ _Rb_tree_rotate_left(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ _Rb_tree_rotate_right(__xpp, __root);
+ }
+ }
+ else
+ {
+ _Rb_tree_node_base* const __y = __xpp->_M_left;
+ if (__y && __y->_M_color == _S_red)
+ {
+ __x->_M_parent->_M_color = _S_black;
+ __y->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ __x = __xpp;
+ }
+ else
+ {
+ if (__x == __x->_M_parent->_M_left)
+ {
+ __x = __x->_M_parent;
+ _Rb_tree_rotate_right(__x, __root);
+ }
+ __x->_M_parent->_M_color = _S_black;
+ __xpp->_M_color = _S_red;
+ _Rb_tree_rotate_left(__xpp, __root);
+ }
+ }
+ }
+ __root->_M_color = _S_black;
+ }
+
+ _Rb_tree_node_base*
+ _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,
+ _Rb_tree_node_base& __header)
+ {
+ _Rb_tree_node_base *& __root = __header._M_parent;
+ _Rb_tree_node_base *& __leftmost = __header._M_left;
+ _Rb_tree_node_base *& __rightmost = __header._M_right;
+ _Rb_tree_node_base* __y = __z;
+ _Rb_tree_node_base* __x = 0;
+ _Rb_tree_node_base* __x_parent = 0;
+
+ if (__y->_M_left == 0) // __z has at most one non-null child. y == z.
+ __x = __y->_M_right; // __x might be null.
+ else
+ if (__y->_M_right == 0) // __z has exactly one non-null child. y == z.
+ __x = __y->_M_left; // __x is not null.
+ else
+ {
+ // __z has two non-null children. Set __y to
+ __y = __y->_M_right; // __z's successor. __x might be null.
+ while (__y->_M_left != 0)
+ __y = __y->_M_left;
+ __x = __y->_M_right;
+ }
+ if (__y != __z)
+ {
+ // relink y in place of z. y is z's successor
+ __z->_M_left->_M_parent = __y;
+ __y->_M_left = __z->_M_left;
+ if (__y != __z->_M_right)
+ {
+ __x_parent = __y->_M_parent;
+ if (__x) __x->_M_parent = __y->_M_parent;
+ __y->_M_parent->_M_left = __x; // __y must be a child of _M_left
+ __y->_M_right = __z->_M_right;
+ __z->_M_right->_M_parent = __y;
+ }
+ else
+ __x_parent = __y;
+ if (__root == __z)
+ __root = __y;
+ else if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __y;
+ else
+ __z->_M_parent->_M_right = __y;
+ __y->_M_parent = __z->_M_parent;
+ std::swap(__y->_M_color, __z->_M_color);
+ __y = __z;
+ // __y now points to node to be actually deleted
+ }
+ else
+ { // __y == __z
+ __x_parent = __y->_M_parent;
+ if (__x)
+ __x->_M_parent = __y->_M_parent;
+ if (__root == __z)
+ __root = __x;
+ else
+ if (__z->_M_parent->_M_left == __z)
+ __z->_M_parent->_M_left = __x;
+ else
+ __z->_M_parent->_M_right = __x;
+ if (__leftmost == __z)
+ if (__z->_M_right == 0) // __z->_M_left must be null also
+ __leftmost = __z->_M_parent;
+ // makes __leftmost == _M_header if __z == __root
+ else
+ __leftmost = _Rb_tree_node_base::_S_minimum(__x);
+ if (__rightmost == __z)
+ if (__z->_M_left == 0) // __z->_M_right must be null also
+ __rightmost = __z->_M_parent;
+ // makes __rightmost == _M_header if __z == __root
+ else // __x == __z->_M_left
+ __rightmost = _Rb_tree_node_base::_S_maximum(__x);
+ }
+ if (__y->_M_color != _S_red)
+ {
+ while (__x != __root && (__x == 0 || __x->_M_color == _S_black))
+ if (__x == __x_parent->_M_left)
+ {
+ _Rb_tree_node_base* __w = __x_parent->_M_right;
+ if (__w->_M_color == _S_red)
+ {
+ __w->_M_color = _S_black;
+ __x_parent->_M_color = _S_red;
+ _Rb_tree_rotate_left(__x_parent, __root);
+ __w = __x_parent->_M_right;
+ }
+ if ((__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_black) &&
+ (__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_black))
+ {
+ __w->_M_color = _S_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ }
+ else
+ {
+ if (__w->_M_right == 0
+ || __w->_M_right->_M_color == _S_black)
+ {
+ __w->_M_left->_M_color = _S_black;
+ __w->_M_color = _S_red;
+ _Rb_tree_rotate_right(__w, __root);
+ __w = __x_parent->_M_right;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_black;
+ if (__w->_M_right)
+ __w->_M_right->_M_color = _S_black;
+ _Rb_tree_rotate_left(__x_parent, __root);
+ break;
+ }
+ }
+ else
+ {
+ // same as above, with _M_right <-> _M_left.
+ _Rb_tree_node_base* __w = __x_parent->_M_left;
+ if (__w->_M_color == _S_red)
+ {
+ __w->_M_color = _S_black;
+ __x_parent->_M_color = _S_red;
+ _Rb_tree_rotate_right(__x_parent, __root);
+ __w = __x_parent->_M_left;
+ }
+ if ((__w->_M_right == 0 ||
+ __w->_M_right->_M_color == _S_black) &&
+ (__w->_M_left == 0 ||
+ __w->_M_left->_M_color == _S_black))
+ {
+ __w->_M_color = _S_red;
+ __x = __x_parent;
+ __x_parent = __x_parent->_M_parent;
+ }
+ else
+ {
+ if (__w->_M_left == 0 || __w->_M_left->_M_color == _S_black)
+ {
+ __w->_M_right->_M_color = _S_black;
+ __w->_M_color = _S_red;
+ _Rb_tree_rotate_left(__w, __root);
+ __w = __x_parent->_M_left;
+ }
+ __w->_M_color = __x_parent->_M_color;
+ __x_parent->_M_color = _S_black;
+ if (__w->_M_left)
+ __w->_M_left->_M_color = _S_black;
+ _Rb_tree_rotate_right(__x_parent, __root);
+ break;
+ }
+ }
+ if (__x) __x->_M_color = _S_black;
+ }
+ return __y;
+ }
+
+ unsigned int
+ _Rb_tree_black_count(const _Rb_tree_node_base* __node,
+ const _Rb_tree_node_base* __root)
+ {
+ if (__node == 0)
+ return 0;
+ unsigned int __sum = 0;
+ do
+ {
+ if (__node->_M_color == _S_black)
+ ++__sum;
+ if (__node == __root)
+ break;
+ __node = __node->_M_parent;
+ }
+ while (1);
+ return __sum;
+ }
+} // namespace std
diff --git a/contrib/libstdc++/src/wlocale-inst.cc b/contrib/libstdc++/src/wlocale-inst.cc
new file mode 100644
index 0000000..fa5059d
--- /dev/null
+++ b/contrib/libstdc++/src/wlocale-inst.cc
@@ -0,0 +1,39 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1 Locales
+//
+
+#include <bits/c++config.h>
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+#define C wchar_t
+#include "locale-inst.cc"
+#endif
diff --git a/contrib/libstdc++/src/wstring-inst.cc b/contrib/libstdc++/src/wstring-inst.cc
index 0200fd4..2bcdcfc 100644
--- a/contrib/libstdc++/src/wstring-inst.cc
+++ b/contrib/libstdc++/src/wstring-inst.cc
@@ -1,6 +1,39 @@
+// wide string support -*- C++ -*-
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 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
+//
+
#include <bits/c++config.h>
-#ifdef _GLIBCPP_USE_WCHAR_T
+#ifdef _GLIBCXX_USE_WCHAR_T
#define C wchar_t
#include "string-inst.cc"
#endif
OpenPOWER on IntegriCloud