URL
https://opencores.org/ocsvn/scarts/scarts/trunk
Subversion Repositories scarts
Compare Revisions
- This comparison shows the changes necessary to convert path
/scarts/trunk/toolchain/scarts-gcc/gcc-4.1.1
- from Rev 17 to Rev 18
- ↔ Reverse comparison
Rev 17 → Rev 18
/libstdc++-v3/src/allocator-inst.cc
0,0 → 1,40
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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> |
|
namespace std |
{ |
template class allocator<char>; |
template class allocator<wchar_t>; |
} // namespace std |
/libstdc++-v3/src/complex_io.cc
0,0 → 1,93
// The template and inlines for the -*- C++ -*- complex number classes. |
|
// Copyright (C) 2000, 2001 Free Software Foundation, Inc. |
// |
// This file is part of the GNU ISO C++ Library. This library is free |
// software; you can redistribute it and/or modify it under the |
// terms of the GNU General Public License as published by the |
// Free Software Foundation; either version 2, or (at your option) |
// any later version. |
|
// This library is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
|
// You should have received a copy of the GNU General Public License along |
// with this library; see the file COPYING. If not, write to the Free |
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
#include <complex> |
|
namespace std |
{ |
template |
basic_istream<char, char_traits<char> >& |
operator>>(basic_istream<char, char_traits<char> >&, complex<float>&); |
|
template |
basic_ostream<char, char_traits<char> >& |
operator<<(basic_ostream<char, char_traits<char> >&, |
const complex<float>&); |
|
template |
basic_istream<char, char_traits<char> >& |
operator>>(basic_istream<char, char_traits<char> >&, complex<double>&); |
|
template |
basic_ostream<char, char_traits<char> >& |
operator<<(basic_ostream<char, char_traits<char> >&, |
const complex<double>&); |
|
template |
basic_istream<char, char_traits<char> >& |
operator>>(basic_istream<char, char_traits<char> >&, |
complex<long double>&); |
|
template |
basic_ostream<char, char_traits<char> >& |
operator<<(basic_ostream<char, char_traits<char> >&, |
const complex<long double>&); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template |
basic_istream<wchar_t, char_traits<wchar_t> >& |
operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, |
complex<float>&); |
|
template |
basic_ostream<wchar_t, char_traits<wchar_t> >& |
operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, |
const complex<float>&); |
|
template |
basic_istream<wchar_t, char_traits<wchar_t> >& |
operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, |
complex<double>&); |
|
template |
basic_ostream<wchar_t, char_traits<wchar_t> >& |
operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, |
const complex<double>&); |
|
template |
basic_istream<wchar_t, char_traits<wchar_t> >& |
operator>>(basic_istream<wchar_t, char_traits<wchar_t> >&, |
complex<long double>&); |
|
template |
basic_ostream<wchar_t, char_traits<wchar_t> >& |
operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, |
const complex<long double>&); |
#endif //_GLIBCXX_USE_WCHAR_T |
} // namespace std |
/libstdc++-v3/src/Makefile.in
0,0 → 1,765
# Makefile.in generated by automake 1.9.6 from Makefile.am. |
# @configure_input@ |
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
# 2003, 2004, 2005 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
|
# This program is distributed in the hope that it will be useful, |
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
# PARTICULAR PURPOSE. |
|
@SET_MAKE@ |
|
srcdir = @srcdir@ |
top_srcdir = @top_srcdir@ |
pkgdatadir = $(datadir)/@PACKAGE@ |
pkglibdir = $(libdir)/@PACKAGE@ |
pkgincludedir = $(includedir)/@PACKAGE@ |
top_builddir = .. |
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd |
INSTALL = @INSTALL@ |
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_triplet = @build@ |
host_triplet = @host@ |
target_triplet = @target@ |
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ |
$(top_srcdir)/fragment.am |
subdir = src |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ |
$(top_srcdir)/../config/lead-dot.m4 \ |
$(top_srcdir)/../config/no-executables.m4 \ |
$(top_srcdir)/../libtool.m4 $(top_srcdir)/crossconfig.m4 \ |
$(top_srcdir)/linkage.m4 $(top_srcdir)/acinclude.m4 \ |
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/configure.ac |
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
$(ACLOCAL_M4) |
CONFIG_HEADER = $(top_builddir)/config.h |
CONFIG_CLEAN_FILES = |
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; |
am__vpath_adj = case $$p in \ |
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ |
*) f=$$p;; \ |
esac; |
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; |
am__installdirs = "$(DESTDIR)$(toolexeclibdir)" |
toolexeclibLTLIBRARIES_INSTALL = $(INSTALL) |
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 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \ |
codecvt.lo compatibility.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 \ |
ios-inst.lo iostream-inst.lo istream-inst.lo istream.lo \ |
locale-inst.lo locale-misc-inst.lo misc-inst.lo \ |
ostream-inst.lo sstream-inst.lo streambuf-inst.lo streambuf.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) |
SOURCES = $(libstdc___la_SOURCES) |
DIST_SOURCES = $(libstdc___la_SOURCES) |
ETAGS = etags |
CTAGS = ctags |
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
VPATH = $(top_srcdir)/src:$(top_srcdir) |
ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@ |
ACLOCAL = @ACLOCAL@ |
ALLOCATOR_H = @ALLOCATOR_H@ |
ALLOCATOR_NAME = @ALLOCATOR_NAME@ |
AMTAR = @AMTAR@ |
AR = @AR@ |
AS = @AS@ |
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_CC = @CCODECVT_CC@ |
CCOLLATE_CC = @CCOLLATE_CC@ |
CCTYPE_CC = @CCTYPE_CC@ |
CFLAGS = @CFLAGS@ |
CLOCALE_CC = @CLOCALE_CC@ |
CLOCALE_H = @CLOCALE_H@ |
CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@ |
CMESSAGES_CC = @CMESSAGES_CC@ |
CMESSAGES_H = @CMESSAGES_H@ |
CMONEY_CC = @CMONEY_CC@ |
CNUMERIC_CC = @CNUMERIC_CC@ |
CPP = @CPP@ |
CPPFLAGS = @CPPFLAGS@ |
CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@ |
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@ |
DEFS = @DEFS@ |
ECHO_C = @ECHO_C@ |
ECHO_N = @ECHO_N@ |
ECHO_T = @ECHO_T@ |
EGREP = @EGREP@ |
ENABLE_SYMVERS_DARWIN_EXPORT_FALSE = @ENABLE_SYMVERS_DARWIN_EXPORT_FALSE@ |
ENABLE_SYMVERS_DARWIN_EXPORT_TRUE = @ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@ |
ENABLE_SYMVERS_GNU_FALSE = @ENABLE_SYMVERS_GNU_FALSE@ |
ENABLE_SYMVERS_GNU_TRUE = @ENABLE_SYMVERS_GNU_TRUE@ |
EXEEXT = @EXEEXT@ |
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ |
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_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@ |
INSTALL_DATA = @INSTALL_DATA@ |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ |
LIBICONV = @LIBICONV@ |
LIBMATHOBJS = @LIBMATHOBJS@ |
LIBOBJS = @LIBOBJS@ |
LIBS = @LIBS@ |
LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@ |
LIBTOOL = @LIBTOOL@ |
LN_S = @LN_S@ |
LTLIBOBJS = @LTLIBOBJS@ |
MAINT = @MAINT@ |
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ |
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ |
MAKEINFO = @MAKEINFO@ |
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@ |
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@ |
am__tar = @am__tar@ |
am__untar = @am__untar@ |
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@ |
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@ |
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@ |
mkdir_p = @mkdir_p@ |
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@ |
|
# May be used by various substitution variables. |
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) |
MAINT_CHARSET = latin1 |
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs |
PWD_COMMAND = $${PWDCMD-pwd} |
STAMP = echo timestamp > |
toolexecdir = $(glibcxx_toolexecdir) |
toolexeclibdir = $(glibcxx_toolexeclibdir) |
|
# 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) |
|
WARN_CXXFLAGS = \ |
$(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once |
|
|
# -I/-D flags to pass when compiling. |
AM_CPPFLAGS = $(GLIBCXX_INCLUDES) |
|
# Cross compiler support. |
toolexeclib_LTLIBRARIES = libstdc++.la |
@ENABLE_SYMVERS_DARWIN_EXPORT_FALSE@@ENABLE_SYMVERS_GNU_FALSE@version_arg = |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@version_arg = -Wl,-exported_symbols_list,libstdc++-symbol.explist |
@ENABLE_SYMVERS_GNU_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver |
@ENABLE_SYMVERS_DARWIN_EXPORT_FALSE@@ENABLE_SYMVERS_GNU_FALSE@version_dep = |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@version_dep = libstdc++-symbol.explist |
@ENABLE_SYMVERS_GNU_TRUE@version_dep = libstdc++-symbol.ver |
|
# Source files linked in via configuration/make substitution for a |
# 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 |
|
atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h |
|
# Source files linked in via configuration/make substitution for a |
# particular host, but with ad hoc naming rules. |
host_sources_extra = \ |
basic_file.cc \ |
c++locale.cc |
|
|
# Sources present in the src directory. |
sources = \ |
bitmap_allocator.cc \ |
pool_allocator.cc \ |
mt_allocator.cc \ |
codecvt.cc \ |
compatibility.cc \ |
complex_io.cc \ |
ctype.cc \ |
debug.cc \ |
debug_list.cc \ |
functexcept.cc \ |
globals_locale.cc \ |
globals_io.cc \ |
ios.cc \ |
ios_failure.cc \ |
ios_init.cc \ |
ios_locale.cc \ |
limits.cc \ |
list.cc \ |
locale.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 \ |
ios-inst.cc \ |
iostream-inst.cc \ |
istream-inst.cc \ |
istream.cc \ |
locale-inst.cc \ |
locale-misc-inst.cc \ |
misc-inst.cc \ |
ostream-inst.cc \ |
sstream-inst.cc \ |
streambuf-inst.cc \ |
streambuf.cc \ |
string-inst.cc \ |
valarray-inst.cc \ |
wlocale-inst.cc \ |
wstring-inst.cc \ |
${host_sources} \ |
${host_sources_extra} |
|
libstdc___la_SOURCES = $(sources) |
libstdc___la_LIBADD = \ |
$(top_builddir)/libmath/libmath.la \ |
$(top_builddir)/libsupc++/libsupc++convenience.la |
|
libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD) |
libstdc___la_LDFLAGS = \ |
-version-info $(libtool_VERSION) ${version_arg} -lm |
|
|
# Use special rules for the deprecated source files so that they find |
# deprecated include files. |
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 calls for it. |
AM_CXXFLAGS = \ |
-fno-implicit-templates \ |
$(WARN_CXXFLAGS) \ |
$(OPTIMIZE_CXXFLAGS) \ |
$(CONFIG_CXXFLAGS) |
|
|
# libstdc++ libtool notes |
|
# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is |
# last. (That way, things like -O2 passed down from the toplevel can |
# be overridden by --enable-debug.) |
|
# 2) In general, libtool expects an argument such as `--tag=CXX' when |
# using the C++ compiler, because that will enable the settings |
# detected when C++ support was being configured. However, when no |
# such flag is given in the command line, libtool attempts to figure |
# it out by matching the compiler name in each configuration section |
# against a prefix of the command line. The problem is that, if the |
# compiler name and its initial flags stored in the libtool |
# configuration file don't match those in the command line, libtool |
# can't decide which configuration to use, and it gives up. The |
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe |
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to |
# attempt to infer which configuration to use |
LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ |
$(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) |
|
|
# 3) We'd have a problem when building the shared libstdc++ object if |
# the rules automake generates would be used. We cannot allow g++ to |
# be used since this would add -lstdc++ to the link line which of |
# course is problematic at this point. So, we get the top-level |
# directory to configure libstdc++-v3 to use gcc as the C++ |
# compilation driver. |
CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ |
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ |
|
debugdir = debug |
all: all-am |
|
.SUFFIXES: |
.SUFFIXES: .cc .lo .o .obj |
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps) |
@for dep in $?; do \ |
case '$(am__configure_deps)' in \ |
*$$dep*) \ |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ |
&& exit 0; \ |
exit 1;; \ |
esac; \ |
done; \ |
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/Makefile'; \ |
cd $(top_srcdir) && \ |
$(AUTOMAKE) --foreign --ignore-deps src/Makefile |
.PRECIOUS: Makefile |
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
@case '$?' in \ |
*config.status*) \ |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ |
*) \ |
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ |
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ |
esac; |
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) |
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) |
@$(NORMAL_INSTALL) |
test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)" |
@list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ |
if test -f $$p; then \ |
f=$(am__strip_dir) \ |
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) |
@set -x; list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \ |
p=$(am__strip_dir) \ |
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$p'"; \ |
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$p"; \ |
done |
|
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 *.$(OBJEXT) |
|
distclean-compile: |
-rm -f *.tab.c |
|
.cc.o: |
$(CXXCOMPILE) -c -o $@ $< |
|
.cc.obj: |
$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` |
|
.cc.lo: |
$(LTCXXCOMPILE) -c -o $@ $< |
|
mostlyclean-libtool: |
-rm -f *.lo |
|
clean-libtool: |
-rm -rf .libs _libs |
|
distclean-libtool: |
-rm -f libtool |
uninstall-info-am: |
|
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; }'`; \ |
mkid -fID $$unique |
tags: TAGS |
|
TAGS: $(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; }'`; \ |
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ |
test -n "$$unique" || unique=$$empty_fix; \ |
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ |
$$tags $$unique; \ |
fi |
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 |
|
GTAGS: |
here=`$(am__cd) $(top_builddir) && pwd` \ |
&& cd $(top_srcdir) \ |
&& gtags -i $(GTAGS_ARGS) $$here |
|
distclean-tags: |
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags |
|
distdir: $(DISTFILES) |
$(mkdir_p) $(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"; \ |
$(mkdir_p) "$(distdir)$$dir"; \ |
else \ |
dir=''; \ |
fi; \ |
if test -d $$d/$$file; then \ |
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 \ |
|| cp -p $$d/$$file $(distdir)/$$file \ |
|| exit 1; \ |
fi; \ |
done |
check-am: all-am |
check: check-am |
all-am: Makefile $(LTLIBRARIES) all-local |
installdirs: |
for dir in "$(DESTDIR)$(toolexeclibdir)"; do \ |
test -z "$$dir" || $(mkdir_p) "$$dir"; \ |
done |
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 |
|
installcheck: installcheck-am |
install-strip: |
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ |
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ |
`test -z '$(STRIP)' || \ |
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install |
mostlyclean-generic: |
|
clean-generic: |
|
distclean-generic: |
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) |
|
maintainer-clean-generic: |
@echo "This command is intended for maintainers to use" |
@echo "it deletes files that may require special tools to rebuild." |
clean: clean-am |
|
clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \ |
mostlyclean-am |
|
distclean: distclean-am |
-rm -f Makefile |
distclean-am: clean-am distclean-compile distclean-generic \ |
distclean-libtool distclean-tags |
|
dvi: dvi-am |
|
dvi-am: |
|
html: html-am |
|
info: info-am |
|
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 |
|
pdf-am: |
|
ps: ps-am |
|
ps-am: |
|
uninstall-am: uninstall-info-am uninstall-toolexeclibLTLIBRARIES |
|
.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 html \ |
html-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 |
|
|
# Symbol versioning for shared libraries. |
# This could be conditional on |
# ENABLE_SYMVERS_GNU || ENABLE_SYMVERS_DARWIN_EXPORT |
# but automake doesn't support OR operations in conditionals. |
libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) \ |
$(port_specific_symbol_files) |
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 |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@libstdc++-symbol.explist : libstdc++-symbol.ver \ |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ ${glibcxx_srcdir}/scripts/make_exports.pl \ |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ perl ${glibcxx_srcdir}/scripts/make_exports.pl \ |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ libstdc++-symbol.ver \ |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ `echo $(libstdc___la_LIBADD) | \ |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ |
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ > $@ || (rm -f $@ ; exit 1) |
|
codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true |
|
collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true |
|
ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true |
|
messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_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$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $< |
strstream.o: strstream.cc |
$(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_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $< |
concept-inst.o: concept-inst.cc |
$(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $< |
|
# Added bits to build debug library. |
@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: |
if test ! -d ${debugdir}; then \ |
mkdir -p ${debugdir}; \ |
(cd ${debugdir}; \ |
sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ |
-e 's/srcdir = \.\./srcdir = ..\/../' \ |
-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; |
|
build_debug: stamp-debug |
(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all) |
|
# Install debug library here. |
install_debug: |
(cd ${debugdir} && $(MAKE) \ |
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: |
/libstdc++-v3/src/localename.cc
0,0 → 1,302
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
#include <clocale> |
#include <cstring> |
#include <locale> |
|
namespace std |
{ |
using namespace __gnu_cxx; |
|
locale::locale(const char* __s) : _M_impl(0) |
{ |
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 __lang; |
__env = std::getenv("LANG"); |
if (!__env || std::strcmp(__env, "") == 0 |
|| std::strcmp(__env, "C") == 0 |
|| std::strcmp(__env, "POSIX") == 0) |
__lang = "C"; |
else |
__lang = __env; |
|
// Scan the categories looking for the first one |
// different from LANG. |
size_t __i = 0; |
if (__lang == "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 |
&& __lang != __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; |
__str.reserve(128); |
for (size_t __j = 0; __j < __i; ++__j) |
{ |
__str += _S_categories[__j]; |
__str += '='; |
__str += __lang; |
__str += ';'; |
} |
__str += _S_categories[__i]; |
__str += '='; |
__str += __env; |
__str += ';'; |
++__i; |
for (; __i < _S_categories_size; ++__i) |
{ |
__env = std::getenv(_S_categories[__i]); |
__str += _S_categories[__i]; |
if (!__env || std::strcmp(__env, "") == 0) |
{ |
__str += '='; |
__str += __lang; |
__str += ';'; |
} |
else if (std::strcmp(__env, "C") == 0 |
|| std::strcmp(__env, "POSIX") == 0) |
__str += "=C;"; |
else |
{ |
__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 (__lang == "C") |
(_M_impl = _S_classic)->_M_add_reference(); |
else |
_M_impl = new _Impl(__lang.c_str(), 1); |
} |
} |
} |
else |
__throw_runtime_error(__N("locale::locale NULL not valid")); |
} |
|
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); |
} |
|
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) |
{ |
__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; |
} |
} |
|
// Construct named _Impl. |
locale::_Impl:: |
_Impl(const char* __s, size_t __refs) |
: _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. |
__c_locale __cloc; |
locale::facet::_S_create_c_locale(__cloc, __s); |
|
try |
{ |
_M_facets = new const facet*[_M_facets_size]; |
for (size_t __i = 0; __i < _M_facets_size; ++__i) |
_M_facets[__i] = 0; |
_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 the categories. |
const size_t __len = std::strlen(__s); |
if (!std::memchr(__s, ';', __len)) |
{ |
_M_names[0] = new char[__len + 1]; |
std::memcpy(_M_names[0], __s, __len + 1); |
} |
else |
{ |
const char* __end = __s; |
for (size_t __i = 0; __i < _S_categories_size; ++__i) |
{ |
const char* __beg = std::strchr(__end + 1, '=') + 1; |
__end = std::strchr(__beg, ';'); |
if (!__end) |
__end = __s + __len; |
_M_names[__i] = new char[__end - __beg + 1]; |
std::memcpy(_M_names[__i], __beg, __end - __beg); |
_M_names[__i][__end - __beg] = '\0'; |
} |
} |
|
// 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 _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); |
} |
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 = 1; |
const bool __have_names = _M_names[0] && __imp->_M_names[0]; |
for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1) |
{ |
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 (__have_names) |
{ |
if (!_M_names[1]) |
{ |
// A full set of _M_names must be prepared, all identical |
// to _M_names[0] to begin with. Then, below, a few will |
// be replaced by the corresponding __imp->_M_names. I.e., |
// not a "simple" locale anymore (see locale::operator==). |
const size_t __len = std::strlen(_M_names[0]) + 1; |
for (size_t __i = 1; __i < _S_categories_size; ++__i) |
{ |
_M_names[__i] = new char[__len]; |
std::memcpy(_M_names[__i], _M_names[0], __len); |
} |
} |
char* __src = __imp->_M_names[__ix] ? __imp->_M_names[__ix] |
: __imp->_M_names[0]; |
const size_t __len = std::strlen(__src) + 1; |
char* __new = new char[__len]; |
std::memcpy(__new, __src, __len); |
delete [] _M_names[__ix]; |
_M_names[__ix] = __new; |
} |
} |
} |
} |
} // namespace std |
/libstdc++-v3/src/limits.cc
0,0 → 1,449
// Static data members of -*- C++ -*- numeric_limits classes |
|
// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. |
// |
// This file is part of the GNU ISO C++ Library. This library is free |
// software; you can redistribute it and/or modify it under the |
// terms of the GNU General Public License as published by the |
// Free Software Foundation; either version 2, or (at your option) |
// any later version. |
|
// This library is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
|
// You should have received a copy of the GNU General Public License along |
// with this library; see the file COPYING. If not, write to the Free |
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr> |
|
// |
// ISO C++ 14882:1998 |
// 18.2.1 |
// |
|
#include <limits> |
|
namespace std |
{ |
const bool __numeric_limits_base::is_specialized; |
const int __numeric_limits_base::digits; |
const int __numeric_limits_base::digits10; |
const bool __numeric_limits_base::is_signed; |
const bool __numeric_limits_base::is_integer; |
const bool __numeric_limits_base::is_exact; |
const int __numeric_limits_base::radix; |
const int __numeric_limits_base::min_exponent; |
const int __numeric_limits_base::min_exponent10; |
const int __numeric_limits_base::max_exponent; |
const int __numeric_limits_base::max_exponent10; |
const bool __numeric_limits_base::has_infinity; |
const bool __numeric_limits_base::has_quiet_NaN; |
const bool __numeric_limits_base::has_signaling_NaN; |
const float_denorm_style __numeric_limits_base::has_denorm; |
const bool __numeric_limits_base::has_denorm_loss; |
const bool __numeric_limits_base::is_iec559; |
const bool __numeric_limits_base::is_bounded; |
const bool __numeric_limits_base::is_modulo; |
const bool __numeric_limits_base::traps; |
const bool __numeric_limits_base::tinyness_before; |
const float_round_style __numeric_limits_base::round_style; |
|
// bool |
const bool numeric_limits<bool>::is_specialized; |
const int numeric_limits<bool>::digits; |
const int numeric_limits<bool>::digits10; |
const bool numeric_limits<bool>::is_signed; |
const bool numeric_limits<bool>::is_integer; |
const bool numeric_limits<bool>::is_exact; |
const int numeric_limits<bool>::radix; |
const int numeric_limits<bool>::min_exponent; |
const int numeric_limits<bool>::min_exponent10; |
const int numeric_limits<bool>::max_exponent; |
const int numeric_limits<bool>::max_exponent10; |
const bool numeric_limits<bool>::has_infinity; |
const bool numeric_limits<bool>::has_quiet_NaN; |
const bool numeric_limits<bool>::has_signaling_NaN; |
const float_denorm_style numeric_limits<bool>::has_denorm; |
const bool numeric_limits<bool>::has_denorm_loss; |
const bool numeric_limits<bool>::is_iec559; |
const bool numeric_limits<bool>::is_bounded; |
const bool numeric_limits<bool>::is_modulo; |
const bool numeric_limits<bool>::traps; |
const bool numeric_limits<bool>::tinyness_before; |
const float_round_style numeric_limits<bool>::round_style; |
|
// char |
const bool numeric_limits<char>::is_specialized; |
const int numeric_limits<char>::digits; |
const int numeric_limits<char>::digits10; |
const bool numeric_limits<char>::is_signed; |
const bool numeric_limits<char>::is_integer; |
const bool numeric_limits<char>::is_exact; |
const int numeric_limits<char>::radix; |
const int numeric_limits<char>::min_exponent; |
const int numeric_limits<char>::min_exponent10; |
const int numeric_limits<char>::max_exponent; |
const int numeric_limits<char>::max_exponent10; |
const bool numeric_limits<char>::has_infinity; |
const bool numeric_limits<char>::has_quiet_NaN; |
const bool numeric_limits<char>::has_signaling_NaN; |
const float_denorm_style numeric_limits<char>::has_denorm; |
const bool numeric_limits<char>::has_denorm_loss; |
const bool numeric_limits<char>::is_iec559; |
const bool numeric_limits<char>::is_bounded; |
const bool numeric_limits<char>::is_modulo; |
const bool numeric_limits<char>::traps; |
const bool numeric_limits<char>::tinyness_before; |
const float_round_style numeric_limits<char>::round_style; |
|
// signed char |
const bool numeric_limits<signed char>::is_specialized; |
const int numeric_limits<signed char>::digits; |
const int numeric_limits<signed char>::digits10; |
const bool numeric_limits<signed char>::is_signed; |
const bool numeric_limits<signed char>::is_integer; |
const bool numeric_limits<signed char>::is_exact; |
const int numeric_limits<signed char>::radix; |
const int numeric_limits<signed char>::min_exponent; |
const int numeric_limits<signed char>::min_exponent10; |
const int numeric_limits<signed char>::max_exponent; |
const int numeric_limits<signed char>::max_exponent10; |
const bool numeric_limits<signed char>::has_infinity; |
const bool numeric_limits<signed char>::has_quiet_NaN; |
const bool numeric_limits<signed char>::has_signaling_NaN; |
const float_denorm_style numeric_limits<signed char>::has_denorm; |
const bool numeric_limits<signed char>::has_denorm_loss; |
const bool numeric_limits<signed char>::is_iec559; |
const bool numeric_limits<signed char>::is_bounded; |
const bool numeric_limits<signed char>::is_modulo; |
const bool numeric_limits<signed char>::traps; |
const bool numeric_limits<signed char>::tinyness_before; |
const float_round_style numeric_limits<signed char>::round_style; |
|
// unsigned char |
const bool numeric_limits<unsigned char>::is_specialized; |
const int numeric_limits<unsigned char>::digits; |
const int numeric_limits<unsigned char>::digits10; |
const bool numeric_limits<unsigned char>::is_signed; |
const bool numeric_limits<unsigned char>::is_integer; |
const bool numeric_limits<unsigned char>::is_exact; |
const int numeric_limits<unsigned char>::radix; |
const int numeric_limits<unsigned char>::min_exponent; |
const int numeric_limits<unsigned char>::min_exponent10; |
const int numeric_limits<unsigned char>::max_exponent; |
const int numeric_limits<unsigned char>::max_exponent10; |
const bool numeric_limits<unsigned char>::has_infinity; |
const bool numeric_limits<unsigned char>::has_quiet_NaN; |
const bool numeric_limits<unsigned char>::has_signaling_NaN; |
const float_denorm_style numeric_limits<unsigned char>::has_denorm; |
const bool numeric_limits<unsigned char>::has_denorm_loss; |
const bool numeric_limits<unsigned char>::is_iec559; |
const bool numeric_limits<unsigned char>::is_bounded; |
const bool numeric_limits<unsigned char>::is_modulo; |
const bool numeric_limits<unsigned char>::traps; |
const bool numeric_limits<unsigned char>::tinyness_before; |
const float_round_style numeric_limits<unsigned char>::round_style; |
|
// wchar_t |
// This used to be problematic... |
#ifdef _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; |
const bool numeric_limits<wchar_t>::is_signed; |
const bool numeric_limits<wchar_t>::is_integer; |
const bool numeric_limits<wchar_t>::is_exact; |
const int numeric_limits<wchar_t>::radix; |
const int numeric_limits<wchar_t>::min_exponent; |
const int numeric_limits<wchar_t>::min_exponent10; |
const int numeric_limits<wchar_t>::max_exponent; |
const int numeric_limits<wchar_t>::max_exponent10; |
const bool numeric_limits<wchar_t>::has_infinity; |
const bool numeric_limits<wchar_t>::has_quiet_NaN; |
const bool numeric_limits<wchar_t>::has_signaling_NaN; |
const float_denorm_style numeric_limits<wchar_t>::has_denorm; |
const bool numeric_limits<wchar_t>::has_denorm_loss; |
const bool numeric_limits<wchar_t>::is_iec559; |
const bool numeric_limits<wchar_t>::is_bounded; |
const bool numeric_limits<wchar_t>::is_modulo; |
const bool numeric_limits<wchar_t>::traps; |
const bool numeric_limits<wchar_t>::tinyness_before; |
const float_round_style numeric_limits<wchar_t>::round_style; |
#endif // _GLIBCXX_USE_WCHAR_T |
|
// short |
const bool numeric_limits<short>::is_specialized; |
const int numeric_limits<short>::digits; |
const int numeric_limits<short>::digits10; |
const bool numeric_limits<short>::is_signed; |
const bool numeric_limits<short>::is_integer; |
const bool numeric_limits<short>::is_exact; |
const int numeric_limits<short>::radix; |
const int numeric_limits<short>::min_exponent; |
const int numeric_limits<short>::min_exponent10; |
const int numeric_limits<short>::max_exponent; |
const int numeric_limits<short>::max_exponent10; |
const bool numeric_limits<short>::has_infinity; |
const bool numeric_limits<short>::has_quiet_NaN; |
const bool numeric_limits<short>::has_signaling_NaN; |
const float_denorm_style numeric_limits<short>::has_denorm; |
const bool numeric_limits<short>::has_denorm_loss; |
const bool numeric_limits<short>::is_iec559; |
const bool numeric_limits<short>::is_bounded; |
const bool numeric_limits<short>::is_modulo; |
const bool numeric_limits<short>::traps; |
const bool numeric_limits<short>::tinyness_before; |
const float_round_style numeric_limits<short>::round_style; |
|
// unsigned short |
const bool numeric_limits<unsigned short>::is_specialized; |
const int numeric_limits<unsigned short>::digits; |
const int numeric_limits<unsigned short>::digits10; |
const bool numeric_limits<unsigned short>::is_signed; |
const bool numeric_limits<unsigned short>::is_integer; |
const bool numeric_limits<unsigned short>::is_exact; |
const int numeric_limits<unsigned short>::radix; |
const int numeric_limits<unsigned short>::min_exponent; |
const int numeric_limits<unsigned short>::min_exponent10; |
const int numeric_limits<unsigned short>::max_exponent; |
const int numeric_limits<unsigned short>::max_exponent10; |
const bool numeric_limits<unsigned short>::has_infinity; |
const bool numeric_limits<unsigned short>::has_quiet_NaN; |
const bool numeric_limits<unsigned short>::has_signaling_NaN; |
const float_denorm_style numeric_limits<unsigned short>::has_denorm; |
const bool numeric_limits<unsigned short>::has_denorm_loss; |
const bool numeric_limits<unsigned short>::is_iec559; |
const bool numeric_limits<unsigned short>::is_bounded; |
const bool numeric_limits<unsigned short>::is_modulo; |
const bool numeric_limits<unsigned short>::traps; |
const bool numeric_limits<unsigned short>::tinyness_before; |
const float_round_style numeric_limits<unsigned short>::round_style; |
|
// int |
const bool numeric_limits<int>::is_specialized; |
const int numeric_limits<int>::digits; |
const int numeric_limits<int>::digits10; |
const bool numeric_limits<int>::is_signed; |
const bool numeric_limits<int>::is_integer; |
const bool numeric_limits<int>::is_exact; |
const int numeric_limits<int>::radix; |
const int numeric_limits<int>::min_exponent; |
const int numeric_limits<int>::min_exponent10; |
const int numeric_limits<int>::max_exponent; |
const int numeric_limits<int>::max_exponent10; |
const bool numeric_limits<int>::has_infinity; |
const bool numeric_limits<int>::has_quiet_NaN; |
const bool numeric_limits<int>::has_signaling_NaN; |
const float_denorm_style numeric_limits<int>::has_denorm; |
const bool numeric_limits<int>::has_denorm_loss; |
const bool numeric_limits<int>::is_iec559; |
const bool numeric_limits<int>::is_bounded; |
const bool numeric_limits<int>::is_modulo; |
const bool numeric_limits<int>::traps; |
const bool numeric_limits<int>::tinyness_before; |
const float_round_style numeric_limits<int>::round_style; |
|
// unsigned int |
const bool numeric_limits<unsigned int>::is_specialized; |
const int numeric_limits<unsigned int>::digits; |
const int numeric_limits<unsigned int>::digits10; |
const bool numeric_limits<unsigned int>::is_signed; |
const bool numeric_limits<unsigned int>::is_integer; |
const bool numeric_limits<unsigned int>::is_exact; |
const int numeric_limits<unsigned int>::radix; |
const int numeric_limits<unsigned int>::min_exponent; |
const int numeric_limits<unsigned int>::min_exponent10; |
const int numeric_limits<unsigned int>::max_exponent; |
const int numeric_limits<unsigned int>::max_exponent10; |
const bool numeric_limits<unsigned int>::has_infinity; |
const bool numeric_limits<unsigned int>::has_quiet_NaN; |
const bool numeric_limits<unsigned int>::has_signaling_NaN; |
const float_denorm_style numeric_limits<unsigned int>::has_denorm; |
const bool numeric_limits<unsigned int>::has_denorm_loss; |
const bool numeric_limits<unsigned int>::is_iec559; |
const bool numeric_limits<unsigned int>::is_bounded; |
const bool numeric_limits<unsigned int>::is_modulo; |
const bool numeric_limits<unsigned int>::traps; |
const bool numeric_limits<unsigned int>::tinyness_before; |
const float_round_style numeric_limits<unsigned int>::round_style; |
|
// long |
const bool numeric_limits<long>::is_specialized; |
const int numeric_limits<long>::digits; |
const int numeric_limits<long>::digits10; |
const bool numeric_limits<long>::is_signed; |
const bool numeric_limits<long>::is_integer; |
const bool numeric_limits<long>::is_exact; |
const int numeric_limits<long>::radix; |
const int numeric_limits<long>::min_exponent; |
const int numeric_limits<long>::min_exponent10; |
const int numeric_limits<long>::max_exponent; |
const int numeric_limits<long>::max_exponent10; |
const bool numeric_limits<long>::has_infinity; |
const bool numeric_limits<long>::has_quiet_NaN; |
const bool numeric_limits<long>::has_signaling_NaN; |
const float_denorm_style numeric_limits<long>::has_denorm; |
const bool numeric_limits<long>::has_denorm_loss; |
const bool numeric_limits<long>::is_iec559; |
const bool numeric_limits<long>::is_bounded; |
const bool numeric_limits<long>::is_modulo; |
const bool numeric_limits<long>::traps; |
const bool numeric_limits<long>::tinyness_before; |
const float_round_style numeric_limits<long>::round_style; |
|
// unsigned long |
const bool numeric_limits<unsigned long>::is_specialized; |
const int numeric_limits<unsigned long>::digits; |
const int numeric_limits<unsigned long>::digits10; |
const bool numeric_limits<unsigned long>::is_signed; |
const bool numeric_limits<unsigned long>::is_integer; |
const bool numeric_limits<unsigned long>::is_exact; |
const int numeric_limits<unsigned long>::radix; |
const int numeric_limits<unsigned long>::min_exponent; |
const int numeric_limits<unsigned long>::min_exponent10; |
const int numeric_limits<unsigned long>::max_exponent; |
const int numeric_limits<unsigned long>::max_exponent10; |
const bool numeric_limits<unsigned long>::has_infinity; |
const bool numeric_limits<unsigned long>::has_quiet_NaN; |
const bool numeric_limits<unsigned long>::has_signaling_NaN; |
const float_denorm_style numeric_limits<unsigned long>::has_denorm; |
const bool numeric_limits<unsigned long>::has_denorm_loss; |
const bool numeric_limits<unsigned long>::is_iec559; |
const bool numeric_limits<unsigned long>::is_bounded; |
const bool numeric_limits<unsigned long>::is_modulo; |
const bool numeric_limits<unsigned long>::traps; |
const bool numeric_limits<unsigned long>::tinyness_before; |
const float_round_style numeric_limits<unsigned long>::round_style; |
|
// NOTA BENE: long long is an extension |
const bool numeric_limits<long long>::is_specialized; |
const int numeric_limits<long long>::digits; |
const int numeric_limits<long long>::digits10; |
const bool numeric_limits<long long>::is_signed; |
const bool numeric_limits<long long>::is_integer; |
const bool numeric_limits<long long>::is_exact; |
const int numeric_limits<long long>::radix; |
const int numeric_limits<long long>::min_exponent; |
const int numeric_limits<long long>::min_exponent10; |
const int numeric_limits<long long>::max_exponent; |
const int numeric_limits<long long>::max_exponent10; |
const bool numeric_limits<long long>::has_infinity; |
const bool numeric_limits<long long>::has_quiet_NaN; |
const bool numeric_limits<long long>::has_signaling_NaN; |
const float_denorm_style numeric_limits<long long>::has_denorm; |
const bool numeric_limits<long long>::has_denorm_loss; |
const bool numeric_limits<long long>::is_iec559; |
const bool numeric_limits<long long>::is_bounded; |
const bool numeric_limits<long long>::is_modulo; |
const bool numeric_limits<long long>::traps; |
const bool numeric_limits<long long>::tinyness_before; |
const float_round_style numeric_limits<long long>::round_style; |
|
const bool numeric_limits<unsigned long long>::is_specialized; |
const int numeric_limits<unsigned long long>::digits; |
const int numeric_limits<unsigned long long>::digits10; |
const bool numeric_limits<unsigned long long>::is_signed; |
const bool numeric_limits<unsigned long long>::is_integer; |
const bool numeric_limits<unsigned long long>::is_exact; |
const int numeric_limits<unsigned long long>::radix; |
const int numeric_limits<unsigned long long>::min_exponent; |
const int numeric_limits<unsigned long long>::min_exponent10; |
const int numeric_limits<unsigned long long>::max_exponent; |
const int numeric_limits<unsigned long long>::max_exponent10; |
const bool numeric_limits<unsigned long long>::has_infinity; |
const bool numeric_limits<unsigned long long>::has_quiet_NaN; |
const bool numeric_limits<unsigned long long>::has_signaling_NaN; |
const float_denorm_style numeric_limits<unsigned long long>::has_denorm; |
const bool numeric_limits<unsigned long long>::has_denorm_loss; |
const bool numeric_limits<unsigned long long>::is_iec559; |
const bool numeric_limits<unsigned long long>::is_bounded; |
const bool numeric_limits<unsigned long long>::is_modulo; |
const bool numeric_limits<unsigned long long>::traps; |
const bool numeric_limits<unsigned long long>::tinyness_before; |
const float_round_style numeric_limits<unsigned long long>::round_style; |
|
// float |
const bool numeric_limits<float>::is_specialized; |
const int numeric_limits<float>::digits; |
const int numeric_limits<float>::digits10; |
const bool numeric_limits<float>::is_signed; |
const bool numeric_limits<float>::is_integer; |
const bool numeric_limits<float>::is_exact; |
const int numeric_limits<float>::radix; |
const int numeric_limits<float>::min_exponent; |
const int numeric_limits<float>::min_exponent10; |
const int numeric_limits<float>::max_exponent; |
const int numeric_limits<float>::max_exponent10; |
const bool numeric_limits<float>::has_infinity; |
const bool numeric_limits<float>::has_quiet_NaN; |
const bool numeric_limits<float>::has_signaling_NaN; |
const float_denorm_style numeric_limits<float>::has_denorm; |
const bool numeric_limits<float>::has_denorm_loss; |
const bool numeric_limits<float>::is_iec559; |
const bool numeric_limits<float>::is_bounded; |
const bool numeric_limits<float>::is_modulo; |
const bool numeric_limits<float>::traps; |
const bool numeric_limits<float>::tinyness_before; |
const float_round_style numeric_limits<float>::round_style; |
|
// double |
const bool numeric_limits<double>::is_specialized; |
const int numeric_limits<double>::digits; |
const int numeric_limits<double>::digits10; |
const bool numeric_limits<double>::is_signed; |
const bool numeric_limits<double>::is_integer; |
const bool numeric_limits<double>::is_exact; |
const int numeric_limits<double>::radix; |
const int numeric_limits<double>::min_exponent; |
const int numeric_limits<double>::min_exponent10; |
const int numeric_limits<double>::max_exponent; |
const int numeric_limits<double>::max_exponent10; |
const bool numeric_limits<double>::has_infinity; |
const bool numeric_limits<double>::has_quiet_NaN; |
const bool numeric_limits<double>::has_signaling_NaN; |
const float_denorm_style numeric_limits<double>::has_denorm; |
const bool numeric_limits<double>::has_denorm_loss; |
const bool numeric_limits<double>::is_iec559; |
const bool numeric_limits<double>::is_bounded; |
const bool numeric_limits<double>::is_modulo; |
const bool numeric_limits<double>::traps; |
const bool numeric_limits<double>::tinyness_before; |
const float_round_style numeric_limits<double>::round_style; |
|
// long double |
const bool numeric_limits<long double>::is_specialized; |
const int numeric_limits<long double>::digits; |
const int numeric_limits<long double>::digits10; |
const bool numeric_limits<long double>::is_signed; |
const bool numeric_limits<long double>::is_integer; |
const bool numeric_limits<long double>::is_exact; |
const int numeric_limits<long double>::radix; |
const int numeric_limits<long double>::min_exponent; |
const int numeric_limits<long double>::min_exponent10; |
const int numeric_limits<long double>::max_exponent; |
const int numeric_limits<long double>::max_exponent10; |
const bool numeric_limits<long double>::has_infinity; |
const bool numeric_limits<long double>::has_quiet_NaN; |
const bool numeric_limits<long double>::has_signaling_NaN; |
const float_denorm_style numeric_limits<long double>::has_denorm; |
const bool numeric_limits<long double>::has_denorm_loss; |
const bool numeric_limits<long double>::is_iec559; |
const bool numeric_limits<long double>::is_bounded; |
const bool numeric_limits<long double>::is_modulo; |
const bool numeric_limits<long double>::traps; |
const bool numeric_limits<long double>::tinyness_before; |
const float_round_style numeric_limits<long double>::round_style; |
} // namespace std |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
/libstdc++-v3/src/streambuf-inst.cc
0,0 → 1,56
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 |
// Free Software Foundation, Inc. |
// |
// This file is part of the GNU ISO C++ Library. This library is free |
// software; you can redistribute it and/or modify it under the |
// terms of the GNU General Public License as published by the |
// Free Software Foundation; either version 2, or (at your option) |
// any later version. |
|
// This library is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
|
// You should have received a copy of the GNU General Public License along |
// with this library; see the file COPYING. If not, write to the Free |
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <ios> |
#include <streambuf> |
|
namespace std |
{ |
// streambuf |
template class basic_streambuf<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_streambuf<wchar_t>; |
#endif |
|
template |
streamsize |
__copy_streambufs(basic_streambuf<char>*, |
basic_streambuf<char>*); |
#ifdef _GLIBCXX_USE_WCHAR_T |
template |
streamsize |
__copy_streambufs(basic_streambuf<wchar_t>*, |
basic_streambuf<wchar_t>*); |
#endif |
} //std |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
/libstdc++-v3/src/ios-inst.cc
0,0 → 1,44
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <ios> |
|
namespace std |
{ |
template class basic_ios<char>; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_ios<wchar_t>; |
#endif |
} |
/libstdc++-v3/src/concept-inst.cc
0,0 → 1,112
// Concept checking instantiations -*- C++ -*- |
|
// Copyright (C) 2001, 2002, 2003 Free Software Foundation |
// |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// The implementation of some of the more complex checks uses the simple |
// checks (good reuse of code), thereby requiring that the simple checks |
// be instantiated somewhere. The simple checks use other simple checks, |
// and so on, until a couple hundred symbols all need instantiations. We |
// explicitly instantiate the initial set of symbols; compiling this file |
// with -fimplicit-templates will take care of the rest for us. |
|
#include <bits/concept_check.h> |
|
#ifdef _GLIBCXX_CONCEPT_CHECKS |
|
#include <memory> |
#include <iterator> |
#include <ostream> |
|
#define _Instantiate(...) template void __function_requires< __VA_ARGS__ > () |
|
namespace __gnu_cxx |
{ |
template void __aux_require_boolean_expr<bool>(bool const&); |
|
_Instantiate(_ConvertibleConcept<unsigned, unsigned> ); |
|
_Instantiate(_InputIteratorConcept<char*> ); |
|
_Instantiate(_InputIteratorConcept<char const*> ); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
_Instantiate(_InputIteratorConcept<wchar_t*> ); |
|
_Instantiate(_InputIteratorConcept<wchar_t const*> ); |
|
_Instantiate(_LessThanComparableConcept<wchar_t*> ); |
#endif |
|
_Instantiate(_LessThanComparableConcept<char*> ); |
|
_Instantiate(_LessThanComparableConcept<int> ); |
|
_Instantiate(_LessThanComparableConcept<long> ); |
|
_Instantiate(_LessThanComparableConcept<long long> ); |
|
_Instantiate(_LessThanComparableConcept<unsigned> ); |
|
_Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator< |
char, std::char_traits<char> >, char> ); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
_Instantiate(_OutputIteratorConcept<std::ostreambuf_iterator< |
wchar_t, std::char_traits<wchar_t> >, wchar_t> ); |
#endif |
|
_Instantiate(_RandomAccessIteratorConcept<char*> ); |
|
_Instantiate(_RandomAccessIteratorConcept<char const*> ); |
|
_Instantiate(_RandomAccessIteratorConcept< |
__normal_iterator<char const*, std::string> > ); |
|
_Instantiate(_RandomAccessIteratorConcept< |
__normal_iterator<char*, std::string> > ); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
_Instantiate(_RandomAccessIteratorConcept< |
__normal_iterator<wchar_t const*, |
std::basic_string<wchar_t, std::char_traits<wchar_t>, |
std::allocator<wchar_t> > > > ); |
|
_Instantiate(_RandomAccessIteratorConcept< |
__normal_iterator<wchar_t*, |
std::basic_string<wchar_t, std::char_traits<wchar_t>, |
std::allocator<wchar_t> > > > ); |
|
_Instantiate(_RandomAccessIteratorConcept<wchar_t*> ); |
|
_Instantiate(_RandomAccessIteratorConcept<wchar_t const*> ); |
#endif |
} // namespace __gnu_cxx |
|
#undef _Instantiate |
|
#endif |
/libstdc++-v3/src/misc-inst.cc
0,0 → 1,79
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// |
// ISO C++ 14882: |
// |
|
#include <string> |
#include <istream> |
#include <ostream> |
#include <ext/stdio_sync_filebuf.h> |
|
namespace std |
{ |
// string related to iostreams |
template |
basic_istream<char>& |
operator>>(basic_istream<char>&, string&); |
template |
basic_ostream<char>& |
operator<<(basic_ostream<char>&, const string&); |
template |
basic_istream<char>& |
getline(basic_istream<char>&, string&, char); |
template |
basic_istream<char>& |
getline(basic_istream<char>&, string&); |
#ifdef _GLIBCXX_USE_WCHAR_T |
template |
basic_istream<wchar_t>& |
operator>>(basic_istream<wchar_t>&, wstring&); |
template |
basic_ostream<wchar_t>& |
operator<<(basic_ostream<wchar_t>&, const wstring&); |
template |
basic_istream<wchar_t>& |
getline(basic_istream<wchar_t>&, wstring&, wchar_t); |
template |
basic_istream<wchar_t>& |
getline(basic_istream<wchar_t>&, wstring&); |
#endif |
} // namespace std |
|
namespace __gnu_cxx |
{ |
template class stdio_sync_filebuf<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class stdio_sync_filebuf<wchar_t>; |
#endif |
} // namespace __gnu_cxx |
|
|
/libstdc++-v3/src/wstring-inst.cc
0,0 → 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 _GLIBCXX_USE_WCHAR_T |
#define C wchar_t |
#include "string-inst.cc" |
#endif |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
/libstdc++-v3/src/pool_allocator.cc
0,0 → 1,173
// Allocator details. |
|
// Copyright (C) 2004, 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <cstdlib> |
#include <ext/pool_allocator.h> |
|
namespace __gnu_internal |
{ |
static __glibcxx_mutex_define_initialized(palloc_init_mutex); |
} |
|
namespace __gnu_cxx |
{ |
// Definitions for __pool_alloc_base. |
__pool_alloc_base::_Obj* volatile* |
__pool_alloc_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_alloc_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_alloc_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)); |
try |
{ |
_S_start_free = static_cast<char*>(::operator new(__bytes_to_get)); |
} |
catch (...) |
{ |
// 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. |
} |
} |
// What we have wasn't enough. Rethrow. |
_S_start_free = _S_end_free = 0; // We have no chunk. |
__throw_exception_again; |
} |
_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_alloc_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_alloc_base::_Obj* volatile __pool_alloc_base::_S_free_list[_S_free_list_size]; |
|
char* __pool_alloc_base::_S_start_free = 0; |
|
char* __pool_alloc_base::_S_end_free = 0; |
|
size_t __pool_alloc_base::_S_heap_size = 0; |
|
// Instantiations. |
template class __pool_alloc<char>; |
template class __pool_alloc<wchar_t>; |
} // namespace __gnu_cxx |
/libstdc++-v3/src/fstream-inst.cc
0,0 → 1,62
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 |
// Free Software Foundation, Inc. |
// |
// This file is part of the GNU ISO C++ Library. This library is free |
// software; you can redistribute it and/or modify it under the |
// terms of the GNU General Public License as published by the |
// Free Software Foundation; either version 2, or (at your option) |
// any later version. |
|
// This library is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
|
// You should have received a copy of the GNU General Public License along |
// with this library; see the file COPYING. If not, write to the Free |
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <fstream> |
|
namespace std |
{ |
// filebuf |
template class basic_filebuf<char, char_traits<char> >; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_filebuf<wchar_t, char_traits<wchar_t> >; |
#endif |
|
// ifstream |
template class basic_ifstream<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_ifstream<wchar_t>; |
#endif |
|
// ofstream |
template class basic_ofstream<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_ofstream<wchar_t>; |
#endif |
|
// fstream |
template class basic_fstream<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_fstream<wchar_t>; |
#endif |
} // namespace std |
/libstdc++-v3/src/istream-inst.cc
0,0 → 1,70
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 |
// Free Software Foundation, Inc. |
// |
// This file is part of the GNU ISO C++ Library. This library is free |
// software; you can redistribute it and/or modify it under the |
// terms of the GNU General Public License as published by the |
// Free Software Foundation; either version 2, or (at your option) |
// any later version. |
|
// This library is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
|
// You should have received a copy of the GNU General Public License along |
// with this library; see the file COPYING. If not, write to the Free |
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <istream> |
#include <iomanip> |
|
namespace std |
{ |
// istream |
template class basic_istream<char>; |
template istream& ws(istream&); |
template istream& operator>>(istream&, char&); |
template istream& operator>>(istream&, unsigned char&); |
template istream& operator>>(istream&, signed char&); |
template istream& operator>>(istream&, char*); |
template istream& operator>>(istream&, unsigned char*); |
template istream& operator>>(istream&, signed char*); |
|
template istream& operator>>(istream&, _Setfill<char>); |
template istream& operator>>(istream&, _Setiosflags); |
template istream& operator>>(istream&, _Resetiosflags); |
template istream& operator>>(istream&, _Setbase); |
template istream& operator>>(istream&, _Setprecision); |
template istream& operator>>(istream&, _Setw); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_istream<wchar_t>; |
template wistream& ws(wistream&); |
template wistream& operator>>(wistream&, wchar_t&); |
template wistream& operator>>(wistream&, wchar_t*); |
|
template wistream& operator>>(wistream&, _Setfill<wchar_t>); |
template wistream& operator>>(wistream&, _Setiosflags); |
template wistream& operator>>(wistream&, _Resetiosflags); |
template wistream& operator>>(wistream&, _Setbase); |
template wistream& operator>>(wistream&, _Setprecision); |
template wistream& operator>>(wistream&, _Setw); |
#endif |
} // namespace std |
/libstdc++-v3/src/mt_allocator.cc
0,0 → 1,784
// Allocator details. |
|
// Copyright (C) 2004, 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// |
// ISO C++ 14882: |
// |
|
#include <bits/c++config.h> |
#include <bits/concurrence.h> |
#include <ext/mt_allocator.h> |
|
namespace __gnu_internal |
{ |
#ifdef __GTHREADS |
struct __freelist |
{ |
typedef __gnu_cxx::__pool<true>::_Thread_record _Thread_record; |
_Thread_record* _M_thread_freelist; |
_Thread_record* _M_thread_freelist_array; |
size_t _M_max_threads; |
__gthread_key_t _M_key; |
|
~__freelist() |
{ |
if (_M_thread_freelist_array) |
{ |
__gthread_key_delete(_M_key); |
::operator delete(static_cast<void*>(_M_thread_freelist_array)); |
} |
} |
}; |
|
// Ensure freelist is constructed first. |
static __freelist freelist; |
static __glibcxx_mutex_define_initialized(freelist_mutex); |
|
static void |
_M_destroy_thread_key(void* __id) |
{ |
// Return this thread id record to the front of thread_freelist. |
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex); |
size_t _M_id = reinterpret_cast<size_t>(__id); |
|
using namespace __gnu_internal; |
typedef __gnu_cxx::__pool<true>::_Thread_record _Thread_record; |
_Thread_record* __tr = &freelist._M_thread_freelist_array[_M_id - 1]; |
__tr->_M_next = freelist._M_thread_freelist; |
freelist._M_thread_freelist = __tr; |
} |
#endif |
} |
|
namespace __gnu_cxx |
{ |
void |
__pool<false>::_M_destroy() throw() |
{ |
if (_M_init && !_M_options._M_force_new) |
{ |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
while (__bin._M_address) |
{ |
_Block_address* __tmp = __bin._M_address->_M_next; |
::operator delete(__bin._M_address->_M_initial); |
__bin._M_address = __tmp; |
} |
::operator delete(__bin._M_first); |
} |
::operator delete(_M_bin); |
::operator delete(_M_binmap); |
} |
} |
|
void |
__pool<false>::_M_reclaim_block(char* __p, size_t __bytes) |
{ |
// Round up to power of 2 and figure out which bin to use. |
const size_t __which = _M_binmap[__bytes]; |
_Bin_record& __bin = _M_bin[__which]; |
|
char* __c = __p - _M_get_align(); |
_Block_record* __block = reinterpret_cast<_Block_record*>(__c); |
|
// Single threaded application - return to global pool. |
__block->_M_next = __bin._M_first[0]; |
__bin._M_first[0] = __block; |
} |
|
char* |
__pool<false>::_M_reserve_block(size_t __bytes, const size_t __thread_id) |
{ |
// Round up to power of 2 and figure out which bin to use. |
const size_t __which = _M_binmap[__bytes]; |
_Bin_record& __bin = _M_bin[__which]; |
const _Tune& __options = _M_get_options(); |
const size_t __bin_size = (__options._M_min_bin << __which) |
+ __options._M_align; |
size_t __block_count = __options._M_chunk_size - sizeof(_Block_address); |
__block_count /= __bin_size; |
|
// Get a new block dynamically, set it up for use. |
void* __v = ::operator new(__options._M_chunk_size); |
_Block_address* __address = static_cast<_Block_address*>(__v); |
__address->_M_initial = __v; |
__address->_M_next = __bin._M_address; |
__bin._M_address = __address; |
|
char* __c = static_cast<char*>(__v) + sizeof(_Block_address); |
_Block_record* __block = reinterpret_cast<_Block_record*>(__c); |
__bin._M_first[__thread_id] = __block; |
while (--__block_count > 0) |
{ |
__c += __bin_size; |
__block->_M_next = reinterpret_cast<_Block_record*>(__c); |
__block = __block->_M_next; |
} |
__block->_M_next = NULL; |
|
__block = __bin._M_first[__thread_id]; |
__bin._M_first[__thread_id] = __block->_M_next; |
|
// NB: For alignment reasons, we can't use the first _M_align |
// bytes, even when sizeof(_Block_record) < _M_align. |
return reinterpret_cast<char*>(__block) + __options._M_align; |
} |
|
void |
__pool<false>::_M_initialize() |
{ |
// _M_force_new must not change after the first allocate(), which |
// in turn calls this method, so if it's false, it's false forever |
// and we don't need to return here ever again. |
if (_M_options._M_force_new) |
{ |
_M_init = true; |
return; |
} |
|
// Create the bins. |
// Calculate the number of bins required based on _M_max_bytes. |
// _M_bin_size is statically-initialized to one. |
size_t __bin_size = _M_options._M_min_bin; |
while (_M_options._M_max_bytes > __bin_size) |
{ |
__bin_size <<= 1; |
++_M_bin_size; |
} |
|
// Setup the bin map for quick lookup of the relevant bin. |
const size_t __j = (_M_options._M_max_bytes + 1) * sizeof(_Binmap_type); |
_M_binmap = static_cast<_Binmap_type*>(::operator new(__j)); |
_Binmap_type* __bp = _M_binmap; |
_Binmap_type __bin_max = _M_options._M_min_bin; |
_Binmap_type __bint = 0; |
for (_Binmap_type __ct = 0; __ct <= _M_options._M_max_bytes; ++__ct) |
{ |
if (__ct > __bin_max) |
{ |
__bin_max <<= 1; |
++__bint; |
} |
*__bp++ = __bint; |
} |
|
// Initialize _M_bin and its members. |
void* __v = ::operator new(sizeof(_Bin_record) * _M_bin_size); |
_M_bin = static_cast<_Bin_record*>(__v); |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
__v = ::operator new(sizeof(_Block_record*)); |
__bin._M_first = static_cast<_Block_record**>(__v); |
__bin._M_first[0] = NULL; |
__bin._M_address = NULL; |
} |
_M_init = true; |
} |
|
|
#ifdef __GTHREADS |
void |
__pool<true>::_M_destroy() throw() |
{ |
if (_M_init && !_M_options._M_force_new) |
{ |
if (__gthread_active_p()) |
{ |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
while (__bin._M_address) |
{ |
_Block_address* __tmp = __bin._M_address->_M_next; |
::operator delete(__bin._M_address->_M_initial); |
__bin._M_address = __tmp; |
} |
::operator delete(__bin._M_first); |
::operator delete(__bin._M_free); |
::operator delete(__bin._M_used); |
::operator delete(__bin._M_mutex); |
} |
} |
else |
{ |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
while (__bin._M_address) |
{ |
_Block_address* __tmp = __bin._M_address->_M_next; |
::operator delete(__bin._M_address->_M_initial); |
__bin._M_address = __tmp; |
} |
::operator delete(__bin._M_first); |
} |
} |
::operator delete(_M_bin); |
::operator delete(_M_binmap); |
} |
} |
|
void |
__pool<true>::_M_reclaim_block(char* __p, size_t __bytes) |
{ |
// Round up to power of 2 and figure out which bin to use. |
const size_t __which = _M_binmap[__bytes]; |
const _Bin_record& __bin = _M_bin[__which]; |
|
// Know __p not null, assume valid block. |
char* __c = __p - _M_get_align(); |
_Block_record* __block = reinterpret_cast<_Block_record*>(__c); |
if (__gthread_active_p()) |
{ |
// Calculate the number of records to remove from our freelist: |
// in order to avoid too much contention we wait until the |
// number of records is "high enough". |
const size_t __thread_id = _M_get_thread_id(); |
const _Tune& __options = _M_get_options(); |
const unsigned long __limit = 100 * (_M_bin_size - __which) |
* __options._M_freelist_headroom; |
|
unsigned long __remove = __bin._M_free[__thread_id]; |
__remove *= __options._M_freelist_headroom; |
if (__remove >= __bin._M_used[__thread_id]) |
__remove -= __bin._M_used[__thread_id]; |
else |
__remove = 0; |
if (__remove > __limit && __remove > __bin._M_free[__thread_id]) |
{ |
_Block_record* __first = __bin._M_first[__thread_id]; |
_Block_record* __tmp = __first; |
__remove /= __options._M_freelist_headroom; |
const unsigned long __removed = __remove; |
while (--__remove > 0) |
__tmp = __tmp->_M_next; |
__bin._M_first[__thread_id] = __tmp->_M_next; |
__bin._M_free[__thread_id] -= __removed; |
|
__gthread_mutex_lock(__bin._M_mutex); |
__tmp->_M_next = __bin._M_first[0]; |
__bin._M_first[0] = __first; |
__bin._M_free[0] += __removed; |
__gthread_mutex_unlock(__bin._M_mutex); |
} |
|
// Return this block to our list and update counters and |
// owner id as needed. |
--__bin._M_used[__block->_M_thread_id]; |
|
__block->_M_next = __bin._M_first[__thread_id]; |
__bin._M_first[__thread_id] = __block; |
|
++__bin._M_free[__thread_id]; |
} |
else |
{ |
// Not using threads, so single threaded application - return |
// to global pool. |
__block->_M_next = __bin._M_first[0]; |
__bin._M_first[0] = __block; |
} |
} |
|
char* |
__pool<true>::_M_reserve_block(size_t __bytes, const size_t __thread_id) |
{ |
// Round up to power of 2 and figure out which bin to use. |
const size_t __which = _M_binmap[__bytes]; |
const _Tune& __options = _M_get_options(); |
const size_t __bin_size = ((__options._M_min_bin << __which) |
+ __options._M_align); |
size_t __block_count = __options._M_chunk_size - sizeof(_Block_address); |
__block_count /= __bin_size; |
|
// Are we using threads? |
// - Yes, check if there are free blocks on the global |
// list. If so, grab up to __block_count blocks in one |
// lock and change ownership. If the global list is |
// empty, we allocate a new chunk and add those blocks |
// directly to our own freelist (with us as owner). |
// - No, all operations are made directly to global pool 0 |
// no need to lock or change ownership but check for free |
// blocks on global list (and if not add new ones) and |
// get the first one. |
_Bin_record& __bin = _M_bin[__which]; |
_Block_record* __block = NULL; |
if (__gthread_active_p()) |
{ |
__gthread_mutex_lock(__bin._M_mutex); |
if (__bin._M_first[0] == NULL) |
{ |
void* __v = ::operator new(__options._M_chunk_size); |
_Block_address* __address = static_cast<_Block_address*>(__v); |
__address->_M_initial = __v; |
__address->_M_next = __bin._M_address; |
__bin._M_address = __address; |
__gthread_mutex_unlock(__bin._M_mutex); |
|
// No need to hold the lock when we are adding a whole |
// chunk to our own list. |
char* __c = static_cast<char*>(__v) + sizeof(_Block_address); |
__block = reinterpret_cast<_Block_record*>(__c); |
__bin._M_free[__thread_id] = __block_count; |
__bin._M_first[__thread_id] = __block; |
while (--__block_count > 0) |
{ |
__c += __bin_size; |
__block->_M_next = reinterpret_cast<_Block_record*>(__c); |
__block = __block->_M_next; |
} |
__block->_M_next = NULL; |
} |
else |
{ |
// Is the number of required blocks greater than or equal |
// to the number that can be provided by the global free |
// list? |
__bin._M_first[__thread_id] = __bin._M_first[0]; |
if (__block_count >= __bin._M_free[0]) |
{ |
__bin._M_free[__thread_id] = __bin._M_free[0]; |
__bin._M_free[0] = 0; |
__bin._M_first[0] = NULL; |
} |
else |
{ |
__bin._M_free[__thread_id] = __block_count; |
__bin._M_free[0] -= __block_count; |
__block = __bin._M_first[0]; |
while (--__block_count > 0) |
__block = __block->_M_next; |
__bin._M_first[0] = __block->_M_next; |
__block->_M_next = NULL; |
} |
__gthread_mutex_unlock(__bin._M_mutex); |
} |
} |
else |
{ |
void* __v = ::operator new(__options._M_chunk_size); |
_Block_address* __address = static_cast<_Block_address*>(__v); |
__address->_M_initial = __v; |
__address->_M_next = __bin._M_address; |
__bin._M_address = __address; |
|
char* __c = static_cast<char*>(__v) + sizeof(_Block_address); |
_Block_record* __block = reinterpret_cast<_Block_record*>(__c); |
__bin._M_first[0] = __block; |
while (--__block_count > 0) |
{ |
__c += __bin_size; |
__block->_M_next = reinterpret_cast<_Block_record*>(__c); |
__block = __block->_M_next; |
} |
__block->_M_next = NULL; |
} |
|
__block = __bin._M_first[__thread_id]; |
__bin._M_first[__thread_id] = __block->_M_next; |
|
if (__gthread_active_p()) |
{ |
__block->_M_thread_id = __thread_id; |
--__bin._M_free[__thread_id]; |
++__bin._M_used[__thread_id]; |
} |
|
// NB: For alignment reasons, we can't use the first _M_align |
// bytes, even when sizeof(_Block_record) < _M_align. |
return reinterpret_cast<char*>(__block) + __options._M_align; |
} |
|
void |
__pool<true>::_M_initialize() |
{ |
// _M_force_new must not change after the first allocate(), |
// which in turn calls this method, so if it's false, it's false |
// forever and we don't need to return here ever again. |
if (_M_options._M_force_new) |
{ |
_M_init = true; |
return; |
} |
|
// Create the bins. |
// Calculate the number of bins required based on _M_max_bytes. |
// _M_bin_size is statically-initialized to one. |
size_t __bin_size = _M_options._M_min_bin; |
while (_M_options._M_max_bytes > __bin_size) |
{ |
__bin_size <<= 1; |
++_M_bin_size; |
} |
|
// Setup the bin map for quick lookup of the relevant bin. |
const size_t __j = (_M_options._M_max_bytes + 1) * sizeof(_Binmap_type); |
_M_binmap = static_cast<_Binmap_type*>(::operator new(__j)); |
_Binmap_type* __bp = _M_binmap; |
_Binmap_type __bin_max = _M_options._M_min_bin; |
_Binmap_type __bint = 0; |
for (_Binmap_type __ct = 0; __ct <= _M_options._M_max_bytes; ++__ct) |
{ |
if (__ct > __bin_max) |
{ |
__bin_max <<= 1; |
++__bint; |
} |
*__bp++ = __bint; |
} |
|
// Initialize _M_bin and its members. |
void* __v = ::operator new(sizeof(_Bin_record) * _M_bin_size); |
_M_bin = static_cast<_Bin_record*>(__v); |
|
// If __gthread_active_p() create and initialize the list of |
// free thread ids. Single threaded applications use thread id 0 |
// directly and have no need for this. |
if (__gthread_active_p()) |
{ |
{ |
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex); |
|
if (!__gnu_internal::freelist._M_thread_freelist_array |
|| __gnu_internal::freelist._M_max_threads |
< _M_options._M_max_threads) |
{ |
const size_t __k = sizeof(_Thread_record) |
* _M_options._M_max_threads; |
__v = ::operator new(__k); |
_Thread_record* _M_thread_freelist |
= static_cast<_Thread_record*>(__v); |
|
// NOTE! The first assignable thread id is 1 since the |
// global pool uses id 0 |
size_t __i; |
for (__i = 1; __i < _M_options._M_max_threads; ++__i) |
{ |
_Thread_record& __tr = _M_thread_freelist[__i - 1]; |
__tr._M_next = &_M_thread_freelist[__i]; |
__tr._M_id = __i; |
} |
|
// Set last record. |
_M_thread_freelist[__i - 1]._M_next = NULL; |
_M_thread_freelist[__i - 1]._M_id = __i; |
|
if (!__gnu_internal::freelist._M_thread_freelist_array) |
{ |
// Initialize per thread key to hold pointer to |
// _M_thread_freelist. |
__gthread_key_create(&__gnu_internal::freelist._M_key, |
__gnu_internal::_M_destroy_thread_key); |
__gnu_internal::freelist._M_thread_freelist |
= _M_thread_freelist; |
} |
else |
{ |
_Thread_record* _M_old_freelist |
= __gnu_internal::freelist._M_thread_freelist; |
_Thread_record* _M_old_array |
= __gnu_internal::freelist._M_thread_freelist_array; |
__gnu_internal::freelist._M_thread_freelist |
= &_M_thread_freelist[_M_old_freelist - _M_old_array]; |
while (_M_old_freelist) |
{ |
size_t next_id; |
if (_M_old_freelist->_M_next) |
next_id = _M_old_freelist->_M_next - _M_old_array; |
else |
next_id = __gnu_internal::freelist._M_max_threads; |
_M_thread_freelist[_M_old_freelist->_M_id - 1]._M_next |
= &_M_thread_freelist[next_id]; |
_M_old_freelist = _M_old_freelist->_M_next; |
} |
::operator delete(static_cast<void*>(_M_old_array)); |
} |
__gnu_internal::freelist._M_thread_freelist_array |
= _M_thread_freelist; |
__gnu_internal::freelist._M_max_threads |
= _M_options._M_max_threads; |
} |
} |
|
const size_t __max_threads = _M_options._M_max_threads + 1; |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
__v = ::operator new(sizeof(_Block_record*) * __max_threads); |
__bin._M_first = static_cast<_Block_record**>(__v); |
|
__bin._M_address = NULL; |
|
__v = ::operator new(sizeof(size_t) * __max_threads); |
__bin._M_free = static_cast<size_t*>(__v); |
|
__v = ::operator new(sizeof(size_t) * __max_threads); |
__bin._M_used = static_cast<size_t*>(__v); |
|
__v = ::operator new(sizeof(__gthread_mutex_t)); |
__bin._M_mutex = static_cast<__gthread_mutex_t*>(__v); |
|
#ifdef __GTHREAD_MUTEX_INIT |
{ |
// Do not copy a POSIX/gthr mutex once in use. |
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; |
*__bin._M_mutex = __tmp; |
} |
#else |
{ __GTHREAD_MUTEX_INIT_FUNCTION(__bin._M_mutex); } |
#endif |
for (size_t __threadn = 0; __threadn < __max_threads; ++__threadn) |
{ |
__bin._M_first[__threadn] = NULL; |
__bin._M_free[__threadn] = 0; |
__bin._M_used[__threadn] = 0; |
} |
} |
} |
else |
{ |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
__v = ::operator new(sizeof(_Block_record*)); |
__bin._M_first = static_cast<_Block_record**>(__v); |
__bin._M_first[0] = NULL; |
__bin._M_address = NULL; |
} |
} |
_M_init = true; |
} |
|
size_t |
__pool<true>::_M_get_thread_id() |
{ |
// If we have thread support and it's active we check the thread |
// key value and return its id or if it's not set we take the |
// first record from _M_thread_freelist and sets the key and |
// returns it's id. |
if (__gthread_active_p()) |
{ |
void* v = __gthread_getspecific(__gnu_internal::freelist._M_key); |
size_t _M_id = (size_t)v; |
if (_M_id == 0) |
{ |
{ |
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex); |
if (__gnu_internal::freelist._M_thread_freelist) |
{ |
_M_id = __gnu_internal::freelist._M_thread_freelist->_M_id; |
__gnu_internal::freelist._M_thread_freelist |
= __gnu_internal::freelist._M_thread_freelist->_M_next; |
} |
} |
|
__gthread_setspecific(__gnu_internal::freelist._M_key, |
(void*)_M_id); |
} |
return _M_id >= _M_options._M_max_threads ? 0 : _M_id; |
} |
|
// Otherwise (no thread support or inactive) all requests are |
// served from the global pool 0. |
return 0; |
} |
|
// XXX GLIBCXX_ABI Deprecated |
void |
__pool<true>::_M_destroy_thread_key(void*) { } |
|
// XXX GLIBCXX_ABI Deprecated |
void |
__pool<true>::_M_initialize(__destroy_handler) |
{ |
// _M_force_new must not change after the first allocate(), |
// which in turn calls this method, so if it's false, it's false |
// forever and we don't need to return here ever again. |
if (_M_options._M_force_new) |
{ |
_M_init = true; |
return; |
} |
|
// Create the bins. |
// Calculate the number of bins required based on _M_max_bytes. |
// _M_bin_size is statically-initialized to one. |
size_t __bin_size = _M_options._M_min_bin; |
while (_M_options._M_max_bytes > __bin_size) |
{ |
__bin_size <<= 1; |
++_M_bin_size; |
} |
|
// Setup the bin map for quick lookup of the relevant bin. |
const size_t __j = (_M_options._M_max_bytes + 1) * sizeof(_Binmap_type); |
_M_binmap = static_cast<_Binmap_type*>(::operator new(__j)); |
_Binmap_type* __bp = _M_binmap; |
_Binmap_type __bin_max = _M_options._M_min_bin; |
_Binmap_type __bint = 0; |
for (_Binmap_type __ct = 0; __ct <= _M_options._M_max_bytes; ++__ct) |
{ |
if (__ct > __bin_max) |
{ |
__bin_max <<= 1; |
++__bint; |
} |
*__bp++ = __bint; |
} |
|
// Initialize _M_bin and its members. |
void* __v = ::operator new(sizeof(_Bin_record) * _M_bin_size); |
_M_bin = static_cast<_Bin_record*>(__v); |
|
// If __gthread_active_p() create and initialize the list of |
// free thread ids. Single threaded applications use thread id 0 |
// directly and have no need for this. |
if (__gthread_active_p()) |
{ |
{ |
__gnu_cxx::lock sentry(__gnu_internal::freelist_mutex); |
|
if (!__gnu_internal::freelist._M_thread_freelist_array |
|| __gnu_internal::freelist._M_max_threads |
< _M_options._M_max_threads) |
{ |
const size_t __k = sizeof(_Thread_record) |
* _M_options._M_max_threads; |
__v = ::operator new(__k); |
_Thread_record* _M_thread_freelist |
= static_cast<_Thread_record*>(__v); |
|
// NOTE! The first assignable thread id is 1 since the |
// global pool uses id 0 |
size_t __i; |
for (__i = 1; __i < _M_options._M_max_threads; ++__i) |
{ |
_Thread_record& __tr = _M_thread_freelist[__i - 1]; |
__tr._M_next = &_M_thread_freelist[__i]; |
__tr._M_id = __i; |
} |
|
// Set last record. |
_M_thread_freelist[__i - 1]._M_next = NULL; |
_M_thread_freelist[__i - 1]._M_id = __i; |
|
if (!__gnu_internal::freelist._M_thread_freelist_array) |
{ |
// Initialize per thread key to hold pointer to |
// _M_thread_freelist. |
__gthread_key_create(&__gnu_internal::freelist._M_key, |
__gnu_internal::_M_destroy_thread_key); |
__gnu_internal::freelist._M_thread_freelist |
= _M_thread_freelist; |
} |
else |
{ |
_Thread_record* _M_old_freelist |
= __gnu_internal::freelist._M_thread_freelist; |
_Thread_record* _M_old_array |
= __gnu_internal::freelist._M_thread_freelist_array; |
__gnu_internal::freelist._M_thread_freelist |
= &_M_thread_freelist[_M_old_freelist - _M_old_array]; |
while (_M_old_freelist) |
{ |
size_t next_id; |
if (_M_old_freelist->_M_next) |
next_id = _M_old_freelist->_M_next - _M_old_array; |
else |
next_id = __gnu_internal::freelist._M_max_threads; |
_M_thread_freelist[_M_old_freelist->_M_id - 1]._M_next |
= &_M_thread_freelist[next_id]; |
_M_old_freelist = _M_old_freelist->_M_next; |
} |
::operator delete(static_cast<void*>(_M_old_array)); |
} |
__gnu_internal::freelist._M_thread_freelist_array |
= _M_thread_freelist; |
__gnu_internal::freelist._M_max_threads |
= _M_options._M_max_threads; |
} |
} |
|
const size_t __max_threads = _M_options._M_max_threads + 1; |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
__v = ::operator new(sizeof(_Block_record*) * __max_threads); |
__bin._M_first = static_cast<_Block_record**>(__v); |
|
__bin._M_address = NULL; |
|
__v = ::operator new(sizeof(size_t) * __max_threads); |
__bin._M_free = static_cast<size_t*>(__v); |
|
__v = ::operator new(sizeof(size_t) * __max_threads); |
__bin._M_used = static_cast<size_t*>(__v); |
|
__v = ::operator new(sizeof(__gthread_mutex_t)); |
__bin._M_mutex = static_cast<__gthread_mutex_t*>(__v); |
|
#ifdef __GTHREAD_MUTEX_INIT |
{ |
// Do not copy a POSIX/gthr mutex once in use. |
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; |
*__bin._M_mutex = __tmp; |
} |
#else |
{ __GTHREAD_MUTEX_INIT_FUNCTION(__bin._M_mutex); } |
#endif |
for (size_t __threadn = 0; __threadn < __max_threads; ++__threadn) |
{ |
__bin._M_first[__threadn] = NULL; |
__bin._M_free[__threadn] = 0; |
__bin._M_used[__threadn] = 0; |
} |
} |
} |
else |
{ |
for (size_t __n = 0; __n < _M_bin_size; ++__n) |
{ |
_Bin_record& __bin = _M_bin[__n]; |
__v = ::operator new(sizeof(_Block_record*)); |
__bin._M_first = static_cast<_Block_record**>(__v); |
__bin._M_first[0] = NULL; |
__bin._M_address = NULL; |
} |
} |
_M_init = true; |
} |
#endif |
|
// Instantiations. |
template class __mt_alloc<char>; |
template class __mt_alloc<wchar_t>; |
} // namespace __gnu_cxx |
/libstdc++-v3/src/string-inst.cc
0,0 → 1,91
// Components for manipulating sequences of characters -*- 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// |
// ISO C++ 14882: 21 Strings library |
// |
|
// Written by Jason Merrill based upon the specification by Takanori Adachi |
// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers. |
|
#include <string> |
|
// Instantiation configuration. |
#ifndef C |
# define C char |
#endif |
|
namespace std |
{ |
typedef basic_string<C> S; |
|
template class basic_string<C>; |
template S operator+(const C*, const S&); |
template S operator+(C, const S&); |
template S operator+(const S&, const S&); |
|
// Only one template keyword allowed here. |
// See core issue #46 (NAD) |
// http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_closed.html#46 |
template |
S::basic_string(C*, C*, const allocator<C>&); |
|
template |
S::basic_string(const C*, const C*, const allocator<C>&); |
|
template |
S::basic_string(S::iterator, S::iterator, const allocator<C>&); |
|
template |
C* |
S::_S_construct(S::iterator, S::iterator, |
const allocator<C>&, forward_iterator_tag); |
|
template |
C* |
S::_S_construct(C*, C*, const allocator<C>&, forward_iterator_tag); |
|
template |
C* |
S::_S_construct(const C*, const C*, const allocator<C>&, |
forward_iterator_tag); |
|
// Used in str::find. |
template |
const C* |
search(const C*, const C*, const C*, const C*, bool(*)(const C&, const C&)); |
} // 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 |
/libstdc++-v3/src/locale_init.cc
0,0 → 1,347
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 object for locale initialization. |
static __glibcxx_mutex_define_initialized(locale_mutex); |
} // namespace __gnu_internal |
|
namespace std |
{ |
using namespace __gnu_internal; |
|
locale::locale() throw() : _M_impl(0) |
{ |
_S_initialize(); |
__gnu_cxx::lock sentry(__gnu_internal::locale_mutex); |
_S_global->_M_add_reference(); |
_M_impl = _S_global; |
} |
|
locale |
locale::global(const locale& __other) |
{ |
_S_initialize(); |
_Impl* __old; |
{ |
__gnu_cxx::lock sentry(__gnu_internal::locale_mutex); |
__old = _S_global; |
__other._M_impl->_M_add_reference(); |
_S_global = __other._M_impl; |
const string __other_name = __other.name(); |
if (__other_name != "*") |
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); |
} |
|
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 the categories. |
_M_names = new (&name_vec) char*[_S_categories_size]; |
_M_names[0] = new (&name_c[0]) char[2]; |
std::memcpy(_M_names[0], locale::facet::_S_get_c_name(), 2); |
for (size_t __j = 1; __j < _S_categories_size; ++__j) |
_M_names[__j] = 0; |
|
// 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 |
/libstdc++-v3/src/strstream.cc
0,0 → 1,416
// strstream definitions -*- C++ -*- |
|
// Copyright (C) 2001, 2002, 2003 Free Software Foundation |
// |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
/* |
* Copyright (c) 1998 |
* Silicon Graphics Computer Systems, Inc. |
* |
* Permission to use, copy, modify, distribute and sell this software |
* and its documentation for any purpose is hereby granted without fee, |
* provided that the above copyright notice appear in all copies and |
* that both that copyright notice and this permission notice appear |
* in supporting documentation. Silicon Graphics makes no |
* representations about the suitability of this software for any |
* purpose. It is provided "as is" without express or implied warranty. |
*/ |
|
// Implementation of the classes in header <strstream>. |
// WARNING: The classes defined in <strstream> are DEPRECATED. This |
// header is defined in section D.7.1 of the C++ standard, and it |
// MAY BE REMOVED in a future standard revision. You should use the |
// header <sstream> instead. |
|
#include <strstream> |
#include <algorithm> |
#include <new> |
#include <stdlib.h> |
#include <string.h> |
#include <limits.h> |
|
namespace std |
{ |
strstreambuf::strstreambuf(streamsize initial_capacity) |
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(true), |
_M_frozen(false), _M_constant(false) |
{ |
streamsize n = std::max(initial_capacity, streamsize(16)); |
|
char* buf = _M_alloc(n); |
if (buf) |
{ |
setp(buf, buf + n); |
setg(buf, buf, buf); |
} |
} |
|
strstreambuf::strstreambuf(void* (*alloc_f)(size_t), void (*free_f)(void*)) |
: _Base(), _M_alloc_fun(alloc_f), _M_free_fun(free_f), _M_dynamic(true), |
_M_frozen(false), _M_constant(false) |
{ |
streamsize n = 16; |
|
char* buf = _M_alloc(n); |
if (buf) |
{ |
setp(buf, buf + n); |
setg(buf, buf, buf); |
} |
} |
|
strstreambuf::strstreambuf(char* get, streamsize n, char* put) |
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false), |
_M_frozen(false), _M_constant(false) |
{ _M_setup(get, put, n); } |
|
strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put) |
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false), |
_M_frozen(false), _M_constant(false) |
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); } |
|
strstreambuf::strstreambuf(unsigned char* get, streamsize n, |
unsigned char* put) |
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false), |
_M_frozen(false), _M_constant(false) |
{ _M_setup(reinterpret_cast<char*>(get), reinterpret_cast<char*>(put), n); } |
|
strstreambuf::strstreambuf(const char* get, streamsize n) |
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false), |
_M_frozen(false), _M_constant(true) |
{ _M_setup(const_cast<char*>(get), 0, n); } |
|
strstreambuf::strstreambuf(const signed char* get, streamsize n) |
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false), |
_M_frozen(false), _M_constant(true) |
{ _M_setup(reinterpret_cast<char*>(const_cast<signed char*>(get)), 0, n); } |
|
strstreambuf::strstreambuf(const unsigned char* get, streamsize n) |
: _Base(), _M_alloc_fun(0), _M_free_fun(0), _M_dynamic(false), |
_M_frozen(false), _M_constant(true) |
{ _M_setup(reinterpret_cast<char*>(const_cast<unsigned char*>(get)), 0, n); } |
|
strstreambuf::~strstreambuf() |
{ |
if (_M_dynamic && !_M_frozen) |
_M_free(eback()); |
} |
|
void |
strstreambuf::freeze(bool frozenflag) |
{ |
if (_M_dynamic) |
_M_frozen = frozenflag; |
} |
|
char* |
strstreambuf::str() |
{ |
freeze(true); |
return eback(); |
} |
|
int |
strstreambuf::pcount() const |
{ return pptr() ? pptr() - pbase() : 0; } |
|
strstreambuf::int_type |
strstreambuf::overflow(int_type c) |
{ |
if (c == traits_type::eof()) |
return traits_type::not_eof(c); |
|
// Try to expand the buffer. |
if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) |
{ |
ptrdiff_t old_size = epptr() - pbase(); |
ptrdiff_t new_size = std::max(ptrdiff_t(2 * old_size), ptrdiff_t(1)); |
|
char* buf = _M_alloc(new_size); |
if (buf) |
{ |
memcpy(buf, pbase(), old_size); |
char* old_buffer = pbase(); |
bool reposition_get = false; |
ptrdiff_t old_get_offset; |
if (gptr() != 0) |
{ |
reposition_get = true; |
old_get_offset = gptr() - eback(); |
} |
|
setp(buf, buf + new_size); |
pbump(old_size); |
|
if (reposition_get) |
setg(buf, buf + old_get_offset, buf + |
std::max(old_get_offset, old_size)); |
|
_M_free(old_buffer); |
} |
} |
|
if (pptr() != epptr()) |
{ |
*pptr() = c; |
pbump(1); |
return c; |
} |
else |
return traits_type::eof(); |
} |
|
strstreambuf::int_type |
strstreambuf::pbackfail(int_type c) |
{ |
if (gptr() != eback()) |
{ |
if (c == _Traits::eof()) |
{ |
gbump(-1); |
return _Traits::not_eof(c); |
} |
else if (c == _Traits::to_int_type(gptr()[-1])) |
{ // KLUDGE |
gbump(-1); |
return c; |
} |
else if (!_M_constant) |
{ |
gbump(-1); |
*gptr() = c; |
return c; |
} |
} |
return _Traits::eof(); |
} |
|
strstreambuf::int_type |
strstreambuf::underflow() |
{ |
if (gptr() == egptr() && pptr() && pptr() > egptr()) |
setg(eback(), gptr(), pptr()); |
|
if (gptr() != egptr()) |
return (unsigned char) *gptr(); |
else |
return _Traits::eof(); |
} |
|
basic_streambuf<char, char_traits<char> >* |
strstreambuf::setbuf(char*, streamsize) |
{ return this; } |
|
strstreambuf::pos_type |
strstreambuf::seekoff(off_type off, ios_base::seekdir dir, |
ios_base::openmode mode) |
{ |
bool do_get = false; |
bool do_put = false; |
|
if ((mode & (ios_base::in | ios_base::out)) |
== (ios_base::in | ios_base::out) && |
(dir == ios_base::beg || dir == ios_base::end)) |
do_get = do_put = true; |
else if (mode & ios_base::in) |
do_get = true; |
else if (mode & ios_base::out) |
do_put = true; |
|
// !gptr() is here because, according to D.7.1 paragraph 4, the seekable |
// area is undefined if there is no get area. |
if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr()) |
return pos_type(off_type(-1)); |
|
char* seeklow = eback(); |
char* seekhigh = epptr() ? epptr() : egptr(); |
|
off_type newoff; |
switch (dir) |
{ |
case ios_base::beg: |
newoff = 0; |
break; |
case ios_base::end: |
newoff = seekhigh - seeklow; |
break; |
case ios_base::cur: |
newoff = do_put ? pptr() - seeklow : gptr() - seeklow; |
break; |
default: |
return pos_type(off_type(-1)); |
} |
|
off += newoff; |
if (off < 0 || off > seekhigh - seeklow) |
return pos_type(off_type(-1)); |
|
if (do_put) |
{ |
if (seeklow + off < pbase()) |
{ |
setp(seeklow, epptr()); |
pbump(off); |
} |
else |
{ |
setp(pbase(), epptr()); |
pbump(off - (pbase() - seeklow)); |
} |
} |
if (do_get) |
{ |
if (off <= egptr() - seeklow) |
setg(seeklow, seeklow + off, egptr()); |
else if (off <= pptr() - seeklow) |
setg(seeklow, seeklow + off, pptr()); |
else |
setg(seeklow, seeklow + off, epptr()); |
} |
return pos_type(newoff); |
} |
|
strstreambuf::pos_type |
strstreambuf::seekpos(pos_type pos, ios_base::openmode mode) |
{ return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode); } |
|
char* |
strstreambuf::_M_alloc(size_t n) |
{ |
if (_M_alloc_fun) |
return static_cast<char*>(_M_alloc_fun(n)); |
else |
return new char[n]; |
} |
|
void |
strstreambuf::_M_free(char* p) |
{ |
if (p) |
if (_M_free_fun) |
_M_free_fun(p); |
else |
delete[] p; |
} |
|
void |
strstreambuf::_M_setup(char* get, char* put, streamsize n) |
{ |
if (get) |
{ |
size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX); |
|
if (put) |
{ |
setg(get, get, put); |
setp(put, put + N); |
} |
else |
setg(get, get, get + N); |
} |
} |
|
istrstream::istrstream(char* s) |
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0) |
{ basic_ios<char>::init(&_M_buf); } |
|
istrstream::istrstream(const char* s) |
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, 0) |
{ basic_ios<char>::init(&_M_buf); } |
|
istrstream::istrstream(char* s, streamsize n) |
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n) |
{ basic_ios<char>::init(&_M_buf); } |
|
istrstream::istrstream(const char* s, streamsize n) |
: basic_ios<char>(), basic_istream<char>(0), _M_buf(s, n) |
{ basic_ios<char>::init(&_M_buf); } |
|
istrstream::~istrstream() { } |
|
strstreambuf* |
istrstream::rdbuf() const |
{ return const_cast<strstreambuf*>(&_M_buf); } |
|
char* |
istrstream::str() |
{ return _M_buf.str(); } |
|
ostrstream::ostrstream() |
: basic_ios<char>(), basic_ostream<char>(0), _M_buf() |
{ basic_ios<char>::init(&_M_buf); } |
|
ostrstream::ostrstream(char* s, int n, ios_base::openmode mode) |
: basic_ios<char>(), basic_ostream<char>(0), |
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) |
{ basic_ios<char>::init(&_M_buf); } |
|
ostrstream::~ostrstream() {} |
|
strstreambuf* |
ostrstream::rdbuf() const |
{ return const_cast<strstreambuf*>(&_M_buf); } |
|
void |
ostrstream::freeze(bool freezeflag) |
{ _M_buf.freeze(freezeflag); } |
|
char* |
ostrstream::str() |
{ return _M_buf.str(); } |
|
int |
ostrstream::pcount() const |
{ return _M_buf.pcount(); } |
|
strstream::strstream() |
: basic_ios<char>(), basic_iostream<char>(0), _M_buf() |
{ basic_ios<char>::init(&_M_buf); } |
|
strstream::strstream(char* s, int n, ios_base::openmode mode) |
: basic_ios<char>(), basic_iostream<char>(0), |
_M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) |
{ basic_ios<char>::init(&_M_buf); } |
|
strstream::~strstream() { } |
|
strstreambuf* |
strstream::rdbuf() const |
{ return const_cast<strstreambuf*>(&_M_buf); } |
|
void |
strstream::freeze(bool freezeflag) |
{ _M_buf.freeze(freezeflag); } |
|
int |
strstream::pcount() const |
{ return _M_buf.pcount(); } |
|
char* |
strstream::str() |
{ return _M_buf.str(); } |
} // namespace std |
/libstdc++-v3/src/ctype.cc
0,0 → 1,114
// 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 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 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 _GLIBCXX_USE_WCHAR_T |
locale::id ctype<wchar_t>::id; |
#endif |
|
template<> |
const ctype<char>& |
use_facet<ctype<char> >(const locale& __loc) |
{ |
size_t __i = ctype<char>::id._M_id(); |
const locale::_Impl* __tmp = __loc._M_impl; |
return static_cast<const ctype<char>&>(*(__tmp->_M_facets[__i])); |
} |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template<> |
const ctype<wchar_t>& |
use_facet<ctype<wchar_t> >(const locale& __loc) |
{ |
size_t __i = ctype<wchar_t>::id._M_id(); |
const locale::_Impl* __tmp = __loc._M_impl; |
return static_cast<const ctype<wchar_t>&>(*(__tmp->_M_facets[__i])); |
} |
#endif |
|
// 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; |
|
ctype<char>::~ctype() |
{ |
_S_destroy_c_locale(_M_c_locale_ctype); |
if (_M_del) |
delete[] this->table(); |
} |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
ctype<wchar_t>::ctype(size_t __refs) |
: __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)), _M_narrow_ok(false) |
{ _M_initialize_ctype(); } |
|
ctype<wchar_t>::~ctype() |
{ _S_destroy_c_locale(_M_c_locale_ctype); } |
|
template<> |
ctype_byname<wchar_t>::ctype_byname(const char* __s, size_t __refs) |
: ctype<wchar_t>(__refs) |
{ |
if (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 |
|
/libstdc++-v3/src/ostream-inst.cc
0,0 → 1,76
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 |
// Free Software Foundation, Inc. |
// |
// This file is part of the GNU ISO C++ Library. This library is free |
// software; you can redistribute it and/or modify it under the |
// terms of the GNU General Public License as published by the |
// Free Software Foundation; either version 2, or (at your option) |
// any later version. |
|
// This library is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
|
// You should have received a copy of the GNU General Public License along |
// with this library; see the file COPYING. If not, write to the Free |
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <ostream> |
#include <iomanip> |
|
namespace std |
{ |
// ostream |
template class basic_ostream<char>; |
template ostream& endl(ostream&); |
template ostream& ends(ostream&); |
template ostream& flush(ostream&); |
template ostream& operator<<(ostream&, char); |
template ostream& operator<<(ostream&, unsigned char); |
template ostream& operator<<(ostream&, signed char); |
template ostream& operator<<(ostream&, const char*); |
template ostream& operator<<(ostream&, const unsigned char*); |
template ostream& operator<<(ostream&, const signed char*); |
|
template ostream& operator<<(ostream&, _Setfill<char>); |
template ostream& operator<<(ostream&, _Setiosflags); |
template ostream& operator<<(ostream&, _Resetiosflags); |
template ostream& operator<<(ostream&, _Setbase); |
template ostream& operator<<(ostream&, _Setprecision); |
template ostream& operator<<(ostream&, _Setw); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_ostream<wchar_t>; |
template wostream& endl(wostream&); |
template wostream& ends(wostream&); |
template wostream& flush(wostream&); |
template wostream& operator<<(wostream&, wchar_t); |
template wostream& operator<<(wostream&, char); |
template wostream& operator<<(wostream&, const wchar_t*); |
template wostream& operator<<(wostream&, const char*); |
|
template wostream& operator<<(wostream&, _Setfill<wchar_t>); |
template wostream& operator<<(wostream&, _Setiosflags); |
template wostream& operator<<(wostream&, _Resetiosflags); |
template wostream& operator<<(wostream&, _Setbase); |
template wostream& operator<<(wostream&, _Setprecision); |
template wostream& operator<<(wostream&, _Setw); |
#endif |
} // namespace std |
/libstdc++-v3/src/streambuf.cc
0,0 → 1,103
// Stream buffer classes -*- C++ -*- |
|
// Copyright (C) 2004, 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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.5 Stream buffers |
// |
|
#include <streambuf> |
|
namespace std |
{ |
template<> |
streamsize |
__copy_streambufs(basic_streambuf<char>* __sbin, |
basic_streambuf<char>* __sbout) |
{ |
typedef basic_streambuf<char>::traits_type traits_type; |
streamsize __ret = 0; |
traits_type::int_type __c = __sbin->sgetc(); |
while (!traits_type::eq_int_type(__c, traits_type::eof())) |
{ |
const streamsize __n = __sbin->egptr() - __sbin->gptr(); |
if (__n > 1) |
{ |
const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n); |
__sbin->gbump(__wrote); |
__ret += __wrote; |
if (__wrote < __n) |
break; |
__c = __sbin->underflow(); |
} |
else |
{ |
__c = __sbout->sputc(traits_type::to_char_type(__c)); |
if (traits_type::eq_int_type(__c, traits_type::eof())) |
break; |
++__ret; |
__c = __sbin->snextc(); |
} |
} |
return __ret; |
} |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template<> |
streamsize |
__copy_streambufs(basic_streambuf<wchar_t>* __sbin, |
basic_streambuf<wchar_t>* __sbout) |
{ |
typedef basic_streambuf<wchar_t>::traits_type traits_type; |
streamsize __ret = 0; |
traits_type::int_type __c = __sbin->sgetc(); |
while (!traits_type::eq_int_type(__c, traits_type::eof())) |
{ |
const streamsize __n = __sbin->egptr() - __sbin->gptr(); |
if (__n > 1) |
{ |
const streamsize __wrote = __sbout->sputn(__sbin->gptr(), __n); |
__sbin->gbump(__wrote); |
__ret += __wrote; |
if (__wrote < __n) |
break; |
__c = __sbin->underflow(); |
} |
else |
{ |
__c = __sbout->sputc(traits_type::to_char_type(__c)); |
if (traits_type::eq_int_type(__c, traits_type::eof())) |
break; |
++__ret; |
__c = __sbin->snextc(); |
} |
} |
return __ret; |
} |
#endif |
} // namespace std |
/libstdc++-v3/src/functexcept.cc
0,0 → 1,157
// 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 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
#include <bits/functexcept.h> |
#include <cstdlib> |
#include <exception> |
#include <stdexcept> |
#include <new> |
#include <typeinfo> |
#include <ios> |
#ifdef _GLIBCXX_USE_NLS |
# include <libintl.h> |
# define _(msgid) gettext (msgid) |
#else |
# define _(msgid) (msgid) |
#endif |
|
namespace std |
{ |
#if __EXCEPTIONS |
void |
__throw_bad_exception(void) |
{ throw bad_exception(); } |
|
void |
__throw_bad_alloc(void) |
{ throw bad_alloc(); } |
|
void |
__throw_bad_cast(void) |
{ throw bad_cast(); } |
|
void |
__throw_bad_typeid(void) |
{ throw bad_typeid(); } |
|
void |
__throw_logic_error(const char* __s) |
{ throw logic_error(_(__s)); } |
|
void |
__throw_domain_error(const char* __s) |
{ throw domain_error(_(__s)); } |
|
void |
__throw_invalid_argument(const char* __s) |
{ throw invalid_argument(_(__s)); } |
|
void |
__throw_length_error(const char* __s) |
{ throw length_error(_(__s)); } |
|
void |
__throw_out_of_range(const char* __s) |
{ throw out_of_range(_(__s)); } |
|
void |
__throw_runtime_error(const char* __s) |
{ throw runtime_error(_(__s)); } |
|
void |
__throw_range_error(const char* __s) |
{ throw range_error(_(__s)); } |
|
void |
__throw_overflow_error(const char* __s) |
{ throw overflow_error(_(__s)); } |
|
void |
__throw_underflow_error(const char* __s) |
{ throw underflow_error(_(__s)); } |
|
void |
__throw_ios_failure(const char* __s) |
{ throw ios_base::failure(_(__s)); } |
#else |
void |
__throw_bad_exception(void) |
{ abort(); } |
|
void |
__throw_bad_alloc(void) |
{ abort(); } |
|
void |
__throw_bad_cast(void) |
{ abort(); } |
|
void |
__throw_bad_typeid(void) |
{ abort(); } |
|
void |
__throw_logic_error(const char*) |
{ abort(); } |
|
void |
__throw_domain_error(const char*) |
{ abort(); } |
|
void |
__throw_invalid_argument(const char*) |
{ abort(); } |
|
void |
__throw_length_error(const char*) |
{ abort(); } |
|
void |
__throw_out_of_range(const char*) |
{ abort(); } |
|
void |
__throw_runtime_error(const char*) |
{ abort(); } |
|
void |
__throw_range_error(const char*) |
{ abort(); } |
|
void |
__throw_overflow_error(const char*) |
{ abort(); } |
|
void |
__throw_underflow_error(const char*) |
{ abort(); } |
|
void |
__throw_ios_failure(const char*) |
{ abort(); } |
#endif //__EXCEPTIONS |
} |
/libstdc++-v3/src/sstream-inst.cc
0,0 → 1,62
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 |
// Free Software Foundation, Inc. |
// |
// This file is part of the GNU ISO C++ Library. This library is free |
// software; you can redistribute it and/or modify it under the |
// terms of the GNU General Public License as published by the |
// Free Software Foundation; either version 2, or (at your option) |
// any later version. |
|
// This library is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
|
// You should have received a copy of the GNU General Public License along |
// with this library; see the file COPYING. If not, write to the Free |
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <sstream> |
|
namespace std |
{ |
// stringbuf |
template class basic_stringbuf<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_stringbuf<wchar_t>; |
#endif |
|
// istringstream |
template class basic_istringstream<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_istringstream<wchar_t>; |
#endif |
|
// ostringstream |
template class basic_ostringstream<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_ostringstream<wchar_t>; |
#endif |
|
// stringstream |
template class basic_stringstream<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_stringstream<wchar_t>; |
#endif |
} // namespace std |
/libstdc++-v3/src/ios.cc
0,0 → 1,194
// Iostreams base classes -*- C++ -*- |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <limits> |
#include <bits/atomicity.h> |
|
namespace std |
{ |
// Definitions for static const members of ios_base. |
const ios_base::fmtflags ios_base::boolalpha; |
const ios_base::fmtflags ios_base::dec; |
const ios_base::fmtflags ios_base::fixed; |
const ios_base::fmtflags ios_base::hex; |
const ios_base::fmtflags ios_base::internal; |
const ios_base::fmtflags ios_base::left; |
const ios_base::fmtflags ios_base::oct; |
const ios_base::fmtflags ios_base::right; |
const ios_base::fmtflags ios_base::scientific; |
const ios_base::fmtflags ios_base::showbase; |
const ios_base::fmtflags ios_base::showpoint; |
const ios_base::fmtflags ios_base::showpos; |
const ios_base::fmtflags ios_base::skipws; |
const ios_base::fmtflags ios_base::unitbuf; |
const ios_base::fmtflags ios_base::uppercase; |
const ios_base::fmtflags ios_base::adjustfield; |
const ios_base::fmtflags ios_base::basefield; |
const ios_base::fmtflags ios_base::floatfield; |
|
const ios_base::iostate ios_base::badbit; |
const ios_base::iostate ios_base::eofbit; |
const ios_base::iostate ios_base::failbit; |
const ios_base::iostate ios_base::goodbit; |
|
const ios_base::openmode ios_base::app; |
const ios_base::openmode ios_base::ate; |
const ios_base::openmode ios_base::binary; |
const ios_base::openmode ios_base::in; |
const ios_base::openmode ios_base::out; |
const ios_base::openmode ios_base::trunc; |
|
const ios_base::seekdir ios_base::beg; |
const ios_base::seekdir ios_base::cur; |
const ios_base::seekdir ios_base::end; |
|
_Atomic_word ios_base::Init::_S_refcount; |
|
bool ios_base::Init::_S_synced_with_stdio = true; |
|
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() |
{ |
// 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; |
} |
} |
|
// 27.4.2.5 ios_base storage functions |
int |
ios_base::xalloc() throw() |
{ |
// Implementation note: Initialize top to zero to ensure that |
// initialization occurs before main() is started. |
static _Atomic_word _S_top = 0; |
return __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, bool __iword) |
{ |
// Precondition: _M_word_size <= __ix |
int __newsize = _S_local_word_size; |
_Words* __words = _M_local_word; |
if (__ix > _S_local_word_size - 1) |
{ |
if (__ix < numeric_limits<int>::max()) |
{ |
__newsize = __ix + 1; |
try |
{ __words = new _Words[__newsize]; } |
catch (...) |
{ |
_M_streambuf_state |= badbit; |
if (_M_streambuf_state & _M_exception) |
__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++) |
__words[__i] = _M_word[__i]; |
if (_M_word && _M_word != _M_local_word) |
{ |
delete [] _M_word; |
_M_word = 0; |
} |
} |
else |
{ |
_M_streambuf_state |= badbit; |
if (_M_streambuf_state & _M_exception) |
__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; |
} |
} |
_M_word = __words; |
_M_word_size = __newsize; |
return _M_word[__ix]; |
} |
|
void |
ios_base::_M_call_callbacks(event __e) throw() |
{ |
_Callback_list* __p = _M_callbacks; |
while (__p) |
{ |
try |
{ (*__p->_M_fn) (__e, *this, __p->_M_index); } |
catch (...) |
{ } |
__p = __p->_M_next; |
} |
} |
|
void |
ios_base::_M_dispose_callbacks(void) |
{ |
_Callback_list* __p = _M_callbacks; |
while (__p && __p->_M_remove_reference() == 0) |
{ |
_Callback_list* __next = __p->_M_next; |
delete __p; |
__p = __next; |
} |
_M_callbacks = 0; |
} |
} // namespace std |
/libstdc++-v3/src/valarray-inst.cc
0,0 → 1,115
// Explicit instantiation file. |
|
// Copyright (C) 2001, 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// |
// ISO C++ 14882: |
// |
|
#include <valarray> |
|
namespace std |
{ |
// Some explicit instantiations. |
template void |
__valarray_fill(size_t* __restrict__, size_t, const size_t&); |
|
template void |
__valarray_copy(const size_t* __restrict__, size_t, size_t* __restrict__); |
|
template valarray<size_t>::valarray(size_t); |
template valarray<size_t>::valarray(const valarray<size_t>&); |
template valarray<size_t>::~valarray(); |
template size_t valarray<size_t>::size() const; |
template size_t& valarray<size_t>::operator[](size_t); |
|
inline size_t |
__valarray_product(const valarray<size_t>& __a) |
{ |
typedef const size_t* __restrict__ _Tp; |
const size_t __n = __a.size(); |
// XXX: This ugly cast is necessary because |
// valarray::operator[]() const return a VALUE! |
// Try to get the committee to correct that gross error. |
valarray<size_t>& __t = const_cast<valarray<size_t>&>(__a); |
return __valarray_product(&__t[0], &__t[0] + __n); |
} |
|
// Map a gslice, described by its multidimensional LENGTHS |
// and corresponding STRIDES, to a linear array of INDEXES |
// for the purpose of indexing a flat, one-dimensional array |
// representation of a gslice_array. |
void |
__gslice_to_index(size_t __o, const valarray<size_t>& __l, |
const valarray<size_t>& __s, valarray<size_t>& __i) |
{ |
// There are as much as dimensions as there are strides. |
size_t __n = __l.size(); |
|
// Get a buffer to hold current multi-index as we go through |
// the gslice for the purpose of computing its linear-image. |
size_t* const __t = static_cast<size_t*> |
(__builtin_alloca(__n * sizeof (size_t))); |
__valarray_fill(__t, __n, size_t(0)); |
|
// Note that this should match the product of all numbers appearing |
// in __l which describes the multidimensional sizes of the |
// the generalized slice. |
const size_t __z = __i.size(); |
|
for (size_t __j = 0; __j < __z; ++__j) |
{ |
// Compute the linear-index image of (t_0, ... t_{n-1}). |
// Normaly, we should use inner_product<>(), but we do it the |
// the hard way here to avoid link-time can of worms. |
size_t __a = __o; |
for (size_t __k = 0; __k < __n; ++__k) |
__a += __s[__k] * __t[__k]; |
|
__i[__j] = __a; |
|
// Process the next multi-index. The loop ought to be |
// backward since we're making a lexicagraphical visit. |
++__t[__n - 1]; |
for (size_t __k2 = __n - 1; __k2; --__k2) |
{ |
if (__t[__k2] >= __l[__k2]) |
{ |
__t[__k2] = 0; |
++__t[__k2 - 1]; |
} |
} |
} |
} |
|
gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __l, |
const valarray<size_t>& __s) |
: _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s), |
_M_index(__l.size() == 0 ? 0 : __valarray_product(__l)) |
{ __gslice_to_index(__o, __l, __s, _M_index); } |
} // namespace std |
/libstdc++-v3/src/iostream-inst.cc
0,0 → 1,49
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <iostream> |
#include <iomanip> |
|
namespace std |
{ |
template class _Setfill<char>; |
template _Setfill<char> setfill(char); |
template class basic_iostream<char>; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template class _Setfill<wchar_t>; |
template _Setfill<wchar_t> setfill(wchar_t); |
template class basic_iostream<wchar_t>; |
#endif |
} |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
/libstdc++-v3/src/locale.cc
0,0 → 1,405
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
#include <cctype> |
#include <cwctype> // For towupper, etc. |
#include <locale> |
#include <bits/atomicity.h> |
#include <bits/concurrence.h> |
|
namespace __gnu_internal |
{ |
// Mutex object for cache access |
static __glibcxx_mutex_define_initialized(locale_cache_mutex); |
} |
|
namespace std |
{ |
// Definitions for static const data members of locale. |
const locale::category locale::none; |
const locale::category locale::ctype; |
const locale::category locale::numeric; |
const locale::category locale::collate; |
const locale::category locale::time; |
const locale::category locale::monetary; |
const locale::category locale::messages; |
const locale::category locale::all; |
|
// These are no longer exported. |
locale::_Impl* locale::_S_classic; |
locale::_Impl* locale::_S_global; |
|
#ifdef __GTHREADS |
__gthread_once_t locale::_S_once = __GTHREAD_ONCE_INIT; |
#endif |
|
locale::locale(const locale& __other) throw() |
: _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. |
// The lack of a reference increment is intentional. |
locale::locale(_Impl* __ip) throw() : _M_impl(__ip) |
{ } |
|
locale::~locale() throw() |
{ _M_impl->_M_remove_reference(); } |
|
bool |
locale::operator==(const locale& __rhs) const throw() |
{ |
// Deal first with the common cases, fast to process: refcopies, |
// unnamed (i.e., !_M_names[0]), "simple" (!_M_names[1] => all the |
// categories same name, i.e., _M_names[0]). Otherwise fall back |
// to the general locale::name(). |
bool __ret; |
if (_M_impl == __rhs._M_impl) |
__ret = true; |
else if (!_M_impl->_M_names[0] || !__rhs._M_impl->_M_names[0] |
|| std::strcmp(_M_impl->_M_names[0], |
__rhs._M_impl->_M_names[0]) != 0) |
__ret = false; |
else if (!_M_impl->_M_names[1] && !__rhs._M_impl->_M_names[1]) |
__ret = true; |
else |
__ret = this->name() == __rhs.name(); |
return __ret; |
} |
|
const locale& |
locale::operator=(const locale& __other) throw() |
{ |
__other._M_impl->_M_add_reference(); |
_M_impl->_M_remove_reference(); |
_M_impl = __other._M_impl; |
return *this; |
} |
|
string |
locale::name() const |
{ |
string __ret; |
if (!_M_impl->_M_names[0]) |
__ret = '*'; |
else if (_M_impl->_M_check_same_name()) |
__ret = _M_impl->_M_names[0]; |
else |
{ |
__ret.reserve(128); |
__ret += _S_categories[0]; |
__ret += '='; |
__ret += _M_impl->_M_names[0]; |
for (size_t __i = 1; __i < _S_categories_size; ++__i) |
{ |
__ret += ';'; |
__ret += _S_categories[__i]; |
__ret += '='; |
__ret += _M_impl->_M_names[__i]; |
} |
} |
return __ret; |
} |
|
locale::category |
locale::_S_normalize_category(category __cat) |
{ |
int __ret = 0; |
if (__cat == none || (__cat & all) && !(__cat & ~all)) |
__ret = __cat; |
else |
{ |
// NB: May be a C-style "LC_ALL" category; convert. |
switch (__cat) |
{ |
case LC_COLLATE: |
__ret = collate; |
break; |
case LC_CTYPE: |
__ret = ctype; |
break; |
case LC_MONETARY: |
__ret = monetary; |
break; |
case LC_NUMERIC: |
__ret = numeric; |
break; |
case LC_TIME: |
__ret = time; |
break; |
#ifdef _GLIBCXX_HAVE_LC_MESSAGES |
case LC_MESSAGES: |
__ret = messages; |
break; |
#endif |
case LC_ALL: |
__ret = all; |
break; |
default: |
__throw_runtime_error(__N("locale::_S_normalize_category " |
"category not found")); |
} |
} |
return __ret; |
} |
|
// locale::facet |
__c_locale locale::facet::_S_c_locale; |
|
const char locale::facet::_S_c_name[2] = "C"; |
|
#ifdef __GTHREADS |
__gthread_once_t locale::facet::_S_once = __GTHREAD_ONCE_INIT; |
#endif |
|
void |
locale::facet::_S_initialize_once() |
{ |
// Initialize the underlying locale model. |
_S_create_c_locale(_S_c_locale, _S_c_name); |
} |
|
__c_locale |
locale::facet::_S_get_c_locale() |
{ |
#ifdef __GHTREADS |
if (__gthread_active_p()) |
__gthread_once(&_S_once, _S_initialize_once); |
else |
#endif |
{ |
if (!_S_c_locale) |
_S_initialize_once(); |
} |
return _S_c_locale; |
} |
|
const char* |
locale::facet::_S_get_c_name() |
{ return _S_c_name; } |
|
locale::facet:: |
~facet() { } |
|
// 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; |
} |
|
// 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 the categories. |
for (size_t __l = 0; (__l < _S_categories_size |
&& __imp._M_names[__l]); ++__l) |
{ |
const size_t __len = std::strlen(__imp._M_names[__l]) + 1; |
_M_names[__l] = new char[__len]; |
std::memcpy(_M_names[__l], __imp._M_names[__l], __len); |
} |
} |
catch(...) |
{ |
this->~_Impl(); |
__throw_exception_again; |
} |
} |
|
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(__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; |
} |
} |
} |
} |
|
void |
locale::_Impl:: |
_M_install_cache(const facet* __cache, size_t __index) |
{ |
__gnu_cxx::lock sentry(__gnu_internal::locale_cache_mutex); |
if (_M_caches[__index] != 0) |
{ |
// Some other thread got in first. |
delete __cache; |
} |
else |
{ |
__cache->_M_add_reference(); |
_M_caches[__index] = __cache; |
} |
} |
|
// 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 |
|
|
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
/libstdc++-v3/src/stdexcept.cc
0,0 → 1,78
// Methods for Exception Support for -*- C++ -*- |
|
// 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 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// |
// ISO C++ 14882: 19.1 Exception classes |
// |
|
#include <string> |
#include <stdexcept> |
|
namespace std |
{ |
logic_error::logic_error(const string& __arg) |
: exception(), _M_msg(__arg) { } |
|
logic_error::~logic_error() throw() { } |
|
const char* |
logic_error::what() const throw() |
{ return _M_msg.c_str(); } |
|
domain_error::domain_error(const string& __arg) |
: logic_error(__arg) { } |
|
invalid_argument::invalid_argument(const string& __arg) |
: logic_error(__arg) { } |
|
length_error::length_error(const string& __arg) |
: logic_error(__arg) { } |
|
out_of_range::out_of_range(const string& __arg) |
: logic_error(__arg) { } |
|
runtime_error::runtime_error(const string& __arg) |
: exception(), _M_msg(__arg) { } |
|
runtime_error::~runtime_error() throw() { } |
|
const char* |
runtime_error::what() const throw() |
{ return _M_msg.c_str(); } |
|
range_error::range_error(const string& __arg) |
: runtime_error(__arg) { } |
|
overflow_error::overflow_error(const string& __arg) |
: runtime_error(__arg) { } |
|
underflow_error::underflow_error(const string& __arg) |
: runtime_error(__arg) { } |
} // namespace std |
|
/libstdc++-v3/src/istream.cc
0,0 → 1,646
// Input streams -*- C++ -*- |
|
// Copyright (C) 2004, 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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.6.1 Input streams |
// |
|
#include <istream> |
|
namespace std |
{ |
template<> |
basic_istream<char>& |
basic_istream<char>:: |
getline(char_type* __s, streamsize __n, char_type __delim) |
{ |
_M_gcount = 0; |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
sentry __cerb(*this, true); |
if (__cerb) |
{ |
try |
{ |
const int_type __idelim = traits_type::to_int_type(__delim); |
const int_type __eof = traits_type::eof(); |
__streambuf_type* __sb = this->rdbuf(); |
int_type __c = __sb->sgetc(); |
|
while (_M_gcount + 1 < __n |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __idelim)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - _M_gcount |
- 1)); |
if (__size > 1) |
{ |
const char_type* __p = traits_type::find(__sb->gptr(), |
__size, |
__delim); |
if (__p) |
__size = __p - __sb->gptr(); |
traits_type::copy(__s, __sb->gptr(), __size); |
__s += __size; |
__sb->gbump(__size); |
_M_gcount += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
*__s++ = traits_type::to_char_type(__c); |
++_M_gcount; |
__c = __sb->snextc(); |
} |
} |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
else if (traits_type::eq_int_type(__c, __idelim)) |
{ |
++_M_gcount; |
__sb->sbumpc(); |
} |
else |
__err |= ios_base::failbit; |
} |
catch(...) |
{ this->_M_setstate(ios_base::badbit); } |
} |
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
// 243. get and getline when sentry reports failure. |
if (__n > 0) |
*__s = char_type(); |
if (!_M_gcount) |
__err |= ios_base::failbit; |
if (__err) |
this->setstate(__err); |
return *this; |
} |
|
template<> |
basic_istream<char>& |
basic_istream<char>:: |
ignore(streamsize __n, int_type __delim) |
{ |
if (traits_type::eq_int_type(__delim, traits_type::eof())) |
return ignore(__n); |
|
_M_gcount = 0; |
sentry __cerb(*this, true); |
if (__cerb && __n > 0) |
{ |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
try |
{ |
const char_type __cdelim = traits_type::to_char_type(__delim); |
const int_type __eof = traits_type::eof(); |
__streambuf_type* __sb = this->rdbuf(); |
int_type __c = __sb->sgetc(); |
|
bool __large_ignore = false; |
while (true) |
{ |
while (_M_gcount < __n |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __delim)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - _M_gcount)); |
if (__size > 1) |
{ |
const char_type* __p = traits_type::find(__sb->gptr(), |
__size, |
__cdelim); |
if (__p) |
__size = __p - __sb->gptr(); |
__sb->gbump(__size); |
_M_gcount += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
++_M_gcount; |
__c = __sb->snextc(); |
} |
} |
if (__n == numeric_limits<streamsize>::max() |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __delim)) |
{ |
_M_gcount = numeric_limits<streamsize>::min(); |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = numeric_limits<streamsize>::max(); |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
else if (traits_type::eq_int_type(__c, __delim)) |
{ |
if (_M_gcount < numeric_limits<streamsize>::max()) |
++_M_gcount; |
__sb->sbumpc(); |
} |
} |
catch(...) |
{ this->_M_setstate(ios_base::badbit); } |
if (__err) |
this->setstate(__err); |
} |
return *this; |
} |
|
template<> |
basic_istream<char>& |
operator>>(basic_istream<char>& __in, char* __s) |
{ |
typedef basic_istream<char> __istream_type; |
typedef __istream_type::int_type __int_type; |
typedef __istream_type::char_type __char_type; |
typedef __istream_type::traits_type __traits_type; |
typedef __istream_type::__streambuf_type __streambuf_type; |
typedef __istream_type::__ctype_type __ctype_type; |
|
streamsize __extracted = 0; |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
__istream_type::sentry __cerb(__in, false); |
if (__cerb) |
{ |
try |
{ |
// Figure out how many characters to extract. |
streamsize __num = __in.width(); |
if (__num <= 0) |
__num = numeric_limits<streamsize>::max(); |
|
const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); |
|
const __int_type __eof = __traits_type::eof(); |
__streambuf_type* __sb = __in.rdbuf(); |
__int_type __c = __sb->sgetc(); |
|
while (__extracted < __num - 1 |
&& !__traits_type::eq_int_type(__c, __eof) |
&& !__ct.is(ctype_base::space, |
__traits_type::to_char_type(__c))) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__num - __extracted |
- 1)); |
if (__size > 1) |
{ |
__size = (__ct.scan_is(ctype_base::space, |
__sb->gptr() + 1, |
__sb->gptr() + __size) |
- __sb->gptr()); |
__traits_type::copy(__s, __sb->gptr(), __size); |
__s += __size; |
__sb->gbump(__size); |
__extracted += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
*__s++ = __traits_type::to_char_type(__c); |
++__extracted; |
__c = __sb->snextc(); |
} |
} |
|
if (__traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
// 68. Extractors for char* should store null at end |
*__s = __char_type(); |
__in.width(0); |
} |
catch(...) |
{ __in._M_setstate(ios_base::badbit); } |
} |
if (!__extracted) |
__err |= ios_base::failbit; |
if (__err) |
__in.setstate(__err); |
return __in; |
} |
|
template<> |
basic_istream<char>& |
operator>>(basic_istream<char>& __in, basic_string<char>& __str) |
{ |
typedef basic_istream<char> __istream_type; |
typedef __istream_type::int_type __int_type; |
typedef __istream_type::char_type __char_type; |
typedef __istream_type::traits_type __traits_type; |
typedef __istream_type::__streambuf_type __streambuf_type; |
typedef __istream_type::__ctype_type __ctype_type; |
typedef basic_string<char> __string_type; |
typedef __string_type::size_type __size_type; |
|
__size_type __extracted = 0; |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
__istream_type::sentry __cerb(__in, false); |
if (__cerb) |
{ |
try |
{ |
__str.erase(); |
const streamsize __w = __in.width(); |
const __size_type __n = __w > 0 ? static_cast<__size_type>(__w) |
: __str.max_size(); |
const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); |
const __int_type __eof = __traits_type::eof(); |
__streambuf_type* __sb = __in.rdbuf(); |
__int_type __c = __sb->sgetc(); |
|
while (__extracted < __n |
&& !__traits_type::eq_int_type(__c, __eof) |
&& !__ct.is(ctype_base::space, |
__traits_type::to_char_type(__c))) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - __extracted)); |
if (__size > 1) |
{ |
__size = (__ct.scan_is(ctype_base::space, |
__sb->gptr() + 1, |
__sb->gptr() + __size) |
- __sb->gptr()); |
__str.append(__sb->gptr(), __size); |
__sb->gbump(__size); |
__extracted += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
__str += __traits_type::to_char_type(__c); |
++__extracted; |
__c = __sb->snextc(); |
} |
} |
|
if (__traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
__in.width(0); |
} |
catch(...) |
{ |
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
// 91. Description of operator>> and getline() for string<> |
// might cause endless loop |
__in._M_setstate(ios_base::badbit); |
} |
} |
if (!__extracted) |
__err |= ios_base::failbit; |
if (__err) |
__in.setstate(__err); |
return __in; |
} |
|
template<> |
basic_istream<char>& |
getline(basic_istream<char>& __in, basic_string<char>& __str, |
char __delim) |
{ |
typedef basic_istream<char> __istream_type; |
typedef __istream_type::int_type __int_type; |
typedef __istream_type::char_type __char_type; |
typedef __istream_type::traits_type __traits_type; |
typedef __istream_type::__streambuf_type __streambuf_type; |
typedef __istream_type::__ctype_type __ctype_type; |
typedef basic_string<char> __string_type; |
typedef __string_type::size_type __size_type; |
|
__size_type __extracted = 0; |
const __size_type __n = __str.max_size(); |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
__istream_type::sentry __cerb(__in, true); |
if (__cerb) |
{ |
try |
{ |
__str.erase(); |
const __int_type __idelim = __traits_type::to_int_type(__delim); |
const __int_type __eof = __traits_type::eof(); |
__streambuf_type* __sb = __in.rdbuf(); |
__int_type __c = __sb->sgetc(); |
|
while (__extracted < __n |
&& !__traits_type::eq_int_type(__c, __eof) |
&& !__traits_type::eq_int_type(__c, __idelim)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - __extracted)); |
if (__size > 1) |
{ |
const __char_type* __p = __traits_type::find(__sb->gptr(), |
__size, |
__delim); |
if (__p) |
__size = __p - __sb->gptr(); |
__str.append(__sb->gptr(), __size); |
__sb->gbump(__size); |
__extracted += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
__str += __traits_type::to_char_type(__c); |
++__extracted; |
__c = __sb->snextc(); |
} |
} |
|
if (__traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
else if (__traits_type::eq_int_type(__c, __idelim)) |
{ |
++__extracted; |
__sb->sbumpc(); |
} |
else |
__err |= ios_base::failbit; |
} |
catch(...) |
{ |
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
// 91. Description of operator>> and getline() for string<> |
// might cause endless loop |
__in._M_setstate(ios_base::badbit); |
} |
} |
if (!__extracted) |
__err |= ios_base::failbit; |
if (__err) |
__in.setstate(__err); |
return __in; |
} |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template<> |
basic_istream<wchar_t>& |
basic_istream<wchar_t>:: |
getline(char_type* __s, streamsize __n, char_type __delim) |
{ |
_M_gcount = 0; |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
sentry __cerb(*this, true); |
if (__cerb) |
{ |
try |
{ |
const int_type __idelim = traits_type::to_int_type(__delim); |
const int_type __eof = traits_type::eof(); |
__streambuf_type* __sb = this->rdbuf(); |
int_type __c = __sb->sgetc(); |
|
while (_M_gcount + 1 < __n |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __idelim)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - _M_gcount |
- 1)); |
if (__size > 1) |
{ |
const char_type* __p = traits_type::find(__sb->gptr(), |
__size, |
__delim); |
if (__p) |
__size = __p - __sb->gptr(); |
traits_type::copy(__s, __sb->gptr(), __size); |
__s += __size; |
__sb->gbump(__size); |
_M_gcount += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
*__s++ = traits_type::to_char_type(__c); |
++_M_gcount; |
__c = __sb->snextc(); |
} |
} |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
else if (traits_type::eq_int_type(__c, __idelim)) |
{ |
++_M_gcount; |
__sb->sbumpc(); |
} |
else |
__err |= ios_base::failbit; |
} |
catch(...) |
{ this->_M_setstate(ios_base::badbit); } |
} |
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
// 243. get and getline when sentry reports failure. |
if (__n > 0) |
*__s = char_type(); |
if (!_M_gcount) |
__err |= ios_base::failbit; |
if (__err) |
this->setstate(__err); |
return *this; |
} |
|
template<> |
basic_istream<wchar_t>& |
basic_istream<wchar_t>:: |
ignore(streamsize __n, int_type __delim) |
{ |
if (traits_type::eq_int_type(__delim, traits_type::eof())) |
return ignore(__n); |
|
_M_gcount = 0; |
sentry __cerb(*this, true); |
if (__cerb && __n > 0) |
{ |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
try |
{ |
const char_type __cdelim = traits_type::to_char_type(__delim); |
const int_type __eof = traits_type::eof(); |
__streambuf_type* __sb = this->rdbuf(); |
int_type __c = __sb->sgetc(); |
|
bool __large_ignore = false; |
while (true) |
{ |
while (_M_gcount < __n |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __delim)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - _M_gcount)); |
if (__size > 1) |
{ |
const char_type* __p = traits_type::find(__sb->gptr(), |
__size, |
__cdelim); |
if (__p) |
__size = __p - __sb->gptr(); |
__sb->gbump(__size); |
_M_gcount += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
++_M_gcount; |
__c = __sb->snextc(); |
} |
} |
if (__n == numeric_limits<streamsize>::max() |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __delim)) |
{ |
_M_gcount = numeric_limits<streamsize>::min(); |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = numeric_limits<streamsize>::max(); |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
else if (traits_type::eq_int_type(__c, __delim)) |
{ |
if (_M_gcount < numeric_limits<streamsize>::max()) |
++_M_gcount; |
__sb->sbumpc(); |
} |
} |
catch(...) |
{ this->_M_setstate(ios_base::badbit); } |
if (__err) |
this->setstate(__err); |
} |
return *this; |
} |
|
template<> |
basic_istream<wchar_t>& |
getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str, |
wchar_t __delim) |
{ |
typedef basic_istream<wchar_t> __istream_type; |
typedef __istream_type::int_type __int_type; |
typedef __istream_type::char_type __char_type; |
typedef __istream_type::traits_type __traits_type; |
typedef __istream_type::__streambuf_type __streambuf_type; |
typedef __istream_type::__ctype_type __ctype_type; |
typedef basic_string<wchar_t> __string_type; |
typedef __string_type::size_type __size_type; |
|
__size_type __extracted = 0; |
const __size_type __n = __str.max_size(); |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
__istream_type::sentry __cerb(__in, true); |
if (__cerb) |
{ |
try |
{ |
__str.erase(); |
const __int_type __idelim = __traits_type::to_int_type(__delim); |
const __int_type __eof = __traits_type::eof(); |
__streambuf_type* __sb = __in.rdbuf(); |
__int_type __c = __sb->sgetc(); |
|
while (__extracted < __n |
&& !__traits_type::eq_int_type(__c, __eof) |
&& !__traits_type::eq_int_type(__c, __idelim)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - __extracted)); |
if (__size > 1) |
{ |
const __char_type* __p = __traits_type::find(__sb->gptr(), |
__size, |
__delim); |
if (__p) |
__size = __p - __sb->gptr(); |
__str.append(__sb->gptr(), __size); |
__sb->gbump(__size); |
__extracted += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
__str += __traits_type::to_char_type(__c); |
++__extracted; |
__c = __sb->snextc(); |
} |
} |
|
if (__traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
else if (__traits_type::eq_int_type(__c, __idelim)) |
{ |
++__extracted; |
__sb->sbumpc(); |
} |
else |
__err |= ios_base::failbit; |
} |
catch(...) |
{ |
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
// 91. Description of operator>> and getline() for string<> |
// might cause endless loop |
__in._M_setstate(ios_base::badbit); |
} |
} |
if (!__extracted) |
__err |= ios_base::failbit; |
if (__err) |
__in.setstate(__err); |
return __in; |
} |
#endif |
} // namespace std |
/libstdc++-v3/src/compatibility.cc
0,0 → 1,388
// Compatibility symbols for previous versions -*- C++ -*- |
|
// Copyright (C) 2005 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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> |
|
#if defined(_GLIBCXX_SYMVER) && defined(PIC) |
#define istreambuf_iterator istreambuf_iteratorXX |
#define basic_fstream basic_fstreamXX |
#define basic_ifstream basic_ifstreamXX |
#define basic_ofstream basic_ofstreamXX |
#define _M_copy(a, b, c) _M_copyXX(a, b, c) |
#define _M_move(a, b, c) _M_moveXX(a, b, c) |
#define _M_assign(a, b, c) _M_assignXX(a, b, c) |
#define _M_disjunct(a) _M_disjunctXX(a) |
#define _M_check_length(a, b, c) _M_check_lengthXX(a, b, c) |
#define _M_set_length_and_sharable(a) _M_set_length_and_sharableXX(a) |
#define ignore ignoreXX |
#define eq eqXX |
#endif |
|
#include <string> |
#include <istream> |
#include <fstream> |
#include <sstream> |
|
namespace std |
{ |
// std::istream ignore explicit specializations. |
|
template<> |
basic_istream<char>& |
basic_istream<char>:: |
ignore(streamsize __n) |
{ |
if (__n == 1) |
return ignore(); |
|
_M_gcount = 0; |
sentry __cerb(*this, true); |
if (__cerb && __n > 0) |
{ |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
try |
{ |
const int_type __eof = traits_type::eof(); |
__streambuf_type* __sb = this->rdbuf(); |
int_type __c = __sb->sgetc(); |
|
// See comment in istream.tcc. |
bool __large_ignore = false; |
while (true) |
{ |
while (_M_gcount < __n |
&& !traits_type::eq_int_type(__c, __eof)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - _M_gcount)); |
if (__size > 1) |
{ |
__sb->gbump(__size); |
_M_gcount += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
++_M_gcount; |
__c = __sb->snextc(); |
} |
} |
if (__n == numeric_limits<streamsize>::max() |
&& !traits_type::eq_int_type(__c, __eof)) |
{ |
_M_gcount = numeric_limits<streamsize>::min(); |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = numeric_limits<streamsize>::max(); |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
} |
catch(...) |
{ this->_M_setstate(ios_base::badbit); } |
if (__err) |
this->setstate(__err); |
} |
return *this; |
} |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template<> |
basic_istream<wchar_t>& |
basic_istream<wchar_t>:: |
ignore(streamsize __n) |
{ |
if (__n == 1) |
return ignore(); |
|
_M_gcount = 0; |
sentry __cerb(*this, true); |
if (__cerb && __n > 0) |
{ |
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); |
try |
{ |
const int_type __eof = traits_type::eof(); |
__streambuf_type* __sb = this->rdbuf(); |
int_type __c = __sb->sgetc(); |
|
bool __large_ignore = false; |
while (true) |
{ |
while (_M_gcount < __n |
&& !traits_type::eq_int_type(__c, __eof)) |
{ |
streamsize __size = std::min(streamsize(__sb->egptr() |
- __sb->gptr()), |
streamsize(__n - _M_gcount)); |
if (__size > 1) |
{ |
__sb->gbump(__size); |
_M_gcount += __size; |
__c = __sb->sgetc(); |
} |
else |
{ |
++_M_gcount; |
__c = __sb->snextc(); |
} |
} |
if (__n == numeric_limits<streamsize>::max() |
&& !traits_type::eq_int_type(__c, __eof)) |
{ |
_M_gcount = numeric_limits<streamsize>::min(); |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = numeric_limits<streamsize>::max(); |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
} |
catch(...) |
{ this->_M_setstate(ios_base::badbit); } |
if (__err) |
this->setstate(__err); |
} |
return *this; |
} |
#endif |
} |
|
// NB: These symbols renames should go into the shared library only, |
// and only those shared libraries that support versioning. |
#if defined(_GLIBCXX_SYMVER) && defined(PIC) |
|
/* gcc-3.4.4 |
_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv |
_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv |
*/ |
namespace std |
{ |
template |
istreambuf_iterator<char>& |
istreambuf_iterator<char>::operator++(); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template |
istreambuf_iterator<wchar_t>& |
istreambuf_iterator<wchar_t>::operator++(); |
#endif |
} // namespace std |
|
/* gcc-4.0.0 |
_ZNSs4_Rep26_M_set_length_and_sharableEj |
_ZNSs7_M_copyEPcPKcj |
_ZNSs7_M_moveEPcPKcj |
_ZNSs9_M_assignEPcjc |
_ZNKSs11_M_disjunctEPKc |
_ZNKSs15_M_check_lengthEjjPKc |
_ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEj |
_ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwj |
_ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwj |
_ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwjw |
_ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw |
_ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEjjPKc |
|
_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv |
_ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv |
_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv |
_ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv |
_ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv |
_ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv |
|
_ZNSi6ignoreEi |
_ZNSi6ignoreEv |
_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi |
_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv |
|
_ZNSt11char_traitsIcE2eqERKcS2_ |
_ZNSt11char_traitsIwE2eqERKwS2_ |
*/ |
namespace std |
{ |
// std::char_traits is explicitly specialized |
bool (* __p1)(const char&, const char&) = &char_traits<char>::eq; |
|
// std::string |
template |
void |
basic_string<char>::_M_copy(char*, const char*, size_t); |
|
template |
void |
basic_string<char>::_M_move(char*, const char*, size_t); |
|
template |
void |
basic_string<char>::_M_assign(char*, size_t, char); |
|
template |
bool |
basic_string<char>::_M_disjunct(const char*) const; |
|
template |
void |
basic_string<char>::_M_check_length(size_t, size_t, const char*) const; |
|
template |
void |
basic_string<char>::_Rep::_M_set_length_and_sharable(size_t); |
|
|
// std::istream |
template |
basic_istream<char>& |
basic_istream<char>::ignore(); |
|
template |
bool |
basic_fstream<char>::is_open() const; |
|
template |
bool |
basic_ifstream<char>::is_open() const; |
|
template |
bool |
basic_ofstream<char>::is_open() const; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
bool (* __p2)(const wchar_t&, const wchar_t&) = &char_traits<wchar_t>::eq; |
|
// std::wstring |
template |
void |
basic_string<wchar_t>::_M_copy(wchar_t*, const wchar_t*, size_t); |
|
template |
void |
basic_string<wchar_t>::_M_move(wchar_t*, const wchar_t*, size_t); |
|
template |
void |
basic_string<wchar_t>::_M_assign(wchar_t*, size_t, wchar_t); |
|
template |
bool |
basic_string<wchar_t>::_M_disjunct(const wchar_t*) const; |
|
template |
void |
basic_string<wchar_t>::_M_check_length(size_t, size_t, |
const char*) const; |
|
template |
void |
basic_string<wchar_t>::_Rep::_M_set_length_and_sharable(size_t); |
|
template |
basic_istream<wchar_t>& |
basic_istream<wchar_t>::ignore(); |
|
template |
bool |
basic_fstream<wchar_t>::is_open() const; |
|
template |
bool |
basic_ifstream<wchar_t>::is_open() const; |
|
template |
bool |
basic_ofstream<wchar_t>::is_open() const; |
#endif |
} |
|
// The rename syntax for default exported names is |
// asm (".symver name1,exportedname@GLIBCXX_3.4") |
// asm (".symver name2,exportedname@@GLIBCXX_3.4.5") |
// In the future, GLIBCXX_ABI > 6 should remove all uses of |
// _GLIBCXX_*_SYMVER macros in this file. |
|
#define _GLIBCXX_3_4_SYMVER(XXname, name) \ |
extern "C" void \ |
_X##name() \ |
__attribute__ ((alias(#XXname))); \ |
asm (".symver " "_X" #name "," #name "@GLIBCXX_3.4"); |
|
#define _GLIBCXX_3_4_5_SYMVER(XXname, name) \ |
extern "C" void \ |
_Y##name() \ |
__attribute__ ((alias(#XXname))); \ |
asm (".symver " "_Y" #name "," #name "@@GLIBCXX_3.4.5"); |
|
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \ |
asm (".symver " #cur "," #old "@@" #version); |
|
#define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_SYMVER |
#include <bits/compatibility.h> |
#undef _GLIBCXX_APPLY_SYMVER |
|
#define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER |
#include <bits/compatibility.h> |
#undef _GLIBCXX_APPLY_SYMVER |
|
#endif |
|
#ifdef __APPLE__ |
#if (defined(__ppc__) || defined (__ppc64__)) && defined (PIC) |
/* __eprintf shouldn't have been made visible from libstdc++, or |
anywhere, but on Mac OS X 10.4 it was defined in |
libstdc++.6.0.3.dylib; so on that platform we have to keep defining |
it to keep binary compatibility. We can't just put the libgcc |
version in the export list, because that doesn't work; once a |
symbol is marked as hidden, it stays that way. */ |
|
#include <cstdio> |
#include <cstdlib> |
|
using namespace std; |
|
extern "C" void |
__eprintf (const char *string, const char *expression, |
unsigned int line, const char *filename) |
{ |
fprintf (stderr, string, expression, line, filename); |
fflush (stderr); |
abort (); |
} |
#endif |
#endif /* __APPLE__ */ |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
/libstdc++-v3/src/locale-inst.cc
0,0 → 1,316
// Locale support -*- C++ -*- |
|
// 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 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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> |
|
// Instantiation configuration. |
#ifndef C |
# define C char |
#endif |
|
namespace std |
{ |
// moneypunct, money_get, and money_put |
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 |
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 |
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; |
|
template |
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<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 |
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 |
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; |
|
template |
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 |
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 |
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 |
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 |
|
template |
ostreambuf_iterator<C> |
num_put<C, ostreambuf_iterator<C> >:: |
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C, |
long) const; |
|
template |
ostreambuf_iterator<C> |
num_put<C, ostreambuf_iterator<C> >:: |
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C, |
unsigned long) const; |
|
#ifdef _GLIBCXX_USE_LONG_LONG |
template |
ostreambuf_iterator<C> |
num_put<C, ostreambuf_iterator<C> >:: |
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C, |
long long) const; |
|
template |
ostreambuf_iterator<C> |
num_put<C, ostreambuf_iterator<C> >:: |
_M_insert_int(ostreambuf_iterator<C>, ios_base&, C, |
unsigned long long) const; |
#endif |
|
template |
ostreambuf_iterator<C> |
num_put<C, ostreambuf_iterator<C> >:: |
_M_insert_float(ostreambuf_iterator<C>, ios_base&, C, char, |
double) const; |
|
template |
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<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<C>; |
template class messages_byname<C>; |
|
// ctype |
inline template class __ctype_abstract_base<C>; |
template class ctype_byname<C>; |
|
// codecvt |
inline template class __codecvt_abstract_base<C, char, mbstate_t>; |
template class codecvt_byname<C, char, mbstate_t>; |
|
// collate |
template class collate<C>; |
template class collate_byname<C>; |
|
// use_facet |
// NB: use_facet<ctype> is specialized |
template |
const codecvt<C, char, mbstate_t>& |
use_facet<codecvt<C, char, mbstate_t> >(const locale&); |
|
template |
const collate<C>& |
use_facet<collate<C> >(const locale&); |
|
template |
const numpunct<C>& |
use_facet<numpunct<C> >(const locale&); |
|
template |
const num_put<C>& |
use_facet<num_put<C> >(const locale&); |
|
template |
const num_get<C>& |
use_facet<num_get<C> >(const locale&); |
|
template |
const moneypunct<C, true>& |
use_facet<moneypunct<C, true> >(const locale&); |
|
template |
const moneypunct<C, false>& |
use_facet<moneypunct<C, false> >(const locale&); |
|
template |
const money_put<C>& |
use_facet<money_put<C> >(const locale&); |
|
template |
const money_get<C>& |
use_facet<money_get<C> >(const locale&); |
|
template |
const __timepunct<C>& |
use_facet<__timepunct<C> >(const locale&); |
|
template |
const time_put<C>& |
use_facet<time_put<C> >(const locale&); |
|
template |
const time_get<C>& |
use_facet<time_get<C> >(const locale&); |
|
template |
const messages<C>& |
use_facet<messages<C> >(const locale&); |
|
// has_facet |
template |
bool |
has_facet<ctype<C> >(const locale&); |
|
template |
bool |
has_facet<codecvt<C, char, mbstate_t> >(const locale&); |
|
template |
bool |
has_facet<collate<C> >(const locale&); |
|
template |
bool |
has_facet<numpunct<C> >(const locale&); |
|
template |
bool |
has_facet<num_put<C> >(const locale&); |
|
template |
bool |
has_facet<num_get<C> >(const locale&); |
|
template |
bool |
has_facet<moneypunct<C> >(const locale&); |
|
template |
bool |
has_facet<money_put<C> >(const locale&); |
|
template |
bool |
has_facet<money_get<C> >(const locale&); |
|
template |
bool |
has_facet<__timepunct<C> >(const locale&); |
|
template |
bool |
has_facet<time_put<C> >(const locale&); |
|
template |
bool |
has_facet<time_get<C> >(const locale&); |
|
template |
bool |
has_facet<messages<C> >(const locale&); |
|
|
// locale functions. |
template |
C* |
__add_grouping<C>(C*, C, char const*, size_t, |
C const*, C const*); |
|
template class __pad<C, char_traits<C> >; |
|
template |
int |
__int_to_char(C*, unsigned long, const C*, |
ios_base::fmtflags, bool); |
|
#ifdef _GLIBCXX_USE_LONG_LONG |
template |
int |
__int_to_char(C*, unsigned long long, const C*, |
ios_base::fmtflags, bool); |
#endif |
} // namespace std |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
|
/libstdc++-v3/src/ext-inst.cc
0,0 → 1,69
// Explicit instantiation file. |
|
// 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 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// |
// ISO C++ 14882: |
// |
|
#include <ext/rope> |
#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[min_len]; |
|
template |
char |
rope<char, std::allocator<char> >:: |
_S_fetch(_Rope_RopeRep<char, std::allocator<char> >*, size_type); |
|
template class stdio_filebuf<char>; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template |
const unsigned long |
rope<wchar_t, std::allocator<wchar_t> >::_S_min_len[min_len]; |
|
template |
wchar_t |
rope<wchar_t, std::allocator<wchar_t> >:: |
_S_fetch(_Rope_RopeRep<wchar_t, std::allocator<wchar_t> >*, size_type); |
|
template class stdio_filebuf<wchar_t>; |
#endif |
} // namespace __gnu_cxx |
/libstdc++-v3/src/bitmap_allocator.cc
0,0 → 1,127
// Bitmap Allocator. Out of line function definitions. -*- C++ -*- |
|
// Copyright (C) 2004, 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <ext/bitmap_allocator.h> |
|
namespace __gnu_cxx |
{ |
namespace balloc |
{ |
template class __mini_vector<std::pair |
<bitmap_allocator<char>::_Alloc_block*, |
bitmap_allocator<char>::_Alloc_block*> >; |
|
template class __mini_vector<std::pair |
<bitmap_allocator<wchar_t>::_Alloc_block*, |
bitmap_allocator<wchar_t>::_Alloc_block*> >; |
|
template class __mini_vector<size_t*>; |
|
template size_t** __lower_bound |
(size_t**, size_t**, |
size_t const&, free_list::_LT_pointer_compare); |
} |
|
size_t* |
free_list:: |
_M_get(size_t __sz) throw(std::bad_alloc) |
{ |
#if defined __GTHREADS |
_Lock __bfl_lock(_M_get_mutex()); |
__bfl_lock._M_lock(); |
#endif |
iterator __temp = |
__gnu_cxx::balloc::__lower_bound |
(_M_get_free_list().begin(), _M_get_free_list().end(), |
__sz, _LT_pointer_compare()); |
|
if (__temp == _M_get_free_list().end() || !_M_should_i_give(**__temp, __sz)) |
{ |
// We release the lock here, because operator new is |
// guaranteed to be thread-safe by the underlying |
// implementation. |
#if defined __GTHREADS |
__bfl_lock._M_unlock(); |
#endif |
// Try twice to get the memory: once directly, and the 2nd |
// time after clearing the free list. If both fail, then |
// throw std::bad_alloc(). |
int __ctr = 2; |
while (__ctr) |
{ |
size_t* __ret = 0; |
--__ctr; |
try |
{ |
__ret = reinterpret_cast<size_t*> |
(::operator new(__sz + sizeof(size_t))); |
} |
catch(...) |
{ |
this->_M_clear(); |
} |
if (!__ret) |
continue; |
*__ret = __sz; |
return __ret + 1; |
} |
std::__throw_bad_alloc(); |
} |
else |
{ |
size_t* __ret = *__temp; |
_M_get_free_list().erase(__temp); |
#if defined __GTHREADS |
__bfl_lock._M_unlock(); |
#endif |
return __ret + 1; |
} |
} |
|
void |
free_list:: |
_M_clear() |
{ |
#if defined __GTHREADS |
_Auto_Lock __bfl_lock(_M_get_mutex()); |
#endif |
vector_type& __free_list = _M_get_free_list(); |
iterator __iter = __free_list.begin(); |
while (__iter != __free_list.end()) |
{ |
::operator delete((void*)*__iter); |
++__iter; |
} |
__free_list.clear(); |
} |
|
// Instantiations. |
template class bitmap_allocator<char>; |
template class bitmap_allocator<wchar_t>; |
} // namespace __gnu_cxx |
/libstdc++-v3/src/ios_init.cc
0,0 → 1,199
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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) |
{ |
// Make sure the standard streams are constructed. |
ios_base::Init __init; |
|
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 |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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" |
/libstdc++-v3/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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 |
|
/libstdc++-v3/src/Makefile.am
0,0 → 1,268
## Makefile for the src subdirectory of the GNU C++ Standard library. |
## |
## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 |
## Free Software Foundation, Inc. |
## |
## This file is part of the libstdc++ version 3 distribution. |
## Process this file with automake to produce Makefile.in. |
|
## This file is part of the GNU ISO C++ Library. This library is free |
## software; you can redistribute it and/or modify it under the |
## terms of the GNU General Public License as published by the |
## Free Software Foundation; either version 2, or (at your option) |
## any later version. |
|
## This library is distributed in the hope that it will be useful, |
## but WITHOUT ANY WARRANTY; without even the implied warranty of |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
## GNU General Public License for more details. |
|
## You should have received a copy of the GNU General Public License along |
## with this library; see the file COPYING. If not, write to the Free |
## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
## USA. |
|
include $(top_srcdir)/fragment.am |
|
# Cross compiler support. |
toolexeclib_LTLIBRARIES = libstdc++.la |
|
# Symbol versioning for shared libraries. |
# This could be conditional on |
# ENABLE_SYMVERS_GNU || ENABLE_SYMVERS_DARWIN_EXPORT |
# but automake doesn't support OR operations in conditionals. |
libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) \ |
$(port_specific_symbol_files) |
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 |
|
if ENABLE_SYMVERS_GNU |
version_arg = -Wl,--version-script=libstdc++-symbol.ver |
version_dep = libstdc++-symbol.ver |
else |
if ENABLE_SYMVERS_DARWIN_EXPORT |
version_arg = -Wl,-exported_symbols_list,libstdc++-symbol.explist |
version_dep = libstdc++-symbol.explist |
libstdc++-symbol.explist : libstdc++-symbol.ver \ |
${glibcxx_srcdir}/scripts/make_exports.pl \ |
$(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) |
perl ${glibcxx_srcdir}/scripts/make_exports.pl \ |
libstdc++-symbol.ver \ |
$(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ |
`echo $(libstdc___la_LIBADD) | \ |
sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ |
> $@ || (rm -f $@ ; exit 1) |
else |
version_arg = |
version_dep = |
endif |
endif |
|
|
# Source files linked in via configuration/make substitution for a |
# 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 |
|
codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true |
|
collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true |
|
ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true |
|
messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC) |
$(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_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_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 host, but with ad hoc naming rules. |
host_sources_extra = \ |
basic_file.cc \ |
c++locale.cc |
|
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 |
|
# Sources present in the src directory. |
sources = \ |
bitmap_allocator.cc \ |
pool_allocator.cc \ |
mt_allocator.cc \ |
codecvt.cc \ |
compatibility.cc \ |
complex_io.cc \ |
ctype.cc \ |
debug.cc \ |
debug_list.cc \ |
functexcept.cc \ |
globals_locale.cc \ |
globals_io.cc \ |
ios.cc \ |
ios_failure.cc \ |
ios_init.cc \ |
ios_locale.cc \ |
limits.cc \ |
list.cc \ |
locale.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 \ |
ios-inst.cc \ |
iostream-inst.cc \ |
istream-inst.cc \ |
istream.cc \ |
locale-inst.cc \ |
locale-misc-inst.cc \ |
misc-inst.cc \ |
ostream-inst.cc \ |
sstream-inst.cc \ |
streambuf-inst.cc \ |
streambuf.cc \ |
string-inst.cc \ |
valarray-inst.cc \ |
wlocale-inst.cc \ |
wstring-inst.cc \ |
${host_sources} \ |
${host_sources_extra} |
|
VPATH = $(top_srcdir)/src:$(top_srcdir) |
|
libstdc___la_SOURCES = $(sources) |
|
libstdc___la_LIBADD = \ |
$(top_builddir)/libmath/libmath.la \ |
$(top_builddir)/libsupc++/libsupc++convenience.la |
|
libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD) |
|
libstdc___la_LDFLAGS = \ |
-version-info $(libtool_VERSION) ${version_arg} -lm |
|
# Use special rules for the deprecated source files so that they find |
# deprecated include files. |
GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include |
strstream.lo: strstream.cc |
$(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $< |
strstream.o: strstream.cc |
$(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_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $< |
concept-inst.o: concept-inst.cc |
$(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 calls for it. |
AM_CXXFLAGS = \ |
-fno-implicit-templates \ |
$(WARN_CXXFLAGS) \ |
$(OPTIMIZE_CXXFLAGS) \ |
$(CONFIG_CXXFLAGS) |
|
|
# libstdc++ libtool notes |
|
# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is |
# last. (That way, things like -O2 passed down from the toplevel can |
# be overridden by --enable-debug.) |
|
# 2) In general, libtool expects an argument such as `--tag=CXX' when |
# using the C++ compiler, because that will enable the settings |
# detected when C++ support was being configured. However, when no |
# such flag is given in the command line, libtool attempts to figure |
# it out by matching the compiler name in each configuration section |
# against a prefix of the command line. The problem is that, if the |
# compiler name and its initial flags stored in the libtool |
# configuration file don't match those in the command line, libtool |
# can't decide which configuration to use, and it gives up. The |
# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe |
# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to |
# attempt to infer which configuration to use |
LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \ |
$(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) |
|
# 3) We'd have a problem when building the shared libstdc++ object if |
# the rules automake generates would be used. We cannot allow g++ to |
# be used since this would add -lstdc++ to the link line which of |
# course is problematic at this point. So, we get the top-level |
# directory to configure libstdc++-v3 to use gcc as the C++ |
# compilation driver. |
CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \ |
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@ |
|
|
# Added bits to build debug library. |
if GLIBCXX_BUILD_DEBUG |
all-local: build_debug |
install-data-local: install_debug |
else |
all-local: |
install-data-local: |
endif |
|
debugdir = debug |
|
# Build parallel set of debug objects here. |
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/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; |
|
build_debug: stamp-debug |
(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all) |
|
# Install debug library here. |
install_debug: |
(cd ${debugdir} && $(MAKE) \ |
toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) |
/libstdc++-v3/src/debug.cc
0,0 → 1,670
// Debugging mode support code -*- C++ -*- |
|
// Copyright (C) 2003, 2004, 2005 |
// 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// 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 <cassert> |
#include <cstring> |
#include <cctype> |
#include <bits/concurrence.h> |
|
using namespace std; |
|
namespace __gnu_internal |
{ |
static __glibcxx_mutex_define_initialized(iterator_base_mutex); |
} // namespace __gnu_internal |
|
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) |
{ |
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex); |
_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() |
{ |
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex); |
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; |
|
const ptrdiff_t __len = __end - __start; |
assert(__len < __bufsize); |
memcpy(__buf, __start, __len); |
__buf[__len] = '\0'; |
_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*, int, const char*, |
const void*) const; |
|
template |
void |
_Error_formatter::_M_format_word(char*, int, const char*, long) const; |
|
template |
void |
_Error_formatter::_M_format_word(char*, int, const char*, |
std::size_t) const; |
|
template |
void |
_Error_formatter::_M_format_word(char*, int, const char*, |
const char*) const; |
} // namespace __gnu_debug |
/libstdc++-v3/src/codecvt.cc
0,0 → 1,152
// Copyright (C) 2000, 2002, 2004, 2005 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
// USA. |
|
// As a special exception, you may use this file as part of a free software |
// library without restriction. Specifically, if other files instantiate |
// templates or use macros or inline functions from this file, or you compile |
// this file and link it with other files to produce an executable, this |
// file does not by itself cause the resulting executable to be covered by |
// the GNU General Public License. This exception does not however |
// invalidate any other reasons why the executable file might be covered by |
// the GNU General Public License. |
|
// Written by Benjamin Kosnik <bkoz@redhat.com> |
|
#include <locale> |
|
namespace std |
{ |
// Definitions for locale::id of standard facets that are specialized. |
locale::id codecvt<char, char, mbstate_t>::id; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
locale::id codecvt<wchar_t, char, mbstate_t>::id; |
#endif |
|
codecvt<char, char, mbstate_t>:: |
codecvt(size_t __refs) |
: __codecvt_abstract_base<char, char, mbstate_t>(__refs), |
_M_c_locale_codecvt(_S_get_c_locale()) |
{ } |
|
codecvt<char, char, mbstate_t>:: |
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>:: |
do_out(state_type&, const intern_type* __from, |
const intern_type*, const intern_type*& __from_next, |
extern_type* __to, extern_type*, |
extern_type*& __to_next) const |
{ |
// _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; |
__to_next = __to; |
return noconv; |
} |
|
codecvt_base::result |
codecvt<char, char, mbstate_t>:: |
do_unshift(state_type&, extern_type* __to, |
extern_type*, extern_type*& __to_next) const |
{ |
__to_next = __to; |
return noconv; |
} |
|
codecvt_base::result |
codecvt<char, char, mbstate_t>:: |
do_in(state_type&, const extern_type* __from, |
const extern_type*, const extern_type*& __from_next, |
intern_type* __to, intern_type*, intern_type*& __to_next) const |
{ |
// _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; |
__to_next = __to; |
return noconv; |
} |
|
int |
codecvt<char, char, mbstate_t>:: |
do_encoding() const throw() |
{ return 1; } |
|
bool |
codecvt<char, char, mbstate_t>:: |
do_always_noconv() const throw() |
{ return true; } |
|
int |
codecvt<char, char, mbstate_t>:: |
do_length (state_type&, const extern_type* __from, |
const extern_type* __end, size_t __max) const |
{ |
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 _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), |
_M_c_locale_codecvt(_S_get_c_locale()) |
{ } |
|
codecvt<wchar_t, char, mbstate_t>:: |
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; |
} |
|
bool |
codecvt<wchar_t, char, mbstate_t>:: |
do_always_noconv() const throw() |
{ return false; } |
#endif // _GLIBCXX_USE_WCHAR_T |
} // namespace std |