URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-stable/gcc-4.5.1/libstdc++-v3/src
- from Rev 816 to Rev 826
- ↔ Reverse comparison
Rev 816 → Rev 826
/hashtable_c++0x.cc
0,0 → 1,32
// std::__detail definitions -*- C++ -*- |
|
// Copyright (C) 2007, 2008, 2009, 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#ifndef __GXX_EXPERIMENTAL_CXX0X__ |
# error "hashtable_c++0x.cc must be compiled with -std=gnu++0x" |
#endif |
|
namespace std |
{ |
#include "hashtable-aux.cc" |
} |
/allocator-inst.cc
0,0 → 1,37
// Explicit instantiation file. |
|
// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <memory> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
template class allocator<char>; |
template class allocator<wchar_t>; |
|
_GLIBCXX_END_NAMESPACE |
/condition_variable.cc
0,0 → 1,89
// condition_variable -*- C++ -*- |
|
// Copyright (C) 2008, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <condition_variable> |
|
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) |
|
namespace std |
{ |
condition_variable::condition_variable() throw () |
{ |
#ifdef __GTHREAD_COND_INIT |
__native_type __tmp = __GTHREAD_COND_INIT; |
_M_cond = __tmp; |
#else |
int __e = __gthread_cond_init(&_M_cond, NULL); |
|
if (__e) |
__throw_system_error(__e); |
#endif |
} |
|
condition_variable::~condition_variable() throw () |
{ |
// XXX no thread blocked |
/* int __e = */ __gthread_cond_destroy(&_M_cond); |
// if __e == EBUSY then blocked |
} |
|
void |
condition_variable::wait(unique_lock<mutex>& __lock) |
{ |
int __e = __gthread_cond_wait(&_M_cond, __lock.mutex()->native_handle()); |
|
if (__e) |
__throw_system_error(__e); |
} |
|
void |
condition_variable::notify_one() |
{ |
int __e = __gthread_cond_signal(&_M_cond); |
|
// XXX not in spec |
// EINVAL |
if (__e) |
__throw_system_error(__e); |
} |
|
void |
condition_variable::notify_all() |
{ |
int __e = __gthread_cond_broadcast(&_M_cond); |
|
// XXX not in spec |
// EINVAL |
if (__e) |
__throw_system_error(__e); |
} |
|
condition_variable_any::condition_variable_any() throw () |
{ } |
|
condition_variable_any::~condition_variable_any() throw () |
{ } |
} |
|
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 |
/Makefile.in
0,0 → 1,998
# Makefile.in generated by automake 1.11.1 from Makefile.am. |
# @configure_input@ |
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ |
|
VPATH = @srcdir@ |
pkgdatadir = $(datadir)/@PACKAGE@ |
pkgincludedir = $(includedir)/@PACKAGE@ |
pkglibdir = $(libdir)/@PACKAGE@ |
pkglibexecdir = $(libexecdir)/@PACKAGE@ |
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd |
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/futex.m4 \ |
$(top_srcdir)/../config/iconv.m4 \ |
$(top_srcdir)/../config/lead-dot.m4 \ |
$(top_srcdir)/../config/lib-ld.m4 \ |
$(top_srcdir)/../config/lib-link.m4 \ |
$(top_srcdir)/../config/lib-prefix.m4 \ |
$(top_srcdir)/../config/multi.m4 \ |
$(top_srcdir)/../config/no-executables.m4 \ |
$(top_srcdir)/../config/override.m4 \ |
$(top_srcdir)/../config/stdint.m4 \ |
$(top_srcdir)/../config/unwind_ipinfo.m4 \ |
$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ |
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ |
$(top_srcdir)/../lt~obsolete.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 = |
CONFIG_CLEAN_VPATH_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 = f=`echo $$p | sed -e 's|^.*/||'`; |
am__install_max = 40 |
am__nobase_strip_setup = \ |
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` |
am__nobase_strip = \ |
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" |
am__nobase_list = $(am__nobase_strip_setup); \ |
for p in $$list; do echo "$$p $$p"; done | \ |
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ |
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ |
if (++n[$$2] == $(am__install_max)) \ |
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ |
END { for (dir in files) print dir, files[dir] }' |
am__base_list = \ |
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ |
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' |
am__installdirs = "$(DESTDIR)$(toolexeclibdir)" |
LTLIBRARIES = $(toolexeclib_LTLIBRARIES) |
am__DEPENDENCIES_1 = |
am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \ |
pool_allocator.cc mt_allocator.cc codecvt.cc compatibility.cc \ |
compatibility-c++0x.cc compatibility-debug_list.cc \ |
compatibility-list.cc complex_io.cc ctype.cc debug.cc \ |
functexcept.cc globals_io.cc hash_c++0x.cc hash_tr1.cc \ |
hashtable_c++0x.cc hashtable_tr1.cc ios.cc ios_failure.cc \ |
ios_init.cc ios_locale.cc limits.cc list.cc debug_list.cc \ |
locale.cc locale_init.cc locale_facets.cc localename.cc \ |
math_stubs_float.cc math_stubs_long_double.cc stdexcept.cc \ |
strstream.cc system_error.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 \ |
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 mutex.cc condition_variable.cc chrono.cc \ |
thread.cc future.cc atomicity.cc codecvt_members.cc \ |
collate_members.cc ctype_members.cc messages_members.cc \ |
monetary_members.cc numeric_members.cc time_members.cc \ |
basic_file.cc c++locale.cc compatibility-ldbl.cc \ |
parallel_list.cc parallel_settings.cc \ |
compatibility-parallel_list.cc |
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 |
@GLIBCXX_LDBL_COMPAT_TRUE@am__objects_2 = compatibility-ldbl.lo |
@ENABLE_PARALLEL_TRUE@am__objects_3 = parallel_list.lo \ |
@ENABLE_PARALLEL_TRUE@ parallel_settings.lo \ |
@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list.lo |
am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \ |
$(am__objects_3) |
am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \ |
mt_allocator.lo codecvt.lo compatibility.lo \ |
compatibility-c++0x.lo compatibility-debug_list.lo \ |
compatibility-list.lo complex_io.lo ctype.lo debug.lo \ |
functexcept.lo globals_io.lo hash_c++0x.lo hash_tr1.lo \ |
hashtable_c++0x.lo hashtable_tr1.lo ios.lo ios_failure.lo \ |
ios_init.lo ios_locale.lo limits.lo list.lo debug_list.lo \ |
locale.lo locale_init.lo locale_facets.lo localename.lo \ |
math_stubs_float.lo math_stubs_long_double.lo stdexcept.lo \ |
strstream.lo system_error.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 \ |
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 mutex.lo condition_variable.lo chrono.lo \ |
thread.lo future.lo $(am__objects_1) $(am__objects_4) |
am_libstdc___la_OBJECTS = $(am__objects_5) |
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS) |
DEFAULT_INCLUDES = -I.@am__isrc@ -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 = $(am__libstdc___la_SOURCES_DIST) |
ETAGS = etags |
CTAGS = ctags |
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
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_FLAGS = @ATOMIC_FLAGS@ |
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@ |
DSYMUTIL = @DSYMUTIL@ |
DUMPBIN = @DUMPBIN@ |
ECHO_C = @ECHO_C@ |
ECHO_N = @ECHO_N@ |
ECHO_T = @ECHO_T@ |
EGREP = @EGREP@ |
ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@ |
EXEEXT = @EXEEXT@ |
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ |
FGREP = @FGREP@ |
GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@ |
GLIBCXX_LIBS = @GLIBCXX_LIBS@ |
GREP = @GREP@ |
INSTALL = @INSTALL@ |
INSTALL_DATA = @INSTALL_DATA@ |
INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ |
LD = @LD@ |
LDFLAGS = @LDFLAGS@ |
LIBICONV = @LIBICONV@ |
LIBOBJS = @LIBOBJS@ |
LIBS = @LIBS@ |
LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@ |
LIBTOOL = @LIBTOOL@ |
LIPO = @LIPO@ |
LN_S = @LN_S@ |
LTLIBICONV = @LTLIBICONV@ |
LTLIBOBJS = @LTLIBOBJS@ |
MAINT = @MAINT@ |
MAKEINFO = @MAKEINFO@ |
MKDIR_P = @MKDIR_P@ |
NM = @NM@ |
NMEDIT = @NMEDIT@ |
OBJDUMP = @OBJDUMP@ |
OBJEXT = @OBJEXT@ |
OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@ |
OPT_LDFLAGS = @OPT_LDFLAGS@ |
OS_INC_SRCDIR = @OS_INC_SRCDIR@ |
OTOOL = @OTOOL@ |
OTOOL64 = @OTOOL64@ |
PACKAGE = @PACKAGE@ |
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ |
PACKAGE_NAME = @PACKAGE_NAME@ |
PACKAGE_STRING = @PACKAGE_STRING@ |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
PACKAGE_URL = @PACKAGE_URL@ |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
RANLIB = @RANLIB@ |
SECTION_FLAGS = @SECTION_FLAGS@ |
SECTION_LDFLAGS = @SECTION_LDFLAGS@ |
SED = @SED@ |
SET_MAKE = @SET_MAKE@ |
SHELL = @SHELL@ |
STRIP = @STRIP@ |
SYMVER_FILE = @SYMVER_FILE@ |
TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ |
USE_NLS = @USE_NLS@ |
VERSION = @VERSION@ |
WARN_FLAGS = @WARN_FLAGS@ |
WERROR = @WERROR@ |
abs_builddir = @abs_builddir@ |
abs_srcdir = @abs_srcdir@ |
abs_top_builddir = @abs_top_builddir@ |
abs_top_srcdir = @abs_top_srcdir@ |
ac_ct_CC = @ac_ct_CC@ |
ac_ct_CXX = @ac_ct_CXX@ |
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ |
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@ |
builddir = @builddir@ |
check_msgfmt = @check_msgfmt@ |
datadir = @datadir@ |
datarootdir = @datarootdir@ |
docdir = @docdir@ |
dvidir = @dvidir@ |
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@ |
htmldir = @htmldir@ |
includedir = @includedir@ |
infodir = @infodir@ |
install_sh = @install_sh@ |
libdir = @libdir@ |
libexecdir = @libexecdir@ |
libtool_VERSION = @libtool_VERSION@ |
localedir = @localedir@ |
localstatedir = @localstatedir@ |
mandir = @mandir@ |
mkdir_p = @mkdir_p@ |
multi_basedir = @multi_basedir@ |
oldincludedir = @oldincludedir@ |
pdfdir = @pdfdir@ |
port_specific_symbol_files = @port_specific_symbol_files@ |
prefix = @prefix@ |
program_transform_name = @program_transform_name@ |
psdir = @psdir@ |
sbindir = @sbindir@ |
sharedstatedir = @sharedstatedir@ |
srcdir = @srcdir@ |
sysconfdir = @sysconfdir@ |
target = @target@ |
target_alias = @target_alias@ |
target_cpu = @target_cpu@ |
target_os = @target_os@ |
target_vendor = @target_vendor@ |
top_build_prefix = @top_build_prefix@ |
top_builddir = @top_builddir@ |
top_srcdir = @top_srcdir@ |
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_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist |
@ENABLE_SYMVERS_FALSE@version_arg = |
@ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,--version-script=libstdc++-symbols.ver |
@ENABLE_SYMVERS_GNU_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,--version-script=libstdc++-symbols.ver |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@version_dep = libstdc++-symbols.explist |
@ENABLE_SYMVERS_FALSE@version_dep = |
@ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@@ENABLE_SYMVERS_TRUE@version_dep = libstdc++-symbols.ver |
@ENABLE_SYMVERS_GNU_TRUE@@ENABLE_SYMVERS_TRUE@version_dep = libstdc++-symbols.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 ${ldbl_compat_sources} ${parallel_sources} |
|
@ENABLE_PARALLEL_FALSE@parallel_sources = |
@ENABLE_PARALLEL_TRUE@parallel_sources = parallel_list.cc parallel_settings.cc \ |
@ENABLE_PARALLEL_TRUE@ compatibility-parallel_list.cc |
|
@GLIBCXX_LDBL_COMPAT_FALSE@ldbl_compat_sources = |
@GLIBCXX_LDBL_COMPAT_TRUE@ldbl_compat_sources = compatibility-ldbl.cc |
|
# Sources present in the src directory. |
sources = \ |
atomic.cc \ |
bitmap_allocator.cc \ |
pool_allocator.cc \ |
mt_allocator.cc \ |
codecvt.cc \ |
compatibility.cc \ |
compatibility-c++0x.cc \ |
compatibility-debug_list.cc \ |
compatibility-list.cc \ |
complex_io.cc \ |
ctype.cc \ |
debug.cc \ |
functexcept.cc \ |
globals_io.cc \ |
hash_c++0x.cc \ |
hash_tr1.cc \ |
hashtable_c++0x.cc \ |
hashtable_tr1.cc \ |
ios.cc \ |
ios_failure.cc \ |
ios_init.cc \ |
ios_locale.cc \ |
limits.cc \ |
list.cc \ |
debug_list.cc \ |
locale.cc \ |
locale_init.cc \ |
locale_facets.cc \ |
localename.cc \ |
math_stubs_float.cc \ |
math_stubs_long_double.cc \ |
stdexcept.cc \ |
strstream.cc \ |
system_error.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 \ |
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 \ |
mutex.cc \ |
condition_variable.cc \ |
chrono.cc \ |
thread.cc \ |
future.cc \ |
${host_sources} \ |
${host_sources_extra} |
|
libstdc___la_SOURCES = $(sources) |
libstdc___la_LIBADD = \ |
$(GLIBCXX_LIBS) \ |
$(top_builddir)/libsupc++/libsupc++convenience.la |
|
libstdc___la_DEPENDENCIES = \ |
${version_dep} \ |
$(top_builddir)/libsupc++/libsupc++convenience.la |
|
libstdc___la_LDFLAGS = \ |
-version-info $(libtool_VERSION) ${version_arg} -lm |
|
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) |
|
# Use special rules for the deprecated source files so that they find |
# deprecated include files. |
GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include |
|
# Use special rules for parallel mode compilation. |
PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp |
|
# 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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ |
$(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) |
|
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) |
|
# 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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ |
$(CXX) $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -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 ) \ |
&& { if test -f $@; then exit 0; else break; fi; }; \ |
exit 1;; \ |
esac; \ |
done; \ |
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps src/Makefile'; \ |
$(am__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 |
$(am__aclocal_m4_deps): |
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) |
@$(NORMAL_INSTALL) |
test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" |
@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ |
list2=; for p in $$list; do \ |
if test -f $$p; then \ |
list2="$$list2 $$p"; \ |
else :; fi; \ |
done; \ |
test -z "$$list2" || { \ |
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ |
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \ |
} |
|
uninstall-toolexeclibLTLIBRARIES: |
@$(NORMAL_UNINSTALL) |
@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ |
for p in $$list; do \ |
$(am__strip_dir) \ |
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \ |
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \ |
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) |
$(libstdc___la_LINK) -rpath $(toolexeclibdir) $(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 |
|
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; nonempty = 1; } \ |
END { if (nonempty) { for (i in files) print i; }; }'`; \ |
mkid -fID $$unique |
tags: TAGS |
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
$(TAGS_FILES) $(LISP) |
set x; \ |
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; nonempty = 1; } \ |
END { if (nonempty) { for (i in files) print i; }; }'`; \ |
shift; \ |
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ |
test -n "$$unique" || unique=$$empty_fix; \ |
if test $$# -gt 0; then \ |
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ |
"$$@" $$unique; \ |
else \ |
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ |
$$unique; \ |
fi; \ |
fi |
ctags: CTAGS |
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
$(TAGS_FILES) $(LISP) |
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; nonempty = 1; } \ |
END { if (nonempty) { for (i in files) print i; }; }'`; \ |
test -z "$(CTAGS_ARGS)$$unique" \ |
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ |
$$unique |
|
GTAGS: |
here=`$(am__cd) $(top_builddir) && pwd` \ |
&& $(am__cd) $(top_srcdir) \ |
&& gtags -i $(GTAGS_ARGS) "$$here" |
|
distclean-tags: |
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags |
|
distdir: $(DISTFILES) |
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
list='$(DISTFILES)'; \ |
dist_files=`for file in $$list; do echo $$file; done | \ |
sed -e "s|^$$srcdirstrip/||;t" \ |
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ |
case $$dist_files in \ |
*/*) $(MKDIR_P) `echo "$$dist_files" | \ |
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ |
sort -u` ;; \ |
esac; \ |
for file in $$dist_files; do \ |
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ |
if test -d $$d/$$file; then \ |
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ |
if test -d "$(distdir)/$$file"; then \ |
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ |
fi; \ |
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ |
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ |
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ |
fi; \ |
cp -fpR $$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) |
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-tags |
|
dvi: dvi-am |
|
dvi-am: |
|
html: html-am |
|
html-am: |
|
info: info-am |
|
info-am: |
|
install-data-am: install-data-local |
|
install-dvi: install-dvi-am |
|
install-dvi-am: |
|
install-exec-am: install-toolexeclibLTLIBRARIES |
|
install-html: install-html-am |
|
install-html-am: |
|
install-info: install-info-am |
|
install-info-am: |
|
install-man: |
|
install-pdf: install-pdf-am |
|
install-pdf-am: |
|
install-ps: install-ps-am |
|
install-ps-am: |
|
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-toolexeclibLTLIBRARIES |
|
.MAKE: install-am install-strip |
|
.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-dvi install-dvi-am \ |
install-exec install-exec-am install-html install-html-am \ |
install-info install-info-am install-man install-pdf \ |
install-pdf-am install-ps install-ps-am 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-toolexeclibLTLIBRARIES |
|
|
# Symbol versioning for shared libraries. |
@ENABLE_SYMVERS_TRUE@libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ |
@ENABLE_SYMVERS_TRUE@ $(port_specific_symbol_files) |
@ENABLE_SYMVERS_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_FILE) ./libstdc++-symbols.ver |
@ENABLE_SYMVERS_TRUE@ chmod +w ./libstdc++-symbols.ver |
@ENABLE_SYMVERS_TRUE@ if test "x$(port_specific_symbol_files)" != x; then \ |
@ENABLE_SYMVERS_TRUE@ if grep '^# Appended to version file.' \ |
@ENABLE_SYMVERS_TRUE@ $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \ |
@ENABLE_SYMVERS_TRUE@ cat $(port_specific_symbol_files) >> $@; \ |
@ENABLE_SYMVERS_TRUE@ else \ |
@ENABLE_SYMVERS_TRUE@ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \ |
@ENABLE_SYMVERS_TRUE@ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \ |
@ENABLE_SYMVERS_TRUE@ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \ |
@ENABLE_SYMVERS_TRUE@ rm tmp.top tmp.bottom; \ |
@ENABLE_SYMVERS_TRUE@ fi; \ |
@ENABLE_SYMVERS_TRUE@ fi |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@libstdc++-symbols.explist : libstdc++-symbols.ver \ |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ ${glibcxx_srcdir}/scripts/make_exports.pl \ |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ perl ${glibcxx_srcdir}/scripts/make_exports.pl \ |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ libstdc++-symbols.ver \ |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ `echo $(libstdc___la_LIBADD) | \ |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ |
@ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@ > $@ || (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 |
|
vpath % $(top_srcdir)/src |
vpath % $(top_srcdir) |
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 $< |
parallel_list.lo: parallel_list.cc |
$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
parallel_list.o: parallel_list.cc |
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
|
parallel_settings.lo: parallel_settings.cc |
$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
parallel_settings.o: parallel_settings.cc |
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
|
compatibility-parallel_list.lo: compatibility-parallel_list.cc |
$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
compatibility-parallel_list.o: compatibility-parallel_list.cc |
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
|
# Use special rules for the C++0x sources so that the proper flags are passed. |
functexcept.lo: functexcept.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
functexcept.o: functexcept.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
system_error.lo: system_error.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
system_error.o: system_error.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
mutex.lo: mutex.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
mutex.o: mutex.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
condition_variable.lo: condition_variable.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
condition_variable.o: condition_variable.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
compatibility-c++0x.lo: compatibility-c++0x.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
compatibility-c++0x.o: compatibility-c++0x.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
hash_c++0x.lo: hash_c++0x.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
hash_c++0x.o: hash_c++0x.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
hashtable_c++0x.lo: hashtable_c++0x.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
hashtable_c++0x.o: hashtable_c++0x.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
limits.lo: limits.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
limits.o: limits.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
atomic.lo: atomic.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
atomic.o: atomic.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
fstream-inst.lo: fstream-inst.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
fstream-inst.o: fstream-inst.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
string-inst.lo: string-inst.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
string-inst.o: string-inst.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
wstring-inst.lo: wstring-inst.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
wstring-inst.o: wstring-inst.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
chrono.lo: chrono.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
chrono.o: chrono.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
thread.lo: thread.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
thread.o: thread.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
future.lo: future.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
future.o: future.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
# Use special rules for compatibility-ldbl.cc compilation, as we need to |
# pass -mlong-double-64. |
@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc |
@GLIBCXX_LDBL_COMPAT_TRUE@ $(LTCXXCOMPILE) -mlong-double-64 -c $< |
@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.o: compatibility-ldbl.cc |
@GLIBCXX_LDBL_COMPAT_TRUE@ $(CXXCOMPILE) -mlong-double-64 -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 a 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: |
/ios_failure.cc
0,0 → 1,44
// Iostreams base classes -*- C++ -*- |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 27.4.2.1.1 Class ios_base::failure |
// |
|
#include <ios> |
|
_GLIBCXX_BEGIN_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(); } |
|
_GLIBCXX_END_NAMESPACE |
/streambuf-inst.cc
0,0 → 1,61
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
// 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <ios> |
#include <streambuf> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
// streambuf |
template class basic_streambuf<char>; |
|
template |
streamsize |
__copy_streambufs(basic_streambuf<char>*, basic_streambuf<char>*); |
|
template |
streamsize |
__copy_streambufs_eof(basic_streambuf<char>*, |
basic_streambuf<char>*, bool&); |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
// wstreambuf |
template class basic_streambuf<wchar_t>; |
|
template |
streamsize |
__copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*); |
|
template |
streamsize |
__copy_streambufs_eof(basic_streambuf<wchar_t>*, |
basic_streambuf<wchar_t>*, bool&); |
#endif |
|
_GLIBCXX_END_NAMESPACE |
/ios-inst.cc
0,0 → 1,40
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <ios> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
template class basic_ios<char>; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_ios<wchar_t>; |
#endif |
|
_GLIBCXX_END_NAMESPACE |
/concept-inst.cc
0,0 → 1,108
// Concept checking instantiations -*- C++ -*- |
|
// Copyright (C) 2001, 2002, 2003, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// 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__ > () |
|
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
|
#undef _Instantiate |
|
#endif |
/wstring-inst.cc
0,0 → 1,35
// wide string support -*- C++ -*- |
|
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// 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 |
/ios_locale.cc
0,0 → 1,57
// Iostreams base classes -*- C++ -*- |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, |
// 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 27.4 Iostreams base classes |
// |
|
#include <ios> |
#include <locale> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
// Called only by basic_ios<>::init. |
void |
ios_base::_M_init() throw() |
{ |
// 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) throw() |
{ |
locale __old = _M_ios_locale; |
_M_ios_locale = __loc; |
_M_call_callbacks(imbue_event); |
return __old; |
} |
|
_GLIBCXX_END_NAMESPACE |
/pool_allocator.cc
0,0 → 1,174
// Allocator details. |
|
// Copyright (C) 2004, 2005, 2006, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <bits/c++config.h> |
#include <cstdlib> |
#include <ext/pool_allocator.h> |
|
namespace |
{ |
__gnu_cxx::__mutex& |
get_palloc_mutex() |
{ |
static __gnu_cxx::__mutex palloc_mutex; |
return palloc_mutex; |
} |
} // anonymous namespace |
|
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) |
|
// Definitions for __pool_alloc_base. |
__pool_alloc_base::_Obj* volatile* |
__pool_alloc_base::_M_get_free_list(size_t __bytes) throw () |
{ |
size_t __i = ((__bytes + (size_t)_S_align - 1) / (size_t)_S_align - 1); |
return _S_free_list + __i; |
} |
|
__mutex& |
__pool_alloc_base::_M_get_mutex() throw () |
{ return get_palloc_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(const std::bad_alloc&) |
{ |
// 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>; |
|
_GLIBCXX_END_NAMESPACE |
/fstream-inst.cc
0,0 → 1,46
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <fstream> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
template class basic_filebuf<char, char_traits<char> >; |
template class basic_ifstream<char>; |
template class basic_ofstream<char>; |
template class basic_fstream<char>; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_filebuf<wchar_t, char_traits<wchar_t> >; |
template class basic_ifstream<wchar_t>; |
template class basic_ofstream<wchar_t>; |
template class basic_fstream<wchar_t>; |
#endif |
|
_GLIBCXX_END_NAMESPACE |
/mt_allocator.cc
0,0 → 1,815
// Allocator details. |
|
// Copyright (C) 2004, 2005, 2006, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <bits/c++config.h> |
#include <ext/concurrence.h> |
#include <ext/mt_allocator.h> |
#include <cstring> |
|
namespace |
{ |
#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)); |
} |
} |
}; |
|
__freelist& |
get_freelist() |
{ |
static __freelist freelist; |
return freelist; |
} |
|
__gnu_cxx::__mutex& |
get_freelist_mutex() |
{ |
static __gnu_cxx::__mutex freelist_mutex; |
return freelist_mutex; |
} |
|
static void |
_M_destroy_thread_key(void* __id) |
{ |
// Return this thread id record to the front of thread_freelist. |
__freelist& freelist = get_freelist(); |
{ |
__gnu_cxx::__scoped_lock sentry(get_freelist_mutex()); |
size_t _M_id = reinterpret_cast<size_t>(__id); |
|
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 |
} // anonymous namespace |
|
_GLIBCXX_BEGIN_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) throw () |
{ |
// 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) throw () |
{ |
// 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 size_t __limit = (100 * (_M_bin_size - __which) |
* __options._M_freelist_headroom); |
|
size_t __remove = __bin._M_free[__thread_id]; |
__remove *= __options._M_freelist_headroom; |
|
// NB: We assume that reads of _Atomic_words are atomic. |
const size_t __max_threads = __options._M_max_threads + 1; |
_Atomic_word* const __reclaimed_base = |
reinterpret_cast<_Atomic_word*>(__bin._M_used + __max_threads); |
const _Atomic_word __reclaimed = __reclaimed_base[__thread_id]; |
const size_t __net_used = __bin._M_used[__thread_id] - __reclaimed; |
|
// NB: For performance sake we don't resync every time, in order |
// to spare atomic ops. Note that if __reclaimed increased by, |
// say, 1024, since the last sync, it means that the other |
// threads executed the atomic in the else below at least the |
// same number of times (at least, because _M_reserve_block may |
// have decreased the counter), therefore one more cannot hurt. |
if (__reclaimed > 1024) |
{ |
__bin._M_used[__thread_id] -= __reclaimed; |
__atomic_add(&__reclaimed_base[__thread_id], -__reclaimed); |
} |
|
if (__remove >= __net_used) |
__remove -= __net_used; |
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 size_t __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. |
if (__block->_M_thread_id == __thread_id) |
--__bin._M_used[__thread_id]; |
else |
__atomic_add(&__reclaimed_base[__block->_M_thread_id], 1); |
|
__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()) |
{ |
// Resync the _M_used counters. |
const size_t __max_threads = __options._M_max_threads + 1; |
_Atomic_word* const __reclaimed_base = |
reinterpret_cast<_Atomic_word*>(__bin._M_used + __max_threads); |
const _Atomic_word __reclaimed = __reclaimed_base[__thread_id]; |
__bin._M_used[__thread_id] -= __reclaimed; |
__atomic_add(&__reclaimed_base[__thread_id], -__reclaimed); |
|
__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 = 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()) |
{ |
__freelist& freelist = get_freelist(); |
{ |
__gnu_cxx::__scoped_lock sentry(get_freelist_mutex()); |
|
if (!freelist._M_thread_freelist_array |
|| 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); |
_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 (!freelist._M_thread_freelist_array) |
{ |
// Initialize per thread key to hold pointer to |
// _M_thread_freelist. |
__gthread_key_create(&freelist._M_key, |
::_M_destroy_thread_key); |
freelist._M_thread_freelist = _M_thread_freelist; |
} |
else |
{ |
_Thread_record* _M_old_freelist |
= freelist._M_thread_freelist; |
_Thread_record* _M_old_array |
= freelist._M_thread_freelist_array; |
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 = 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)); |
} |
freelist._M_thread_freelist_array = _M_thread_freelist; |
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); |
std::memset(__v, 0, 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); |
std::memset(__v, 0, sizeof(size_t) * __max_threads); |
|
__bin._M_free = static_cast<size_t*>(__v); |
|
__v = ::operator new(sizeof(size_t) * __max_threads |
+ sizeof(_Atomic_word) * __max_threads); |
std::memset(__v, 0, (sizeof(size_t) * __max_threads |
+ sizeof(_Atomic_word) * __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 |
} |
} |
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 its id. |
if (__gthread_active_p()) |
{ |
__freelist& freelist = get_freelist(); |
void* v = __gthread_getspecific(freelist._M_key); |
size_t _M_id = (size_t)v; |
if (_M_id == 0) |
{ |
{ |
__gnu_cxx::__scoped_lock sentry(get_freelist_mutex()); |
if (freelist._M_thread_freelist) |
{ |
_M_id = freelist._M_thread_freelist->_M_id; |
freelist._M_thread_freelist |
= freelist._M_thread_freelist->_M_next; |
} |
} |
|
__gthread_setspecific(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*) throw () { } |
|
// 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()) |
{ |
__freelist& freelist = get_freelist(); |
{ |
__gnu_cxx::__scoped_lock sentry(get_freelist_mutex()); |
|
if (!freelist._M_thread_freelist_array |
|| 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); |
_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 (!freelist._M_thread_freelist_array) |
{ |
// Initialize per thread key to hold pointer to |
// _M_thread_freelist. |
__gthread_key_create(&freelist._M_key, |
::_M_destroy_thread_key); |
freelist._M_thread_freelist = _M_thread_freelist; |
} |
else |
{ |
_Thread_record* _M_old_freelist |
= freelist._M_thread_freelist; |
_Thread_record* _M_old_array |
= freelist._M_thread_freelist_array; |
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 = 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)); |
} |
freelist._M_thread_freelist_array = _M_thread_freelist; |
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); |
std::memset(__v, 0, 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); |
std::memset(__v, 0, sizeof(size_t) * __max_threads); |
__bin._M_free = static_cast<size_t*>(__v); |
|
__v = ::operator new(sizeof(size_t) * __max_threads + |
sizeof(_Atomic_word) * __max_threads); |
std::memset(__v, 0, (sizeof(size_t) * __max_threads |
+ sizeof(_Atomic_word) * __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 |
} |
} |
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>; |
|
_GLIBCXX_END_NAMESPACE |
/hashtable_tr1.cc
0,0 → 1,31
// std::__detail definitions -*- C++ -*- |
|
// Copyright (C) 2007, 2008, 2009, 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
namespace std |
{ |
namespace tr1 |
{ |
#include "hashtable-aux.cc" |
} |
} |
/hash-string-aux.cc
0,0 → 1,48
// std::hash and std::tr1::hash definitions, string bits -*- C++ -*- |
|
// Copyright (C) 2007, 2008, 2009, 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#ifndef _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL |
template<> |
size_t |
hash<string>::operator()(string __s) const |
{ return _Fnv_hash::hash(__s.data(), __s.length()); } |
|
template<> |
size_t |
hash<const string&>::operator()(const string& __s) const |
{ return _Fnv_hash::hash(__s.data(), __s.length()); } |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template<> |
size_t |
hash<wstring>::operator()(wstring __s) const |
{ return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); } |
|
template<> |
size_t |
hash<const wstring&>::operator()(const wstring& __s) const |
{ return _Fnv_hash::hash(__s.data(), __s.length() * sizeof(wchar_t)); } |
#endif |
|
#endif |
/hash_c++0x.cc
0,0 → 1,34
// std::hash definitions -*- C++ -*- |
|
// Copyright (C) 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#ifndef __GXX_EXPERIMENTAL_CXX0X__ |
# error "hash_c++0x.cc must be compiled with -std=gnu++0x" |
#endif |
|
#include <bits/functional_hash.h> |
|
namespace std |
{ |
#include "hash-long-double-aux.cc" |
} |
/strstream.cc
0,0 → 1,414
// strstream definitions -*- C++ -*- |
|
// Copyright (C) 2001, 2002, 2003, 2005, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
/* |
* 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> |
|
_GLIBCXX_BEGIN_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) throw () |
: _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) throw () |
: _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) throw () |
: _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) throw () |
: _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) throw () |
: _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) throw () |
: _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) throw () |
{ |
if (_M_dynamic) |
_M_frozen = frozenflag; |
} |
|
char* |
strstreambuf::str() throw () |
{ |
freeze(true); |
return eback(); |
} |
|
int |
strstreambuf::pcount() const throw () |
{ 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) throw () |
{ |
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 throw () |
{ return const_cast<strstreambuf*>(&_M_buf); } |
|
char* |
istrstream::str() throw () |
{ 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 throw () |
{ return const_cast<strstreambuf*>(&_M_buf); } |
|
void |
ostrstream::freeze(bool freezeflag) throw () |
{ _M_buf.freeze(freezeflag); } |
|
char* |
ostrstream::str() throw () |
{ return _M_buf.str(); } |
|
int |
ostrstream::pcount() const throw () |
{ 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 throw () |
{ return const_cast<strstreambuf*>(&_M_buf); } |
|
void |
strstream::freeze(bool freezeflag) throw () |
{ _M_buf.freeze(freezeflag); } |
|
int |
strstream::pcount() const throw () |
{ return _M_buf.pcount(); } |
|
char* |
strstream::str() throw () |
{ return _M_buf.str(); } |
|
_GLIBCXX_END_NAMESPACE |
/compatibility-ldbl.cc
0,0 → 1,87
// Compatibility symbols for -mlong-double-64 compatibility -*- C++ -*- |
|
// Copyright (C) 2006, 2008, 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <locale> |
#include <cmath> |
#include <tr1/functional> |
|
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#ifdef __LONG_DOUBLE_128__ |
#error "compatibility-ldbl.cc must be compiled with -mlong-double-64" |
#endif |
|
namespace std |
{ |
#define C char |
template class num_get<C, istreambuf_iterator<C> >; |
template class num_put<C, ostreambuf_iterator<C> >; |
template class money_get<C, istreambuf_iterator<C> >; |
template class money_put<C, ostreambuf_iterator<C> >; |
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 money_put<C>& use_facet<money_put<C> >(const locale&); |
template const money_get<C>& use_facet<money_get<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<money_put<C> >(const locale&); |
template bool has_facet<money_get<C> >(const locale&); |
#undef C |
#ifdef _GLIBCXX_USE_WCHAR_T |
#define C wchar_t |
template class num_get<C, istreambuf_iterator<C> >; |
template class num_put<C, ostreambuf_iterator<C> >; |
template class money_get<C, istreambuf_iterator<C> >; |
template class money_put<C, ostreambuf_iterator<C> >; |
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 money_put<C>& use_facet<money_put<C> >(const locale&); |
template const money_get<C>& use_facet<money_get<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<money_put<C> >(const locale&); |
template bool has_facet<money_get<C> >(const locale&); |
#undef C |
#endif |
} |
|
// For std::tr1::hash<long double>::operator() |
#define _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL |
|
namespace std |
{ |
namespace tr1 |
{ |
#include "hash-long-double-aux.cc" |
} |
} |
|
// std::tr1::hash<long double>::operator() |
// and std::hash<long double>::operator() |
// are the same, no need to duplicate them. |
extern "C" void _ZNKSt4hashIeEclEe (void) |
__attribute__((alias ("_ZNKSt3tr14hashIeEclEe"))); |
|
#endif |
/ctype.cc
0,0 → 1,136
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, |
// 2006, 2007, 2008, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <locale> |
#include <cstdlib> |
#include <cstring> |
|
_GLIBCXX_BEGIN_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 |
|
// 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(); |
} |
|
// Fill in the narrowing cache and flag whether all values are |
// valid or not. _M_narrow_ok is set to 2 if memcpy can't |
// be used. |
void |
ctype<char>:: |
_M_narrow_init() const |
{ |
char __tmp[sizeof(_M_narrow)]; |
for (size_t __i = 0; __i < sizeof(_M_narrow); ++__i) |
__tmp[__i] = __i; |
do_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow); |
|
_M_narrow_ok = 1; |
if (__builtin_memcmp(__tmp, _M_narrow, sizeof(_M_narrow))) |
_M_narrow_ok = 2; |
else |
{ |
// Deal with the special case of zero: renarrow with a |
// different default and compare. |
char __c; |
do_narrow(__tmp, __tmp + 1, 1, &__c); |
if (__c == 1) |
_M_narrow_ok = 2; |
} |
} |
|
void |
ctype<char>:: |
_M_widen_init() const |
{ |
char __tmp[sizeof(_M_widen)]; |
for (size_t __i = 0; __i < sizeof(_M_widen); ++__i) |
__tmp[__i] = __i; |
do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen); |
|
_M_widen_ok = 1; |
// Set _M_widen_ok to 2 if memcpy can't be used. |
if (__builtin_memcmp(__tmp, _M_widen, sizeof(_M_widen))) |
_M_widen_ok = 2; |
} |
|
#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); } |
|
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(); |
} |
} |
|
ctype_byname<wchar_t>::~ctype_byname() |
{ } |
|
#endif |
|
_GLIBCXX_END_NAMESPACE |
/parallel_list.cc
0,0 → 1,25
// Parallel mode support code for list -*- C++ -*- |
|
// Copyright (C) 2007, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include "list.cc" |
/streambuf.cc
0,0 → 1,113
// Stream buffer classes -*- C++ -*- |
|
// Copyright (C) 2004, 2005, 2006, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 27.5 Stream buffers |
// |
|
#include <streambuf> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
template<> |
streamsize |
__copy_streambufs_eof(basic_streambuf<char>* __sbin, |
basic_streambuf<char>* __sbout, bool& __ineof) |
{ |
typedef basic_streambuf<char>::traits_type traits_type; |
streamsize __ret = 0; |
__ineof = true; |
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) |
{ |
__ineof = false; |
break; |
} |
__c = __sbin->underflow(); |
} |
else |
{ |
__c = __sbout->sputc(traits_type::to_char_type(__c)); |
if (traits_type::eq_int_type(__c, traits_type::eof())) |
{ |
__ineof = false; |
break; |
} |
++__ret; |
__c = __sbin->snextc(); |
} |
} |
return __ret; |
} |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template<> |
streamsize |
__copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin, |
basic_streambuf<wchar_t>* __sbout, bool& __ineof) |
{ |
typedef basic_streambuf<wchar_t>::traits_type traits_type; |
streamsize __ret = 0; |
__ineof = true; |
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) |
{ |
__ineof = false; |
break; |
} |
__c = __sbin->underflow(); |
} |
else |
{ |
__c = __sbout->sputc(traits_type::to_char_type(__c)); |
if (traits_type::eq_int_type(__c, traits_type::eof())) |
{ |
__ineof = false; |
break; |
} |
++__ret; |
__c = __sbin->snextc(); |
} |
} |
return __ret; |
} |
#endif |
|
_GLIBCXX_END_NAMESPACE |
/compatibility-debug_list.cc
0,0 → 1,27
// Compatibility symbols for previous versions, debug list -*- C++ -*- |
|
// Copyright (C) 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#define _GLIBCXX_DEBUG |
|
#include "compatibility-list.cc" |
/functexcept.cc
0,0 → 1,182
// Copyright (C) 2001, 2002, 2003, 2005, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <bits/functexcept.h> |
#include <cstdlib> |
#include <exception> |
#include <stdexcept> |
#include <new> |
#include <typeinfo> |
#include <ios> |
#include <system_error> |
#include <future> |
#include <functional> |
|
#ifdef _GLIBCXX_USE_NLS |
# include <libintl.h> |
# define _(msgid) gettext (msgid) |
#else |
# define _(msgid) (msgid) |
#endif |
|
_GLIBCXX_BEGIN_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)); } |
|
void |
__throw_system_error(int __i) |
{ throw system_error(error_code(__i, generic_category())); } |
|
void |
__throw_future_error(int __i) |
{ throw future_error(make_error_code(future_errc(__i))); } |
|
void |
__throw_bad_function_call() |
{ throw bad_function_call(); } |
#else |
void |
__throw_bad_exception(void) |
{ std::abort(); } |
|
void |
__throw_bad_alloc(void) |
{ std::abort(); } |
|
void |
__throw_bad_cast(void) |
{ std::abort(); } |
|
void |
__throw_bad_typeid(void) |
{ std::abort(); } |
|
void |
__throw_logic_error(const char*) |
{ std::abort(); } |
|
void |
__throw_domain_error(const char*) |
{ std::abort(); } |
|
void |
__throw_invalid_argument(const char*) |
{ std::abort(); } |
|
void |
__throw_length_error(const char*) |
{ std::abort(); } |
|
void |
__throw_out_of_range(const char*) |
{ std::abort(); } |
|
void |
__throw_runtime_error(const char*) |
{ std::abort(); } |
|
void |
__throw_range_error(const char*) |
{ std::abort(); } |
|
void |
__throw_overflow_error(const char*) |
{ std::abort(); } |
|
void |
__throw_underflow_error(const char*) |
{ std::abort(); } |
|
void |
__throw_ios_failure(const char*) |
{ std::abort(); } |
|
void |
__throw_system_error(int) |
{ std::abort(); } |
|
void |
__throw_future_error(int) |
{ std::abort(); } |
|
void |
__throw_bad_function_call() |
{ std::abort(); } |
|
#endif //__EXCEPTIONS |
|
_GLIBCXX_END_NAMESPACE |
/system_error.cc
0,0 → 1,95
// <system_error> implementation file |
|
// Copyright (C) 2007, 2008, 2009, 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
|
#include <cstring> |
#include <system_error> |
#include <bits/functexcept.h> |
#include <limits> |
|
namespace |
{ |
using std::string; |
|
struct generic_error_category : public std::error_category |
{ |
virtual const char* |
name() const |
{ return "generic"; } |
|
virtual string |
message(int i) const |
{ |
// XXX locale issues: how does one get or set loc. |
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc) |
return string(strerror(i)); |
} |
}; |
|
struct system_error_category : public std::error_category |
{ |
virtual const char* |
name() const |
{ return "system"; } |
|
virtual string |
message(int i) const |
{ |
// XXX locale issues: how does one get or set loc. |
// _GLIBCXX_HAVE_STRERROR_L, strerror_l(i, cloc) |
return string(strerror(i)); |
} |
}; |
|
const generic_error_category generic_category_instance; |
const system_error_category system_category_instance; |
} |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
const error_category& |
system_category() throw() { return system_category_instance; } |
|
const error_category& |
generic_category() throw() { return generic_category_instance; } |
|
system_error::~system_error() throw() { } |
|
error_condition |
error_category::default_error_condition(int __i) const |
{ return error_condition(__i, *this); } |
|
bool |
error_category::equivalent(int __i, const error_condition& __cond) const |
{ return default_error_condition(__i) == __cond; } |
|
bool |
error_category::equivalent(const error_code& __code, int __i) const |
{ return *this == __code.category() && __code.value() == __i; } |
|
error_condition |
error_code::default_error_condition() const |
{ return category().default_error_condition(value()); } |
|
_GLIBCXX_END_NAMESPACE |
/iostream-inst.cc
0,0 → 1,46
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
// 2006, 2007, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <iomanip> |
#include <istream> |
|
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
/compatibility-parallel_list.cc
0,0 → 1,25
// Compatibility symbols for previous versions, parallel list -*- C++ -*- |
|
// Copyright (C) 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include "compatibility-list.cc" |
/tree.cc
0,0 → 1,451
// RB tree utilities implementation -*- C++ -*- |
|
// Copyright (C) 2003, 2005, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
/* |
* |
* 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> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
_Rb_tree_node_base* |
_Rb_tree_increment(_Rb_tree_node_base* __x) throw () |
{ |
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) throw () |
{ |
return _Rb_tree_increment(const_cast<_Rb_tree_node_base*>(__x)); |
} |
|
_Rb_tree_node_base* |
_Rb_tree_decrement(_Rb_tree_node_base* __x) throw () |
{ |
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) throw () |
{ |
return _Rb_tree_decrement(const_cast<_Rb_tree_node_base*>(__x)); |
} |
|
static void |
local_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; |
} |
|
/* Static keyword was missing on _Rb_tree_rotate_left. |
Export the symbol for backward compatibility until |
next ABI change. */ |
void |
_Rb_tree_rotate_left(_Rb_tree_node_base* const __x, |
_Rb_tree_node_base*& __root) |
{ |
local_Rb_tree_rotate_left (__x, __root); |
} |
|
static void |
local_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; |
} |
|
/* Static keyword was missing on _Rb_tree_rotate_right |
Export the symbol for backward compatibility until |
next ABI change. */ |
void |
_Rb_tree_rotate_right(_Rb_tree_node_base* const __x, |
_Rb_tree_node_base*& __root) |
{ |
local_Rb_tree_rotate_right (__x, __root); |
} |
|
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) throw () |
{ |
_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; |
local_Rb_tree_rotate_left(__x, __root); |
} |
__x->_M_parent->_M_color = _S_black; |
__xpp->_M_color = _S_red; |
local_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; |
local_Rb_tree_rotate_right(__x, __root); |
} |
__x->_M_parent->_M_color = _S_black; |
__xpp->_M_color = _S_red; |
local_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) throw () |
{ |
_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; |
local_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; |
local_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; |
local_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; |
local_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; |
local_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; |
local_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) throw () |
{ |
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; |
} |
|
_GLIBCXX_END_NAMESPACE |
/locale.cc
0,0 → 1,441
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
// 2006, 2007, 2008, 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <clocale> |
#include <cstring> |
#include <cstdlib> // For getenv |
#include <cctype> |
#include <cwctype> // For towupper, etc. |
#include <locale> |
#include <ext/concurrence.h> |
|
namespace |
{ |
__gnu_cxx::__mutex& |
get_locale_cache_mutex() |
{ |
static __gnu_cxx::__mutex locale_cache_mutex; |
return locale_cache_mutex; |
} |
} // anonymous namespace |
|
// XXX GLIBCXX_ABI Deprecated |
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
# define _GLIBCXX_LOC_ID(mangled) extern std::locale::id mangled |
_GLIBCXX_LOC_ID (_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
_GLIBCXX_LOC_ID (_ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
_GLIBCXX_LOC_ID (_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
_GLIBCXX_LOC_ID (_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
# ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_LOC_ID (_ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
_GLIBCXX_LOC_ID (_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
_GLIBCXX_LOC_ID (_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
_GLIBCXX_LOC_ID (_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
# endif |
#endif |
|
_GLIBCXX_BEGIN_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() throw() |
{ 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::__scoped_lock sentry(get_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 throw() |
{ |
if (!_M_index) |
{ |
// XXX GLIBCXX_ABI Deprecated |
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
locale::id *f = 0; |
# define _GLIBCXX_SYNC_ID(facet, mangled) \ |
if (this == &::mangled) \ |
f = &facet::id |
_GLIBCXX_SYNC_ID (num_get<char>, _ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
_GLIBCXX_SYNC_ID (num_put<char>, _ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
_GLIBCXX_SYNC_ID (money_get<char>, _ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
_GLIBCXX_SYNC_ID (money_put<char>, _ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE); |
# ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_SYNC_ID (num_get<wchar_t>, _ZNSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
_GLIBCXX_SYNC_ID (num_put<wchar_t>, _ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
_GLIBCXX_SYNC_ID (money_get<wchar_t>, _ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
_GLIBCXX_SYNC_ID (money_put<wchar_t>, _ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE); |
# endif |
if (f) |
_M_index = 1 + f->_M_id(); |
else |
#endif |
_M_index = 1 + __gnu_cxx::__exchange_and_add_dispatch(&_S_refcount, |
1); |
} |
return _M_index - 1; |
} |
|
_GLIBCXX_END_NAMESPACE |
/wlocale-inst.cc
0,0 → 1,76
// Locale support -*- C++ -*- |
|
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 22.1 Locales |
// |
|
#include <bits/c++config.h> |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
#define C wchar_t |
#include "locale-inst.cc" |
|
// XXX GLIBCXX_ABI Deprecated |
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ |
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) |
|
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES4_S4_RSt8ios_basewT_, |
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES4_S4_RSt8ios_basewT_, |
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intImEES3_S3_RSt8ios_basewT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES4_S4_RSt8ios_basewT_, |
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIxEES3_S3_RSt8ios_basewT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES4_S4_RSt8ios_basewT_, |
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIyEES3_S3_RSt8ios_basewT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES4_S4_RSt8ios_basewcT_, |
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIdEES3_S3_RSt8ios_basewcT_, |
_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE15_M_insert_floatIeEES3_S3_RSt8ios_basewcT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, |
_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, |
_ZNKSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE, |
_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb0EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES4_S4_RSt8ios_basewRKSbIwS3_SaIwEE, |
_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE9_M_insertILb1EEES3_S3_RSt8ios_basewRKSbIwS2_SaIwEE); |
|
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
#endif |
/mutex.cc
0,0 → 1,97
// mutex -*- C++ -*- |
|
// Copyright (C) 2008, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <mutex> |
|
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) |
#ifndef _GLIBCXX_HAVE_TLS |
namespace |
{ |
inline std::unique_lock<std::mutex>*& |
__get_once_functor_lock_ptr() |
{ |
static std::unique_lock<std::mutex>* __once_functor_lock_ptr = 0; |
return __once_functor_lock_ptr; |
} |
} |
#endif |
|
namespace std |
{ |
const defer_lock_t defer_lock = defer_lock_t(); |
const try_to_lock_t try_to_lock = try_to_lock_t(); |
const adopt_lock_t adopt_lock = adopt_lock_t(); |
|
#ifdef _GLIBCXX_HAVE_TLS |
__thread void* __once_callable; |
__thread void (*__once_call)(); |
#else |
// Explicit instantiation due to -fno-implicit-instantiation. |
template class function<void()>; |
function<void()> __once_functor; |
|
mutex& |
__get_once_mutex() |
{ |
static mutex once_mutex; |
return once_mutex; |
} |
|
// code linked against ABI 3.4.12 and later uses this |
void |
__set_once_functor_lock_ptr(unique_lock<mutex>* __ptr) |
{ |
__get_once_functor_lock_ptr() = __ptr; |
} |
|
// unsafe - retained for compatibility with ABI 3.4.11 |
unique_lock<mutex>& |
__get_once_functor_lock() |
{ |
static unique_lock<mutex> once_functor_lock(__get_once_mutex(), defer_lock); |
return once_functor_lock; |
} |
#endif |
|
extern "C" |
{ |
void __once_proxy() |
{ |
#ifndef _GLIBCXX_HAVE_TLS |
function<void()> __once_call = std::move(__once_functor); |
if (unique_lock<mutex>* __lock = __get_once_functor_lock_ptr()) |
{ |
// caller is using new ABI and provided lock ptr |
__get_once_functor_lock_ptr() = 0; |
__lock->unlock(); |
} |
else |
__get_once_functor_lock().unlock(); // global lock |
#endif |
__once_call(); |
} |
} |
} |
|
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 |
/stdexcept.cc
0,0 → 1,75
// Methods for Exception Support for -*- C++ -*- |
|
// Copyright (C) 1997, 1999, 2001, 2002, 2005, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 19.1 Exception classes |
// |
|
#include <string> |
#include <stdexcept> |
|
_GLIBCXX_BEGIN_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) { } |
|
_GLIBCXX_END_NAMESPACE |
|
/hash_tr1.cc
0,0 → 1,35
// std::tr1::hash definitions -*- C++ -*- |
|
// Copyright (C) 2007, 2008, 2009, 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <string> |
#include <tr1/functional> |
|
namespace std |
{ |
namespace tr1 |
{ |
#include "hash-long-double-aux.cc" |
#include "hash-string-aux.cc" |
} |
} |
/compatibility.cc
0,0 → 1,543
// Compatibility symbols for previous versions -*- C++ -*- |
|
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <bits/c++config.h> |
|
#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \ |
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) |
#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 |
#define _List_node_base _List_node_baseXX |
#endif |
|
#include <string> |
#include <istream> |
#include <fstream> |
#include <sstream> |
#include <cmath> |
#include <ext/numeric_traits.h> |
|
_GLIBCXX_BEGIN_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 ( __n > 0 && __cerb) |
{ |
ios_base::iostate __err = 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 == __gnu_cxx::__numeric_traits<streamsize>::__max |
&& !traits_type::eq_int_type(__c, __eof)) |
{ |
_M_gcount = |
__gnu_cxx::__numeric_traits<streamsize>::__min; |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
} |
__catch(__cxxabiv1::__forced_unwind&) |
{ |
this->_M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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 (__n > 0 && __cerb) |
{ |
ios_base::iostate __err = 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 == __gnu_cxx::__numeric_traits<streamsize>::__max |
&& !traits_type::eq_int_type(__c, __eof)) |
{ |
_M_gcount = |
__gnu_cxx::__numeric_traits<streamsize>::__min; |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; |
|
if (traits_type::eq_int_type(__c, __eof)) |
__err |= ios_base::eofbit; |
} |
__catch(__cxxabiv1::__forced_unwind&) |
{ |
this->_M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__catch(...) |
{ this->_M_setstate(ios_base::badbit); } |
if (__err) |
this->setstate(__err); |
} |
return *this; |
} |
#endif |
|
_GLIBCXX_END_NAMESPACE |
|
|
// NB: These symbols renames should go into the shared library only, |
// and only those shared libraries that support versioning. |
#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \ |
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) |
|
/* gcc-3.4.4 |
_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv |
_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv |
*/ |
|
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
|
|
/* 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_ |
*/ |
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
|
// 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 |
|
|
/* gcc-3.4.0 |
_ZN10__gnu_norm15_List_node_base4hookEPS0_; |
_ZN10__gnu_norm15_List_node_base4swapERS0_S1_; |
_ZN10__gnu_norm15_List_node_base6unhookEv; |
_ZN10__gnu_norm15_List_node_base7reverseEv; |
_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_; |
*/ |
#include "list.cc" |
_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX7_M_hookEPS_, \ |
_ZN10__gnu_norm15_List_node_base4hookEPS0_, \ |
GLIBCXX_3.4) |
|
_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX4swapERS_S0_, \ |
_ZN10__gnu_norm15_List_node_base4swapERS0_S1_, \ |
GLIBCXX_3.4) |
|
_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX9_M_unhookEv, \ |
_ZN10__gnu_norm15_List_node_base6unhookEv, \ |
GLIBCXX_3.4) |
|
_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX10_M_reverseEv, \ |
_ZN10__gnu_norm15_List_node_base7reverseEv, \ |
GLIBCXX_3.4) |
|
_GLIBCXX_ASM_SYMVER(_ZNSt17_List_node_baseXX11_M_transferEPS_S0_, \ |
_ZN10__gnu_norm15_List_node_base8transferEPS0_S1_, \ |
GLIBCXX_3.4) |
#undef _List_node_base |
|
// gcc-4.1.0 |
// Long double versions of "C" math functions. |
#if defined (_GLIBCXX_LONG_DOUBLE_COMPAT) \ |
|| (defined (__arm__) && defined (__linux__) && defined (__ARM_EABI__)) \ |
|| (defined (__hppa__) && defined (__linux__)) \ |
|| (defined (__m68k__) && defined (__mcoldfire__) && defined (__linux__)) \ |
|| (defined (__mips__) && defined (_ABIO32) && defined (__linux__)) \ |
|| (defined (__sh__) && defined (__linux__) && __SIZEOF_SIZE_T__ == 4) \ |
|
#define _GLIBCXX_MATHL_WRAPPER(name, argdecl, args, ver) \ |
extern "C" double \ |
__ ## name ## l_wrapper argdecl \ |
{ \ |
return name args; \ |
} \ |
asm (".symver __" #name "l_wrapper, " #name "l@" #ver) |
|
#define _GLIBCXX_MATHL_WRAPPER1(name, ver) \ |
_GLIBCXX_MATHL_WRAPPER (name, (double x), (x), ver) |
|
#define _GLIBCXX_MATHL_WRAPPER2(name, ver) \ |
_GLIBCXX_MATHL_WRAPPER (name, (double x, double y), (x, y), ver) |
|
#ifdef _GLIBCXX_HAVE_ACOSL |
_GLIBCXX_MATHL_WRAPPER1 (acos, GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_ASINL |
_GLIBCXX_MATHL_WRAPPER1 (asin, GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_ATAN2L |
_GLIBCXX_MATHL_WRAPPER2 (atan2, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_ATANL |
_GLIBCXX_MATHL_WRAPPER1 (atan, GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_CEILL |
_GLIBCXX_MATHL_WRAPPER1 (ceil, GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_COSHL |
_GLIBCXX_MATHL_WRAPPER1 (cosh, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_COSL |
_GLIBCXX_MATHL_WRAPPER1 (cos, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_EXPL |
_GLIBCXX_MATHL_WRAPPER1 (exp, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_FLOORL |
_GLIBCXX_MATHL_WRAPPER1 (floor, GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_FMODL |
_GLIBCXX_MATHL_WRAPPER2 (fmod, GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_FREXPL |
_GLIBCXX_MATHL_WRAPPER (frexp, (double x, int *y), (x, y), GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_HYPOTL |
_GLIBCXX_MATHL_WRAPPER2 (hypot, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_LDEXPL |
_GLIBCXX_MATHL_WRAPPER (ldexp, (double x, int y), (x, y), GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_LOG10L |
_GLIBCXX_MATHL_WRAPPER1 (log10, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_LOGL |
_GLIBCXX_MATHL_WRAPPER1 (log, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_MODFL |
_GLIBCXX_MATHL_WRAPPER (modf, (double x, double *y), (x, y), GLIBCXX_3.4.3); |
#endif |
#ifdef _GLIBCXX_HAVE_POWL |
_GLIBCXX_MATHL_WRAPPER2 (pow, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_SINHL |
_GLIBCXX_MATHL_WRAPPER1 (sinh, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_SINL |
_GLIBCXX_MATHL_WRAPPER1 (sin, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_SQRTL |
_GLIBCXX_MATHL_WRAPPER1 (sqrt, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_TANHL |
_GLIBCXX_MATHL_WRAPPER1 (tanh, GLIBCXX_3.4); |
#endif |
#ifdef _GLIBCXX_HAVE_TANL |
_GLIBCXX_MATHL_WRAPPER1 (tan, GLIBCXX_3.4); |
#endif |
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#endif |
|
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
extern void *_ZTVN10__cxxabiv123__fundamental_type_infoE[]; |
extern void *_ZTVN10__cxxabiv119__pointer_type_infoE[]; |
extern __attribute__((used, weak)) const char _ZTSe[2] = "e"; |
extern __attribute__((used, weak)) const char _ZTSPe[3] = "Pe"; |
extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe"; |
extern __attribute__((used, weak)) const void * const _ZTIe[2] |
= { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2], |
(void *) _ZTSe }; |
extern __attribute__((used, weak)) const void * const _ZTIPe[4] |
= { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], |
(void *) _ZTSPe, (void *) 0L, (void *) _ZTIe }; |
extern __attribute__((used, weak)) const void * const _ZTIPKe[4] |
= { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], |
(void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; |
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#ifdef _GLIBCXX_SYMVER_DARWIN |
#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 |
/globals_io.cc
0,0 → 1,105
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include "bits/c++config.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) |
|
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
|
namespace __gnu_internal _GLIBCXX_VISIBILITY_ATTR(hidden) |
{ |
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 |
} // namespace __gnu_internal |
/ext-inst.cc
0,0 → 1,63
// Explicit instantiation file. |
|
// Copyright (C) 2001, 2002, 2004, 2006, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <ext/rope> |
#include <ext/stdio_filebuf.h> |
|
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) |
|
namespace |
{ |
const int min_len = __detail::_S_max_rope_depth + 1; |
} |
|
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 |
|
_GLIBCXX_END_NAMESPACE |
/list.cc
0,0 → 1,138
// std::list utilities implementation -*- C++ -*- |
|
// Copyright (C) 2003, 2005, 2009, 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
/* |
* |
* 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> |
|
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) |
|
void |
_List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw() |
{ |
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::_M_transfer(_List_node_base * const __first, |
_List_node_base * const __last) throw() |
{ |
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::_M_reverse() throw() |
{ |
_List_node_base* __tmp = this; |
do |
{ |
std::swap(__tmp->_M_next, __tmp->_M_prev); |
|
// Old next node is now prev. |
__tmp = __tmp->_M_prev; |
} |
while (__tmp != this); |
} |
|
void |
_List_node_base::_M_hook(_List_node_base* const __position) throw() |
{ |
this->_M_next = __position; |
this->_M_prev = __position->_M_prev; |
__position->_M_prev->_M_next = this; |
__position->_M_prev = this; |
} |
|
void |
_List_node_base::_M_unhook() throw() |
{ |
_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; |
} |
|
_GLIBCXX_END_NESTED_NAMESPACE |
/bitmap_allocator.cc
0,0 → 1,122
// Bitmap Allocator. Out of line function definitions. -*- C++ -*- |
|
// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <ext/bitmap_allocator.h> |
|
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) |
|
namespace __detail |
{ |
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 |
__mutex_type& __bfl_mutex = _M_get_mutex(); |
#endif |
const vector_type& __free_list = _M_get_free_list(); |
using __gnu_cxx::__detail::__lower_bound; |
iterator __tmp = __lower_bound(__free_list.begin(), __free_list.end(), |
__sz, _LT_pointer_compare()); |
|
if (__tmp == __free_list.end() || !_M_should_i_give(**__tmp, __sz)) |
{ |
// We release the lock here, because operator new is |
// guaranteed to be thread-safe by the underlying |
// implementation. |
#if defined __GTHREADS |
__bfl_mutex.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(const std::bad_alloc&) |
{ |
this->_M_clear(); |
} |
if (!__ret) |
continue; |
*__ret = __sz; |
return __ret + 1; |
} |
std::__throw_bad_alloc(); |
} |
else |
{ |
size_t* __ret = *__tmp; |
_M_get_free_list().erase(__tmp); |
#if defined __GTHREADS |
__bfl_mutex.unlock(); |
#endif |
return __ret + 1; |
} |
} |
|
void |
free_list:: |
_M_clear() |
{ |
#if defined __GTHREADS |
__gnu_cxx::__scoped_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>; |
|
_GLIBCXX_END_NAMESPACE |
/parallel_settings.cc
0,0 → 1,42
// Default settings for parallel mode -*- C++ -*- |
|
// Copyright (C) 2007, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <parallel/settings.h> |
|
namespace |
{ |
__gnu_parallel::_Settings s; |
} |
|
namespace __gnu_parallel |
{ |
const _Settings& |
_Settings::get() throw() |
{ return s; } |
|
// XXX MT |
void |
_Settings::set(_Settings& obj) throw() |
{ s = obj; } |
} |
/debug_list.cc
0,0 → 1,28
// Debugging mode support code for list -*- C++ -*- |
|
// Copyright (C) 2004, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#define _GLIBCXX_DEBUG |
|
#include "list.cc" |
|
/locale_facets.cc
0,0 → 1,115
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
// 2006, 2007, 2008, 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <locale> |
|
_GLIBCXX_BEGIN_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) throw() |
{ |
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'; |
} |
|
bool |
__verify_grouping(const char* __grouping, size_t __grouping_size, |
const string& __grouping_tmp) throw() |
{ |
const size_t __n = __grouping_tmp.size() - 1; |
const size_t __min = std::min(__n, size_t(__grouping_size - 1)); |
size_t __i = __n; |
bool __test = true; |
|
// Parsed number groupings have to match the |
// numpunct::grouping string exactly, starting at the |
// right-most point of the parsed sequence of elements ... |
for (size_t __j = 0; __j < __min && __test; --__i, ++__j) |
__test = __grouping_tmp[__i] == __grouping[__j]; |
for (; __i && __test; --__i) |
__test = __grouping_tmp[__i] == __grouping[__min]; |
// ... but the first parsed grouping can be <= numpunct |
// grouping (only do the check if the numpunct char is > 0 |
// because <= 0 means any size is ok). |
if (static_cast<signed char>(__grouping[__min]) > 0 |
&& __grouping[__min] != __gnu_cxx::__numeric_traits<char>::__max) |
__test &= __grouping_tmp[0] <= __grouping[__min]; |
return __test; |
} |
|
_GLIBCXX_END_NAMESPACE |
/codecvt.cc
0,0 → 1,148
// Copyright (C) 2000, 2002, 2004, 2005, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// Written by Benjamin Kosnik <bkoz@redhat.com> |
|
#include <locale> |
|
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
/complex_io.cc
0,0 → 1,110
// The template and inlines for the -*- C++ -*- complex number classes. |
|
// Copyright (C) 2000, 2001, 2005, 2006, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <complex> |
|
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
|
// XXX GLIBCXX_ABI Deprecated |
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ |
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) |
|
_GLIBCXX_LDBL_COMPAT (_ZStlsIdcSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E, |
_ZStlsIecSt11char_traitsIcEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E); |
#ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_LDBL_COMPAT (_ZStlsIdwSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E, |
_ZStlsIewSt11char_traitsIwEERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E); |
#endif |
_GLIBCXX_LDBL_COMPAT (_ZStrsIdcSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E, |
_ZStrsIecSt11char_traitsIcEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E); |
#ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_LDBL_COMPAT (_ZStrsIdwSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E, |
_ZStrsIewSt11char_traitsIwEERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E); |
#endif |
|
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
/localename.cc
0,0 → 1,351
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
// 2006, 2007, 2008, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <clocale> |
#include <cstring> |
#include <cstdlib> |
#include <locale> |
|
_GLIBCXX_BEGIN_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); |
__c_locale __clocm = __cloc; |
|
__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 char* __smon = __s; |
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; |
bool __found_ctype = false; |
bool __found_monetary = false; |
size_t __ci = 0, __mi = 0; |
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'; |
if (!__found_ctype |
&& *(__beg - 2) == 'E' && *(__beg - 3) == 'P') |
{ |
__found_ctype = true; |
__ci = __i; |
} |
else if (!__found_monetary && *(__beg - 2) == 'Y') |
{ |
__found_monetary = true; |
__mi = __i; |
} |
} |
|
if (std::strcmp(_M_names[__ci], _M_names[__mi])) |
{ |
__smon = _M_names[__mi]; |
__clocm = locale::facet::_S_lc_ctype_c_locale(__cloc, |
__smon); |
} |
} |
|
// 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, 0)); |
_M_init_facet(new moneypunct<char, true>(__cloc, 0)); |
_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>(__clocm, __smon)); |
_M_init_facet(new moneypunct<wchar_t, true>(__clocm, __smon)); |
_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); |
if (__clocm != __cloc) |
locale::facet::_S_destroy_c_locale(__clocm); |
} |
__catch(...) |
{ |
locale::facet::_S_destroy_c_locale(__cloc); |
if (__clocm != __cloc) |
locale::facet::_S_destroy_c_locale(__clocm); |
this->~_Impl(); |
__throw_exception_again; |
} |
} |
|
void |
locale::_Impl:: |
_M_replace_categories(const _Impl* __imp, category __cat) |
{ |
category __mask = 1; |
if (!_M_names[0] || !__imp->_M_names[0]) |
{ |
if (_M_names[0]) |
{ |
delete [] _M_names[0]; |
_M_names[0] = 0; // Unnamed. |
} |
|
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]); |
} |
} |
else |
{ |
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); |
} |
} |
|
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]); |
|
// FIXME: Hack for libstdc++/29217: the numerical encodings |
// of the time and collate categories are swapped vs the |
// order of the names in locale::_S_categories. We'd like to |
// adjust the former (the latter is dictated by compatibility |
// with glibc) but we can't for binary compatibility. |
size_t __ix_name = __ix; |
if (__ix == 2 || __ix == 3) |
__ix_name = 5 - __ix; |
|
char* __src = __imp->_M_names[__ix_name] ? |
__imp->_M_names[__ix_name] : __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_name]; |
_M_names[__ix_name] = __new; |
} |
} |
} |
} |
|
_GLIBCXX_END_NAMESPACE |
/limits.cc
0,0 → 1,544
// Static data members of -*- C++ -*- numeric_limits classes |
|
// Copyright (C) 1999, 2001, 2002, 2005, 2006, 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr> |
|
// |
// ISO C++ 14882:1998 |
// 18.2.1 |
// |
|
#include <limits> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
const bool __numeric_limits_base::is_specialized; |
const int __numeric_limits_base::digits; |
const int __numeric_limits_base::digits10; |
const int __numeric_limits_base::max_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 int numeric_limits<bool>::max_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 int numeric_limits<char>::max_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 int numeric_limits<signed char>::max_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 int numeric_limits<unsigned char>::max_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 int numeric_limits<wchar_t>::max_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 int numeric_limits<short>::max_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 int numeric_limits<unsigned short>::max_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 int numeric_limits<int>::max_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 int numeric_limits<unsigned int>::max_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 int numeric_limits<long>::max_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 int numeric_limits<unsigned long>::max_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 int numeric_limits<long long>::max_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 int numeric_limits<unsigned long long>::max_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 int numeric_limits<float>::max_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 int numeric_limits<double>::max_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 int numeric_limits<long double>::max_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; |
|
// char16_t |
const bool numeric_limits<char16_t>::is_specialized; |
const int numeric_limits<char16_t>::digits; |
const int numeric_limits<char16_t>::digits10; |
const int numeric_limits<char16_t>::max_digits10; |
const bool numeric_limits<char16_t>::is_signed; |
const bool numeric_limits<char16_t>::is_integer; |
const bool numeric_limits<char16_t>::is_exact; |
const int numeric_limits<char16_t>::radix; |
const int numeric_limits<char16_t>::min_exponent; |
const int numeric_limits<char16_t>::min_exponent10; |
const int numeric_limits<char16_t>::max_exponent; |
const int numeric_limits<char16_t>::max_exponent10; |
const bool numeric_limits<char16_t>::has_infinity; |
const bool numeric_limits<char16_t>::has_quiet_NaN; |
const bool numeric_limits<char16_t>::has_signaling_NaN; |
const float_denorm_style numeric_limits<char16_t>::has_denorm; |
const bool numeric_limits<char16_t>::has_denorm_loss; |
const bool numeric_limits<char16_t>::is_iec559; |
const bool numeric_limits<char16_t>::is_bounded; |
const bool numeric_limits<char16_t>::is_modulo; |
const bool numeric_limits<char16_t>::traps; |
const bool numeric_limits<char16_t>::tinyness_before; |
const float_round_style numeric_limits<char16_t>::round_style; |
|
// char32_t |
const bool numeric_limits<char32_t>::is_specialized; |
const int numeric_limits<char32_t>::digits; |
const int numeric_limits<char32_t>::digits10; |
const int numeric_limits<char32_t>::max_digits10; |
const bool numeric_limits<char32_t>::is_signed; |
const bool numeric_limits<char32_t>::is_integer; |
const bool numeric_limits<char32_t>::is_exact; |
const int numeric_limits<char32_t>::radix; |
const int numeric_limits<char32_t>::min_exponent; |
const int numeric_limits<char32_t>::min_exponent10; |
const int numeric_limits<char32_t>::max_exponent; |
const int numeric_limits<char32_t>::max_exponent10; |
const bool numeric_limits<char32_t>::has_infinity; |
const bool numeric_limits<char32_t>::has_quiet_NaN; |
const bool numeric_limits<char32_t>::has_signaling_NaN; |
const float_denorm_style numeric_limits<char32_t>::has_denorm; |
const bool numeric_limits<char32_t>::has_denorm_loss; |
const bool numeric_limits<char32_t>::is_iec559; |
const bool numeric_limits<char32_t>::is_bounded; |
const bool numeric_limits<char32_t>::is_modulo; |
const bool numeric_limits<char32_t>::traps; |
const bool numeric_limits<char32_t>::tinyness_before; |
const float_round_style numeric_limits<char32_t>::round_style; |
|
_GLIBCXX_END_NAMESPACE |
|
// XXX GLIBCXX_ABI Deprecated |
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#define _GLIBCXX_NUM_LIM_COMPAT(type, member, len) \ |
extern "C" type _ZNSt14numeric_limitsIeE ## len ## member ## E \ |
__attribute__ ((alias ("_ZNSt14numeric_limitsIdE" #len #member "E"))) |
_GLIBCXX_NUM_LIM_COMPAT (bool, is_specialized, 14); |
_GLIBCXX_NUM_LIM_COMPAT (int, digits, 6); |
_GLIBCXX_NUM_LIM_COMPAT (int, digits10, 8); |
_GLIBCXX_NUM_LIM_COMPAT (bool, is_signed, 9); |
_GLIBCXX_NUM_LIM_COMPAT (bool, is_integer, 10); |
_GLIBCXX_NUM_LIM_COMPAT (bool, is_exact, 8); |
_GLIBCXX_NUM_LIM_COMPAT (int, radix, 5); |
_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent, 12); |
_GLIBCXX_NUM_LIM_COMPAT (int, min_exponent10, 14); |
_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent, 12); |
_GLIBCXX_NUM_LIM_COMPAT (int, max_exponent10, 14); |
_GLIBCXX_NUM_LIM_COMPAT (bool, has_infinity, 12); |
_GLIBCXX_NUM_LIM_COMPAT (bool, has_quiet_NaN, 13); |
_GLIBCXX_NUM_LIM_COMPAT (bool, has_signaling_NaN, 17); |
_GLIBCXX_NUM_LIM_COMPAT (std::float_denorm_style, has_denorm, 10); |
_GLIBCXX_NUM_LIM_COMPAT (bool, has_denorm_loss, 15); |
_GLIBCXX_NUM_LIM_COMPAT (bool, is_iec559, 9); |
_GLIBCXX_NUM_LIM_COMPAT (bool, is_bounded, 10); |
_GLIBCXX_NUM_LIM_COMPAT (bool, is_modulo, 9); |
_GLIBCXX_NUM_LIM_COMPAT (bool, traps, 5); |
_GLIBCXX_NUM_LIM_COMPAT (bool, tinyness_before, 15); |
_GLIBCXX_NUM_LIM_COMPAT (std::float_round_style, round_style, 11); |
|
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
/misc-inst.cc
0,0 → 1,76
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <string> |
#include <istream> |
#include <ostream> |
#include <ext/stdio_sync_filebuf.h> |
|
_GLIBCXX_BEGIN_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 |
|
_GLIBCXX_END_NAMESPACE |
|
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) |
|
template class stdio_sync_filebuf<char>; |
#ifdef _GLIBCXX_USE_WCHAR_T |
template class stdio_sync_filebuf<wchar_t>; |
#endif |
|
_GLIBCXX_END_NAMESPACE |
|
|
/future.cc
0,0 → 1,73
// future -*- C++ -*- |
|
// Copyright (C) 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <future> |
|
namespace |
{ |
struct future_error_category : public std::error_category |
{ |
virtual const char* |
name() const |
{ return "future"; } |
|
virtual std::string message(int __ec) const |
{ |
std::string __msg; |
switch (std::future_errc(__ec)) |
{ |
case std::future_errc::broken_promise: |
__msg = "Broken promise"; |
break; |
case std::future_errc::future_already_retrieved: |
__msg = "Future already retrieved"; |
break; |
case std::future_errc::promise_already_satisfied: |
__msg = "Promise already satisfied"; |
break; |
default: |
__msg = "Unknown error"; |
break; |
} |
return __msg; |
} |
}; |
|
const future_error_category& |
__future_category_instance() |
{ |
static const future_error_category __fec; |
return __fec; |
} |
} |
|
namespace std |
{ |
const error_category* const future_category = &__future_category_instance(); |
|
future_error::~future_error() throw() { } |
|
const char* |
future_error::what() const throw() { return _M_code.message().c_str(); } |
} |
/atomic.cc
0,0 → 1,139
// Support for atomic operations -*- C++ -*- |
|
// Copyright (C) 2008, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include "gstdint.h" |
#include <atomic> |
#include <mutex> |
|
#define LOGSIZE 4 |
|
namespace |
{ |
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) |
std::mutex& |
get_atomic_mutex() |
{ |
static std::mutex atomic_mutex; |
return atomic_mutex; |
} |
#endif |
|
std::__atomic_flag_base flag_table[ 1 << LOGSIZE ] = |
{ |
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, |
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, |
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, |
ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, |
}; |
} // anonymous namespace |
|
namespace std |
{ |
namespace __atomic0 |
{ |
bool |
atomic_flag::test_and_set(memory_order) |
{ |
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) |
lock_guard<mutex> __lock(get_atomic_mutex()); |
#endif |
bool result = _M_i; |
_M_i = true; |
return result; |
} |
|
void |
atomic_flag::clear(memory_order) |
{ |
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) |
lock_guard<mutex> __lock(get_atomic_mutex()); |
#endif |
_M_i = false; |
} |
} |
|
extern "C" |
{ |
bool |
atomic_flag_test_and_set_explicit(__atomic_flag_base* __a, |
memory_order __m) throw() |
{ |
atomic_flag* d = static_cast<volatile atomic_flag*>(__a); |
return d->test_and_set(__m); |
} |
|
void |
atomic_flag_clear_explicit(__atomic_flag_base* __a, |
memory_order __m) throw() |
{ |
atomic_flag* d = static_cast<volatile atomic_flag*>(__a); |
return d->clear(__m); |
} |
|
void |
__atomic_flag_wait_explicit(__atomic_flag_base* __a, |
memory_order __x) throw() |
{ |
while (atomic_flag_test_and_set_explicit(__a, __x)) |
{ }; |
} |
|
__atomic_flag_base* |
__atomic_flag_for_address(const void* __z) throw() |
{ |
uintptr_t __u = reinterpret_cast<uintptr_t>(__z); |
__u += (__u >> 2) + (__u << 4); |
__u += (__u >> 7) + (__u << 5); |
__u += (__u >> 17) + (__u << 13); |
if (sizeof(uintptr_t) > 4) |
__u += (__u >> 31); |
__u &= ~((~uintptr_t(0)) << LOGSIZE); |
return flag_table + __u; |
} |
} // extern "C" |
} // namespace std |
|
|
// XXX GLIBCXX_ABI Deprecated |
// gcc-4.5.0 |
// <atomic> signature changes |
|
// 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. |
|
#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \ |
&& defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) |
|
#define _GLIBCXX_ASM_SYMVER(cur, old, version) \ |
asm (".symver " #cur "," #old "@@" #version); |
|
_GLIBCXX_ASM_SYMVER(_ZNSt9__atomic011atomic_flag5clearESt12memory_order, _ZNVSt9__atomic011atomic_flag5clearESt12memory_order, GLIBCXX_3.4.11) |
|
_GLIBCXX_ASM_SYMVER(_ZNSt9__atomic011atomic_flag12test_and_setESt12memory_order, _ZNVSt9__atomic011atomic_flag12test_and_setESt12memory_order, GLIBCXX_3.4.11) |
|
#endif |
/istream-inst.cc
0,0 → 1,112
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <istream> |
#include <iomanip> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
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); |
|
template istream& istream::_M_extract(unsigned short&); |
template istream& istream::_M_extract(unsigned int&); |
template istream& istream::_M_extract(long&); |
template istream& istream::_M_extract(unsigned long&); |
template istream& istream::_M_extract(bool&); |
#ifdef _GLIBCXX_USE_LONG_LONG |
template istream& istream::_M_extract(long long&); |
template istream& istream::_M_extract(unsigned long long&); |
#endif |
template istream& istream::_M_extract(float&); |
template istream& istream::_M_extract(double&); |
template istream& istream::_M_extract(long double&); |
template istream& istream::_M_extract(void*&); |
|
#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); |
|
template wistream& wistream::_M_extract(unsigned short&); |
template wistream& wistream::_M_extract(unsigned int&); |
template wistream& wistream::_M_extract(long&); |
template wistream& wistream::_M_extract(unsigned long&); |
template wistream& wistream::_M_extract(bool&); |
#ifdef _GLIBCXX_USE_LONG_LONG |
template wistream& wistream::_M_extract(long long&); |
template wistream& wistream::_M_extract(unsigned long long&); |
#endif |
template wistream& wistream::_M_extract(float&); |
template wistream& wistream::_M_extract(double&); |
template wistream& wistream::_M_extract(long double&); |
template wistream& wistream::_M_extract(void*&); |
#endif |
|
_GLIBCXX_END_NAMESPACE |
|
// XXX GLIBCXX_ABI Deprecated |
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ |
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) |
_GLIBCXX_LDBL_COMPAT (_ZNSirsERd, _ZNSirsERe); |
#ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd, |
_ZNSt13basic_istreamIwSt11char_traitsIwEErsERe); |
#endif |
_GLIBCXX_LDBL_COMPAT (_ZNSi10_M_extractIdEERSiRT_, |
_ZNSi10_M_extractIeEERSiRT_); |
#ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIdEERS2_RT_, |
_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIeEERS2_RT_); |
#endif |
|
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
/string-inst.cc
0,0 → 1,83
// Components for manipulating sequences of characters -*- C++ -*- |
|
// Copyright (C) 1997, 1998, 2009, 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// 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 |
|
_GLIBCXX_BEGIN_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); |
|
_GLIBCXX_END_NAMESPACE |
|
_GLIBCXX_BEGIN_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&); |
|
_GLIBCXX_END_NAMESPACE |
/compatibility-list.cc
0,0 → 1,99
// Compatibility symbols for previous versions, list bits -*- C++ -*- |
|
// Copyright (C) 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <bits/move.h> |
|
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) |
|
struct _List_node_base |
{ |
_List_node_base* _M_next; |
_List_node_base* _M_prev; |
|
void |
transfer(_List_node_base * const __first, |
_List_node_base * const __last) throw (); |
|
void |
reverse() throw (); |
|
void |
hook(_List_node_base * const __position) throw (); |
|
void |
unhook() throw (); |
}; |
|
void |
_List_node_base::transfer(_List_node_base * const __first, |
_List_node_base * const __last) throw () |
{ |
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() throw () |
{ |
_List_node_base* __tmp = this; |
do |
{ |
std::swap(__tmp->_M_next, __tmp->_M_prev); |
|
// Old next node is now prev. |
__tmp = __tmp->_M_prev; |
} |
while (__tmp != this); |
} |
|
void |
_List_node_base::hook(_List_node_base* const __position) throw () |
{ |
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() throw () |
{ |
_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; |
} |
|
_GLIBCXX_END_NESTED_NAMESPACE |
/locale_init.cc
0,0 → 1,471
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
// 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <clocale> |
#include <cstring> |
#include <cstdlib> // For getenv, free. |
#include <cctype> |
#include <cwctype> // For towupper, etc. |
#include <locale> |
#include <ext/concurrence.h> |
|
namespace |
{ |
__gnu_cxx::__mutex& |
get_locale_mutex() |
{ |
static __gnu_cxx::__mutex locale_mutex; |
return locale_mutex; |
} |
|
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 |
} // anonymous namespace |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
locale::locale() throw() : _M_impl(0) |
{ |
_S_initialize(); |
|
// Checked locking to optimize the common case where _S_global |
// still points to _S_classic (locale::_S_initialize_once()): |
// - If they are the same, just increment the reference count and |
// we are done. This effectively constructs a C locale object |
// identical to the static c_locale. |
// - Otherwise, _S_global can and may be destroyed due to |
// locale::global() call on another thread, in which case we |
// fall back to lock protected access to both _S_global and |
// its reference count. |
_M_impl = _S_global; |
if (_M_impl == _S_classic) |
_M_impl->_M_add_reference(); |
else |
{ |
__gnu_cxx::__scoped_lock sentry(get_locale_mutex()); |
_S_global->_M_add_reference(); |
_M_impl = _S_global; |
} |
} |
|
locale |
locale::global(const locale& __other) |
{ |
_S_initialize(); |
_Impl* __old; |
{ |
__gnu_cxx::__scoped_lock sentry(get_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 *(new (&c_locale) locale(_S_classic)); |
} |
|
void |
locale::_S_initialize_once() throw() |
{ |
// 2 references. |
// One reference for _S_classic, one for _S_global |
_S_classic = new (&c_locale_impl) _Impl(2); |
_S_global = _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 |
} |
|
_GLIBCXX_END_NAMESPACE |
/math_stubs_long_double.cc
0,0 → 1,224
// Stub definitions for long double math. |
|
// Copyright (C) 2001, 2002, 2003, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <cmath> |
|
// For targets which do not have support for long double versions, |
// we use the following crude approximations. We keep saying that we'll do |
// better later, but never do. |
|
extern "C" |
{ |
#ifndef _GLIBCXX_HAVE_FABSL |
long double |
fabsl(long double x) |
{ |
return fabs((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ACOSL |
long double |
acosl(long double x) |
{ |
return acos((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ASINL |
long double |
asinl(long double x) |
{ |
return asin((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ATANL |
long double |
atanl(long double x) |
{ |
return atan ((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ATAN2L |
long double |
atan2l(long double x, long double y) |
{ |
return atan2((double) x, (double) y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_CEILL |
long double |
ceill(long double x) |
{ |
return ceil((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_COSL |
long double |
cosl(long double x) |
{ |
return cos((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_COSHL |
long double |
coshl(long double x) |
{ |
return cosh((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_EXPL |
long double |
expl(long double x) |
{ |
return exp((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_FLOORL |
long double |
floorl(long double x) |
{ |
return floor((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_FMODL |
long double |
fmodl(long double x, long double y) |
{ |
return fmod((double) x, (double) y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_FREXPL |
long double |
frexpl(long double x, int *exp) |
{ |
return frexp((double) x, exp); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_SQRTL |
long double |
sqrtl(long double x) |
{ |
return sqrt((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_HYPOTL |
long double |
hypotl(long double x, long double y) |
{ |
long double s = fabsl(x) + fabsl(y); |
if (s == 0.0L) |
return s; |
x /= s; y /= s; |
return s * sqrtl(x * x + y * y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_LDEXPL |
long double |
ldexpl(long double x, int exp) |
{ |
return ldexp((double) x, exp); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_LOGL |
long double |
logl(long double x) |
{ |
return log((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_LOG10L |
long double |
log10l(long double x) |
{ |
return log10((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_MODFL |
long double |
modfl(long double x, long double *iptr) |
{ |
double result, temp; |
|
result = modf((double) x, &temp); |
*iptr = temp; |
return result; |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_POWL |
long double |
powl(long double x, long double y) |
{ |
return pow((double) x, (double) y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_SINL |
long double |
sinl(long double x) |
{ |
return sin((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_SINHL |
long double |
sinhl(long double x) |
{ |
return sinh((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_TANL |
long double |
tanl(long double x) |
{ |
return tan((double) x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_TANHL |
long double |
tanhl(long double x) |
{ |
return tanh((double) x); |
} |
#endif |
} // extern "C" |
/hash-long-double-aux.cc
0,0 → 1,50
// std::hash and std::tr1::hash definitions, long double bits -*- C++ -*- |
|
// Copyright (C) 2010 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// For long double, careful with random padding bits (e.g., on x86, |
// 10 bytes -> 12 bytes) and resort to frexp. |
template<> |
size_t |
hash<long double>::operator()(long double __val) const |
{ |
// 0 and -0 both hash to zero. |
if (__val == 0.0L) |
return 0; |
|
int __exponent; |
__val = __builtin_frexpl(__val, &__exponent); |
__val = __val < 0.0l ? -(__val + 0.5l) : __val; |
|
const long double __mult = __SIZE_MAX__ + 1.0l; |
__val *= __mult; |
|
// Try to use all the bits of the mantissa (really necessary only |
// on 32-bit targets, at least for 80-bit floating point formats). |
const size_t __hibits = (size_t)__val; |
__val = (__val - (long double)__hibits) * __mult; |
|
const size_t __coeff = __SIZE_MAX__ / __LDBL_MAX_EXP__; |
|
return __hibits + (size_t)__val + __coeff * __exponent; |
} |
/ostream-inst.cc
0,0 → 1,115
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
// 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <ostream> |
#include <iomanip> |
|
_GLIBCXX_BEGIN_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); |
template ostream& __ostream_insert(ostream&, const char*, streamsize); |
|
template ostream& ostream::_M_insert(long); |
template ostream& ostream::_M_insert(unsigned long); |
template ostream& ostream::_M_insert(bool); |
#ifdef _GLIBCXX_USE_LONG_LONG |
template ostream& ostream::_M_insert(long long); |
template ostream& ostream::_M_insert(unsigned long long); |
#endif |
template ostream& ostream::_M_insert(double); |
template ostream& ostream::_M_insert(long double); |
template ostream& ostream::_M_insert(const void*); |
|
#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); |
template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize); |
|
template wostream& wostream::_M_insert(long); |
template wostream& wostream::_M_insert(unsigned long); |
template wostream& wostream::_M_insert(bool); |
#ifdef _GLIBCXX_USE_LONG_LONG |
template wostream& wostream::_M_insert(long long); |
template wostream& wostream::_M_insert(unsigned long long); |
#endif |
template wostream& wostream::_M_insert(double); |
template wostream& wostream::_M_insert(long double); |
template wostream& wostream::_M_insert(const void*); |
#endif |
|
_GLIBCXX_END_NAMESPACE |
|
// XXX GLIBCXX_ABI Deprecated |
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT |
|
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ |
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) |
_GLIBCXX_LDBL_COMPAT (_ZNSolsEd, _ZNSolsEe); |
#ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd, |
_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe); |
#endif |
_GLIBCXX_LDBL_COMPAT (_ZNSo9_M_insertIdEERSoT_, |
_ZNSo9_M_insertIeEERSoT_); |
#ifdef _GLIBCXX_USE_WCHAR_T |
_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_, |
_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_); |
#endif |
|
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
/hashtable-aux.cc
0,0 → 1,91
// std::__detail and std::tr1::__detail definitions -*- C++ -*- |
|
// Copyright (C) 2007, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
namespace __detail |
{ |
extern const unsigned long __prime_list[] = // 256 + 1 or 256 + 48 + 1 |
{ |
2ul, 3ul, 5ul, 7ul, 11ul, 13ul, 17ul, 19ul, 23ul, 29ul, 31ul, |
37ul, 41ul, 43ul, 47ul, 53ul, 59ul, 61ul, 67ul, 71ul, 73ul, 79ul, |
83ul, 89ul, 97ul, 103ul, 109ul, 113ul, 127ul, 137ul, 139ul, 149ul, |
157ul, 167ul, 179ul, 193ul, 199ul, 211ul, 227ul, 241ul, 257ul, |
277ul, 293ul, 313ul, 337ul, 359ul, 383ul, 409ul, 439ul, 467ul, |
503ul, 541ul, 577ul, 619ul, 661ul, 709ul, 761ul, 823ul, 887ul, |
953ul, 1031ul, 1109ul, 1193ul, 1289ul, 1381ul, 1493ul, 1613ul, |
1741ul, 1879ul, 2029ul, 2179ul, 2357ul, 2549ul, 2753ul, 2971ul, |
3209ul, 3469ul, 3739ul, 4027ul, 4349ul, 4703ul, 5087ul, 5503ul, |
5953ul, 6427ul, 6949ul, 7517ul, 8123ul, 8783ul, 9497ul, 10273ul, |
11113ul, 12011ul, 12983ul, 14033ul, 15173ul, 16411ul, 17749ul, |
19183ul, 20753ul, 22447ul, 24281ul, 26267ul, 28411ul, 30727ul, |
33223ul, 35933ul, 38873ul, 42043ul, 45481ul, 49201ul, 53201ul, |
57557ul, 62233ul, 67307ul, 72817ul, 78779ul, 85229ul, 92203ul, |
99733ul, 107897ul, 116731ul, 126271ul, 136607ul, 147793ul, |
159871ul, 172933ul, 187091ul, 202409ul, 218971ul, 236897ul, |
256279ul, 277261ul, 299951ul, 324503ul, 351061ul, 379787ul, |
410857ul, 444487ul, 480881ul, 520241ul, 562841ul, 608903ul, |
658753ul, 712697ul, 771049ul, 834181ul, 902483ul, 976369ul, |
1056323ul, 1142821ul, 1236397ul, 1337629ul, 1447153ul, 1565659ul, |
1693859ul, 1832561ul, 1982627ul, 2144977ul, 2320627ul, 2510653ul, |
2716249ul, 2938679ul, 3179303ul, 3439651ul, 3721303ul, 4026031ul, |
4355707ul, 4712381ul, 5098259ul, 5515729ul, 5967347ul, 6456007ul, |
6984629ul, 7556579ul, 8175383ul, 8844859ul, 9569143ul, 10352717ul, |
11200489ul, 12117689ul, 13109983ul, 14183539ul, 15345007ul, |
16601593ul, 17961079ul, 19431899ul, 21023161ul, 22744717ul, |
24607243ul, 26622317ul, 28802401ul, 31160981ul, 33712729ul, |
36473443ul, 39460231ul, 42691603ul, 46187573ul, 49969847ul, |
54061849ul, 58488943ul, 63278561ul, 68460391ul, 74066549ul, |
80131819ul, 86693767ul, 93793069ul, 101473717ul, 109783337ul, |
118773397ul, 128499677ul, 139022417ul, 150406843ul, 162723577ul, |
176048909ul, 190465427ul, 206062531ul, 222936881ul, 241193053ul, |
260944219ul, 282312799ul, 305431229ul, 330442829ul, 357502601ul, |
386778277ul, 418451333ul, 452718089ul, 489790921ul, 529899637ul, |
573292817ul, 620239453ul, 671030513ul, 725980837ul, 785430967ul, |
849749479ul, 919334987ul, 994618837ul, 1076067617ul, 1164186217ul, |
1259520799ul, 1362662261ul, 1474249943ul, 1594975441ul, 1725587117ul, |
1866894511ul, 2019773507ul, 2185171673ul, 2364114217ul, 2557710269ul, |
2767159799ul, 2993761039ul, 3238918481ul, 3504151727ul, 3791104843ul, |
4101556399ul, 4294967291ul, |
// Sentinel, so we don't have to test the result of lower_bound, |
// or, on 64-bit machines, rest of the table. |
#if __SIZEOF_LONG__ != 8 |
4294967291ul |
#else |
6442450933ul, 8589934583ul, 12884901857ul, 17179869143ul, |
25769803693ul, 34359738337ul, 51539607367ul, 68719476731ul, |
103079215087ul, 137438953447ul, 206158430123ul, 274877906899ul, |
412316860387ul, 549755813881ul, 824633720731ul, 1099511627689ul, |
1649267441579ul, 2199023255531ul, 3298534883309ul, 4398046511093ul, |
6597069766607ul, 8796093022151ul, 13194139533241ul, 17592186044399ul, |
26388279066581ul, 35184372088777ul, 52776558133177ul, 70368744177643ul, |
105553116266399ul, 140737488355213ul, 211106232532861ul, 281474976710597ul, |
562949953421231ul, 1125899906842597ul, 2251799813685119ul, |
4503599627370449ul, 9007199254740881ul, 18014398509481951ul, |
36028797018963913ul, 72057594037927931ul, 144115188075855859ul, |
288230376151711717ul, 576460752303423433ul, |
1152921504606846883ul, 2305843009213693951ul, |
4611686018427387847ul, 9223372036854775783ul, |
18446744073709551557ul, 18446744073709551557ul |
#endif |
}; |
} // namespace __detail |
/chrono.cc
0,0 → 1,79
// chrono -*- C++ -*- |
|
// Copyright (C) 2008, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <chrono> |
|
#ifdef _GLIBCXX_USE_C99_STDINT_TR1 |
|
// conditional inclusion of sys/time.h for gettimeofday |
#if !defined(_GLIBCXX_USE_CLOCK_MONOTONIC) && \ |
!defined(_GLIBCXX_USE_CLOCK_REALTIME) && \ |
defined(_GLIBCXX_USE_GETTIMEOFDAY) |
#include <sys/time.h> |
#endif |
|
namespace std |
{ |
namespace chrono |
{ |
const bool system_clock::is_monotonic; |
|
system_clock::time_point |
system_clock::now() throw () |
{ |
#ifdef _GLIBCXX_USE_CLOCK_REALTIME |
timespec tp; |
// -EINVAL, -EFAULT |
clock_gettime(CLOCK_REALTIME, &tp); |
return time_point(duration(chrono::seconds(tp.tv_sec) |
+ chrono::nanoseconds(tp.tv_nsec))); |
#elif defined(_GLIBCXX_USE_GETTIMEOFDAY) |
timeval tv; |
// EINVAL, EFAULT |
gettimeofday(&tv, NULL); |
return time_point(duration(chrono::seconds(tv.tv_sec) |
+ chrono::microseconds(tv.tv_usec))); |
#else |
std::time_t __sec = std::time(0); |
return system_clock::from_time_t(__sec); |
#endif |
} |
|
#ifdef _GLIBCXX_USE_CLOCK_MONOTONIC |
const bool monotonic_clock::is_monotonic; |
|
monotonic_clock::time_point |
monotonic_clock::now() |
{ |
timespec tp; |
// -EINVAL, -EFAULT |
clock_gettime(CLOCK_MONOTONIC, &tp); |
return time_point(duration(chrono::seconds(tp.tv_sec) |
+ chrono::nanoseconds(tp.tv_nsec))); |
} |
#endif |
} |
} |
|
#endif // _GLIBCXX_USE_C99_STDINT_TR1 |
/sstream-inst.cc
0,0 → 1,46
// Explicit instantiation file. |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <sstream> |
|
_GLIBCXX_BEGIN_NAMESPACE(std) |
|
template class basic_stringbuf<char>; |
template class basic_istringstream<char>; |
template class basic_ostringstream<char>; |
template class basic_stringstream<char>; |
|
#ifdef _GLIBCXX_USE_WCHAR_T |
template class basic_stringbuf<wchar_t>; |
template class basic_istringstream<wchar_t>; |
template class basic_ostringstream<wchar_t>; |
template class basic_stringstream<wchar_t>; |
#endif |
|
_GLIBCXX_END_NAMESPACE |
/ios.cc
0,0 → 1,190
// Iostreams base classes -*- C++ -*- |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
// 2006, 2007, 2008, 2009, 2010 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 27.4 Iostreams base classes |
// |
|
#include <ios> |
#include <limits> |
|
_GLIBCXX_BEGIN_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() throw() |
: _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_dispatch(&_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(const std::bad_alloc&) |
{ |
_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) throw() |
{ |
_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; |
} |
|
_GLIBCXX_END_NAMESPACE |
/valarray-inst.cc
0,0 → 1,106
// Explicit instantiation file. |
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: |
// |
|
#include <valarray> |
|
_GLIBCXX_BEGIN_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 many dimensions as there are strides. |
const size_t __n = __l.size(); |
|
// Holds current multi-index as we go through the gslice for the |
// purpose of computing its linear-image. |
valarray<size_t> __t(__l); |
|
// Note that this should match the product of all numbers appearing |
// in __l which describes the multidimensional sizes of 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}). |
__i[__j] = __o; |
|
--__t[__n - 1]; |
__o += __s[__n - 1]; |
|
// Process the next multi-index. The loop ought to be |
// backward since we're making a lexicographical visit. |
for (size_t __k2 = __n - 1; __k2 && !__t[__k2]; --__k2) |
{ |
__o -= __s[__k2] * __l[__k2]; |
__t[__k2] = __l[__k2]; |
|
--__t[__k2 - 1]; |
__o += __s[__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); } |
|
_GLIBCXX_END_NAMESPACE |
/math_stubs_float.cc
0,0 → 1,224
// Stub definitions for float math. |
|
// Copyright (C) 2001, 2002, 2003, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
#include <cmath> |
|
// For targets which do not have support for float versions, |
// we use the following crude approximations. We keep saying that we'll do |
// better later, but never do. |
|
extern "C" |
{ |
#ifndef _GLIBCXX_HAVE_FABSF |
float |
fabsf(float x) |
{ |
return (float) fabs(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ACOSF |
float |
acosf(float x) |
{ |
return (float) acos(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ASINF |
float |
asinf(float x) |
{ |
return (float) asin(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ATANF |
float |
atanf(float x) |
{ |
return (float) atan(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_ATAN2F |
float |
atan2f(float x, float y) |
{ |
return (float) atan2(x, y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_CEILF |
float |
ceilf(float x) |
{ |
return (float) ceil(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_COSF |
float |
cosf(float x) |
{ |
return (float) cos(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_COSHF |
float |
coshf(float x) |
{ |
return (float) cosh(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_EXPF |
float |
expf(float x) |
{ |
return (float) exp(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_FLOORF |
float |
floorf(float x) |
{ |
return (float) floor(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_FMODF |
float |
fmodf(float x, float y) |
{ |
return (float) fmod(x, y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_FREXPF |
float |
frexpf(float x, int *exp) |
{ |
return (float) frexp(x, exp); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_SQRTF |
float |
sqrtf(float x) |
{ |
return (float) sqrt(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_HYPOTF |
float |
hypotf(float x, float y) |
{ |
float s = fabsf(x) + fabsf(y); |
if (s == 0.0F) |
return s; |
x /= s; y /= s; |
return s * sqrtf(x * x + y * y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_LDEXPF |
float |
ldexpf(float x, int exp) |
{ |
return (float) ldexp(x, exp); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_LOGF |
float |
logf(float x) |
{ |
return (float) log(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_LOG10F |
float |
log10f(float x) |
{ |
return (float) log10(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_MODFF |
float |
modff(float x, float *iptr) |
{ |
double result, temp; |
|
result = modf(x, &temp); |
*iptr = (float) temp; |
return (float) result; |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_POWF |
float |
powf(float x, float y) |
{ |
return (float) pow(x, y); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_SINF |
float |
sinf(float x) |
{ |
return (float) sin(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_SINHF |
float |
sinhf(float x) |
{ |
return (float) sinh(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_TANF |
float |
tanf(float x) |
{ |
return (float) tan(x); |
} |
#endif |
|
#ifndef _GLIBCXX_HAVE_TANHF |
float |
tanhf(float x) |
{ |
return (float) tanh(x); |
} |
#endif |
} // extern "C" |
/istream.cc
0,0 → 1,687
// Input streams -*- C++ -*- |
|
// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 27.6.1 Input streams |
// |
|
#include <istream> |
|
_GLIBCXX_BEGIN_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::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(__cxxabiv1::__forced_unwind&) |
{ |
this->_M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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 (__n > 0 && __cerb) |
{ |
ios_base::iostate __err = 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 == __gnu_cxx::__numeric_traits<streamsize>::__max |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __delim)) |
{ |
_M_gcount = |
__gnu_cxx::__numeric_traits<streamsize>::__min; |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = __gnu_cxx::__numeric_traits<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 |
< __gnu_cxx::__numeric_traits<streamsize>::__max) |
++_M_gcount; |
__sb->sbumpc(); |
} |
} |
__catch(__cxxabiv1::__forced_unwind&) |
{ |
this->_M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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::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 = __gnu_cxx::__numeric_traits<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(__cxxabiv1::__forced_unwind&) |
{ |
__in._M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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::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(__cxxabiv1::__forced_unwind&) |
{ |
__in._M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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::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(__cxxabiv1::__forced_unwind&) |
{ |
__in._M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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::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(__cxxabiv1::__forced_unwind&) |
{ |
this->_M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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 (__n > 0 && __cerb) |
{ |
ios_base::iostate __err = 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 == __gnu_cxx::__numeric_traits<streamsize>::__max |
&& !traits_type::eq_int_type(__c, __eof) |
&& !traits_type::eq_int_type(__c, __delim)) |
{ |
_M_gcount = |
__gnu_cxx::__numeric_traits<streamsize>::__min; |
__large_ignore = true; |
} |
else |
break; |
} |
|
if (__large_ignore) |
_M_gcount = __gnu_cxx::__numeric_traits<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 |
< __gnu_cxx::__numeric_traits<streamsize>::__max) |
++_M_gcount; |
__sb->sbumpc(); |
} |
} |
__catch(__cxxabiv1::__forced_unwind&) |
{ |
this->_M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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::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(__cxxabiv1::__forced_unwind&) |
{ |
__in._M_setstate(ios_base::badbit); |
__throw_exception_again; |
} |
__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 |
|
_GLIBCXX_END_NAMESPACE |
/thread.cc
0,0 → 1,100
// thread -*- C++ -*- |
|
// Copyright (C) 2008, 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
|
#include <thread> |
#include <cerrno> |
|
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) |
|
namespace std |
{ |
namespace |
{ |
extern "C" void* |
execute_native_thread_routine(void* __p) |
{ |
thread::_Impl_base* __t = static_cast<thread::_Impl_base*>(__p); |
thread::__shared_base_type __local; |
__local.swap(__t->_M_this_ptr); |
|
__try |
{ |
__t->_M_run(); |
} |
__catch(...) |
{ |
std::terminate(); |
} |
|
return 0; |
} |
} |
|
void |
thread::join() |
{ |
int __e = EINVAL; |
|
if (_M_id != id()) |
__e = __gthread_join(_M_id._M_thread, NULL); |
|
if (__e) |
__throw_system_error(__e); |
|
_M_id = id(); |
} |
|
void |
thread::detach() |
{ |
int __e = EINVAL; |
|
if (_M_id != id()) |
__e = __gthread_detach(_M_id._M_thread); |
|
if (__e) |
__throw_system_error(__e); |
|
_M_id = id(); |
} |
|
void |
thread::_M_start_thread(__shared_base_type __b) |
{ |
if (!__gthread_active_p()) |
__throw_system_error(int(errc::operation_not_permitted)); |
|
__b->_M_this_ptr = __b; |
int __e = __gthread_create(&_M_id._M_thread, |
&execute_native_thread_routine, __b.get()); |
if (__e) |
{ |
__b->_M_this_ptr.reset(); |
__throw_system_error(__e); |
} |
} |
} |
|
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 |
/locale-inst.cc
0,0 → 1,361
// Locale support -*- C++ -*- |
|
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
// 2009 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 22.1 Locales |
// |
|
#include <locale> |
|
// Instantiation configuration. |
#ifndef C |
# define C char |
# define C_is_char |
#endif |
|
_GLIBCXX_BEGIN_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>; |
_GLIBCXX_BEGIN_LDBL_NAMESPACE |
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; |
_GLIBCXX_END_LDBL_NAMESPACE |
|
// numpunct, numpunct_byname, num_get, and num_put |
template class numpunct<C>; |
template struct __numpunct_cache<C>; |
template class numpunct_byname<C>; |
_GLIBCXX_BEGIN_LDBL_NAMESPACE |
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; |
_GLIBCXX_END_LDBL_NAMESPACE |
|
// 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 |
template |
const ctype<C>& |
use_facet<ctype<C> >(const locale&); |
|
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 |
|
_GLIBCXX_END_NAMESPACE |
|
// XXX GLIBCXX_ABI Deprecated |
#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined C_is_char |
|
#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \ |
extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak)) |
|
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIjEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIlEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intImEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intItEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIxEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_, |
_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intIyEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_, |
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES4_S4_RSt8ios_basecT_, |
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intImEES3_S3_RSt8ios_basecT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES4_S4_RSt8ios_basecT_, |
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIxEES3_S3_RSt8ios_basecT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES4_S4_RSt8ios_basecT_, |
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIyEES3_S3_RSt8ios_basecT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES4_S4_RSt8ios_baseccT_, |
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIdEES3_S3_RSt8ios_baseccT_, |
_ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE15_M_insert_floatIeEES3_S3_RSt8ios_baseccT_); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, |
_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb0EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRSs, |
_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10_M_extractILb1EEES3_S3_S3_RSt8ios_baseRSt12_Ios_IostateRSs); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES4_S4_RSt8ios_basecRKSs, |
_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb0EEES3_S3_RSt8ios_basecRKSs); |
_GLIBCXX_LDBL_COMPAT(_ZNKSt17__gnu_cxx_ldbl1289money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES4_S4_RSt8ios_basecRKSs, |
_ZNKSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE9_M_insertILb1EEES3_S3_RSt8ios_basecRKSs); |
|
#endif // _GLIBCXX_LONG_DOUBLE_COMPAT |
/ios_init.cc
0,0 → 1,199
// Iostreams base classes -*- C++ -*- |
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
// 2006, 2007, 2008, 2009 |
// 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 3, 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. |
|
// Under Section 7 of GPL version 3, you are granted additional |
// permissions described in the GCC Runtime Library Exception, version |
// 3.1, as published by the Free Software Foundation. |
|
// You should have received a copy of the GNU General Public License and |
// a copy of the GCC Runtime Library Exception along with this program; |
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
// <http://www.gnu.org/licenses/>. |
|
// |
// ISO C++ 14882: 27.4 Iostreams base classes |
// |
|
#include <ios> |
#include <ostream> |
#include <istream> |
#include <fstream> |
#include <ext/stdio_filebuf.h> |
#include <ext/stdio_sync_filebuf.h> |
|
namespace __gnu_internal _GLIBCXX_VISIBILITY_ATTR(hidden) |
{ |
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 |
|
_GLIBCXX_BEGIN_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_dispatch(&_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.setf(ios_base::unitbuf); |
// _GLIBCXX_RESOLVE_LIB_DEFECTS |
// 455. cerr::tie() and wcerr::tie() are overspecified. |
cerr.tie(&cout); |
|
#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.setf(ios_base::unitbuf); |
wcerr.tie(&wcout); |
#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_dispatch(&_S_refcount, 1); |
} |
} |
|
ios_base::Init::~Init() |
{ |
if (__gnu_cxx::__exchange_and_add_dispatch(&_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; |
} |
|
_GLIBCXX_END_NAMESPACE |
/Makefile.am
0,0 → 1,411
## Makefile for the src subdirectory of the GNU C++ Standard library. |
## |
## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
## 2006, 2007, 2008, 2009, 2010 |
## 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 3, 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 COPYING3. If not see |
## <http://www.gnu.org/licenses/>. |
|
include $(top_srcdir)/fragment.am |
|
# Cross compiler support. |
toolexeclib_LTLIBRARIES = libstdc++.la |
|
# Symbol versioning for shared libraries. |
if ENABLE_SYMVERS |
libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ |
$(port_specific_symbol_files) |
cp ${glibcxx_srcdir}/$(SYMVER_FILE) ./libstdc++-symbols.ver |
chmod +w ./libstdc++-symbols.ver |
if test "x$(port_specific_symbol_files)" != x; then \ |
if grep '^# Appended to version file.' \ |
$(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \ |
cat $(port_specific_symbol_files) >> $@; \ |
else \ |
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; \ |
fi |
|
if ENABLE_SYMVERS_GNU |
version_arg = -Wl,--version-script=libstdc++-symbols.ver |
version_dep = libstdc++-symbols.ver |
endif |
if ENABLE_SYMVERS_GNU_NAMESPACE |
version_arg = -Wl,--version-script=libstdc++-symbols.ver |
version_dep = libstdc++-symbols.ver |
endif |
if ENABLE_SYMVERS_DARWIN |
version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist |
version_dep = libstdc++-symbols.explist |
libstdc++-symbols.explist : libstdc++-symbols.ver \ |
${glibcxx_srcdir}/scripts/make_exports.pl \ |
$(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) |
perl ${glibcxx_srcdir}/scripts/make_exports.pl \ |
libstdc++-symbols.ver \ |
$(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ |
`echo $(libstdc___la_LIBADD) | \ |
sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ |
> $@ || (rm -f $@ ; exit 1) |
endif |
else |
version_arg = |
version_dep = |
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 ${ldbl_compat_sources} ${parallel_sources} |
|
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 |
|
if ENABLE_PARALLEL |
parallel_sources = parallel_list.cc parallel_settings.cc \ |
compatibility-parallel_list.cc |
else |
parallel_sources = |
endif |
|
if GLIBCXX_LDBL_COMPAT |
ldbl_compat_sources = compatibility-ldbl.cc |
else |
ldbl_compat_sources = |
endif |
|
# Sources present in the src directory. |
sources = \ |
atomic.cc \ |
bitmap_allocator.cc \ |
pool_allocator.cc \ |
mt_allocator.cc \ |
codecvt.cc \ |
compatibility.cc \ |
compatibility-c++0x.cc \ |
compatibility-debug_list.cc \ |
compatibility-list.cc \ |
complex_io.cc \ |
ctype.cc \ |
debug.cc \ |
functexcept.cc \ |
globals_io.cc \ |
hash_c++0x.cc \ |
hash_tr1.cc \ |
hashtable_c++0x.cc \ |
hashtable_tr1.cc \ |
ios.cc \ |
ios_failure.cc \ |
ios_init.cc \ |
ios_locale.cc \ |
limits.cc \ |
list.cc \ |
debug_list.cc \ |
locale.cc \ |
locale_init.cc \ |
locale_facets.cc \ |
localename.cc \ |
math_stubs_float.cc \ |
math_stubs_long_double.cc \ |
stdexcept.cc \ |
strstream.cc \ |
system_error.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 \ |
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 \ |
mutex.cc \ |
condition_variable.cc \ |
chrono.cc \ |
thread.cc \ |
future.cc \ |
${host_sources} \ |
${host_sources_extra} |
|
vpath % $(top_srcdir)/src |
vpath % $(top_srcdir) |
|
libstdc___la_SOURCES = $(sources) |
|
libstdc___la_LIBADD = \ |
$(GLIBCXX_LIBS) \ |
$(top_builddir)/libsupc++/libsupc++convenience.la |
|
libstdc___la_DEPENDENCIES = \ |
${version_dep} \ |
$(top_builddir)/libsupc++/libsupc++convenience.la |
|
libstdc___la_LDFLAGS = \ |
-version-info $(libtool_VERSION) ${version_arg} -lm |
|
libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) |
|
# 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 $< |
|
# Use special rules for parallel mode compilation. |
PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp |
parallel_list.lo: parallel_list.cc |
$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
parallel_list.o: parallel_list.cc |
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
|
parallel_settings.lo: parallel_settings.cc |
$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
parallel_settings.o: parallel_settings.cc |
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
|
compatibility-parallel_list.lo: compatibility-parallel_list.cc |
$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
compatibility-parallel_list.o: compatibility-parallel_list.cc |
$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $< |
|
# Use special rules for the C++0x sources so that the proper flags are passed. |
functexcept.lo: functexcept.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
functexcept.o: functexcept.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
system_error.lo: system_error.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
system_error.o: system_error.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
mutex.lo: mutex.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
mutex.o: mutex.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
condition_variable.lo: condition_variable.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
condition_variable.o: condition_variable.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
compatibility-c++0x.lo: compatibility-c++0x.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
compatibility-c++0x.o: compatibility-c++0x.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
hash_c++0x.lo: hash_c++0x.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
hash_c++0x.o: hash_c++0x.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
hashtable_c++0x.lo: hashtable_c++0x.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
hashtable_c++0x.o: hashtable_c++0x.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
limits.lo: limits.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
limits.o: limits.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
atomic.lo: atomic.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
atomic.o: atomic.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
fstream-inst.lo: fstream-inst.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
fstream-inst.o: fstream-inst.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
string-inst.lo: string-inst.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
string-inst.o: string-inst.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
wstring-inst.lo: wstring-inst.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
wstring-inst.o: wstring-inst.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
chrono.lo: chrono.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
chrono.o: chrono.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
thread.lo: thread.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
thread.o: thread.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
future.lo: future.cc |
$(LTCXXCOMPILE) -std=gnu++0x -c $< |
future.o: future.cc |
$(CXXCOMPILE) -std=gnu++0x -c $< |
|
if GLIBCXX_LDBL_COMPAT |
# Use special rules for compatibility-ldbl.cc compilation, as we need to |
# pass -mlong-double-64. |
compatibility-ldbl.lo: compatibility-ldbl.cc |
$(LTCXXCOMPILE) -mlong-double-64 -c $< |
compatibility-ldbl.o: compatibility-ldbl.cc |
$(CXXCOMPILE) -mlong-double-64 -c $< |
endif |
|
# 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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \ |
$(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) |
|
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) |
|
# 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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ |
$(CXX) $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -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 a 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) |
Makefile.am
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: debug.cc
===================================================================
--- debug.cc (nonexistent)
+++ debug.cc (revision 826)
@@ -0,0 +1,720 @@
+// Debugging mode support code -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// .
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+
+namespace
+{
+ __gnu_cxx::__mutex&
+ get_safe_base_mutex()
+ {
+ static __gnu_cxx::__mutex safe_base_mutex;
+ return safe_base_mutex;
+ }
+} // anonymous namespace
+
+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()
+ {
+ __gnu_cxx::__scoped_lock sentry(_M_get_mutex());
+ for (_Safe_iterator_base* __iter = _M_iterators; __iter;)
+ {
+ _Safe_iterator_base* __old = __iter;
+ __iter = __iter->_M_next;
+ __old->_M_detach_single();
+ }
+
+ for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;)
+ {
+ _Safe_iterator_base* __old = __iter2;
+ __iter2 = __iter2->_M_next;
+ __old->_M_detach_single();
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_detach_singular()
+ {
+ __gnu_cxx::__scoped_lock sentry(_M_get_mutex());
+ for (_Safe_iterator_base* __iter = _M_iterators; __iter;)
+ {
+ _Safe_iterator_base* __old = __iter;
+ __iter = __iter->_M_next;
+ if (__old->_M_singular())
+ __old->_M_detach_single();
+ }
+
+ for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;)
+ {
+ _Safe_iterator_base* __old = __iter2;
+ __iter2 = __iter2->_M_next;
+ if (__old->_M_singular())
+ __old->_M_detach_single();
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_revalidate_singular()
+ {
+ __gnu_cxx::__scoped_lock sentry(_M_get_mutex());
+ for (_Safe_iterator_base* __iter = _M_iterators; __iter;
+ __iter = __iter->_M_next)
+ __iter->_M_version = _M_version;
+
+ for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;
+ __iter2 = __iter2->_M_next)
+ __iter2->_M_version = _M_version;
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_swap(_Safe_sequence_base& __x)
+ {
+ __gnu_cxx::__scoped_lock sentry(_M_get_mutex());
+ 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;
+ }
+
+ __gnu_cxx::__mutex&
+ _Safe_sequence_base::
+ _M_get_mutex() throw ()
+ { return get_safe_base_mutex(); }
+
+ void
+ _Safe_iterator_base::
+ _M_attach(_Safe_sequence_base* __seq, bool __constant)
+ {
+ __gnu_cxx::__scoped_lock sentry(_M_get_mutex());
+ _M_attach_single(__seq, __constant);
+ }
+
+ void
+ _Safe_iterator_base::
+ _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ()
+ {
+ _M_detach_single();
+
+ // Attach to the new sequence (if there is one)
+ if (__seq)
+ {
+ _M_sequence = __seq;
+ _M_version = _M_sequence->_M_version;
+ _M_prior = 0;
+ if (__constant)
+ {
+ _M_next = _M_sequence->_M_const_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_const_iterators = this;
+ }
+ else
+ {
+ _M_next = _M_sequence->_M_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_iterators = this;
+ }
+ }
+ }
+
+ void
+ _Safe_iterator_base::
+ _M_detach()
+ {
+ __gnu_cxx::__scoped_lock sentry(_M_get_mutex());
+ _M_detach_single();
+ }
+
+ void
+ _Safe_iterator_base::
+ _M_detach_single() throw ()
+ {
+ 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 throw ()
+ { return !_M_sequence || _M_version != _M_sequence->_M_version; }
+
+ bool
+ _Safe_iterator_base::
+ _M_can_compare(const _Safe_iterator_base& __x) const throw ()
+ {
+ return (!_M_singular()
+ && !__x._M_singular() && _M_sequence == __x._M_sequence);
+ }
+
+ __gnu_cxx::__mutex&
+ _Safe_iterator_base::
+ _M_get_mutex() throw ()
+ { return get_safe_base_mutex(); }
+
+ 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)
+ {
+ if (!_M_variant._M_iterator._M_type)
+ __formatter->_M_print_word("");
+ else
+ // 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] =
+ {
+ "",
+ "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] =
+ {
+ "",
+ "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)
+ {
+ if (!_M_variant._M_iterator._M_seq_type)
+ __formatter->_M_print_word("");
+ else
+ // TBD: demangle!
+ __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)
+ {
+ if (!_M_variant._M_sequence._M_type)
+ __formatter->_M_print_word("");
+ else
+ // TBD: demangle!
+ __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 throw ()
+ { 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);
+ }
+
+ if (_M_max_length)
+ _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
+ void
+ _Error_formatter::_M_format_word(char* __buf,
+ int __n __attribute__ ((__unused__)),
+ const char* __fmt, _Tp __s) const throw ()
+ {
+#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* __finish = __start;
+ const int __bufsize = 128;
+ char __buf[__bufsize];
+
+ while (*__start)
+ {
+ if (*__start != '%')
+ {
+ // [__start, __finish) denotes the next word
+ __finish = __start;
+ while (isalnum(*__finish))
+ ++__finish;
+ if (__start == __finish)
+ ++__finish;
+ if (isspace(*__finish))
+ ++__finish;
+
+ const ptrdiff_t __len = __finish - __start;
+ assert(__len < __bufsize);
+ memcpy(__buf, __start, __len);
+ __buf[__len] = '\0';
+ _M_print_word(__buf);
+ __start = __finish;
+
+ // 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);
+ }
+ }
+
+ void
+ _Error_formatter::_M_get_max_length() const throw ()
+ {
+ const char* __nptr = std::getenv("GLIBCXX_DEBUG_MESSAGE_LENGTH");
+ if (__nptr)
+ {
+ char* __endptr;
+ const unsigned long __ret = std::strtoul(__nptr, &__endptr, 0);
+ if (*__nptr != '\0' && *__endptr == '\0')
+ _M_max_length = __ret;
+ }
+ }
+
+ // 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
Index: compatibility-c++0x.cc
===================================================================
--- compatibility-c++0x.cc (nonexistent)
+++ compatibility-c++0x.cc (revision 826)
@@ -0,0 +1,62 @@
+// Compatibility symbols for previous versions, C++0x bits -*- C++ -*-
+
+// Copyright (C) 2009, 2010 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// .
+
+#define _GLIBCXX_COMPATIBILITY_CXX0X
+#include
+#include
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# error "compatibility-c++0x.cc must be compiled with -std=gnu++0x"
+#endif
+
+namespace std
+{
+ // gcc-4.4.0
+ // exported std::lock_error
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+ class lock_error : public exception
+ {
+ public:
+ virtual const char*
+ _GLIBCXX_CONST what() const throw();
+ };
+
+ const char*
+ lock_error::what() const throw()
+ { return "std::lock_error"; }
+#endif
+
+ // We need these due to the symbols exported since GLIBCXX_3.4.10.
+ // See libstdc++/41662 for details.
+
+#include "hash-string-aux.cc"
+
+ template<>
+ size_t
+ hash::operator()(error_code __e) const
+ {
+ const size_t __tmp = std::_Fnv_hash::hash(__e._M_value);
+ return std::_Fnv_hash::__hash_combine(__e._M_cat, __tmp);
+ }
+}