libstdc++-v3: New directory.

2000-04-21  Benjamin Kosnik  <bkoz@redhat.com>

	* libstdc++-v3: New directory.

From-SVN: r33317
This commit is contained in:
Benjamin Kosnik 2000-04-21 20:33:34 +00:00
parent 051d082b26
commit b2dad0e372
486 changed files with 109649 additions and 0 deletions

5936
libstdc++-v3/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

147
libstdc++-v3/Makefile.am Normal file
View File

@ -0,0 +1,147 @@
## Makefile for the toplevel directory of the GNU C++ Standard library.
##
## Copyright (C) 1997,1998, 1999, 2000 Free Software Foundation, Inc.
##
## This file is part of the libstdc++ version 3 distribution.
## Process this file with automake to produce Makefile.in.
## This file is part of the GNU ISO C++ Library. This library is free
## software; you can redistribute it and/or modify it under the
## terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2, or (at your option)
## any later version.
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License along
## with this library; see the file COPYING. If not, write to the Free
## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
## USA.
AUTOMAKE_OPTIONS = 1.3 cygnus
MAINT_CHARSET = latin1
# This helps subvert libstdcxx_interface, as calculated by devo/config.if
# Needed so that g++ can find the correct include subdir automatically.
INTERFACE = v3
gxx_include_dir=$(includedir)/g++
SUBDIRS = math libio src
check: $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 0 $(top_builddir) $(top_srcdir)
check-install: $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 1 $(top_builddir) $(top_srcdir) $(prefix)
#all-local: stamp-rebuild
# This has already been sanity-checked by configure to a certain extent
#stamp-rebuild: $(top_builddir)/config.status
# if test "$(GCC_OBJDIR)" != "no"; then \
# (cd "$(GCC_OBJDIR)/gcc" && \
# if test -f libgcc2.ready ; then \
# rm -f libgcc2.ready libgcc.a libgcc2.a ; \
# $(MAKE) libgcc2.a TARGET_LIBGCC2_CFLAGS='@NAMESPACES@' ; \
# $(MAKE) libgcc.a ; \
# else \
# echo '** There does not appear to be a previously-built' ; \
# echo '** library here. Please see' ; \
# echo '** <http://sourceware.cygnus.com/libstdc++/install.html>' ; \
# echo '** In particular, the "Building and Installing' ; \
# echo '** the library (without GCC sources)" section.' ; \
# exit 1 ; \
# fi \
# ) \
# fi
# touch stamp-rebuild
# Multilib support.
MAKEOVERRIDES=
# Multilib variables.
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
# Multilib Makefile bits.
.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
maintainer-clean-multi
all-am: all-multi
install-am: install-multi
mostlyclean-am: mostlyclean-multi
clean-am: clean-multi
distclean-am: distclean-multi
maintainer-clean-am: maintainer-clean-multi
all-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
mostlyclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"EXPECT=$(EXPECT)" \
"RUNTEST=$(RUNTEST)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"includedir=$(includedir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"NM=$(NM)" \
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
"DESTDIR=$(DESTDIR)"

509
libstdc++-v3/Makefile.in Normal file
View File

@ -0,0 +1,509 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
BUILD_LIBIO_INCLUDE = @BUILD_LIBIO_INCLUDE@
CC = @CC@
CPP = @CPP@
CSTDIO_CC = @CSTDIO_CC@
CSTDIO_H = @CSTDIO_H@
CXX = @CXX@
CXXCPP = @CXXCPP@
DEBUGFLAGS = @DEBUGFLAGS@
DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@
GCC_OBJDIR = @GCC_OBJDIR@
GLIBCPP_CFLAGS = @GLIBCPP_CFLAGS@
GLIBCPP_CXXFLAGS = @GLIBCPP_CXXFLAGS@
LIBMATHOBJS = @LIBMATHOBJS@
LIBSTRINGOBJS = @LIBSTRINGOBJS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
NAMESPACES = @NAMESPACES@
OBJDUMP = @OBJDUMP@
OPTLEVEL = @OPTLEVEL@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
THREADDEPS = @THREADDEPS@
THREADINCS = @THREADINCS@
THREADLIBS = @THREADLIBS@
THREADOBJS = @THREADOBJS@
THREADSPEC = @THREADSPEC@
USE_LONG_DOUBLE = @USE_LONG_DOUBLE@
VERSION = @VERSION@
WERRORSUPPRESS = @WERRORSUPPRESS@
cpu_include_dir = @cpu_include_dir@
ctype_include_dir = @ctype_include_dir@
glibcpp_basedir = @glibcpp_basedir@
AUTOMAKE_OPTIONS = 1.3 cygnus
MAINT_CHARSET = latin1
# This helps subvert libstdcxx_interface, as calculated by devo/config.if
# Needed so that g++ can find the correct include subdir automatically.
INTERFACE = v3
gxx_include_dir = $(includedir)/g++
SUBDIRS = math libio src
#all-local: stamp-rebuild
# This has already been sanity-checked by configure to a certain extent
#stamp-rebuild: $(top_builddir)/config.status
# if test "$(GCC_OBJDIR)" != "no"; then \
# (cd "$(GCC_OBJDIR)/gcc" && \
# if test -f libgcc2.ready ; then \
# rm -f libgcc2.ready libgcc.a libgcc2.a ; \
# $(MAKE) libgcc2.a TARGET_LIBGCC2_CFLAGS='@NAMESPACES@' ; \
# $(MAKE) libgcc.a ; \
# else \
# echo '** There does not appear to be a previously-built' ; \
# echo '** library here. Please see' ; \
# echo '** <http://sourceware.cygnus.com/libstdc++/install.html>' ; \
# echo '** In particular, the "Building and Installing' ; \
# echo '** the library (without GCC sources)" section.' ; \
# exit 1 ; \
# fi \
# ) \
# fi
# touch stamp-rebuild
# Multilib support.
MAKEOVERRIDES =
# Multilib variables.
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"EXPECT=$(EXPECT)" \
"RUNTEST=$(RUNTEST)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"includedir=$(includedir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"NM=$(NM)" \
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
"DESTDIR=$(DESTDIR)"
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = mkcheck
DIST_COMMON = README ./stamp-h.in ChangeLog Makefile.am Makefile.in \
acconfig.h acinclude.m4 aclocal.m4 config.h.in configure configure.in \
mkcheck.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h
@if test ! -f $@; then \
rm -f stamp-h; \
$(MAKE) stamp-h; \
else :; fi
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
$(SHELL) ./config.status
@echo timestamp > stamp-h 2> /dev/null
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in
@if test ! -f $@; then \
rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \
else :; fi
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f config.h
maintainer-clean-hdr:
mkcheck: $(top_builddir)/config.status mkcheck.in
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
@SET_MAKE@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive install-info-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
test "$$subdir" = "." && dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
for subdir in $(SUBDIRS); do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
fi; \
done
info-am:
info: info-recursive
dvi-am:
dvi: dvi-recursive
check-am:
check: check-recursive
installcheck-am:
installcheck: installcheck-recursive
install-info-am:
install-info: install-info-recursive
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
install-exec-am:
install-exec: install-exec-recursive
install-data-am:
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive
uninstall-am:
uninstall: uninstall-recursive
all-am: Makefile config.h
all-redirect: all-recursive-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive
installdirs-am:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
clean: clean-recursive
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
-rm -f libtool
distclean: distclean-recursive
-rm -f config.status
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-recursive
-rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
install-data-recursive uninstall-data-recursive install-exec-recursive \
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
all-recursive check-recursive installcheck-recursive info-recursive \
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-info-am \
install-info all-recursive-am install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs-am installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
check: $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 0 $(top_builddir) $(top_srcdir)
check-install: $(top_builddir)/mkcheck
$(top_builddir)/mkcheck 1 $(top_builddir) $(top_srcdir) $(prefix)
# Multilib Makefile bits.
.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
maintainer-clean-multi
all-am: all-multi
install-am: install-multi
mostlyclean-am: mostlyclean-multi
clean-am: clean-multi
distclean-am: distclean-multi
maintainer-clean-am: maintainer-clean-multi
all-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
mostlyclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
# 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:

94
libstdc++-v3/README Normal file
View File

@ -0,0 +1,94 @@
file: isolib/README
New users may wish to point their web browsers to the file index.html
in the 'docs' subdirectory. It contains brief building instructions
and notes on how to configure the library in interesting ways.
Instructions for configuring and building this snapshot appear
in install.html.
This directory contains the files needed to create [a still broken
subset of] an ISO Standard C++ Library.
It has subdirectories:
bits
Files included by standard headers and by other files in
the bits directory. Includes a set of files bits/std_xxxx.h
that implement the standard headers <xxxx>.
std
Files meant to be found by #include <name> directives in
standard-conforming user programs. These headers are not
referred to by other headers, because such dependencies
confuse Make (leading it to delete them, all too often).
Installations may substitute symbolic links in place of
these files.
ext
Headers that define extensions to the standard library. No
standard header refers to any of them.
backward
Headers provided for backward compatibility, such as <iostream.h>.
They are not used in this library.
src
Files that are used in constructing the library, but are not
installed.
testsuites/17_* to 27_*
Test programs are here, and may be used to begin to exercise the
library. Support for "make check" and "make check-install" is
complete, and runs through all the subdirectories here when this
command is issued from the build directory. Please note that
"make check" calls the script mkcheck, which requires bash, and which
may need the paths to bash adjusted to work properly, as /bin/bash is
assumed.
shadow
Headers intended to shadow standard C headers provided by an
underlying OS or C library, and other headers depended on directly
by C++ headers (e.g. unistd.h). These are meant to wrap the names
defined there into the _CSwamp namespace.
[NB: this is still experimental, and is not currently used.]
cshadow
The contents of this directory are constructed by scripts which
examine the underlying C headers to discover other headers they
depend on. These headers are wrappers for them.
[NB: this is still experimental, and is not currently used.]
Other subdirectories contain variant versions of certain files
that are meant to be copied or linked by the configure script.
Currently these are:
amm1 generic glibc math
Files needed only to construct the library, but not installed,
are in src/. Files to be copied as part of an installation are
all found in the subdirectories mentioned above. (A configure
script may link files from another directory into one of these.)
In a normal installation the bits/ directory is copied
under the std/ directory, and arranged to be searched only
when an include directive specifies a filename of "bits/..."
or <bits/...>. When building the library, we use
-Istd -I. -Iconfig/* -Iconfig/cpu/*
to get the same effect.
Note that glibc also has a bits/ subdirectory. We will either
need to be careful not to collide with names in its bits/
directory; or rename bits to (e.g.) cppbits/.
To install libstdc++ you need GNU make. The makefiles do not work with
any other make.
In files throughout the system, lines marked with an "XXX" indicate
a bug or incompletely-implemented feature. Lines marked "XXX MT"
indicate a place that may require attention for multi-thread safety.
(Warning: places that need an atomic read are not so marked yet.)

199
libstdc++-v3/acconfig.h Normal file
View File

@ -0,0 +1,199 @@
// acconfig.h symbols and macros for libstdc++ v3 -*- C++ -*-
// If using the namespace std, you need this. Eventually this should
// not be an option. In the meantime, and as things like std_ctype.h
// need to be hacked out, give people the option. If this is set to 1,
// CXXFLAGS should include -fhonor-std. If this is undefined, CXXFLAGS
// should include -fno-honor-std.
#undef _GLIBCPP_USE_NAMESPACES
// Include support for 'long long' and 'unsigned long long'.
#undef _GLIBCPP_USE_LONG_LONG
// Define if the host has a type mbstate_t defined in
// wchar.h, as required by 21.1.3.1. Some systems, namely
// hppa-hp-hpux10.20 do not meet this requirement, and must be worked
// around.
#undef _GLIBCPP_NEED_MBSTATE_T
// Define if WCHAR_MIN and WCHAR_MAX are in the <cwchar_t>
// header. Presently, this is needed so that solaris won't
// instantitate numeric_limits<wchar_t>
#undef _GLIBCPP_HAS_WCHAR_MIN_MAX
// Define if code specialized for wchar_t should be used.
#undef _GLIBCPP_USE_WCHAR_T
// Define if the compiler/host combination has __builtin_sinf defined.
#undef _GLIBCPP_HAS_BUILTIN_SINF
// Define if the compiler/host combination has __builtin_cosf defined.
#undef _GLIBCPP_HAS_BUILTIN_COSF
// Define if the compiler/host combination has __builtin_fabsf defined.
#undef _GLIBCPP_HAS_BUILTIN_FABSF
// Define if the compiler/host combination has __builtin_fabsf defined.
#undef _GLIBCPP_HAS_BUILTIN_SQRTF
// Define if GCC support for __complex__ float is buggy.
#undef _GLIBCPP_BUGGY_FLOAT_COMPLEX
// Define if GCC support for __complex__ is buggy.
#undef _GLIBCPP_BUGGY_COMPLEX
// Define if LC_MESSAGES is available in <locale.h>.
#undef HAVE_LC_MESSAGES
// Define if <float.h> exists.
#undef HAVE_FLOAT_H
// Define if modf is present in <math.h>
#undef HAVE_MODF
// @BOTTOM@
//
// Systems that have certain non-standard functions prefixed with an
// underscore, we'll handle those here. Must come after config.h.in.
//
#if defined (HAVE__ISNAN) && ! defined (HAVE_ISNAN)
# define HAVE_ISNAN 1
# define isnan _isnan
#endif
#if defined (HAVE__ISNANF) && ! defined (HAVE_ISNANF)
# define HAVE_ISNANF 1
# define isnanf _isnanf
#endif
#if defined (HAVE__ISNANL) && ! defined (HAVE_ISNANL)
# define HAVE_ISNANL 1
# define isnanl _isnanl
#endif
#if defined (HAVE__ISINF) && ! defined (HAVE_ISINF)
# define HAVE_ISINF 1
# define isinf _isinf
#endif
#if defined (HAVE__ISINFF) && ! defined (HAVE_ISINFF)
# define HAVE_ISINFF 1
# define isinff _isinff
#endif
#if defined (HAVE__ISINFL) && ! defined (HAVE_ISINFL)
# define HAVE_ISINFL 1
# define isinfl _isinfl
#endif
#if defined (HAVE__COPYSIGN) && ! defined (HAVE_COPYSIGN)
# define HAVE_COPYSIGN 1
# define copysign _copysign
#endif
#if defined (HAVE__COPYSIGNL) && ! defined (HAVE_COPYSIGNL)
# define HAVE_COPYSIGNL 1
# define copysignl _copysignl
#endif
#if defined (HAVE__COSF) && ! defined (HAVE_COSF)
# define HAVE_COSF 1
# define cosf _cosf
#endif
#if defined (HAVE__COSHF) && ! defined (HAVE_COSHF)
# define HAVE_COSHF 1
# define coshf _coshf
#endif
#if defined (HAVE__LOGF) && ! defined (HAVE_LOGF)
# define HAVE_LOGF 1
# define logf _logf
#endif
#if defined (HAVE__LOG10F) && ! defined (HAVE_LOG10F)
# define HAVE_LOG10F 1
# define log10f _log10f
#endif
#if defined (HAVE__POWF) && ! defined (HAVE_POWF)
# define HAVE_POWF 1
# define powf _powf
#endif
#if defined (HAVE__SINF) && ! defined (HAVE_SINF)
# define HAVE_SINF 1
# define sinf _sinf
#endif
#if defined (HAVE__SINHF) && ! defined (HAVE_SINHF)
# define HAVE_SINHF 1
# define sinhf _sinhf
#endif
#if defined (HAVE__SQRTF) && ! defined (HAVE_SQRTF)
# define HAVE_SQRTF 1
# define sqrtf _sqrtf
#endif
#if defined (HAVE__TANF) && ! defined (HAVE_TANF)
# define HAVE_TANF 1
# define tanf _tanf
#endif
#if defined (HAVE__TANHF) && ! defined (HAVE_TANHF)
# define HAVE_TANHF 1
# define tanhf _tanhf
#endif
#if defined (HAVE__STRTOF) && ! defined (HAVE_STRTOF)
# define HAVE_STRTOF 1
# define strtof _strtof
#endif
#if defined (HAVE__STRTOLD) && ! defined (HAVE_STRTOLD)
# define HAVE_STRTOLD 1
# define strtold _strtold
#endif
#if defined (HAVE__FABSF) && ! defined (HAVE_FABSF)
# define HAVE_FABSF 1
# define fabsf _fabsf
#endif
#if defined (HAVE__SINCOS) && ! defined (HAVE_SINCOS)
# define HAVE_SINCOS 1
# define sincos _sincos
#endif
#if defined (HAVE__SINCOSF) && ! defined (HAVE_SINCOSF)
# define HAVE_SINCOSF 1
# define sincosf _sincosf
#endif
#if defined (HAVE__SINCOSL) && ! defined (HAVE_SINCOSL)
# define HAVE_SINCOSL 1
# define sincosl _sincosl
#endif
#if defined (HAVE__FINITE) && ! defined (HAVE_FINITE)
# define HAVE_FINITE 1
# define finite _finite
#endif
#if defined (HAVE__QFINITE) && ! defined (HAVE_QFINITE)
# define HAVE_QFINITE 1
# define qfinite _qfinite
#endif
#if defined (HAVE__FPCLASS) && ! defined (HAVE_FPCLASS)
# define HAVE_FPCLASS 1
# define fpclass _fpclass
#endif
#if defined (HAVE__QFPCLASS) && ! defined (HAVE_QFPCLASS)
# define HAVE_QFPCLASS 1
# define qfpclass _qfpclass
#endif

881
libstdc++-v3/acinclude.m4 Normal file
View File

@ -0,0 +1,881 @@
dnl
dnl Initialize configure bits.
dnl
dnl Define OPTLEVEL='-O2' if new inlining code present.
dnl
dnl GLIBCPP_CONFIGURE
AC_DEFUN(GLIBCPP_CONFIGURE, [
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build hella library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl We may get other options which we dont document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
glibcpp_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(glibcpp_basedir)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
dnl Fool anybody using AC_PROG_CC.
AC_PROVIDE([AC_PROG_CC])
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# Likewise for AC_PROG_CXX.
AC_DEFUN(LIB_AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
dnl Fool anybody using AC_PROG_CXX.
AC_PROVIDE([AC_PROG_CXX])
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
fi
else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
LIB_AC_PROG_CXX
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
# run it explicitly here, it will be run implicitly before
# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which cant create executables. So we include AC_EXEEXT to keep
# automake happy, but we dont execute it, since we dont care about
# the result.
if false; then
AC_EXEEXT
fi
# configure.host sets the following important variables
# glibcpp_cflags - host specific C compiler flags
# glibcpp_cxxflags - host specific C++ compiler flags
glibcpp_cflags=
glibcpp_cxxflags=
. [$]{glibcpp_basedir}/configure.host
case [$]{glibcpp_basedir} in
/* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
*) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
esac
GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
AC_SUBST(GLIBCPP_CFLAGS)
AC_SUBST(GLIBCPP_CXXFLAGS)
])
dnl
dnl Check to see if g++ can compile this library.
dnl
dnl Define OPTLEVEL='-O2' if new inlining code present.
dnl
dnl GLIBCPP_CHECK_COMPILER_VERSION
AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
AC_MSG_CHECKING([for g++ that will successfullly compile this code])
AC_EGREP_CPP([ok], [
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
ok
#endif
], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
AC_MSG_RESULT($gpp_satisfactory)
AC_MSG_CHECKING([for g++ that supports new inlining mechanism])
AC_EGREP_CPP([ok], [
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
ok
#endif
], [OPTLEVEL='-O2'
WERRORSUPPRESS=
], [OPTLEVEL=
WERRORSUPPRESS=-Wno-error
])
if test "$OPTLEVEL" = ""; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
AC_SUBST(OPTLEVEL)
AC_SUBST(WERRORSUPPRESS)
])
dnl
dnl Check to see what builtin math functions are supported
dnl
dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
dnl
dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
dnl Test for builtin math functions.
AC_MSG_CHECKING([for __builtin_sinf])
AC_TRY_COMPILE([#include <math.h>],
[float foo(void) { __builtin_sinf(0.0); }],
use_builtin_sinf=yes, use_builtin_sinf=no)
AC_MSG_RESULT($use_builtin_sinf)
if test $use_builtin_sinf = "yes"; then
AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
fi
AC_MSG_CHECKING([for __builtin_cosf])
AC_TRY_COMPILE([#include <math.h>],
[float foo(void) { __builtin_cosf(0.0); }],
use_builtin_cosf=yes, use_builtin_cosf=no)
AC_MSG_RESULT($use_builtin_cosf)
if test $use_builtin_cosf = "yes"; then
AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
fi
AC_MSG_CHECKING([for __builtin_fabsf])
AC_TRY_COMPILE([#include <math.h>],
[float foo(void) { __builtin_fabsf(0.0); }],
use_builtin_fabsf=yes, use_builtin_fabsf=no)
AC_MSG_RESULT($use_builtin_fabsf)
if test $use_builtin_fabsf = "yes"; then
AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
fi
AC_MSG_CHECKING([for __builtin_sqrtf])
AC_TRY_COMPILE([#include <math.h>],
[float foo(void) { __builtin_sqrtf(0.0); }],
use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
AC_MSG_RESULT($use_builtin_sqrtf)
if test $use_builtin_sqrtf = "yes"; then
AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
fi
])
dnl
dnl Check to see what architecture we are compiling for. If it's
dnl supported, use special hand-crafted routines to provide thread
dnl primitives.
dnl
dnl Depending on what is found, select various configure/cpu/*/atomicity.h
dnl If not found, select configure/cpu/generic/atomicity.h
dnl
dnl GLIBCPP_CHECK_CPU
AC_DEFUN(GLIBCPP_CHECK_CPU, [
AC_MSG_CHECKING([for cpu primitives directory])
case "$target_cpu" in
alpha*)
cpu_include_dir="config/cpu/alpha"
;;
arm*)
cpu_include_dir="config/cpu/arm"
;;
i486 | i586 | i686 | i786)
cpu_include_dir="config/cpu/i386"
;;
powerpc | rs6000)
cpu_include_dir="config/cpu/powerpc"
;;
sparc64 | ultrasparc)
cpu_include_dir="config/cpu/sparc/sparc64"
;;
sparc*)
cpu_include_dir="config/cpu/sparc/sparc32"
;;
*)
cpu_include_dir="config/cpu/generic"
;;
esac
AC_MSG_RESULT($cpu_include_dir)
AC_SUBST(cpu_include_dir)
])
dnl
dnl Check to see what the underlying c library's interface to ctype looks
dnl like. Bits of locale rely on things like isspace, toupper, etc. This
dnl stuff makes sure the right bits from the clibrary get called.
dnl
dnl Depending on what is found, select various configure/*/bits/ctype_base.h
dnl Depending on what is found, select various configure/*/ctype.cc
dnl
dnl GLIBCPP_CHECK_CTYPE
AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
AC_CHECK_HEADER(ctype.h, [
dnl If doesn't match any specified, go with defaults.
ctype_default=yes
dnl Test for <ctype> functionality -- gnu-linux
AC_MSG_CHECKING([for gnu-linux <ctype>])
AC_TRY_COMPILE([#include <ctype.h>],
[int
foo (int a)
{ return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
+ _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
+ __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
ctype_linux=yes, ctype_linux=no)
AC_MSG_RESULT($ctype_linux)
if test $ctype_linux = "yes"; then
ctype_include_dir="config/gnu-linux"
ctype_default=no
fi
dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
if test $ctype_default = "yes"; then
AC_MSG_CHECKING([for solaris 2.6 or 2.7 <ctype>])
AC_TRY_COMPILE([#include <ctype.h>],
[int
foo (int a)
{ return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
ctype_solaris=yes, ctype_solaris=no)
AC_MSG_RESULT($ctype_solaris)
if test $ctype_solaris = "yes"; then
AC_MSG_CHECKING([ for version])
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <ctype.h>],
[typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
ctype_solaris26=yes, ctype_solaris26=no)
AC_LANG_C
if test $ctype_solaris26 = "yes"; then
ctype_include_dir="config/solaris/solaris2.6"
AC_MSG_RESULT("solaris2.6")
ctype_default=no
else
ctype_include_dir="config/solaris/solaris2.7"
AC_MSG_RESULT("solaris2.7")
ctype_default=no
fi
fi
fi
dnl Test for <ctype> functionality -- solaris 2.5.1
if test $ctype_default = "yes"; then
AC_MSG_CHECKING([for solaris 2.5.1 <ctype>])
AC_TRY_COMPILE([#include <ctype.h>],
[int
foo (int a)
{ return _U + _L + _N + _S + _P + _C + _X + _B \
+ __ctype[a];}], \
ctype_solaris25=yes, ctype_solaris25=no)
AC_MSG_RESULT($ctype_solaris25)
if test $ctype_solaris25 = "yes"; then
ctype_include_dir="config/solaris/solaris2.5"
ctype_default=no
fi
fi
dnl Test for <ctype> functionality -- aix
if test $ctype_default = "yes"; then
AC_MSG_CHECKING([for aix <ctype>])
AC_TRY_COMPILE([#include <ctype.h>],
[int
foo (int a)
{ return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
+ _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
+ _VALC('a') + _IS('c', 0);}], \
ctype_aix=yes, ctype_aix=no)
AC_MSG_RESULT($ctype_aix)
if test $ctype_aix = "yes"; then
ctype_include_dir="config/aix"
ctype_default=no
fi
fi
dnl Test for <ctype> functionality -- newlib
if test $ctype_default = "yes"; then
AC_MSG_CHECKING([for newlib <ctype>])
AC_TRY_COMPILE([#include <ctype.h>],
[int
foo (int a)
{ return _U + _L + _N + _S + _P + _C + _X + _B \
+ _ctype_[a];}], \
ctype_newlib=yes, ctype_newlib=no)
AC_MSG_RESULT($ctype_newlib)
if test $ctype_newlib = "yes"; then
ctype_include_dir="config/newlib"
ctype_default=no
fi
fi
if test $ctype_default = "yes"; then
ctype_include_dir="config/generic"
AC_MSG_WARN("Using default ctype headers.")
fi
AC_SUBST(ctype_include_dir)
])
])
dnl
dnl Check to see what the underlying c library or math library is like.
dnl
dnl Define HAVE_CARGF etc if "cargf" is found.
dnl
dnl GLIBCPP_CHECK_MATH_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
AC_CHECK_LIB(m, sin, libm="-lm")
save_LIBS="$LIBS"
LIBS="$LIBS $libm"
dnl Check for complex versions of math functions of platform.
AC_CHECK_HEADERS([complex.h])
AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
ctan ctanf ctanh ctanhf \
carg cargf nan hypot hypotf atan2f expf copysignf)
dnl We compile the long double complex functions only if the function
dnl provides the non-complex functions.
USE_LONG_DOUBLE=no
AC_CHECK_FUNC(sinl,
USE_LONG_DOUBLE=yes
AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
AC_SUBST(USE_LONG_DOUBLE)
dnl Check to see if basic C math functions have faster float versions.
AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
fpclass qfpclass)
#Some runtimes have these functions with a preceding underscore. Please
# keep this sync'd with the one above. And if you add any new symbol,
# please add the corresponding block in the @BOTTOM@ section of
# acconfig.h.
AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
_copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
_strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
_fpclass _qfpclass)
LIBS="$save_LIBS"
])
dnl
dnl Check to see if this target can enable the wchar_t parts of libstdc++.
dnl
dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
dnl Define _GLIBCPP_HAS_WCHAR_MIN_MAX if WCHAR_MIN, WCHAR_MAX in wchar.h
dnl
dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
AC_CHECK_HEADER(wchar.h,[
dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
AC_MSG_CHECKING([for native mbstate_t])
AC_TRY_COMPILE([#include <wchar.h>],
[mbstate_t teststate;],
use_native_mbstatet=yes, use_native_mbstatet=no)
AC_MSG_RESULT($use_native_mbstatet)
if test $use_native_mbstatet = "no"; then
AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
fi
dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
dnl numeric_limits can instantiate type_traits<wchar_t>
AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
AC_TRY_COMPILE([#include <wchar.h>],
[int i = WCHAR_MIN; int j = WCHAR_MAX;],
has_wchar_minmax=yes, has_wchar_minmax=no)
AC_MSG_RESULT($has_wchar_minmax)
if test $has_wchar_minmax = "yes"; then
AC_DEFINE(_GLIBCPP_HAS_WCHAR_MIN_MAX)
fi
# Test wchar.h for WEOF, which is what we use to determine whether
# to specialize for wchar_t or not.
AC_MSG_CHECKING([for WEOF])
AC_TRY_COMPILE([
#include <wchar.h>
#include <stddef.h>],
[wint_t i = WEOF;],
has_weof=yes, has_weof=no)
AC_MSG_RESULT($has_weof)
dnl Tests for wide character functions.
AC_REPLACE_STRINGFUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset)
AC_MSG_CHECKING([for wide character support])
if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
AC_MSG_RESULT(ok)
else
AC_MSG_RESULT("not specializing for wchar_t")
fi
],[
AC_MSG_WARN([<wchar.h> not found])
AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
])
])
dnl
dnl Check to see if this version of GNU C++ is afflicted by bugs in
dnl __complex__ float support.
dnl
dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
dnl
dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING([for GNU C++ __complex__ float support])
AC_CACHE_VAL(glibcpp_cv_float_complex, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
rm -f conftest.h
cat > conftest.h <<EOB
//
// Check for buggy __complex__ that causes ICE in most versions of egcs
// and gcc-2.95.x on certain platforms (eg., x86-win32).
//
// See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
// more info on the bug itself.
//
struct
float_complex
{
__complex__ float m_value;
float_complex (float = 0.0f, float = 0.0f);
float_complex (__complex__ float val) : m_value (val) {}
float_complex foo (const float_complex &val)
{ return float_complex (~val.m_value); }
};
EOB
AC_TRY_COMPILE([#include "conftest.h"], ,
glibcpp_cv_float_complex=ok,
glibcpp_cv_float_complex=buggy
)
AC_LANG_RESTORE
])
AC_MSG_RESULT($glibcpp_cv_float_complex)
if test $glibcpp_cv_float_complex = buggy; then
AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
fi
])
dnl
dnl
dnl Check to see if this version of GNU C++ is afflicted by bugs in
dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
dnl gcc-2.95.x when using the library, unless we define the default copy
dnl ctor in the specializations of complex<>.
dnl
dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
dnl
dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING([for GNU C++ __complex__ support])
AC_CACHE_VAL(glibcpp_cv_complex, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
[ dcomplex x; f(x); ],
glibcpp_cv_complex=ok,
glibcpp_cv_complex=buggy
)
AC_LANG_RESTORE
])
AC_MSG_RESULT($glibcpp_cv_complex)
if test $glibcpp_cv_complex = buggy; then
AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
fi
])
dnl
dnl Check for certain special build configurations.
dnl
dnl GLIBCPP_ENABLE_DEBUG
dnl --enable-debug sets '-ggdb -O0'.
dnl --disable-debug sets '-g' and whatever optimization options the
dnl compiler can handle.
dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
dnl defaults to `no'.
AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
AC_ARG_ENABLE(debug,
changequote(<<, >>)dnl
<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
changequote([, ])dnl
[case "$enableval" in
yes) enable_debug=yes ;;
no) enable_debug=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
esac],
enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
dnl Option parsed, now set things appropriately
case "$enable_debug" in
yes) DEBUGFLAGS='-ggdb -O0'
;;
no) DEBUGFLAGS='-g'
;;
esac
AC_SUBST(DEBUGFLAGS)
])
dnl
dnl Check for certain special build configurations.
dnl
dnl GLIBCPP_ENABLE_NAMESPACES
dnl --enable-namespaces sets '-fhonor-std' and defines _GLIBCPP_USE_NAMESPACES
dnl --disable-namespaces sets '-fno-honor-std' (the macro should be
dnl undefined by default in whatever.h.in).
dnl + Eventually, this will go away.
dnl + Usage: GLIBCPP_ENABLE_NAMESPACES[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
dnl defaults to `no'.
AC_DEFUN(GLIBCPP_ENABLE_NAMESPACES, [dnl
define([GLIBCPP_ENABLE_NAMESPACES_DEFAULT], ifelse($1, yes, yes, no))dnl
AC_ARG_ENABLE(namespaces,
changequote(<<, >>)dnl
<< --enable-namespaces turns on 'std' [default=>>GLIBCPP_ENABLE_NAMESPACES_DEFAULT],
changequote([, ])dnl
[case "$enableval" in
yes) enable_namespaces=yes ;;
no) enable_namespaces=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable namespaces]) ;;
esac],
enable_namespaces=GLIBCPP_ENABLE_NAMESPACES_DEFAULT)dnl
dnl Option parsed, now set things appropriately
case "$enable_namespaces" in
yes) NAMESPACES='-fhonor-std'
AC_DEFINE(_GLIBCPP_USE_NAMESPACES)
;;
no) NAMESPACES='-fno-honor-std'
;;
esac
AC_SUBST(NAMESPACES)
])
dnl
dnl Check for instructions to automatically rebuild libgcc.a. Requires,
dnl of course, the location of the gcc objdir. Note that if --disable-
dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
dnl
dnl GLIBCPP_ENABLE_RELIBGCC
dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
dnl (presumably in the top-level Makefile) to /absol.../objdir
dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
dnl a warning if this is given along with --enable-namespaces), by
dnl setting GCC_OBJDIR to `no'.
dnl + Doing this by default is going to be interesting. What default
dnl "on" value can there be?
dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
dnl The default path should be ../.. if bundled with GCC source.
dnl If ommitted, it defaults to `no'.
dnl
AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
AC_ARG_ENABLE(libgcc-rebuild,
changequote(<<, >>)dnl
<< --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
the GCC objdir; see install.html>>,
changequote([, ])dnl
[case "$enableval" in
yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
no) enable_libgcc_rebuild=no ;;
*) if test -d "$enableval" && test -d "${enableval}/gcc" && \
test -d "${enableval}/libiberty"
then
enable_libgcc_rebuild="$enableval"
else
AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
fi
;;
esac],
enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
GCC_OBJDIR="$enable_libgcc_rebuild"
AC_SUBST(GCC_OBJDIR)
])
dnl
dnl Check for certain special build configurations.
dnl
dnl GLIBCPP_ENABLE_CSTDIO
dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
dnl
dnl default is libio
dnl
AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
AC_MSG_CHECKING([for cstdio to use])
AC_ARG_ENABLE(cstdio,
[ --enable-cstdio enable GNU libio for target io package. (default)
--enable-cstdio=LIB use LIB target-speific io package.],
if test x$enable_cstdio = xno; then
enable_cstdio=libio
fi,
enable_cstdio=libio)
enable_cstdio_flag=$enable_cstdio
dnl Check if a valid thread package
case x${enable_cstdio_flag} in
xlibio | x | xno | xnone | xyes)
# default
CSTDIO_H=c_io_libio.h
CSTDIO_CC=c_io_libio.cc
AC_MSG_RESULT(libio)
# see if we are on a system with libio native (ie, linux)
AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
if test $has_libio = "yes"; then
BUILD_LIBIO_INCLUDE=
need_libio=no
else
BUILD_LIBIO_INCLUDE='-I../libio'
need_libio=yes
fi
AC_SUBST(BUILD_LIBIO_INCLUDE)
;;
xwince)
CSTDIO_H=c_io_wince.h
CSTDIO_CC=c_io_wince.cc
AC_MSG_RESULT(wince)
need_libio=no
BUILD_LIBIO_INCLUDE=
AC_SUBST(BUILD_LIBIO_INCLUDE)
;;
*)
echo "$enable_cstdio is an unknown io package" 1>&2
exit 1
;;
esac
AC_SUBST(CSTDIO_H)
AC_SUBST(CSTDIO_CC)
AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
])
dnl
dnl Check for certain special build configurations.
dnl
dnl GLIBCPP_ENABLE_THREADS
dnl --enable-threads=posix sets config/threads-posix.h et. al.
dnl
dnl default is no threads
dnl
AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
dnl Note this comes from the gcc/config.in and libjava/config.in
dnl Efforts should be made to keep this in sync.
AC_MSG_CHECKING([for threads package to use])
AC_ARG_ENABLE(threads,
[ --enable-threads enable thread usage for target GCC.
--enable-threads=LIB use LIB thread package for target GCC.],
if test x$enable_threads = xno; then
enable_threads=''
fi,
enable_threads='')
enable_threads_flag=$enable_threads
dnl Check if a valid thread package
case x${enable_threads_flag} in
x | xno | xnone)
# No threads
target_thread_file='single'
;;
xyes)
# default
target_thread_file=''
;;
xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
xsolaris | xwin32 | xdce | xvxworks)
target_thread_file=$enable_threads_flag
;;
*)
echo "$enable_threads is an unknown thread package" 1>&2
exit 1
;;
esac
dnl Check for thread package actually supported in libstdc++
case "$target_thread_file" in
no | none | single)
THREADS=none
;;
posix | pthreads)
THREADS=posix
case "$host" in
*-*-linux*)
;;
esac
;;
decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
AC_MSG_ERROR(thread package $THREADS not yet supported)
;;
*)
AC_MSG_ERROR($THREADS is an unknown thread package)
;;
esac
AC_MSG_RESULT($THREADS)
THREADLIBS=
THREADINCS=
THREADDEPS=
THREADOBJS=
THREADH=
THREADSPEC=
case "$THREADS" in
posix)
AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
THREADLIBS=-lpthread
THREADSPEC=-lpthread
dnl Not presently used
dnl THREADOBJS=threads-posix.lo
THREADH=threads-posix.h
;;
none)
dnl Not presently used
dnl THREADOBJS=threads-no.lo
THREADH=threads-no.h
;;
esac
AC_SUBST(THREADLIBS)
AC_SUBST(THREADINCS)
AC_SUBST(THREADDEPS)
AC_SUBST(THREADOBJS)
AC_SUBST(THREADSPEC)
])
dnl
dnl Check for certain special build configurations.
dnl
dnl GLIBCPP_ENABLE_LONG_LONG
dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
dnl defaults to `no'.
dnl
dnl GLIBCPP_ENABLE_LONG_LONG
AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
AC_ARG_ENABLE(long-long,
changequote(<<, >>)dnl
<<--enable-long_long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
changequote([, ])dnl
[case "$enableval" in
yes) enable_long_long=yes ;;
no) enable_long_long=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
esac],
enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
dnl Option parsed, now set things appropriately
case "$enable_long_long" in
yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
;;
esac
])

1503
libstdc++-v3/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,114 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_ALGO_H
#define _CPP_BACKWARD_ALGO_H 1
#include "algobase.h"
#include "tempbuf.h"
#include <bits/stl_algo.h>
#include <bits/stl_numeric.h>
#ifdef __STL_USE_NAMESPACES
// Names from <stl_algo.h>
using __STD::for_each;
using __STD::find;
using __STD::find_if;
using __STD::adjacent_find;
using __STD::count;
using __STD::count_if;
using __STD::search;
using __STD::search_n;
using __STD::swap_ranges;
using __STD::transform;
using __STD::replace;
using __STD::replace_if;
using __STD::replace_copy;
using __STD::replace_copy_if;
using __STD::generate;
using __STD::generate_n;
using __STD::remove;
using __STD::remove_if;
using __STD::remove_copy;
using __STD::remove_copy_if;
using __STD::unique;
using __STD::unique_copy;
using __STD::reverse;
using __STD::reverse_copy;
using __STD::rotate;
using __STD::rotate_copy;
using __STD::random_shuffle;
using __STD::random_sample;
using __STD::random_sample_n;
using __STD::partition;
using __STD::stable_partition;
using __STD::sort;
using __STD::stable_sort;
using __STD::partial_sort;
using __STD::partial_sort_copy;
using __STD::nth_element;
using __STD::lower_bound;
using __STD::upper_bound;
using __STD::equal_range;
using __STD::binary_search;
using __STD::merge;
using __STD::inplace_merge;
using __STD::includes;
using __STD::set_union;
using __STD::set_intersection;
using __STD::set_difference;
using __STD::set_symmetric_difference;
using __STD::min_element;
using __STD::max_element;
using __STD::next_permutation;
using __STD::prev_permutation;
using __STD::find_first_of;
using __STD::find_end;
using __STD::is_sorted;
using __STD::is_heap;
// Names from stl_heap.h
using __STD::push_heap;
using __STD::pop_heap;
using __STD::make_heap;
using __STD::sort_heap;
// Names from stl_numeric.h
using __STD::accumulate;
using __STD::inner_product;
using __STD::partial_sum;
using __STD::adjacent_difference;
using __STD::power;
using __STD::iota;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_ALGO_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,71 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_ALGOBASE_H
#define _CPP_BACKWARD_ALGOBASE_H 1
#ifndef _CPP_BACKWARD_PAIR_H
#include "pair.h"
#endif
#ifndef _CPP_BACKWARD_ITERATOR_H
#include "iterator.h"
#endif
#ifndef _CPP_BITS_STL__ALGOBASE_H
#include <bits/stl_algobase.h>
#endif
#ifndef _CPP_BITS_STL_UNINITIALIZED_H
#include <bits/stl_uninitialized.h>
#endif
#ifdef __STL_USE_NAMESPACES
// Names from stl_algobase.h
using __STD::iter_swap;
using __STD::swap;
using __STD::min;
using __STD::max;
using __STD::copy;
using __STD::copy_backward;
using __STD::copy_n;
using __STD::fill;
using __STD::fill_n;
using __STD::mismatch;
using __STD::equal;
using __STD::lexicographical_compare;
using __STD::lexicographical_compare_3way;
// Names from stl_uninitialized.h
using __STD::uninitialized_copy;
using __STD::uninitialized_copy_n;
using __STD::uninitialized_fill;
using __STD::uninitialized_fill_n;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_ALGOBASE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,46 @@
/*
* 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.
*/
#ifndef _CPP_BACKWARD_ALLOC_H
#define _CPP_BACKWARD_ALLOC_H 1
#ifndef _CPP_BITS_STL_CONFIG_H
#include <bits/stl_config.h>
#endif
#ifndef _CPP_BITS_STL_ALLOC_H
#include <bits/stl_alloc.h>
#endif
#ifdef __STL_USE_NAMESPACES
using __STD::__malloc_alloc_template;
using __STD::malloc_alloc;
using __STD::simple_alloc;
using __STD::debug_alloc;
using __STD::__default_alloc_template;
using __STD::alloc;
using __STD::single_client_alloc;
#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
using __STD::__malloc_alloc_oom_handler;
#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */
#ifdef __STL_USE_STD_ALLOCATORS
using __STD::allocator;
#endif /* __STL_USE_STD_ALLOCATORS */
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_ALLOC_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,51 @@
/*
*
* 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
* 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.
*/
#ifndef _CPP_BACKWARD_BVECTOR_H
#define _CPP_BACKWARD_BVECTOR_H 1
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
#include "vector.h"
#else
#include "algobase.h"
#include "alloc.h"
#endif
#include <bits/stl_bvector.h>
#ifdef __STL_USE_NAMESPACES
using __STD::bit_vector;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_BVECTOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,87 @@
/*
*
* 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.
*
*/
// Inclusion of this file is DEPRECATED. This is the original HP
// default allocator. It is provided only for backward compatibility.
// This file WILL BE REMOVED in a future release.
//
// DO NOT USE THIS FILE unless you have an old container implementation
// that requires an allocator with the HP-style interface.
//
// Standard-conforming allocators have a very different interface. The
// standard default allocator is declared in the header <memory>.
#ifndef _CPP_BACKWARD_DEFALLOC_H
#define _CPP_BACKWARD_DEFALLOC_H 1
#include "new.h"
#include <stddef.h>
#include <stdlib.h>
#include <limits.h>
#include "iostream.h"
#include "algobase.h"
template <class _Tp>
inline _Tp* allocate(ptrdiff_t __size, _Tp*) {
set_new_handler(0);
_Tp* __tmp = (_Tp*)(::operator new((size_t)(__size * sizeof(_Tp))));
if (__tmp == 0) {
cerr << "out of memory" << endl;
exit(1);
}
return __tmp;
}
template <class _Tp>
inline void deallocate(_Tp* __buffer) {
::operator delete(__buffer);
}
template <class _Tp>
class allocator {
public:
typedef _Tp value_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
pointer allocate(size_type __n) {
return ::allocate((difference_type)__n, (pointer)0);
}
void deallocate(pointer __p) { ::deallocate(__p); }
pointer address(reference __x) { return (pointer)&__x; }
const_pointer const_address(const_reference __x) {
return (const_pointer)&__x;
}
size_type init_page_size() {
return max(size_type(1), size_type(4096/sizeof(_Tp)));
}
size_type max_size() const {
return max(size_type(1), size_type(UINT_MAX/sizeof(_Tp)));
}
};
class allocator<void> {
public:
typedef void* pointer;
};
#endif /* _CPP_BACKWARD_DEFALLOC_H */

View File

@ -0,0 +1,42 @@
/*
*
* 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) 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.
*/
#ifndef _CPP_BACKWARD_DEQUE_H
#define _CPP_BACKWARD_DEQUE_H 1
#include "algobase.h"
#include "alloc.h"
#include <bits/std_deque.h>
#ifdef __STL_USE_NAMESPACES
using __STD::deque;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_DEQUE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,118 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_FUNCTION_H
#define _CPP_BACKWARD_FUNCTION_H 1
#ifndef _CPP_BITS_STL_CONFIG_H
#include <bits/stl_config.h>
#endif
#ifndef _CPP_BITS_STL_RELOPS
#include <bits/stl_relops.h>
#endif
#include <stddef.h>
#ifndef _CPP_BITS_STL_FUNCTION_H
#include <bits/stl_function.h>
#endif
#ifdef __STL_USE_NAMESPACE_FOR_RELOPS
// Names from stl_relops.h
using __STD_RELOPS::operator!=;
using __STD_RELOPS::operator>;
using __STD_RELOPS::operator<=;
using __STD_RELOPS::operator>=;
#endif /* __STL_USE_NAMESPACE_FOR_RELOPS */
#ifdef __STL_USE_NAMESPACES
// Names from stl_function.h
using __STD::unary_function;
using __STD::binary_function;
using __STD::plus;
using __STD::minus;
using __STD::multiplies;
using __STD::divides;
using __STD::identity_element;
using __STD::modulus;
using __STD::negate;
using __STD::equal_to;
using __STD::not_equal_to;
using __STD::greater;
using __STD::less;
using __STD::greater_equal;
using __STD::less_equal;
using __STD::logical_and;
using __STD::logical_or;
using __STD::logical_not;
using __STD::unary_negate;
using __STD::binary_negate;
using __STD::not1;
using __STD::not2;
using __STD::binder1st;
using __STD::binder2nd;
using __STD::bind1st;
using __STD::bind2nd;
using __STD::unary_compose;
using __STD::binary_compose;
using __STD::compose1;
using __STD::compose2;
using __STD::pointer_to_unary_function;
using __STD::pointer_to_binary_function;
using __STD::ptr_fun;
using __STD::identity;
using __STD::select1st;
using __STD::select2nd;
using __STD::project1st;
using __STD::project2nd;
using __STD::constant_void_fun;
using __STD::constant_unary_fun;
using __STD::constant_binary_fun;
using __STD::constant0;
using __STD::constant1;
using __STD::constant2;
using __STD::subtractive_rng;
using __STD::mem_fun_t;
using __STD::const_mem_fun_t;
using __STD::mem_fun_ref_t;
using __STD::const_mem_fun_ref_t;
using __STD::mem_fun1_t;
using __STD::const_mem_fun1_t;
using __STD::mem_fun1_ref_t;
using __STD::const_mem_fun1_ref_t;
using __STD::mem_fun;
using __STD::mem_fun_ref;
using __STD::mem_fun1;
using __STD::mem_fun1_ref;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_FUNCTION_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 1996
* 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.
*
*/
#ifndef _CPP_BACKWARD_HASH_MAP_H
#define _CPP_BACKWARD_HASH_MAP_H 1
#ifndef _CPP_BITS_STL_HASHTABLE_H
#include <bits/stl_hashtable.h>
#endif
#include "algobase.h"
#include <bits/stl_hash_map.h>
#ifdef __STL_USE_NAMESPACES
using __STD::hash;
using __STD::hashtable;
using __STD::hash_map;
using __STD::hash_multimap;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_HASH_MAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 1996
* 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.
*
*/
#ifndef _CPP_BACKWARD_HASH_SET_H
#define _CPP_BACKWARD_HASH_SET_H 1
#ifndef _CPP_BITS_STL_HASHTABLE_H
#include <bits/stl_hashtable.h>
#endif
#include "algobase.h"
#include <bits/stl_hash_set.h>
#ifdef __STL_USE_NAMESPACES
using __STD::hash;
using __STD::hashtable;
using __STD::hash_set;
using __STD::hash_multiset;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_HASH_SET_H */

View File

@ -0,0 +1,48 @@
/*
* 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.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef _CPP_BACKWARD_HASHTABLE_H
#define _CPP_BACKWARD_HASHTABLE_H 1
#include <bits/stl_hashtable.h>
#include "algo.h"
#include "alloc.h"
#include "vector.h"
#ifdef __STL_USE_NAMESPACES
using __STD::hash;
using __STD::hashtable;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_HASHTABLE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,46 @@
/*
*
* 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) 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.
*/
#ifndef _CPP_BACKWARD_HEAP_H
#define _CPP_BACKWARD_HEAP_H 1
#include <bits/stl_config.h>
#include <bits/stl_heap.h>
#ifdef __STL_USE_NAMESPACES
using __STD::push_heap;
using __STD::pop_heap;
using __STD::make_heap;
using __STD::sort_heap;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_HEAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,55 @@
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _CPP_BACKWARD_IOSTREAM_H
#define _CPP_BACKWARD_IOSTREAM_H 1
#include <bits/std_iostream.h>
#ifdef __STL_USE_NAMESPACES
using __STD::iostream;
using __STD::ostream;
using __STD::istream;
using __STD::ios;
using __STD::streambuf;
using __STD::cout;
using __STD::cin;
using __STD::cerr;
using __STD::clog;
using __STD::wcout;
using __STD::wcin;
using __STD::wcerr;
using __STD::wclog;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_IOSTREAM_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,104 @@
/*
*
* 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
* 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.
*/
#ifndef _CPP_BACKWARD_ITERATOR_H
#define _CPP_BACKWARD_ITERATOR_H 1
#ifndef _CPP_BACKWARD_FUNCTION_H
#include "function.h"
#endif
#include <stddef.h>
#include "iostream.h"
#ifndef _CPP_BITS_STL_ITERATOR_H
#include <bits/stl_iterator.h>
#endif
#ifndef _CPP_BITS_TYPE_TRAITS_H
#include <bits/type_traits.h>
#endif
#ifndef _CPP_BITS_STL_CONSTRUCT_H
#include <bits/stl_construct.h>
#endif
#ifndef _CPP_BITS_STL_RAW_STORAGE_ITERATOR_H
#include <bits/stl_raw_storage_iter.h>
#endif
#ifdef __STL_USE_NAMESPACES
// Names from stl_iterator.h
using __STD::input_iterator_tag;
using __STD::output_iterator_tag;
using __STD::forward_iterator_tag;
using __STD::bidirectional_iterator_tag;
using __STD::random_access_iterator_tag;
#if 0
using __STD::iterator;
#endif
using __STD::input_iterator;
using __STD::output_iterator;
using __STD::forward_iterator;
using __STD::bidirectional_iterator;
using __STD::random_access_iterator;
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
using __STD::iterator_traits;
#endif
using __STD::iterator_category;
using __STD::distance_type;
using __STD::value_type;
using __STD::distance;
using __STD::advance;
using __STD::insert_iterator;
using __STD::front_insert_iterator;
using __STD::back_insert_iterator;
using __STD::inserter;
using __STD::front_inserter;
using __STD::back_inserter;
using __STD::reverse_iterator;
using __STD::reverse_bidirectional_iterator;
using __STD::istream_iterator;
using __STD::ostream_iterator;
// Names from stl_construct.h
using __STD::construct;
using __STD::destroy;
// Names from stl_raw_storage_iter.h
using __STD::raw_storage_iterator;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_ITERATOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,42 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_LIST_H
#define _CPP_BACKWARD_LIST_H 1
#include <bits/stl_algobase.h>
#include "alloc.h"
#include <bits/std_list.h>
#ifdef __STL_USE_NAMESPACES
using __STD::list;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_LIST_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,41 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_MAP_H
#define _CPP_BACKWARD_MAP_H 1
#include "tree.h"
#include <bits/stl_map.h>
#ifdef __STL_USE_NAMESPACES
using __STD::map;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_MAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,41 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_MULTIMAP_H
#define _CPP_BACKWARD_MULTIMAP_H 1
#include "tree.h"
#include <bits/stl_multimap.h>
#ifdef __STL_USE_NAMESPACES
using __STD::multimap;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_MULTIMAP_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,41 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_MULTISET_H
#define _CPP_BACKWARD_MULTISET_H 1
#include "tree.h"
#include <bits/stl_multiset.h>
#ifdef __STL_USE_NAMESPACES
using __STD::multiset;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_MULTISET_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,46 @@
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _CPP_BACKWARD_NEW_H
#define _CPP_BACKWARD_NEW_H 1
#include <bits/std_new.h>
#ifdef __STL_USE_NAMESPACES
using __STD::bad_alloc;
using __STD::nothrow_t;
using __STD::nothrow;
using __STD::new_handler;
using __STD::set_new_handler;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_NEW_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,51 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_PAIR_H
#define _CPP_BACKWARD_PAIR_H 1
#ifndef _CPP_BITS_STL_CONFIG_H
#include <bits/stl_config.h>
#endif
#ifndef _CPP_BITS_STL_RELOPS_H
#include <bits/stl_relops.h>
#endif
#ifndef _CPP_BITS_STL_PAIR_H
#include <bits/stl_pair.h>
#endif
#ifdef __STL_USE_NAMESPACES
using __STD::pair;
using __STD::make_pair;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_PAIR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 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.
*/
#ifndef _CPP_BACKWARD_ROPE_H
#define _CPP_BACKWARD_ROPE_H 1
#include "hashtable.h"
#include <bits/stl_rope.h>
#ifdef __STL_USE_NAMESPACES
using __STD::char_producer;
using __STD::sequence_buffer;
using __STD::rope;
using __STD::crope;
using __STD::wrope;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_ROPE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,41 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_SET_H
#define _CPP_BACKWARD_SET_H 1
#include "tree.h"
#include <bits/stl_set.h>
#ifdef __STL_USE_NAMESPACES
using __STD::set;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_SET_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 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.
*
*/
#ifndef _CPP_BACKWARD_SLIST_H
#define _CPP_BACKWARD_SLIST_H 1
#include <ext/slist>
#ifdef __STL_USE_NAMESPACES
using __STD::slist;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_SLIST_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,46 @@
/*
*
* 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.
*/
#ifndef _CPP_BACKWARD_STACK_H
#define _CPP_BACKWARD_STACK_H 1
#include "vector.h"
#include "deque.h"
#include "heap.h"
#include <bits/stl_stack.h>
#include <bits/stl_queue.h>
#ifdef __STL_USE_NAMESPACES
using __STD::stack;
using __STD::queue;
using __STD::priority_queue;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_STACK_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,62 @@
/*
*
* 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
* 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.
*/
#ifndef _CPP_BACKWARD_TEMPBUF_H
#define _CPP_BACKWARD_TEMPBUF_H 1
#ifndef _CPP_BACKWARD_PAIR_H
#include "pair.h"
#endif
#include <iterator.h>
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef _CPP_BITS_TYPE_TRAITS_H
#include <bits/type_traits.h>
#endif
#ifndef _CPP_BITS_STL_CONSTRUCT_H
#include <bits/stl_construct.h>
#endif
#ifndef _CPP_BITS_STL_UNINITIALIZED_H
#include <bits/stl_uninitialized.h>
#endif
#ifndef _CPP_BITS_STL_TEMPBUF_H
#include <bits/stl_tempbuf.h>
#endif
#ifdef __STL_USE_NAMESPACES
using __STD::get_temporary_buffer;
using __STD::return_temporary_buffer;
using __STD::_Temporary_buffer;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_TEMPBUF_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,46 @@
/*
*
* 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.
*
*
*/
#ifndef _CPP_BACKWARD_TREE_H
#define _CPP_BACKWARD_TREE_H 1
#ifndef _CPP_BITS_STL_TREE_H
#include <bits/stl_tree.h>
#endif
#include "algobase.h"
#include "alloc.h"
#ifdef __STL_USE_NAMESPACES
using __STD::rb_tree;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_TREE_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,42 @@
/*
*
* 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
* 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.
*/
#ifndef _CPP_BACKWARD_VECTOR_H
#define _CPP_BACKWARD_VECTOR_H 1
#include "algobase.h"
#include "alloc.h"
#include <bits/stl_vector.h>
#ifdef __STL_USE_NAMESPACES
using __STD::vector;
#endif /* __STL_USE_NAMESPACES */
#endif /* _CPP_BACKWARD_VECTOR_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,174 @@
// Wrapper of C-language FILE struct -*- C++ -*-
// Copyright (C) 1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.8 File-based streams
//
#ifndef _CPP_BASIC_FILE
#define _CPP_BASIC_FILE 1
#include <bits/c++config.h>
#include <bits/std_ios.h>
namespace std {
// Some of these member functions are based on libio/filebuf.cc.
// Also note that the order and number of virtual functions has to precisely
// match the order and number in the _IO_jump_t struct defined in libioP.h.
#if _GLIBCPP_BASIC_FILE_INHERITANCE
class __basic_file: public __c_file_type
#else
class __basic_file
#endif
{
#if _GLIBCPP_BASIC_FILE_ENCAPSULATION
int _M_fileno;
__c_file_type* _M_cfile;
#endif
public:
__basic_file(__c_lock* __lock = 0);
// Eqivalent to the normal fopen function.
__basic_file*
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
// Used for opening the standard streams, cin, cout, cerr, clog,
// and their wide-stream equivalents. Instead of calling open, it
// just sets __c_file_type->_fileno and the respective _flags bits, and
// returns.
__basic_file*
sys_open(int __fd, ios_base::openmode __mode);
__basic_file*
close();
bool
is_open();
// Needed by ios_base::sync_with_stdio.
int get_fileno(void);
// NB: Must match FILE specific jump table starting here--this
// means all virtual functions starting with the dtor must match,
// slot by slot. For glibc-based dystems, this means the _IO_FILE
// as the FILE struct and _IO_jump_t as the jump table.
virtual
~__basic_file(); // Takes the place of __finish.
virtual int
overflow(int __c = EOF);
virtual int
underflow();
virtual int
uflow();
virtual int
pbackfail(int __c);
// A complex "write" function that sets all of __c_file_type's
// ponters and associated data members correctly and manages it's
// relation to the external byte sequence.
virtual streamsize
xsputn(const char* __s, streamsize __n);
// A complex "read" function that sets all of __c_file_type's
// ponters and associated data members correctly and manages it's
// relation to the external byte sequence.
virtual streamsize
xsgetn(char* __s, streamsize __n);
// A complex "seekoff" function that sets all of __c_file_type's
// ponters and associated data members correctly and manages it's
// relation to the external byte sequence.
virtual __c_streampos
seekoff(streamoff __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out);
// A complex "seekpos" function that sets all of __c_file_type's
// pointers and associated data members correctly and manages it's
// relation to the external byte sequence.
virtual __c_streampos
seekpos(__c_streampos __pos,
ios_base::openmode __mode = ios_base::in | ios_base::out);
virtual streambuf*
setbuf(char* __b, int __len);
virtual int
sync();
virtual int
doallocate();
// A simple read function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamsize
sys_read(char* __s, streamsize __n);
// A simple write function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual streamsize
sys_write(const char* __s, streamsize __n);
// A simple seek function for the external byte sequence, that
// does no mucking around with or setting of the pointers or flags
// in __c_file_type.
virtual __c_streampos
sys_seek(__c_streampos __off, ios_base::seekdir __way);
virtual int
sys_close();
virtual int
sys_stat(void* __v);
virtual int
showmanyc();
virtual void
imbue(void* __v);
};
} // namespace std
#endif /* _CPP_BASIC_FILE */

View File

@ -0,0 +1,216 @@
// Iostreams base classes -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _CPP_BITS_BASICIOS_H
#define _CPP_BITS_BASICIOS_H 1
#include <bits/sbuf_iter.h>
namespace std {
// 27.4.5 Template class basic_ios
template<typename _CharT, typename _Traits>
class basic_ios : public ios_base
{
public:
// Types:
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard Types:
typedef ctype<_CharT> __ctype_type;
// From ostream
typedef ostreambuf_iterator<_CharT> __ostreambuf_iter;
typedef num_put<_CharT, __ostreambuf_iter> __numput_type;
typedef istreambuf_iterator<_CharT> __istreambuf_iter;
typedef num_get<_CharT, __istreambuf_iter> __numget_type;
// Data members:
private:
basic_ostream<_CharT, _Traits>* _M_tie;
char_type _M_fill;
iostate _M_exception;
protected:
basic_streambuf<_CharT, _Traits>* _M_streambuf;
iostate _M_streambuf_state;
// Cached use_facet<ctype>, which is based on the current locale info.
const __ctype_type* _M_fctype_ios;
// From ostream.
const __numput_type* _M_fnumput;
// From istream.
const __numget_type* _M_fnumget;
public:
inline const __ctype_type*
_M_get_fctype_ios(void)
{ return _M_fctype_ios; }
inline const __numget_type*
_M_get_fnumget(void)
{ return _M_fnumget; }
inline const __numput_type*
_M_get_fnumput(void)
{ return _M_fnumput; }
operator void*() const
{ return this->fail() ? 0 : const_cast<basic_ios*>(this); }
inline bool
operator!() const
{ return this->fail(); }
inline iostate
rdstate() const
{ return _M_streambuf_state; }
inline void
clear(iostate __state = goodbit)
{
if (this->rdbuf())
_M_streambuf_state = __state;
else
_M_streambuf_state = __state | badbit;
if ((this->rdstate() & this->exceptions()))
throw failure("basic_ios::clear(iostate) caused exception");
}
inline void
setstate(iostate __state)
{ this->clear(this->rdstate() | __state); }
inline bool
good() const
{ return this->rdstate() == 0; }
inline bool
eof() const
{ return (this->rdstate() & eofbit) != 0; }
inline bool
fail() const
{ return (this->rdstate() & (badbit | failbit)) != 0; }
inline bool
bad() const
{ return (this->rdstate() & badbit) != 0; }
inline iostate
exceptions() const
{ return _M_exception; }
inline void
exceptions(iostate __except)
{
_M_exception = __except;
this->clear(_M_streambuf_state);
}
// Constructor/destructor:
explicit
basic_ios(basic_streambuf<_CharT, _Traits>* __sb) : ios_base()
{ this->init(__sb); }
virtual
~basic_ios() { }
// Members:
inline basic_ostream<_CharT, _Traits>*
tie() const
{ return _M_tie; }
inline basic_ostream<_CharT, _Traits>*
tie(basic_ostream<_CharT, _Traits>* __tiestr)
{
basic_ostream<_CharT, _Traits>* __old = _M_tie;
_M_tie = __tiestr;
return __old;
}
inline basic_streambuf<_CharT, _Traits>*
rdbuf() const
{ return _M_streambuf; }
basic_streambuf<_CharT, _Traits>*
rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
basic_ios&
copyfmt(const basic_ios& __rhs);
inline char_type
fill() const
{ return _M_fill; }
inline char_type
fill(char_type __ch)
{
char_type __old = _M_fill;
_M_fill = __ch;
return __old;
}
// Locales:
locale
imbue(const locale& __loc);
char
narrow(char_type __c, char __dfault) const;
char_type
widen(char __c) const;
protected:
// 27.4.5.1 basic_ios constructors
basic_ios() : ios_base()
{ }
void
init(basic_streambuf<_CharT, _Traits>* __sb);
};
} // namespace std
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
# define export
//#include <bits/basic_ios.tcc>
#endif
#endif /* _CPP_BITS_BASICIOS_H */

View File

@ -0,0 +1,142 @@
// basic_ios locale and locale-related member functions -*- C++ -*-
// Copyright (C) 1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _CPP_BITS_BASICIOS_TCC
#define _CPP_BITS_BASICIOS_TCC 1
namespace std {
template<typename _CharT, typename _Traits>
basic_streambuf<_CharT, _Traits>*
basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
{
basic_streambuf<_CharT, _Traits>* __old = _M_streambuf;
_M_streambuf = __sb;
this->clear();
return __old;
}
template<typename _CharT, typename _Traits>
basic_ios<_CharT, _Traits>&
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
{
// Per 27.1.1.1, do not call imbue, yet must trash all caches
// associated with imbue()
// Alloc any new word array first, so if it fails we have "rollback".
_Words* __words = (__rhs._M_word_limit <= _S_local_words) ?
_M_word_array : new _Words[__rhs._M_word_limit];
// XXX This is the only reason _Callback_list was defined
// inline. The suspicion is that this increased compilation
// times dramatically for functions that use this member
// function (inserters_extractors, ios_manip_fmtflags). FIX ME,
// clean this stuff up. Callbacks are broken right now, anyway.
// Bump refs before doing callbacks, for safety.
_Callback_list* __cb = __rhs._M_callbacks;
if (__cb)
__cb->_M_add_reference();
_M_call_callbacks(erase_event);
if (_M_words != _M_word_array)
delete [] _M_words;
_M_dispose_callbacks();
_M_callbacks = __cb; // NB: Don't want any added during above.
for (int __i = 0; __i < __rhs._M_word_limit; ++__i)
__words[__i] = __rhs._M_words[__i];
if (_M_words != _M_word_array)
delete [] _M_words;
_M_words = __words;
_M_word_limit = __rhs._M_word_limit;
this->flags(__rhs.flags());
this->width(__rhs.width());
this->precision(__rhs.precision());
this->tie(__rhs.tie());
this->fill(__rhs.fill());
// The next is required to be the last assignment.
this->exceptions(__rhs.exceptions());
_M_call_callbacks(copyfmt_event);
return *this;
}
template<typename _CharT, typename _Traits>
char
basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
{ return _M_fctype_ios->narrow(__c, __dfault); }
template<typename _CharT, typename _Traits>
_CharT
basic_ios<_CharT, _Traits>::widen(char __c) const
{ return _M_fctype_ios->widen(__c); }
// Locales:
template<typename _CharT, typename _Traits>
locale
basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
{
locale __old(this->getloc());
ios_base::imbue(__loc);
_M_fctype_ios = &use_facet<__ctype_type>(__loc);
_M_fnumput = &use_facet<__numput_type>(__loc);
_M_fnumget = &use_facet<__numget_type>(__loc);
if (this->rdbuf() != 0)
this->rdbuf()->pubimbue(__loc);
return __old;
}
template<typename _CharT, typename _Traits>
void
basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
{
// NB: This may be called more than once on the same object.
ios_base::_M_init();
locale __loc = this->getloc();
_M_fctype_ios = &use_facet<__ctype_type>(__loc);
// Should be filled in by ostream and istream, respectively.
_M_fnumput = &use_facet<__numput_type>(__loc);
_M_fnumget = &use_facet<__numget_type>(__loc);
_M_tie = 0;
_M_fill = this->widen(' ');
_M_exception = goodbit;
_M_streambuf = __sb;
iostate __state = __sb ? goodbit : badbit;
_M_streambuf_state = __state;
}
} // namespace std
#endif /* _CPP_BITS_BASICIOS_TCC */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
// Predefined symbols and macros -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _CPP_CPPCONFIG
#define _CPP_CPPCONFIG 1
// The current version of the C++ library in compressed ISO date format.
#define __GLIBCPP__ 20000324
// This flag controls the error handling in string, and perhaps other
// bits as time goes on: check out bits/basic_string.h for more
// info. It also helps alleviate the circular dependency between
// string and exception.
# define _GLIBCPP_USE_EXCEPTIONS 1
// This is necessary until Egcs supports separate template
// compilation.
#define _GLIBCPP_NO_TEMPLATE_EXPORT 1
// This is a hack around not having either pre-compiled headers or
// export compilation. If defined, the io, string, and valarray
// headers will include all the necessary bits. If not defined, the
// implementation optimizes the headers for the most commonly-used
// types. For the io library, this means that larger, out-of-line
// member functions are only declared, and definitions are not parsed
// by the compiler, but instead instantiated into the library binary.
//#define _GLIBCPP_FULLY_COMPLIANT_HEADERS 1
// To enable older, ARM-style iostreams and other anachronisms use this.
//#define _GLIBCPP_DEPRICATED 1
// Use corrected code from the committee library group's issues list.
# define _GLIBCPP_RESOLVE_LIB_DEFECTS 1

View File

@ -0,0 +1,327 @@
// Character Traits for use by standard string and iostream
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 21 Strings library
//
#ifndef _CPP_BITS_CHAR_TRAITS_H
#define _CPP_BITS_CHAR_TRAITS_H 1
#include <bits/std_cwchar.h> // For mbstate_t.
#include <bits/std_cstring.h> // For memmove, memset, memchr
#include <bits/fpos.h> // For streamoff, streamsize
namespace std {
// Same as iosfwd
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Can't have self-recursive types for streampos.
// 21.1.3.1 char_traits sets size_type to streampos
// 27.4.1
// And here, where streampos is typedefed to fpos<traits::state_type>
typedef fpos<mbstate_t> streampos;
# ifdef _GLIBCPP_USE_WCHAR_T
typedef fpos<mbstate_t> wstreampos;
# endif
#endif
// 21.1.2 Basis for explicit _Traits specialization
// NB: That for any given actual character type this definition is
// probably wrong.
template<class _CharT>
struct char_traits
{
typedef _CharT char_type;
// Unsigned as wint_t in unsigned.
typedef unsigned long int_type;
typedef streampos pos_type;
typedef streamoff off_type;
typedef mbstate_t state_type;
static void
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
static int
compare(const char_type* __s1, const char_type* __s2, int_type __n)
{
for (int_type __i = 0; __i < __n; ++__i)
if (!eq(__s1[__i],__s2[__i]))
return lt(__s1[__i],__s2[__i]) ? -1 : 1;
return 0;
}
static size_t
length(const char_type* __s)
{
const char_type* __p = __s;
while (*__p) ++__p;
return (__p - __s);
}
static const char_type*
find(const char_type* __s, int __n, const char_type& __a)
{
for (const char_type* __p = __s; __p < __s+__n; ++__p)
if (*__p == __a) return __p;
return 0;
}
static char_type*
move(char_type* __s1, const char_type* __s2, int_type __n)
{ return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
static char_type*
copy(char_type* __s1, const char_type* __s2, int_type __n)
{ return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
static char_type*
assign(char_type* __s, int_type __n, char_type __a)
{
for (char_type* __p = __s; __p - __s < __n; ++__p)
assign(*__p, __a);
return __s;
}
static char_type
to_char_type(const int_type& __c)
{ return char_type(__c); }
static int_type
to_int_type(const char_type& __c) { return int_type(__c); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static state_type
get_state (pos_type __pos) { return __pos.state(); }
static int_type
eof() { return static_cast<int_type>(-1); }
static int_type
eos() { return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? int_type(0) : __c; }
};
// 21.1.4 char_traits specializations
template<>
struct char_traits<char>
{
typedef char char_type;
typedef unsigned int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
typedef mbstate_t state_type;
static void
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
static int
compare(const char_type* __s1, const char_type* __s2, int_type __n)
{ return memcmp(__s1, __s2, __n); }
static size_t
length(const char_type* __s)
{ return strlen(__s); }
static const char_type*
find(const char_type* __s, int __n, const char_type& __a)
{ return static_cast<char*>(memchr(__s, __a, __n)); }
static char_type*
move(char_type* __s1, const char_type* __s2, int_type __n)
{ return static_cast<char*>(memmove(__s1, __s2, __n)); }
static char_type*
copy(char_type* __s1, const char_type* __s2, int_type __n)
{ return static_cast<char*>(memcpy(__s1, __s2, __n)); }
static char_type*
assign(char_type* __s, int_type __n, char_type __a)
{ return static_cast<char*>(memset(__s, __a, __n)); }
static char_type
to_char_type(const int_type& __c)
{ return static_cast<char>(__c); }
// To keep both the byte 0xff and the eof symbol 0xffffffff
// from ending up as 0xffffffff.
static int_type
to_int_type(const char_type& __c)
{ return static_cast<int_type>(static_cast<unsigned char>(__c)); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static state_type
get_state(pos_type __pos) { return __pos.state(); }
static int_type
eof() { return static_cast<int_type>(EOF); }
static int_type
eos() { return '\0'; }
static int_type
not_eof(const int_type& __c)
{ return (__c == eof()) ? 0 : __c; }
};
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
struct char_traits<wchar_t>
{
typedef wchar_t char_type;
typedef wint_t int_type;
typedef wstreamoff off_type;
typedef wstreampos pos_type;
typedef mbstate_t state_type;
static void
assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; }
static bool
eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; }
static bool
lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; }
static int
compare(const char_type* __s1, const char_type* __s2, int_type __n)
{
for (int_type __i = 0; __i < __n; ++__i)
if (!eq(__s1[__i], __s2[__i]))
return lt(__s1[__i], __s2[__i]) ? -1 : 1;
return 0;
}
static size_t
length(const char_type* __s)
{
const char_type* __p = __s;
while (*__p)
++__p;
return (__p - __s);
}
static const char_type*
find (const char_type* __s, int __n, const char_type& __a)
{
for (const char_type* __p = __s; __p < __s+__n; ++__p)
if (*__p == __a)
return __p;
return 0;
}
static char_type*
move(char_type* __s1, const char_type* __s2, int_type __n)
{ return static_cast<wchar_t*>(memmove(__s1, __s2,
__n * sizeof(wchar_t))); }
static char_type*
copy(char_type* __s1, const char_type* __s2, int_type __n)
{ return static_cast<wchar_t*>(memcpy(__s1, __s2,
__n * sizeof(wchar_t))); }
static char_type*
assign(char_type* __s, int_type __n, char_type __a)
{
for (char_type* __p = __s; __p < __s + __n; ++__p)
assign(*__p, __a);
return __s;
}
static char_type
to_char_type(const int_type& __c) { return char_type(__c); }
static int_type
to_int_type(const char_type& __c) { return int_type(__c); }
static bool
eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; }
static state_type
get_state(pos_type __pos) { return __pos.state(); }
static int_type
eof() { return static_cast<int_type>(WEOF); }
static int_type
eos() { return int_type(); }
static int_type
not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? 0 : __c; }
};
#endif //_GLIBCPP_USE_WCHAR_T
template<typename _CharT, typename _Traits>
struct _Char_traits_match
{
_CharT _M_c;
_Char_traits_match(_CharT const& __c) : _M_c(__c) { }
bool
operator()(_CharT const& __a) { return _Traits::eq(_M_c,__a); }
};
} // namespace std
#endif /* _CPP_BITS_CHAR_TRAITS_H */

View File

@ -0,0 +1,301 @@
// The -*- C++ -*- type traits classes for internal use in libstdc++
// Copyright (C) 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
#ifndef _CPP_BITS_CPP_TYPE_TRAITS_H
#define _CPP_BITS_CPP_TYPE_TRAITS_H 1
//
// This file provides some compile-time information about various types.
// These informations were designed, on purpose, to be constant-expressions
// and not types as found in <stl/bits/type_traits.h>. In particular, they
// can be used in control structures and the optimizer hopefully will do
// the obvious thing.
//
// Why integral expressions, and not functions nor types?
// Firstly, these compile-time information entities are used as
// template-arguments so function return values won't work. We
// need compile-time entities. We're left with types and constant
// integral expressions.
// Secondly, from the point of view of ease of use type-based compile-time
// information is -not- *that* convenient. On has to write lots of
// overloaded functions and to hope that the compiler will select the right
// one. As a net effect, the overall structure isn't very clear at first
// glance.
// Thirdly, partial ordering and overload resolution (of template functions)
// is very costly in terms of compiler-resource. It is a Good Thing to
// keep these resource consumption as least as possible.
//
// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.
//
namespace std {
template<typename _Tp>
struct __is_void
{
enum
{
_M_type = 0
};
};
template<>
struct __is_void<void>
{
enum
{
_M_type = 1
};
};
//
// Integer types
//
template<typename _Tp>
struct __is_integer
{
enum
{
_M_type = 0
};
};
// Thirteen specializations (yes there are eleven standard integer
// types; 'long long' and 'unsigned long long' are supported as
// extensions)
template<>
struct __is_integer<bool>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<char>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<signed char>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<unsigned char>
{
enum
{
_M_type = 1
};
};
# ifdef _GLIBCPP_USE_WCHAR_T
template<>
struct __is_integer<wchar_t>
{
enum
{
_M_type = 1
};
};
# endif
template<>
struct __is_integer<short>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<unsigned short>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<int>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<unsigned int>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<long>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<unsigned long>
{
enum
{
_M_type = 1
};
};
# ifdef _GLIBCPP_USE_LONG_LONG
template<>
struct __is_integer<long long>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_integer<unsigned long long>
{
enum
{
_M_type = 1
};
};
# endif
//
// Floating point types
//
template<typename _Tp>
struct __is_floating
{
enum
{
_M_type = 0
};
};
// three specializations (float, double and 'long double')
template<>
struct __is_floating<float>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_floating<double>
{
enum
{
_M_type = 1
};
};
template<>
struct __is_floating<long double>
{
enum
{
_M_type = 1
};
};
//
// An arithmetic type is an integer type or a floating point type
//
template<typename _Tp>
struct __is_arithmetic
{
enum
{
_M_type = __is_integer<_Tp>::_M_type || __is_floating<_Tp>::_M_type
};
};
//
// A fundamental type is `void' or and arithmetic type
//
template<typename _Tp>
struct __is_fundamental
{
enum
{
_M_type = __is_void<_Tp>::_M_type || __is_arithmetic<_Tp>::_M_type
};
};
//
// For the immediate use, the following is a good approximation
//
template<typename _Tp>
struct __is_pod
{
enum
{
_M_type = __is_fundamental<_Tp>::_M_type
};
};
} // namespace std
#endif //_CPP_BITS_CPP_TYPE_TRAITS_H

View File

@ -0,0 +1,79 @@
// Methods and support infrastructure for exceptions -*- C++ -*-
// Copyright (C) 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 15 Exception handling
//
// This file declares functions whose only purpose is to throw an
// exception. They help break a circularity between <string> and
// <stdexcept>. See src/stdexcept.cc, where these functions are
// defined.
// XXX: These functions serve a similar purpose to those in
// stl/bits/stl_range_errors.h . Eventually the two approaches should
// be merged.
#ifndef _CPP_EXCEPTION_SUPPORT_H
#define _CPP_EXCEPTION_SUPPORT_H 1
namespace std {
#if _GLIBCPP_USE_EXCEPTIONS
// Internal functions for string implementation.
extern void __out_of_range(const char *__str);
extern void __length_error(const char *__str);
# define __OUTOFRANGE(__cond) \
do { if (__cond) __out_of_range(#__cond); } while (0)
# define __LENGTHERROR(__cond) \
do { if (__cond) __length_error(#__cond); } while (0)
#else
# include <bits/std_cassert.h>
# define __OUTOFRANGE(__cond) assert(!(__cond))
# define __LENGTHERROR(__cond) assert(!(__cond))
#endif
} // namespace std
#endif /* _CPP_EXCEPTION_SUPPORT_H */

121
libstdc++-v3/bits/fpos.h Normal file
View File

@ -0,0 +1,121 @@
// File position object and stream types
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27 Input/output library
//
#ifndef _CPP_BITS_FPOS_H
#define _CPP_BITS_FPOS_H 1
// Need this here as well as in std_ios because fpos is used in
// char_traits, and char_traits is used by string, which may or may
// not have included the std_ios file.
#include <bits/c++io.h>
namespace std {
// 27.4.1 Types
// 27.4.3 Template class fpos
template<typename _StateT>
class fpos
{
public:
// Types:
typedef _StateT __state_type;
__state_type
state() const { return _M_st; }
void
state(__state_type __st) { _M_st = __st; }
// NB: The standard defines only the implicit copy ctor and the
// previous two members. The rest is a "conforming extension".
fpos(): _M_st(__state_type()), _M_pos(streamoff()) { }
fpos(streamoff __pos, __state_type __st)
: _M_st(__st), _M_pos(__pos) { }
fpos(streamoff __pos)
: _M_st(), _M_pos(__pos) { }
operator streamoff() const { return _M_pos; }
fpos&
operator+=(streamoff __off) { _M_pos += __off; return *this; }
fpos&
operator-=(streamoff __off) { _M_pos -= __off; return *this; }
bool
operator==(const fpos& __pos2) const { return _M_pos == __pos2._M_pos; }
bool
operator!=(const fpos& __pos2) const { return _M_pos != __pos2._M_pos; }
streamoff
_M_position() const { return _M_pos; }
void
_M_position(streamoff __pos) { _M_pos = __pos; }
private:
__state_type _M_st;
streamoff _M_pos;
};
template<typename _State>
inline fpos<_State>
operator+(const fpos<_State>& __pos, streamoff __off)
{
fpos<_State> t(__pos);
return t += __off;
}
template<typename _State>
inline fpos<_State>
operator-(const fpos<_State>& __pos, streamoff __off)
{
fpos<_State> t(__pos);
return t -= __off;
}
template<typename _State>
inline streamoff
operator-(const fpos<_State>& __pos1, const fpos<_State>& __pos2)
{ return __pos1._M_position() - __pos2._M_position(); }
} // namespace std
#endif /* _CPP_BITS_FPOS_H */

View File

@ -0,0 +1,568 @@
// File based streams -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.8 File-based streams
//
#ifndef _CPP_BITS_FSTREAM_TCC
#define _CPP_BITS_FSTREAM_TCC 1
namespace std
{
template<typename _CharT, typename _Traits>
void
basic_filebuf<_CharT, _Traits>::
_M_init_filebuf(void)
{
_M_buf_unified = true; // Tie input to output for basic_filebuf.
_M_buf_size = static_cast<int_type>(BUFSIZ * sizeof(char_type));
try {
_M_file = new __file_type(&_M_lock);
}
catch(...) {
delete _M_file;
throw;
}
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::
basic_filebuf()
: __streambuf_type(), _M_file(NULL), _M_last_overflowed(false),
_M_state_cur(), _M_state_beg()
{ _M_fcvt = &use_facet<__codecvt_type>(this->getloc()); }
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::
basic_filebuf(int __fd, const char* /*__name*/, ios_base::openmode __mode)
: __streambuf_type(), _M_last_overflowed(false),
_M_state_cur(), _M_state_beg()
{
_M_fcvt = &use_facet<__codecvt_type>(this->getloc());
_M_init_filebuf();
_M_file->sys_open(__fd, __mode);
if (this->is_open() && _M_buf_size)
{
_M_mode = __mode;
// XXX So that istream::getc() will only need to get 1 char,
// as opposed to BUF_SIZE.
if (__fd == 0)
_M_buf_size = 1;
try {
_M_buf = new char_type[_M_buf_size];
}
catch(...) {
delete [] _M_buf;
throw;
}
this->_M_set_indeterminate();
}
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::__filebuf_type*
basic_filebuf<_CharT, _Traits>::
open(const char* __s, ios_base::openmode __mode)
{
__filebuf_type *__retval = NULL;
if (!this->is_open())
{
_M_init_filebuf();
_M_file->open(__s, __mode);
if (this->is_open() && _M_buf_size)
{
_M_mode = __mode;
try {
_M_buf = new char_type[_M_buf_size];
}
catch(...) {
delete [] _M_buf;
throw;
}
// For time being, set both (in/out) sets of pointers.
_M_set_indeterminate();
if (__mode & ios_base::ate
&& this->seekoff(0, ios_base::end, __mode) < 0)
this->close();
__retval = this;
}
}
return __retval;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::__filebuf_type*
basic_filebuf<_CharT, _Traits>::
close()
{
__filebuf_type *__retval = NULL;
if (this->is_open())
{
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
if (__testput)
_M_really_overflow(traits_type::eof());
#if 0
// XXX not done
if (_M_last_overflowed)
{
_M_output_unshift();
_M_really_overflow(traits_type::eof());
}
#endif
if (_M_file->close())
{
_M_mode = ios_base::openmode(0);
if (_M_buf_size)
delete [] _M_buf;
_M_buf = NULL;
this->setg(NULL, NULL, NULL);
this->setp(NULL, NULL);
__retval = this;
}
}
_M_last_overflowed = false;
return __retval;
}
template<typename _CharT, typename _Traits>
streamsize
basic_filebuf<_CharT, _Traits>::
showmanyc()
{
streamsize __retval = -1;
bool __testin = _M_mode & ios_base::in;
if (__testin)
{
bool __testeof = false;
if (_M_in_cur >= _M_in_end)
__testeof = this->underflow() == traits_type::eof();
if (!__testeof)
__retval = (_M_in_end - _M_in_cur) / sizeof(char_type);
}
_M_last_overflowed = false;
return __retval;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::
underflow()
{
int_type __retval = traits_type::eof();
bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
bool __testinit = _M_is_indeterminate();
bool __testout = _M_mode & ios_base::out;
bool __testin = _M_mode & ios_base::in;
if (__testin)
{
// Sync internal and external buffers.
// NB: __testget -> __testput as _M_buf_unified here.
if (__testget)
{
if (__testout)
_M_really_overflow();
else
_M_file->seekoff(_M_in_cur - _M_in_beg, ios_base::cur,
ios_base::in);
}
if (__testinit || __testget)
{
// Part one: (Re)fill external buf (_M_file->_IO_*) from
// external byte sequence (whatever physical byte sink or
// FILE actually is.)
char __conv_buf[_M_buf_size];
int_type __size = _M_file->xsgetn(__conv_buf, _M_buf_size);
// Part two: (Re)fill internal buf contents from external buf.
if (0 < __size)
{
_M_set_determinate(__size);
char* __conv_cur = __conv_buf;
_M_state_beg = _M_state_cur;
__res_type __r = _M_fcvt->in(_M_state_cur,
__conv_buf,
__conv_buf + __size,
const_cast<const char*&>(__conv_cur),
_M_in_beg, _M_in_end, _M_in_cur);
if (__r == codecvt_base::partial)
{
// XXX Retry with larger _M_buf size.
}
// Set pointers to internal and external buffers
// correctly. . .
if (__r != codecvt_base::error)
{
if (__testout)
_M_out_cur = _M_in_cur;
__retval = traits_type::to_int_type(*_M_in_cur);
}
// Part three: Sync the current internal buffer
// position with the (now overshot) external buffer
// position.
pos_type __p = _M_file->seekoff(0 - __size, ios_base::cur,
ios_base::in);
if (__p._M_position() == -1)
{
// XXX Something is wrong, do error checking.
}
}
}
}
_M_last_overflowed = false;
return __retval;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::
pbackfail(int_type __i)
{
int_type __retval = traits_type::eof();
char_type __c = traits_type::to_char_type(__i);
bool __testeof = traits_type::eq_int_type(__i, traits_type::eof());
bool __testout = _M_mode & ios_base::out;
bool __testin = _M_mode & ios_base::in;
if (__testin)
{
if (!_M_is_indeterminate())
{
bool __testpb = _M_in_beg < _M_in_cur;
bool __testeq = traits_type::eq(__c, this->gptr()[-1]);
// Try to put back __c into input sequence in one of three ways.
// Order these tests done in is unspecified by the standard.
if (!__testeof && __testpb && __testeq)
{
--_M_in_cur;
if (__testout)
--_M_out_cur;
__retval = __i;
}
else if (!__testeof && __testpb && __testout)
{
--_M_in_cur;
if (__testout)
--_M_out_cur;
*_M_in_cur = __c;
__retval = __i;
}
else if (__testeof && __testpb)
{
--_M_in_cur;
if (__testout)
--_M_out_cur;
__retval = traits_type::not_eof(__i);
}
}
else
{
// Need to make a putback position available.
this->seekoff(-1, ios_base::cur);
this->underflow();
if (!__testeof)
{
*_M_in_cur = __c;
__retval = __c;
}
else
__retval = traits_type::not_eof(__i);
}
}
_M_last_overflowed = false;
return __retval;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::
overflow(int_type __c)
{
int_type __retval = traits_type::eof();
bool __testpos = _M_out_cur && _M_out_cur >= _M_buf + _M_buf_size;
bool __testout = _M_mode & ios_base::out;
if (__testout)
{
if (!__testpos)
{
*_M_out_cur = traits_type::to_char_type(__c);
_M_buf_bump(1);
__retval = traits_type::not_eof(__c);
}
else
__retval = this->_M_really_overflow(__c);
}
_M_last_overflowed = false; // Set in _M_really_overflow, below.
return __retval;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::
_M_really_overflow(int_type __c)
{
int_type __retval = traits_type::eof();
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
if (__testput)
{
// Part one: Allocate temporary conversion buffer on
// stack. Convert internal buffer plus __c (ie,
// "pending sequence") to temporary conversion buffer.
int __plen = _M_out_end - _M_out_beg;
char_type __pbuf[__plen + sizeof(char_type)];
traits_type::copy(__pbuf, this->pbase(), __plen);
if (!__testeof)
{
__pbuf[__plen] = traits_type::to_char_type(__c);
++__plen;
}
char_type* __pend;
char __conv_buf[__plen];
char* __conv_end;
_M_state_beg = _M_state_cur;
__res_type __r = _M_fcvt->out(_M_state_cur,
__pbuf, __pbuf + __plen,
const_cast<const char_type*&>(__pend),
__conv_buf, __conv_buf + __plen,
__conv_end);
// Part two: (Re)spill converted "pending sequence"
// contents (now in temporary conversion buffer) to
// external buffer (_M_file->_IO_*) using
// _M_file->sys_write(), and do error (minimal) checking.
if (__r != codecvt_base::error)
{
streamsize __r = _M_file->xsputn(__conv_buf, __plen);
// NB: Need this so that external byte sequence reflects
// internal buffer.
_M_file->sync();
if (__r == __plen)
{
_M_set_indeterminate();
__retval = traits_type::not_eof(__c);
}
}
}
_M_last_overflowed = true;
return __retval;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::
seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
{
pos_type __retval = pos_type(off_type(-1));
bool __testopen = this->is_open();
bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
int __width = _M_fcvt->encoding();
if (__width < 0)
__width = 0;
bool __testfail = __off != 0 && __width <= 0;
if (__testopen && !__testfail && (__testin || __testout))
{
if (__way != ios_base::cur || __off != 0)
{
off_type __computed_off = __width * __off;
bool __testget = _M_in_cur && _M_in_beg < _M_in_end;
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
// Sync the internal and external streams.
// out
if (__testput || _M_last_overflowed)
{
// Part one: update the output sequence.
this->sync();
// Part two: output unshift sequence.
_M_output_unshift();
}
//in
// NB: underflow() rewinds the external buffer.
else if (__testget && __way == ios_base::cur)
__computed_off += _M_in_cur - _M_in_beg;
__retval = _M_file->seekoff(__computed_off, __way, __mode);
if (__retval._M_position() == -1)
__retval == pos_type(off_type(-1));
_M_set_indeterminate();
}
// NB: Need to do this in case _M_file in indeterminate
// state, ie _M_file->_offset == -1
else
{
__retval = _M_file->seekoff(__off, ios_base::cur, __mode);
__retval += max(_M_out_cur, _M_in_cur) - _M_buf;
}
}
_M_last_overflowed = false;
return __retval;
}
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::
seekpos(pos_type __pos, ios_base::openmode __mode)
{
pos_type __retval;
off_type __off = __pos;
__retval = this->seekoff(__off, ios_base::beg, __mode);
_M_last_overflowed = false;
return __retval;
}
template<typename _CharT, typename _Traits>
void
basic_filebuf<_CharT, _Traits>::
_M_output_unshift()
{
#if 0
// XXX Not complete, or correct.
int __width = _M_fcvt->encoding();
if (__width < 0)
{
// Part one: call codecvt::unshift
int __unsft_len = 0;
char_type __unsft_buf[_M_buf_size];
char_type* __unsft_cur; // XXX Set to external buf.
_M_state_beg = _M_state_cur;
__res_type __r = _M_fcvt->unshift(_M_state_cur,
__unsft_buf,
__unsft_buf + _M_buf_size,
__unsft_cur);
// Note, for char_type == char, wchar_t unshift
// should store no charachers.
if (__r == codecvt_base::ok || __r == codecvt_base::noconv)
__unsft_len = __unsft_cur - __unsft_buf;
// "Output the resulting sequence."
if (__unsft_len)
{
int __plen = _M_out_cur - _M_out_beg;
int __rlen = __plen + __unsft_len;
char_type __rbuf[__rlen];
char_type* __rend;
traits_type::copy(__rbuf, this->pbase(), __plen);
traits_type::copy(__rbuf + __plen, __unsft_buf,
__unsft_len);
char __conv_buf[__rlen];
char* __conv_end;
_M_state_beg = _M_state_cur; // XXX Needed?
__r = _M_fcvt->out(_M_state_cur,
__rbuf, __rbuf + __rlen,
const_cast<const char_type*&>(__rend),
__conv_buf,
__conv_buf + __rlen,
__conv_end);
if (__r != codecvt_base::error)
{
streamsize __r = _M_file->xsputn(__conv_buf,
__rlen);
if (__r == __rlen)
{
_M_out_cur = _M_out_beg;
if (_M_mode & ios_base::in)
_M_in_cur = _M_out_cur;
}
else
{
// XXX Throw "wig out and die exception?"
}
}
}
}
#endif
}
template<typename _CharT, typename _Traits>
void
basic_filebuf<_CharT, _Traits>::
imbue(const locale& __loc)
{
bool __testbeg = gptr() == eback() && pptr() == pbase();
bool __teststate = _M_fcvt->encoding() == -1;
_M_locale_set = true;
if (__testbeg && !__teststate && _M_locale_buf != __loc)
{
// XXX Will need to save these older values.
_M_locale_buf = __loc;
_M_fcvt = &use_facet<__codecvt_type>(_M_locale_buf);
// XXX Necessary?
_M_fctype_buf = &use_facet<__ctype_type>(_M_locale_buf);
}
// NB this may require the reconversion of previously
// converted chars. This in turn may cause the reconstruction
// of the original file. YIKES!!
// XXX The part in the above comment is not done.
_M_last_overflowed = false;
}
} // namespace std
#endif // _CPP_BITS_FSTREAM_TCC

View File

@ -0,0 +1,57 @@
// generic C header shadow file -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// This file is included by all the standard C <foo.h> headers
// after defining _SHADOW_NAME.
#ifdef _IN_C_SWAMP_ /* sub-included by a C header */
// get out of the "swamp"
} // close extern "C"
} // close namespace _C_Swamp::
# undef _IN_C_SWAMP_
# include _SHADOW_NAME
// dive back into the "swamp"
namespace _C_Swamp {
extern "C" {
# define _IN_C_SWAMP_
#else /* not _IN_C_SWAMP_: directly included by user program */
# include _SHADOW_NAME
// expose global C names, including non-standard ones, but shadow
// some names and types with the std:: C++ version.
using namespace ::_C_Swamp::_C_Shadow;
#endif /* _IN_C_SWAMP_ */

117
libstdc++-v3/bits/gslice.h Normal file
View File

@ -0,0 +1,117 @@
// The template and inlines for the -*- C++ -*- gslice class.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef _CPP_BITS_GSLICE_H
#define _CPP_BITS_GSLICE_H
namespace std {
class gslice
{
public:
gslice ();
gslice (size_t, const valarray<size_t>&, const valarray<size_t>&);
// XXX: the IS says the copy-ctor and copy-assignment operators are
// synthetized by the compiler but they are just unsuitable
// for a ref-counted semantic
gslice(const gslice&);
~gslice();
// XXX: See the note above.
gslice& operator= (const gslice&);
size_t start () const;
valarray<size_t> size () const;
valarray<size_t> stride () const;
private:
struct _Indexer {
size_t _M_count;
size_t _M_start;
valarray<size_t> _M_size;
valarray<size_t> _M_stride;
valarray<size_t> _M_index;
_Indexer(size_t, const valarray<size_t>&,
const valarray<size_t>&);
void _M_increment_use() { ++_M_count; }
size_t _M_decrement_use() { return --_M_count; }
};
_Indexer* _M_index;
template<typename _Tp> friend class valarray;
};
inline size_t
gslice::start () const
{ return _M_index ? _M_index->_M_start : 0; }
inline valarray<size_t>
gslice::size () const
{ return _M_index ? _M_index->_M_size : valarray<size_t>(); }
inline valarray<size_t>
gslice::stride () const
{ return _M_index ? _M_index->_M_stride : valarray<size_t>(); }
inline gslice::gslice () : _M_index(0) {}
inline
gslice::gslice(size_t __o, const valarray<size_t>& __l,
const valarray<size_t>& __s)
: _M_index(new gslice::_Indexer(__o, __l, __s)) {}
inline
gslice::gslice(const gslice& __g) : _M_index(__g._M_index)
{ if (_M_index) _M_index->_M_increment_use(); }
inline
gslice::~gslice()
{ if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; }
inline gslice&
gslice::operator= (const gslice& __g)
{
if (__g._M_index) __g._M_index->_M_increment_use();
if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index;
_M_index = __g._M_index;
return *this;
}
} // std::
#endif /* _CPP_BITS_GSLICE_H */
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,169 @@
// The template and inlines for the -*- C++ -*- gslice_array class.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef _CPP_BITS_GSLICE_ARRAY
#define _CPP_BITS_GSLICE_ARRAY 1
namespace std {
template<typename _Tp> class gslice_array
{
public:
typedef _Tp value_type;
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
void operator%= (const valarray<_Tp>&) const;
void operator+= (const valarray<_Tp>&) const;
void operator-= (const valarray<_Tp>&) const;
void operator^= (const valarray<_Tp>&) const;
void operator&= (const valarray<_Tp>&) const;
void operator|= (const valarray<_Tp>&) const;
void operator<<=(const valarray<_Tp>&) const;
void operator>>=(const valarray<_Tp>&) const;
void operator=(const _Tp&);
template<class _Dom>
void operator= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator<<= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator>>= (const _Expr<_Dom,_Tp>&) const;
private:
_Array<_Tp> _M_array;
const valarray<size_t>& _M_index;
friend class valarray<_Tp>;
gslice_array (_Array<_Tp>, const valarray<size_t>&);
// this constructor needs to be implemented.
gslice_array (const gslice_array&);
// not implemented
gslice_array();
gslice_array& operator= (const gslice_array&);
};
template<typename _Tp>
inline
gslice_array<_Tp>::gslice_array (_Array<_Tp> __a,
const valarray<size_t>& __i)
: _M_array (__a), _M_index (__i) {}
template<typename _Tp>
inline
gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a)
: _M_array (__a._M_array), _M_index (__a._M_index) {}
template<typename _Tp>
inline void
gslice_array<_Tp>::operator= (const _Tp& __t)
{
__valarray_fill (_M_array, _Array<size_t>(_M_index),
_M_index.size(), __t);
}
template<typename _Tp>
inline void
gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
{
__valarray_copy (_Array<_Tp> (__v), __v.size (),
_M_array, _Array<size_t>(_M_index));
}
template<typename _Tp>
template<class E>
inline void
gslice_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
{
__valarray_copy (__e, _M_index.size(), _M_array,
_Array<size_t>(_M_index));
}
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _Tp> \
inline void \
gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
{ \
_Array_augmented_##name (_M_array, _Array<size_t>(_M_index), \
_Array<_Tp> (__v), __v.size ()); \
} \
\
template<typename _Tp> template<class E> \
inline void \
gslice_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const \
{ \
_Array_augmented_##name (_M_array, _Array<size_t>(_M_index), __e, \
_M_index.size()); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // std::
#endif /* _CPP_BITS_GSLICE_ARRAY */
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,160 @@
// The template and inlines for the -*- C++ -*- indirect_array class.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef _CPP_BITS_INDIRECT_ARRAY_H
#define _CPP_BITS_INDIRECT_ARRAY_H
namespace std {
template <class _Tp> class indirect_array
{
public:
typedef _Tp value_type;
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
void operator%= (const valarray<_Tp>&) const;
void operator+= (const valarray<_Tp>&) const;
void operator-= (const valarray<_Tp>&) const;
void operator^= (const valarray<_Tp>&) const;
void operator&= (const valarray<_Tp>&) const;
void operator|= (const valarray<_Tp>&) const;
void operator<<= (const valarray<_Tp>&) const;
void operator>>= (const valarray<_Tp>&) const;
void operator= (const _Tp&);
// ~indirect_array();
template<class _Dom>
void operator= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator<<= (const _Expr<_Dom, _Tp>&) const;
template<class _Dom>
void operator>>= (const _Expr<_Dom, _Tp>&) const;
private:
indirect_array (const indirect_array&);
indirect_array (_Array<_Tp>, size_t, _Array<size_t>);
friend class valarray<_Tp>;
friend class gslice_array<_Tp>;
const size_t _M_sz;
const _Array<size_t> _M_index;
const _Array<_Tp> _M_array;
// not implemented
indirect_array ();
indirect_array& operator= (const indirect_array&);
};
template<typename _Tp>
inline indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)
: _M_sz (__a._M_sz), _M_index (__a._M_index),
_M_array (__a._M_array) {}
template<typename _Tp>
inline
indirect_array<_Tp>::indirect_array (_Array<_Tp> __a, size_t __s,
_Array<size_t> __i)
: _M_sz (__s), _M_index (__i), _M_array (__a) {}
// template<typename _Tp>
// inline indirect_array<_Tp>::~indirect_array() {}
template<typename _Tp>
inline void
indirect_array<_Tp>::operator= (const _Tp& __t)
{ __valarray_fill(_M_array, _M_index, _M_sz, __t); }
template<typename _Tp>
inline void
indirect_array<_Tp>::operator= (const valarray<_Tp>& __v) const
{ __valarray_copy (_Array<_Tp> (__v), _M_sz, _M_array, _M_index); }
template<typename _Tp>
template<class _Dom>
inline void
indirect_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const
{ __valarray_copy (__e, _M_sz, _M_array, _M_index); }
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _Tp> \
inline void \
indirect_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
{ \
_Array_augmented_##name (_M_array, _M_index, _Array<_Tp> (__v), _M_sz); \
} \
\
template<typename _Tp> template<class _Dom> \
inline void \
indirect_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \
{ \
_Array_augmented_##name (_M_array, _M_index, __e, _M_sz); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // std::
#endif /* _CPP_BITS_INDIRECT_ARRAY_H */
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,576 @@
// Iostreams base classes -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.8 File-based streams
//
#ifndef _CPP_BITS_IOSBASE_H
#define _CPP_BITS_IOSBASE_H 1
namespace std {
// The following definitions of bitmask types are enums, not ints,
// as permitted (but not required) in the standard, in order to provide
// better type safety in iostream calls. A side effect is that
// expressions involving them are no longer compile-time constants.
enum _Ios_Fmtflags { _S_ios_fmtflags_end = 1<<16 };
inline _Ios_Fmtflags
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
inline _Ios_Fmtflags
operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
inline _Ios_Fmtflags
operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Fmtflags
operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a | __b; }
inline _Ios_Fmtflags
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a & __b; }
inline _Ios_Fmtflags
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a ^ __b; }
inline _Ios_Fmtflags
operator~(_Ios_Fmtflags __a)
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
enum _Ios_Openmode { _S_ios_openmode_end = 1<<16 };
inline _Ios_Openmode
operator&(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
inline _Ios_Openmode
operator|(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
inline _Ios_Openmode
operator^(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Openmode
operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a | __b; }
inline _Ios_Openmode
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a & __b; }
inline _Ios_Openmode
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a ^ __b; }
inline _Ios_Openmode
operator~(_Ios_Openmode __a)
{ return _Ios_Openmode(~static_cast<int>(__a)); }
enum _Ios_Iostate { _S_ios_iostate_end = 1<<16 };
inline _Ios_Iostate
operator&(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
inline _Ios_Iostate
operator|(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
inline _Ios_Iostate
operator^(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
inline _Ios_Iostate
operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a | __b; }
inline _Ios_Iostate
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a & __b; }
inline _Ios_Iostate
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a ^ __b; }
inline _Ios_Iostate
operator~(_Ios_Iostate __a)
{ return _Ios_Iostate(~static_cast<int>(__a)); }
enum _Ios_Seekdir { _S_ios_Seekdir_end = 1<<16 };
// 27.4.2 Class ios_base
class ios_base
{
public:
// 27.4.2.1.1 Class ios_base::failure
class failure : public exception
{
public:
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Can't do exception(_msg) as defined in 27.4.2.1.1
explicit
failure(const string& __str);
virtual
~failure() { };
virtual const
char* what() const throw() { return _M_name; }
private:
enum { _M_bufsize = 256 };
char _M_name[_M_bufsize];
#endif
};
// 27.4.2.1.2 Type ios_base::fmtflags
typedef _Ios_Fmtflags fmtflags;
// 27.4.2.1.2 Type fmtflags
static const fmtflags boolalpha = fmtflags(__ios_flags::_S_boolalpha);
static const fmtflags dec = fmtflags(__ios_flags::_S_dec);
static const fmtflags fixed = fmtflags(__ios_flags::_S_fixed);
static const fmtflags hex = fmtflags(__ios_flags::_S_hex);
static const fmtflags internal = fmtflags(__ios_flags::_S_internal);
static const fmtflags left = fmtflags(__ios_flags::_S_left);
static const fmtflags oct = fmtflags(__ios_flags::_S_oct);
static const fmtflags right = fmtflags(__ios_flags::_S_right);
static const fmtflags scientific = fmtflags(__ios_flags::_S_scientific);
static const fmtflags showbase = fmtflags(__ios_flags::_S_showbase);
static const fmtflags showpoint = fmtflags(__ios_flags::_S_showpoint);
static const fmtflags showpos = fmtflags(__ios_flags::_S_showpos);
static const fmtflags skipws = fmtflags(__ios_flags::_S_skipws);
static const fmtflags unitbuf = fmtflags(__ios_flags::_S_unitbuf);
static const fmtflags uppercase = fmtflags(__ios_flags::_S_uppercase);
static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
static const fmtflags basefield = fmtflags(__ios_flags::_S_basefield);
static const fmtflags floatfield = fmtflags(__ios_flags::_S_floatfield);
// 27.4.2.1.3 Type ios_base::iostate
typedef _Ios_Iostate iostate;
static const iostate badbit = iostate(__ios_flags::_S_badbit);
static const iostate eofbit = iostate(__ios_flags::_S_eofbit);
static const iostate failbit = iostate(__ios_flags::_S_failbit);
static const iostate goodbit = iostate(0);
// 27.4.2.1.4 Type openmode
typedef _Ios_Openmode openmode;
static const openmode app = openmode(__ios_flags::_S_app);
static const openmode ate = openmode(__ios_flags::_S_ate);
static const openmode binary = openmode(__ios_flags::_S_bin);
static const openmode in = openmode(__ios_flags::_S_in);
static const openmode out = openmode(__ios_flags::_S_out);
static const openmode trunc = openmode(__ios_flags::_S_trunc);
// 27.4.2.1.5 Type seekdir
typedef _Ios_Seekdir seekdir;
static const seekdir beg = seekdir(0);
static const seekdir cur = seekdir(SEEK_CUR);
static const seekdir end = seekdir(SEEK_END);
#ifdef _GLIBCPP_DEPRICATED
typedef int io_state;
typedef int open_mode;
typedef int seek_dir;
#endif
// Callbacks;
enum event
{
erase_event,
imbue_event,
copyfmt_event
};
typedef void (*event_callback) (event, ios_base&, int);
void
register_callback(event_callback __fn, int __index);
protected:
// Data Members
streamsize _M_precision;
streamsize _M_width;
fmtflags _M_flags;
// 27.4.2.6 Members for callbacks
// 27.4.2.6 ios_base callbacks
struct _Callback_list
{
// Data Members
_Callback_list* _M_next;
ios_base::event_callback _M_fn;
int _M_index;
int _M_refcount; // 0 means one reference.
_Callback_list(ios_base::event_callback __fn, int __index,
_Callback_list* __cb)
: _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
void
_M_add_reference() { ++_M_refcount; } // XXX MT
int
_M_remove_reference() { return _M_refcount--; } // 0 => OK to delete
};
_Callback_list* _M_callbacks;
void
_M_call_callbacks(event __ev) throw();
void
_M_dispose_callbacks(void);
// 27.4.2.5 Members for iword/pword storage
struct _Words
{
void* _M_pword;
long _M_iword;
};
static const int _S_local_words = 8;
_Words _M_word_array[_S_local_words]; // Guaranteed storage
_Words _M_dummy; // Only for failed iword/pword calls.
_Words* _M_words;
int _M_word_limit;
_Words&
_M_grow_words(int __index);
// Members for locale and locale caching.
locale _M_locale_ios;
void
_M_init();
public:
// 27.4.2.1.6 Class ios_base::Init
// Used to initialize standard streams. In theory, g++ could use
// -finit-priority to order this stuff correctly without going
// through these machinations.
class Init
{
friend class ios_base;
public:
Init();
~Init();
private:
static int _M_ios_base_init;
filebuf* _M_cout;
filebuf* _M_cin;
filebuf* _M_cerr;
#ifdef _GLIBCPP_USE_WCHAR_T
wfilebuf* _M_wcout;
wfilebuf* _M_wcin;
wfilebuf* _M_wcerr;
#endif
};
// Fmtflags state:
inline fmtflags
flags() const { return _M_flags; }
inline fmtflags
flags(fmtflags __fmtfl)
{
fmtflags __old = _M_flags;
_M_flags = __fmtfl;
return __old;
}
inline fmtflags
setf(fmtflags __fmtfl)
{
fmtflags __old = _M_flags;
_M_flags |= __fmtfl;
return __old;
}
inline fmtflags
setf(fmtflags __fmtfl, fmtflags __mask)
{
fmtflags __old = _M_flags;
_M_flags &= ~__mask;
_M_flags |= (__fmtfl & __mask);
return __old;
}
inline void
unsetf(fmtflags __mask) { _M_flags &= ~__mask; }
inline streamsize
precision() const { return _M_precision; }
inline streamsize
precision(streamsize __prec)
{
streamsize __old = _M_precision;
_M_precision = __prec;
return __old;
}
inline streamsize
width() const { return _M_width; }
inline streamsize
width(streamsize __wide)
{
streamsize __old = _M_width;
_M_width = __wide;
return __old;
}
static bool
sync_with_stdio(bool __sync = true);
// Locales:
locale
imbue(const locale& __loc);
inline locale
getloc() const { return _M_locale_ios; }
// Storage:
static int
xalloc() throw();
inline long&
iword(int __ix)
{
_Words& __word = (__ix < _M_word_limit)
? _M_words[__ix] : _M_grow_words(__ix);
return __word._M_iword;
}
inline void*&
pword(int __ix)
{
_Words& __word = (__ix < _M_word_limit)
? _M_words[__ix] : _M_grow_words(__ix);
return __word._M_pword;
}
// Destructor
~ios_base();
protected:
ios_base();
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
private:
ios_base(const ios_base&);
ios_base&
operator=(const ios_base&);
#endif
};
// 27.4.5.1 fmtflags manipulators:
inline ios_base&
boolalpha(ios_base& __base)
{
__base.setf(ios_base::boolalpha);
return __base;
}
inline ios_base&
noboolalpha(ios_base& __base)
{
__base.unsetf(ios_base::boolalpha);
return __base;
}
inline ios_base&
showbase(ios_base& __base)
{
__base.setf(ios_base::showbase);
return __base;
}
inline ios_base&
noshowbase(ios_base& __base)
{
__base.unsetf(ios_base::showbase);
return __base;
}
inline ios_base&
showpoint(ios_base& __base)
{
__base.setf(ios_base::showpoint);
return __base;
}
inline ios_base&
noshowpoint(ios_base& __base)
{
__base.unsetf(ios_base::showpoint);
return __base;
}
inline ios_base&
showpos(ios_base& __base)
{
__base.setf(ios_base::showpos);
return __base;
}
inline ios_base&
noshowpos(ios_base& __base)
{
__base.unsetf(ios_base::showpos);
return __base;
}
inline ios_base&
skipws(ios_base& __base)
{
__base.setf(ios_base::skipws);
return __base;
}
inline ios_base&
noskipws(ios_base& __base)
{
__base.unsetf(ios_base::skipws);
return __base;
}
inline ios_base&
uppercase(ios_base& __base)
{
__base.setf(ios_base::uppercase);
return __base;
}
inline ios_base&
nouppercase(ios_base& __base)
{
__base.unsetf(ios_base::uppercase);
return __base;
}
inline ios_base&
unitbuf(ios_base& __base)
{
__base.setf(ios_base::unitbuf);
return __base;
}
inline ios_base&
nounitbuf(ios_base& __base)
{
__base.unsetf(ios_base::unitbuf);
return __base;
}
// 27.4.5.2 adjustfield anipulators:
inline ios_base&
internal(ios_base& __base)
{
__base.setf(ios_base::internal, ios_base::adjustfield);
return __base;
}
inline ios_base&
left(ios_base& __base)
{
__base.setf(ios_base::left, ios_base::adjustfield);
return __base;
}
inline ios_base&
right(ios_base& __base)
{
__base.setf(ios_base::right, ios_base::adjustfield);
return __base;
}
// 27.4.5.3 basefield anipulators:
inline ios_base&
dec(ios_base& __base)
{
__base.setf(ios_base::dec, ios_base::basefield);
return __base;
}
inline ios_base&
hex(ios_base& __base)
{
__base.setf(ios_base::hex, ios_base::basefield);
return __base;
}
inline ios_base&
oct(ios_base& __base)
{
__base.setf(ios_base::oct, ios_base::basefield);
return __base;
}
// 27.4.5.4 floatfield anipulators:
inline ios_base&
fixed(ios_base& __base)
{
__base.setf(ios_base::fixed, ios_base::floatfield);
return __base;
}
inline ios_base&
scientific(ios_base& __base)
{
__base.setf(ios_base::scientific, ios_base::floatfield);
return __base;
}
} // namespace std
#endif /* _CPP_BITS_IOSBASE_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,786 @@
// The template and inlines for the -*- C++ -*- numeric_limits classes.
// Copyright (C) 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Note: this is not a conforming implementation.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
//
// ISO 14882:1998
// 18.2.1
//
#ifndef _CPP_NUMERIC_LIMITS
#define _CPP_NUMERIC_LIMITS 1
#include <bits/c++config.h>
#include <bits/std_cfloat.h>
#include <bits/std_climits.h>
#if defined( _GLIBCPP_USE_WCHAR_T) && defined(_GLIBCPP_HAS_WCHAR_MIN_MAX)
#include <bits/std_cwchar.h>
#endif
namespace std {
enum float_round_style {
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3
};
enum float_denorm_style {
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
template<typename _T> struct numeric_limits {
static const bool is_specialized = false;
static _T min() throw() { return static_cast<_T>(0); }
static _T max() throw() { return static_cast<_T>(0); }
static const int digits = 0;
static const int digits10 = 0;
static const bool is_signed = false;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 0;
static _T epsilon() throw() { return static_cast<_T>(0); }
static _T round_error() throw() { return static_cast<_T>(0); }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static _T infinity() throw() { return static_cast<_T>(0); }
static _T quiet_NaN() throw() { return static_cast<_T>(0); }
static _T signaling_NaN() throw() { return static_cast<_T>(0); }
static _T denorm_min() throw() { return static_cast<_T>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = false;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<typename _T> _T __limits_infinity();
template<typename _T> _T __limits_quiet_NaN();
template<typename _T> _T __limits_signaling_NaN();
template<typename _T> _T __limits_denorm_min();
template<> struct numeric_limits<bool> {
static const bool is_specialized = true;
static bool min() throw()
{ return false; }
static bool max() throw()
{ return true; }
static const int digits = 8;
static const int digits10 = 2;
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static bool epsilon() throw()
{ return 0; }
static bool round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static bool infinity() throw()
{ return static_cast<bool>(0); }
static bool quiet_NaN() throw()
{ return static_cast<bool>(0); }
static bool signaling_NaN() throw()
{ return static_cast<bool>(0); }
static bool denorm_min() throw()
{ return static_cast<bool>(0); }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<char> {
static const bool is_specialized = true;
static char min() throw()
{ return CHAR_MIN; }
static char max() throw()
{ return CHAR_MAX; }
static const int digits = 7;
static const int digits10 = 2;
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static char epsilon() throw()
{ return 0; }
static char round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static char infinity() throw()
{ return static_cast<char>(0); }
static char quiet_NaN() throw()
{ return static_cast<char>(0); }
static char signaling_NaN() throw()
{ return static_cast<char>(0); }
static char denorm_min() throw()
{ return static_cast<char>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<signed char> {
static const bool is_specialized = true;
static signed char min() throw()
{ return SCHAR_MIN; }
static signed char max() throw()
{ return SCHAR_MAX; }
static const int digits = 7;
static const int digits10 = 2;
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static signed char epsilon() throw()
{ return 0; }
static signed char round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static signed char infinity() throw()
{ return static_cast<signed char>(0); }
static signed char quiet_NaN() throw()
{ return static_cast<signed char>(0); }
static signed char signaling_NaN() throw()
{ return static_cast<signed char>(0); }
static signed char denorm_min() throw()
{ return static_cast<signed char>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<unsigned char> {
static const bool is_specialized = true;
static unsigned char min() throw()
{ return 0; }
static unsigned char max() throw()
{ return UCHAR_MAX; }
static const int digits = 8;
static const int digits10 = 2;
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned char epsilon() throw()
{ return 0; }
static unsigned char round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned char infinity() throw()
{ return static_cast<unsigned char>(0); }
static unsigned char quiet_NaN() throw()
{ return static_cast<unsigned char>(0); }
static unsigned char signaling_NaN() throw()
{ return static_cast<unsigned char>(0); }
static unsigned char denorm_min() throw()
{ return static_cast<unsigned char>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = true;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
#if defined( _GLIBCPP_USE_WCHAR_T) && defined(_GLIBCPP_HAS_WCHAR_MIN_MAX)
template<> struct numeric_limits<wchar_t> {
static const bool is_specialized = true;
static wchar_t min() throw()
{ return WCHART_MIN; }
static wchar_t max() throw()
{ return WCHART_MAX; }
static const int digits = 31;
static const int digits10 = 9;
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static wchar_t epsilon() throw()
{ return 0; }
static wchar_t round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static wchar_t infinity() throw()
{ return static_cast<wchar_t>(0); }
static wchar_t quiet_NaN() throw()
{ return static_cast<wchar_t>(0); }
static wchar_t signaling_NaN() throw()
{ return static_cast<wchar_t>(0); }
static wchar_t denorm_min() throw()
{ return static_cast<wchar_t>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
#endif
template<> struct numeric_limits<short> {
static const bool is_specialized = true;
static short min() throw()
{ return SHRT_MIN; }
static short max() throw()
{ return SHRT_MAX; }
static const int digits = 15;
static const int digits10 = 4;
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static short epsilon() throw()
{ return 0; }
static short round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static short infinity() throw()
{ return static_cast<short>(0); }
static short quiet_NaN() throw()
{ return static_cast<short>(0); }
static short signaling_NaN() throw()
{ return static_cast<short>(0); }
static short denorm_min() throw()
{ return static_cast<short>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<unsigned short> {
static const bool is_specialized = true;
static unsigned short min() throw()
{ return 0; }
static unsigned short max() throw()
{ return USHRT_MAX; }
static const int digits = 16;
static const int digits10 = 4;
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned short epsilon() throw()
{ return 0; }
static unsigned short round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned short infinity() throw()
{ return static_cast<unsigned short>(0); }
static unsigned short quiet_NaN() throw()
{ return static_cast<unsigned short>(0); }
static unsigned short signaling_NaN() throw()
{ return static_cast<unsigned short>(0); }
static unsigned short denorm_min() throw()
{ return static_cast<unsigned short>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = true;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<int> {
static const bool is_specialized = true;
static int min() throw()
{ return INT_MIN; }
static int max() throw()
{ return INT_MAX; }
static const int digits = 31;
static const int digits10 = 9;
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static int epsilon() throw()
{ return 0; }
static int round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static int infinity() throw()
{ return static_cast<int>(0); }
static int quiet_NaN() throw()
{ return static_cast<int>(0); }
static int signaling_NaN() throw()
{ return static_cast<int>(0); }
static int denorm_min() throw()
{ return static_cast<int>(0); }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<unsigned int> {
static const bool is_specialized = true;
static unsigned int min() throw()
{ return 0; }
static unsigned int max() throw()
{ return UINT_MAX; }
static const int digits = 32;
static const int digits10 = 9;
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned int epsilon() throw()
{ return 0; }
static unsigned int round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned int infinity() throw()
{ return static_cast<unsigned int>(0); }
static unsigned int quiet_NaN() throw()
{ return static_cast<unsigned int>(0); }
static unsigned int signaling_NaN() throw()
{ return static_cast<unsigned int>(0); }
static unsigned int denorm_min() throw()
{ return static_cast<unsigned int>(0); }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = true;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<long> {
static const bool is_specialized = true;
static long min() throw()
{ return LONG_MIN; }
static long max() throw()
{ return LONG_MAX; }
static const int digits = 31;
static const int digits10 = 9;
static const bool is_signed = true;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static long epsilon() throw()
{ return 0; }
static long round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static long infinity() throw()
{ return static_cast<long>(0); }
static long quiet_NaN() throw()
{ return static_cast<long>(0); }
static long signaling_NaN() throw()
{ return static_cast<long>(0); }
static long denorm_min() throw()
{ return static_cast<long>(0); }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<unsigned long> {
static const bool is_specialized = true;
static unsigned long min() throw()
{ return 0; }
static unsigned long max() throw()
{ return ULONG_MAX; }
static const int digits = 32;
static const int digits10 = 9;
static const bool is_signed = false;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static unsigned long epsilon() throw()
{ return 0; }
static unsigned long round_error() throw()
{ return 0; }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static unsigned long infinity() throw()
{ return static_cast<unsigned long>(0); }
static unsigned long quiet_NaN() throw()
{ return static_cast<unsigned long>(0); }
static unsigned long signaling_NaN() throw()
{ return static_cast<unsigned long>(0); }
static unsigned long denorm_min() throw()
{ return static_cast<unsigned long>(0); }
static const bool is_iec559 = true;
static const bool is_bounded = true;
static const bool is_modulo = true;
static const bool traps = true;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<float> {
static const bool is_specialized = true;
static float min() throw()
{ return FLT_MIN; }
static float max() throw()
{ return FLT_MAX; }
static const int digits = FLT_MANT_DIG;
static const int digits10 = FLT_DIG;
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = FLT_RADIX;
static float epsilon() throw()
{ return FLT_EPSILON; }
static float round_error() throw()
{ return FLT_ROUNDS; }
static const int min_exponent = FLT_MIN_EXP;
static const int min_exponent10 = FLT_MIN_10_EXP;
static const int max_exponent = FLT_MAX_EXP;
static const int max_exponent10 = FLT_MAX_10_EXP;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static float infinity() throw()
{ return static_cast<float>(0); }
static float quiet_NaN() throw()
{ return static_cast<float>(0); }
static float signaling_NaN() throw()
{ return static_cast<float>(0); }
static float denorm_min() throw()
{ return static_cast<float>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<double> {
static const bool is_specialized = true;
static double min() throw()
{ return DBL_MIN; }
static double max() throw()
{ return DBL_MAX; }
static const int digits = DBL_MANT_DIG;
static const int digits10 = DBL_DIG;
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 2;
static double epsilon() throw()
{ return DBL_EPSILON; }
static double round_error() throw()
{ return 1.0; }
static const int min_exponent = DBL_MIN_EXP;
static const int min_exponent10 = DBL_MIN_10_EXP;
static const int max_exponent = DBL_MAX_EXP;
static const int max_exponent10 = DBL_MAX_10_EXP;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static double infinity() throw()
{ return static_cast<double>(0); }
static double quiet_NaN() throw()
{ return static_cast<double>(0); }
static double signaling_NaN() throw()
{ return static_cast<double>(0); }
static double denorm_min() throw()
{ return static_cast<double>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
template<> struct numeric_limits<long double> {
static const bool is_specialized = true;
static double min() throw()
{ return LDBL_MIN; }
static double max() throw()
{ return LDBL_MAX; }
static const int digits = LDBL_MANT_DIG;
static const int digits10 = LDBL_DIG;
static const bool is_signed = true;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 2;
static double epsilon() throw()
{ return LDBL_EPSILON; }
static double round_error() throw()
{ return 1.0L; }
static const int min_exponent = LDBL_MIN_EXP;
static const int min_exponent10 = LDBL_MIN_10_EXP;
static const int max_exponent = LDBL_MAX_EXP;
static const int max_exponent10 = LDBL_MAX_10_EXP;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static double infinity() throw()
{ return static_cast<double>(0); }
static double quiet_NaN() throw()
{ return static_cast<double>(0); }
static double signaling_NaN() throw()
{ return static_cast<double>(0); }
static double denorm_min() throw()
{ return static_cast<double>(0); }
static const bool is_iec559 = false;
static const bool is_bounded = true;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
} // namespace std
#endif // _CPP_NUMERIC_LIMITS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,497 @@
// Locale support -*- C++ -*-
// Copyright (C) 1997-2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 22.1 Locales
//
#ifndef _CPP_BITS_LOCCORE_H
#define _CPP_BITS_LOCCORE_H 1
#include <bits/c++config.h>
#include <bits/std_climits.h> // For CHAR_BIT
#include <bits/std_string.h> // For string
#include <bits/std_cctype.h> // For isspace, etc.
namespace std
{
// _Count_ones: compile-time computation of number of 1-bits in a value N
// This takes only 5 (or 6) instantiations, doing recursive descent
// in parallel -- ncm
template<unsigned _Num, int _Shift = (sizeof(unsigned) * CHAR_BIT)/2,
unsigned _Mask = (~0u >> _Shift) >
struct _Count_ones;
template<unsigned _Num, unsigned _Mask>
struct _Count_ones<_Num,0,_Mask>
{ static const unsigned _S_count = _Num; };
template<unsigned _Num, int _Shift, unsigned _Mask>
struct _Count_ones
{
static const unsigned _S_halfcount =
_Count_ones<_Num, _Shift/2, (_Mask^((~_Mask)>>(_Shift/2))) >::_S_count;
static const unsigned _S_count
= (_S_halfcount&_Mask) + ((_S_halfcount>>_Shift)&_Mask);
};
// 22.1.1 Locale
template<typename _Tp> class allocator;
template<typename _Tp, typename _Alloc> class vector;
class locale;
template<typename _Facet>
const _Facet&
use_facet(const locale&);
template<typename _Facet>
bool
has_facet(const locale&) throw();
// 22.1.3 Convenience interfaces
template<typename _CharT>
inline bool
isspace(_CharT, const locale&);
template<typename _CharT>
inline bool
isprint(_CharT, const locale&);
template<typename _CharT>
inline bool
iscntrl(_CharT, const locale&);
template<typename _CharT>
inline bool
isupper(_CharT, const locale&);
template<typename _CharT>
inline bool
islower(_CharT, const locale&);
template<typename _CharT>
inline bool
isalpha(_CharT, const locale&);
template<typename _CharT>
inline bool
isdigit(_CharT, const locale&);
template<typename _CharT>
inline bool
ispunct(_CharT, const locale&);
template<typename _CharT>
inline bool
isxdigit(_CharT, const locale&);
template<typename _CharT>
inline bool
isalnum(_CharT, const locale&);
template<typename _CharT>
inline bool
isgraph(_CharT, const locale&);
template<typename _CharT>
inline _CharT
toupper(_CharT, const locale&);
template<typename _CharT>
inline _CharT
tolower(_CharT, const locale&);
// 22.2.1 and 22.2.1.3 ctype
class ctype_base;
template<typename _CharT>
class ctype;
template<> class ctype<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> class ctype<wchar_t>;
#endif
template<typename _CharT>
class ctype_byname;
// NB: Specialized for char and wchar_t in locfacets.h.
class codecvt_base;
template<typename _InternT, typename _ExternT, typename _StateT>
class codecvt;
template<> class codecvt<char, char, mbstate_t>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> class codecvt<wchar_t, char, mbstate_t>;
#endif
template<typename _InternT, typename _ExternT, typename _StateT>
class codecvt_byname;
template<> class codecvt_byname<char, char, mbstate_t>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> class codecvt_byname<wchar_t, char, mbstate_t>;
#endif
// 22.2.2 and 22.2.3 numeric
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
class num_get;
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
class num_put;
template<typename _CharT> class numpunct;
template<typename _CharT> class numpunct_byname;
// 22.2.4 collation
template<typename _CharT>
class collate;
template<> class collate<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> class collate<wchar_t>;
#endif
template<typename _CharT> class
collate_byname;
// 22.2.5 date and time
class time_base;
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
class time_get;
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
class time_get_byname;
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
class time_put;
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
class time_put_byname;
// 22.2.6 money
class money_base;
template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
class money_get;
template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
class money_put;
template<typename _CharT, bool _Intl = false>
class moneypunct;
template<typename _CharT, bool _Intl = false>
class moneypunct_byname;
// 22.2.7 message retrieval
class messages_base;
template<typename _CharT>
class messages;
template<typename _CharT>
class messages_byname;
// 22.1.1 Class locale
class locale
{
// Forwrd decls and friends:
class _Impl;
friend _Impl;
template<typename _Facet>
friend const _Facet&
use_facet(const locale&);
template<typename _Facet>
friend bool
has_facet(const locale&) throw();
public:
// Types:
class facet;
class id;
typedef int category;
// Category values:
// NB much depends on the order in which these appear:
static const category none = 0;
static const category collate = 0x0100;
static const category ctype = 0x0200;
static const category monetary = 0x0400;
static const category numeric = 0x0800;
static const category time = 0x1000;
static const category messages = 0x2000;
static const category all = (collate | ctype | monetary |
numeric | time | messages);
// Construct/copy/destroy:
inline
locale() throw();
inline
locale(const locale& __other) throw();
explicit
locale(const char* __std_name);
locale(const locale& __other, const char* __std_name, category __cats);
locale(const locale& __other, const locale& __one, category __cats);
template<typename _Facet>
locale(const locale& __other, _Facet* __f);
inline
~locale() throw();
const locale&
operator=(const locale& __other) throw();
template<typename _Facet>
locale
combine(const locale& __other);
// Locale operations:
string
name() const;
bool
operator==(const locale& __other) const throw ();
inline bool
operator!=(const locale& __other) const throw ()
{ return !(operator==(__other)); }
template<typename _Char, typename _Traits, typename _Alloc>
bool
operator()(const basic_string<_Char,_Traits,_Alloc>& __s1,
const basic_string<_Char,_Traits,_Alloc>& __s2) const;
// Global locale objects:
static locale
global(const locale&);
static const locale&
classic();
private:
_Impl* _M_impl; // The (shared) implementation
static _Impl* _S_classic; // The one true C reference locale
static _Impl* _S_global; // Current global reference locale
explicit
locale(_Impl*) throw();
static inline void
_S_initialize()
{ if (!_S_classic) classic(); }
static int
_S_normalize_category(int);
static const int
_S_num_categories = _Count_ones<all>::_S_count;
};
// locale implementation object
class locale::_Impl
{
typedef vector<facet*, allocator<facet*> > __vec_facet;
typedef vector<string, allocator<string> > __vec_string;
// Friends:
friend class locale;
friend class facet;
template<typename _Facet>
friend const _Facet&
use_facet(const locale&);
template<typename _Facet>
friend bool
has_facet(const locale&) throw();
size_t _M_num_references;
__vec_facet* _M_facets;
__vec_string* _M_category_names;
bool _M_has_name;
bool _M_cached_name_ok;
string _M_cached_name;
inline void
_M_add_reference() throw()
{ ++_M_num_references; } // XXX MT
inline void
_M_remove_reference() throw()
{
if (_M_num_references-- == 0) // XXX MT
{
try {
delete this;
}
catch(...) {
}
}
}
_Impl(const _Impl&, size_t __refs);
_Impl(const _Impl&, const string&, category, size_t __refs);
_Impl(size_t __facets, size_t __refs);
~_Impl() throw();
void
_M_replace_categories(const _Impl*, category);
void
_M_replace_category(const _Impl*, const locale::id* const*);
void
_M_replace_facet(const _Impl*, const locale::id*);
void
_M_install_facet(const locale::id*, facet*);
template<typename _Facet>
inline void
_M_init_facet(_Facet* __facet)
{ _M_install_facet(&_Facet::id, __facet); }
void
_M_construct_collate(const char*);
void
_M_construct_ctype(const char*);
void
_M_construct_monetary(const char*);
void
_M_construct_numeric(const char*);
void
_M_construct_time(const char*);
void
_M_construct_messages(const char*);
category
_M_normalize_category_names(const string&, category __cats);
static const locale::id* const _S_id_collate[];
static const locale::id* const _S_id_ctype[];
static const locale::id* const _S_id_monetary[];
static const locale::id* const _S_id_numeric[];
static const locale::id* const _S_id_time[];
static const locale::id* const _S_id_messages[];
static const locale::id* const* const _S_facet_categories[];
};
// class locale inlines, that need declaration of locale::_Imp
locale::locale() throw()
{
_S_initialize();
(_M_impl = _S_global)->_M_add_reference();
} // XXX MT
locale::locale(const locale& __other) throw()
{ (_M_impl = __other._M_impl)->_M_add_reference(); }
template<typename _Facet>
locale::locale(const locale& __other, _Facet* __f)
{
_M_impl = new _Impl(*__other._M_impl, 0);
_M_impl->_M_install_facet(&_Facet::id, __f);
_M_impl->_M_has_name = false;
}
locale::~locale() throw()
{ _M_impl->_M_remove_reference(); }
// 22.1.1.1.2 Class locale::facet
class locale::facet
{
friend class locale;
friend class locale::_Impl;
protected:
explicit
facet(size_t __refs = 0) throw();
virtual
~facet() {};
private:
size_t _M_num_references;
void
_M_add_reference() throw();
void
_M_remove_reference() throw();
facet(const facet&); // not defined
void
operator=(const facet&); // not defined
};
// 22.1.1.1.3 Class locale::id
class locale::id
{
friend class locale;
friend class locale::_Impl;
template<typename _Facet>
friend const _Facet&
use_facet(const locale&);
template<typename _Facet>
friend bool
has_facet(const locale&) throw ();
public:
id() {};
private:
// NB: there is no accessor for _M_index because it may be used
// before the constructor is run; the effect of calling a member
// function (even an inline) would be undefined.
mutable size_t _M_index;
static size_t _S_highwater; // last id number assigned
void
operator=(const id&); // not defined
id(const id&); // not defined
};
template<typename _Facet>
const _Facet&
use_facet(const locale& __loc);
template<typename _Facet>
bool
has_facet(const locale& __loc) throw();
} // namespace std
#endif /* _CPP_BITS_LOCCORE_H */
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,160 @@
// The template and inlines for the -*- C++ -*- mask_array class.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef _CPP_BITS_MASK_ARRAY_H
#define _CPP_BITS_MASK_ARRAY_H 1
namespace std {
template <class _Tp> class mask_array
{
public:
typedef _Tp value_type;
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
void operator%= (const valarray<_Tp>&) const;
void operator+= (const valarray<_Tp>&) const;
void operator-= (const valarray<_Tp>&) const;
void operator^= (const valarray<_Tp>&) const;
void operator&= (const valarray<_Tp>&) const;
void operator|= (const valarray<_Tp>&) const;
void operator<<=(const valarray<_Tp>&) const;
void operator>>=(const valarray<_Tp>&) const;
void operator= (const _Tp&);
// ~mask_array ();
template<class _Dom>
void operator= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator<<=(const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator>>=(const _Expr<_Dom,_Tp>&) const;
private:
mask_array (_Array<_Tp>, size_t, _Array<bool>);
friend class valarray<_Tp>;
const size_t _M_sz;
const _Array<bool> _M_mask;
const _Array<_Tp> _M_array;
mask_array (const mask_array&);
// not implemented
mask_array ();
mask_array& operator= (const mask_array&);
};
template<typename _Tp>
inline mask_array<_Tp>::mask_array (const mask_array<_Tp>& a)
: _M_sz (a._M_sz), _M_mask (a._M_mask), _M_array (a._M_array) {}
template<typename _Tp>
inline
mask_array<_Tp>::mask_array (_Array<_Tp> __a, size_t __s, _Array<bool> __m)
: _M_sz (__s), _M_mask (__m), _M_array (__a) {}
// template<typename _Tp>
// inline mask_array<_Tp>::~mask_array () {}
template<typename _Tp>
inline void
mask_array<_Tp>::operator= (const _Tp& __t)
{ __valarray_fill (_M_array, _M_sz, _M_mask, __t); }
template<typename _Tp>
inline void
mask_array<_Tp>::operator= (const valarray<_Tp>& __v) const
{ __valarray_copy (_Array<_Tp> (__v), __v.size (), _M_array, _M_mask); }
template<typename _Tp>
template<class E>
inline void
mask_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
{ __valarray_copy (__e, __e.size (), _M_array, _M_mask); }
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _Tp> \
inline void \
mask_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
{ \
_Array_augmented_##name (_M_array, _M_mask, \
_Array<_Tp> (__v), __v.size ()); \
} \
\
template<typename _Tp> template<class E> \
inline void \
mask_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const \
{ \
_Array_augmented_##name (_M_array, _M_mask, __e, __e.size ()); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // std::
#endif /* _CPP_BITS_MASK_ARRAY_H */
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,673 @@
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.6.2 Output streams
//
#include <bits/std_locale.h>
namespace std {
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>::sentry::
sentry(basic_ostream<_CharT,_Traits>& __os)
: _M_ok(__os.good()), _M_os(__os)
{
// XXX MT
if (_M_ok && __os.tie())
__os.tie()->flush();
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::
operator<<(__ostream_type& (*__pf)(__ostream_type&))
{
sentry __cerb(*this);
if (__cerb)
{
try {
__pf(*this);
}
catch(exception& __fail){
// 27.6.2.5.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::
operator<<(__ios_type& (*__pf)(__ios_type&))
{
sentry __cerb(*this);
if (__cerb)
{
try {
__pf(*this);
}
catch(exception& __fail){
// 27.6.2.5.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::
operator<<(ios_base& (*__pf)(ios_base&))
{
sentry __cerb(*this);
if (__cerb)
{
try {
__pf(*this);
}
catch(exception& __fail){
// 27.6.2.5.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(bool __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(long __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
bool __f;
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt & ios_base::oct || __fmt & ios_base::hex)
__f = _M_fnumput->put(*this, *this, this->fill(),
static_cast<unsigned long>(__n)).failed();
else
__f = _M_fnumput->put(*this, *this, this->fill(), __n).failed();
if (__f)
this->setstate(ios_base::badbit);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
#ifdef _GLIBCPP_USE_LONG_LONG
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(long long __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
bool __f;
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt & ios_base::oct || __fmt & ios_base::hex)
__f = _M_fnumput->put(*this, *this, this->fill(),
static_cast<unsigned long long>(__n)).failed();
else
__f = _M_fnumput->put(*this, *this, this->fill(), __n).failed();
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
#endif
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(double __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(long double __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
{
sentry __cerb(*this);
if (__cerb)
{
try {
if (_M_fnumput->put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
this->setstate(ios_base::badbit);
if ((this->exceptions() & ios_base::badbit) != 0)
throw;
}
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sbin)
{
streamsize __xtrct = 0;
__streambuf_type* __sbout = this->rdbuf();
sentry __cerb(*this);
if (__sbin && __cerb)
__xtrct = _S_copy_streambufs(*this, __sbin, __sbout);
if (!__sbin || !__xtrct)
this->setstate(ios_base::failbit);
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::put(char_type __c)
{
sentry __cerb(*this);
if (__cerb)
{
int_type __put = rdbuf()->sputc(__c);
if (__put != traits_type::to_int_type(__c))
this->setstate(ios_base::badbit);
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::write(const _CharT* __s, streamsize __n)
{
sentry __cerb(*this);
if (__cerb)
{
streamsize __put = this->rdbuf()->sputn(__s, __n);
if ( __put != __n)
this->setstate(ios_base::badbit);
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::flush()
{
sentry __cerb(*this);
if (__cerb)
{
if (this->rdbuf() && this->rdbuf()->pubsync() == -1)
this->setstate(ios_base::badbit);
}
return *this;
}
template<typename _CharT, typename _Traits>
typename basic_ostream<_CharT, _Traits>::pos_type
basic_ostream<_CharT, _Traits>::tellp()
{
pos_type __retval = pos_type(-1);
bool __testok = this->fail() != true;
if (__testok)
__retval = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
return __retval;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
{
bool __testok = this->fail() != true;
if (__testok)
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 136. seekp, seekg setting wrong streams?
this->rdbuf()->pubseekpos(__pos, ios_base::out);
#endif
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::
seekp(off_type __off, ios_base::seekdir __d)
{
bool __testok = this->fail() != true;
if (__testok)
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 136. seekp, seekg setting wrong streams?
rdbuf()->pubseekoff(__off, __d, ios_base::out);
#endif
return *this;
}
// 27.6.2.5.4 Character inserters
// Construct correctly padded string, as per 22.2.2.2.2
// Similar in theory to _S_pad_numeric, from num_put, but it doesn't
// use _S_fill: perhaps it should.
// Assumes
// __newlen > __oldlen
// __news is allocated for __newlen size
template<typename _CharT, typename _Traits>
static void
_S_pad_char(basic_ios<_CharT, _Traits>& __ios,
_CharT* __news, const _CharT* __olds,
const streamsize __newlen, const streamsize __oldlen)
{
typedef _CharT char_type;
typedef _Traits traits_type;
typedef typename traits_type::int_type int_type;
int_type __plen = static_cast<size_t>(__newlen - __oldlen);
char_type __pads[__plen];
traits_type::assign(__pads, __plen, __ios.fill());
char_type* __beg;
char_type* __end;
size_t __mod = 0;
size_t __beglen; //either __plen or __oldlen
ios_base::fmtflags __fmt = __ios.flags() & ios_base::adjustfield;
if (__fmt == ios_base::left)
{
// Padding last.
__beg = const_cast<char_type*>(__olds);
__beglen = __oldlen;
__end = __pads;
}
else if (__fmt == ios_base::internal)
{
// Pad after the sign, if there is one.
// Pad after 0[xX], if there is one.
// Who came up with these rules, anyway? Jeeze.
typedef _Format_cache<_CharT> __cache_type;
__cache_type const* __fmt = __cache_type::_S_get(__ios);
const char_type* __minus = traits_type::find(__olds, __oldlen,
__fmt->_S_minus);
const char_type* __plus = traits_type::find(__olds, __oldlen,
__fmt->_S_plus);
bool __testsign = __minus || __plus;
bool __testhex = __olds[0] == '0'
&& (__olds[1] == 'x' || __olds[1] == 'X');
if (__testhex)
{
__news[0] = __olds[0];
__news[1] = __olds[1];
__mod += 2;
__beg = const_cast<char_type*>(__olds + __mod);
__beglen = __oldlen - __mod;
__end = __pads;
}
else if (__testsign)
{
__mod += __plen;
const char_type* __sign = __minus ? __minus + 1: __plus + 1;
__beg = const_cast<char_type*>(__olds);
__beglen = __sign - __olds;
__end = const_cast<char_type*>(__sign + __plen);
traits_type::copy(__news + __beglen, __pads, __plen);
}
else
{
// Padding first.
__beg = __pads;
__beglen = __plen;
__end = const_cast<char_type*>(__olds);
}
}
else
{
// Padding first.
__beg = __pads;
__beglen = __plen;
__end = const_cast<char_type*>(__olds);
}
traits_type::copy(__news, __beg, __beglen);
traits_type::copy(__news + __beglen, __end, __newlen - __beglen - __mod);
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
{
typedef basic_ostream<_CharT, _Traits> __ostream_type;
__ostream_type::sentry __cerb(__out);
if (__cerb)
{
try {
streamsize __w = __out.width();
_CharT __pads[__w];
__pads[0] = __c;
streamsize __len = 1;
if (__w > __len)
{
_S_pad_char(__out, __pads, &__c, __w, __len);
__len = __w;
}
__out.write(__pads, __len);
__out.width(0);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
__out.setstate(ios_base::badbit);
if ((__out.exceptions() & ios_base::badbit) != 0)
throw;
}
}
return __out;
}
// Specialization
template <class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, char __c)
{
typedef basic_ostream<char, _Traits> __ostream_type;
__ostream_type::sentry __cerb(__out);
if (__cerb)
{
try {
streamsize __w = __out.width();
char __pads[__w + 1];
__pads[0] = __c;
streamsize __len = 1;
if (__w > __len)
{
_S_pad_char(__out, __pads, &__c, __w, __len);
__len = __w;
}
__out.write(__pads, __len);
__out.width(0);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
__out.setstate(ios_base::badbit);
if ((__out.exceptions() & ios_base::badbit) != 0)
throw;
}
}
return __out;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
{
typedef basic_ostream<_CharT, _Traits> __ostream_type;
__ostream_type::sentry __cerb(__out);
if (__cerb)
{
try {
streamsize __w = __out.width();
_CharT __pads[__w];
streamsize __len = static_cast<streamsize>(_Traits::length(__s));
if (__w > __len)
{
_S_pad_char(__out, __pads, __s, __w, __len);
__s = __pads;
__len = __w;
}
__out.write(__s, __len);
__out.width(0);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
__out.setstate(ios_base::badbit);
if ((__out.exceptions() & ios_base::badbit) != 0)
throw;
}
}
return __out;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, const char* /*__s*/)
{
#if 0
typedef basic_ostream<_CharT, _Traits> __ostream_type;
typedef typename _Traits::state_type __state_type;
typedef codecvt<char, _CharT, __state_type> __codecvt_type;
typedef typename __ostream_type::char_type __char_type;
__ostream_type::sentry __cerb(__out);
if (__cerb)
{
const __codecvt_type* __fcvt = &use_facet<__codecvt_type>(__out.getloc());
try {
streamsize __n = char_traits<char>::length(__s);
__char_type __conv[__n];
__state_type __state_cur;
__char_type __pbuf[__n];
__char_type* __pend;
char* __send;
__fcvt->out(__state_cur,
__pbuf, __pbuf + __n,
const_cast<const __char_type*&>(__pend),
const_cast<char*>(__s),
const_cast<char*>(__s + __n),
__send);
__out.write(__pbuf, __n);
}
#endif
return __out;
}
// Partial specializationss
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
{
typedef basic_ostream<char, _Traits> __ostream_type;
__ostream_type::sentry __cerb(__out);
if (__cerb)
{
try {
streamsize __w = __out.width();
char __pads[__w];
streamsize __len = static_cast<streamsize>(_Traits::length(__s));
if (__w > __len)
{
_S_pad_char(__out, __pads, __s, __w, __len);
__s = __pads;
__len = __w;
}
__out.write(__s, __len);
__out.width(0);
}
catch(exception& __fail){
// 27.6.1.2.1 Common requirements.
// Turn this on without causing an ios::failure to be thrown.
__out.setstate(ios_base::badbit);
if ((__out.exceptions() & ios_base::badbit) != 0)
throw;
}
}
return __out;
}
// 21.3.7.8 basic_string::operator<<
template<typename _CharT, typename _Traits, typename _Alloc>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out,
const basic_string<_CharT, _Traits, _Alloc>& __s)
{ return (__out << __s.c_str()); }
} // namespace std
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,495 @@
/*
* Copyright (c) 1996
* 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.
*/
#ifndef _CPP_BITS_PTHREAD_ALLOCIMPL_H
#define _CPP_BITS_PTHREAD_ALLOCIMPL_H 1
// Pthread-specific node allocator.
// This is similar to the default allocator, except that free-list
// information is kept separately for each thread, avoiding locking.
// This should be reasonably fast even in the presence of threads.
// The down side is that storage may not be well-utilized.
// It is not an error to allocate memory in thread A and deallocate
// it in thread B. But this effectively transfers ownership of the memory,
// so that it can only be reallocated by thread B. Thus this can effectively
// result in a storage leak if it's done on a regular basis.
// It can also result in frequent sharing of
// cache lines among processors, with potentially serious performance
// consequences.
#include <bits/std_cerrno.h>
#include <bits/stl_config.h>
#include <bits/stl_alloc.h>
#ifndef __RESTRICT
# define __RESTRICT
#endif
#ifndef __STL_NO_BAD_ALLOC
# include <bits/std_new.h>
#endif
__STL_BEGIN_NAMESPACE
#define __STL_DATA_ALIGNMENT 8
union _Pthread_alloc_obj {
union _Pthread_alloc_obj * __free_list_link;
char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */
};
// Pthread allocators don't appear to the client to have meaningful
// instances. We do in fact need to associate some state with each
// thread. That state is represented by
// _Pthread_alloc_per_thread_state<_Max_size>.
template<size_t _Max_size>
struct _Pthread_alloc_per_thread_state {
typedef _Pthread_alloc_obj __obj;
enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT };
_Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
_Pthread_alloc_per_thread_state<_Max_size> * __next;
// Free list link for list of available per thread structures.
// When one of these becomes available for reuse due to thread
// termination, any objects in its free list remain associated
// with it. The whole structure may then be used by a newly
// created thread.
_Pthread_alloc_per_thread_state() : __next(0)
{
memset((void *)__free_list, 0, (size_t) _S_NFREELISTS * sizeof(__obj *));
}
// Returns an object of size __n, and possibly adds to size n free list.
void *_M_refill(size_t __n);
};
// Pthread-specific allocator.
// The argument specifies the largest object size allocated from per-thread
// free lists. Larger objects are allocated using malloc_alloc.
// Max_size must be a power of 2.
template <size_t _Max_size = 128>
class _Pthread_alloc_template {
public: // but only for internal use:
typedef _Pthread_alloc_obj __obj;
// Allocates a chunk for nobjs of size size. nobjs may be reduced
// if it is inconvenient to allocate the requested number.
static char *_S_chunk_alloc(size_t __size, int &__nobjs);
enum {_S_ALIGN = __STL_DATA_ALIGNMENT};
static size_t _S_round_up(size_t __bytes) {
return (((__bytes) + (int) _S_ALIGN-1) & ~((int) _S_ALIGN - 1));
}
static size_t _S_freelist_index(size_t __bytes) {
return (((__bytes) + (int) _S_ALIGN-1)/(int)_S_ALIGN - 1);
}
private:
// Chunk allocation state. And other shared state.
// Protected by _S_chunk_allocator_lock.
static pthread_mutex_t _S_chunk_allocator_lock;
static char *_S_start_free;
static char *_S_end_free;
static size_t _S_heap_size;
static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states;
static pthread_key_t _S_key;
static bool _S_key_initialized;
// Pthread key under which per thread state is stored.
// Allocator instances that are currently unclaimed by any thread.
static void _S_destructor(void *instance);
// Function to be called on thread exit to reclaim per thread
// state.
static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state();
// Return a recycled or new per thread state.
static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state();
// ensure that the current thread has an associated
// per thread state.
class _M_lock;
friend class _M_lock;
class _M_lock {
public:
_M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); }
~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); }
};
public:
/* n must be > 0 */
static void * allocate(size_t __n)
{
__obj * volatile * __my_free_list;
__obj * __RESTRICT __result;
_Pthread_alloc_per_thread_state<_Max_size>* __a;
if (__n > _Max_size) {
return(malloc_alloc::allocate(__n));
}
if (!_S_key_initialized ||
!(__a = (_Pthread_alloc_per_thread_state<_Max_size>*)
pthread_getspecific(_S_key))) {
__a = _S_get_per_thread_state();
}
__my_free_list = __a -> __free_list + _S_freelist_index(__n);
__result = *__my_free_list;
if (__result == 0) {
void *__r = __a -> _M_refill(_S_round_up(__n));
return __r;
}
*__my_free_list = __result -> __free_list_link;
return (__result);
};
/* p may not be 0 */
static void deallocate(void *__p, size_t __n)
{
__obj *__q = (__obj *)__p;
__obj * volatile * __my_free_list;
_Pthread_alloc_per_thread_state<_Max_size>* __a;
if (__n > _Max_size) {
malloc_alloc::deallocate(__p, __n);
return;
}
if (!_S_key_initialized ||
!(__a = (_Pthread_alloc_per_thread_state<_Max_size> *)
pthread_getspecific(_S_key))) {
__a = _S_get_per_thread_state();
}
__my_free_list = __a->__free_list + _S_freelist_index(__n);
__q -> __free_list_link = *__my_free_list;
*__my_free_list = __q;
}
static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz);
} ;
typedef _Pthread_alloc_template<> pthread_alloc;
template <size_t _Max_size>
void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance)
{
_M_lock __lock_instance; // Need to acquire lock here.
_Pthread_alloc_per_thread_state<_Max_size>* __s =
(_Pthread_alloc_per_thread_state<_Max_size> *)__instance;
__s -> __next = _S_free_per_thread_states;
_S_free_per_thread_states = __s;
}
template <size_t _Max_size>
_Pthread_alloc_per_thread_state<_Max_size> *
_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state()
{
/* lock already held here. */
if (0 != _S_free_per_thread_states) {
_Pthread_alloc_per_thread_state<_Max_size> *__result =
_S_free_per_thread_states;
_S_free_per_thread_states = _S_free_per_thread_states -> __next;
return __result;
} else {
return new _Pthread_alloc_per_thread_state<_Max_size>;
}
}
template <size_t _Max_size>
_Pthread_alloc_per_thread_state<_Max_size> *
_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state()
{
/*REFERENCED*/
_M_lock __lock_instance; // Need to acquire lock here.
int __ret_code;
_Pthread_alloc_per_thread_state<_Max_size> * __result;
if (!_S_key_initialized) {
if (pthread_key_create(&_S_key, _S_destructor)) {
__THROW_BAD_ALLOC; // defined in stl_alloc.h
}
_S_key_initialized = true;
}
__result = _S_new_per_thread_state();
__ret_code = pthread_setspecific(_S_key, __result);
if (__ret_code) {
if (__ret_code == ENOMEM) {
__THROW_BAD_ALLOC;
} else {
// EINVAL
abort();
}
}
return __result;
}
/* We allocate memory in large chunks in order to avoid fragmenting */
/* the malloc heap too much. */
/* We assume that size is properly aligned. */
template <size_t _Max_size>
char *_Pthread_alloc_template<_Max_size>
::_S_chunk_alloc(size_t __size, int &__nobjs)
{
{
char * __result;
size_t __total_bytes;
size_t __bytes_left;
/*REFERENCED*/
_M_lock __lock_instance; // Acquire lock for this routine
__total_bytes = __size * __nobjs;
__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 >= __size) {
__nobjs = __bytes_left/__size;
__total_bytes = __size * __nobjs;
__result = _S_start_free;
_S_start_free += __total_bytes;
return(__result);
} else {
size_t __bytes_to_get =
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
// Try to make use of the left-over piece.
if (__bytes_left > 0) {
_Pthread_alloc_per_thread_state<_Max_size>* __a =
(_Pthread_alloc_per_thread_state<_Max_size>*)
pthread_getspecific(_S_key);
__obj * volatile * __my_free_list =
__a->__free_list + _S_freelist_index(__bytes_left);
((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
*__my_free_list = (__obj *)_S_start_free;
}
# ifdef _SGI_SOURCE
// Try to get memory that's aligned on something like a
// cache line boundary, so as to avoid parceling out
// parts of the same line to different threads and thus
// possibly different processors.
{
const int __cache_line_size = 128; // probable upper bound
__bytes_to_get &= ~(__cache_line_size-1);
_S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
if (0 == _S_start_free) {
_S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
}
}
# else /* !SGI_SOURCE */
_S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
# endif
_S_heap_size += __bytes_to_get;
_S_end_free = _S_start_free + __bytes_to_get;
}
}
// lock is released here
return(_S_chunk_alloc(__size, __nobjs));
}
/* Returns an object of size n, and optionally adds to size n free list.*/
/* We assume that n is properly aligned. */
/* We hold the allocation lock. */
template <size_t _Max_size>
void *_Pthread_alloc_per_thread_state<_Max_size>
::_M_refill(size_t __n)
{
int __nobjs = 128;
char * __chunk =
_Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs);
__obj * volatile * __my_free_list;
__obj * __result;
__obj * __current_obj, * __next_obj;
int __i;
if (1 == __nobjs) {
return(__chunk);
}
__my_free_list = __free_list
+ _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n);
/* Build free list in chunk */
__result = (__obj *)__chunk;
*__my_free_list = __next_obj = (__obj *)(__chunk + __n);
for (__i = 1; ; __i++) {
__current_obj = __next_obj;
__next_obj = (__obj *)((char *)__next_obj + __n);
if (__nobjs - 1 == __i) {
__current_obj -> __free_list_link = 0;
break;
} else {
__current_obj -> __free_list_link = __next_obj;
}
}
return(__result);
}
template <size_t _Max_size>
void *_Pthread_alloc_template<_Max_size>
::reallocate(void *__p, size_t __old_sz, size_t __new_sz)
{
void * __result;
size_t __copy_sz;
if (__old_sz > _Max_size
&& __new_sz > _Max_size) {
return(realloc(__p, __new_sz));
}
if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
__result = allocate(__new_sz);
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
memcpy(__result, __p, __copy_sz);
deallocate(__p, __old_sz);
return(__result);
}
template <size_t _Max_size>
_Pthread_alloc_per_thread_state<_Max_size> *
_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0;
template <size_t _Max_size>
pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key;
template <size_t _Max_size>
bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false;
template <size_t _Max_size>
pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock
= PTHREAD_MUTEX_INITIALIZER;
template <size_t _Max_size>
char *_Pthread_alloc_template<_Max_size>
::_S_start_free = 0;
template <size_t _Max_size>
char *_Pthread_alloc_template<_Max_size>
::_S_end_free = 0;
template <size_t _Max_size>
size_t _Pthread_alloc_template<_Max_size>
::_S_heap_size = 0;
#ifdef __STL_USE_STD_ALLOCATORS
template <class _Tp>
class pthread_allocator {
typedef pthread_alloc _S_Alloc; // The underlying allocator.
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
template <class _NewType> struct rebind {
typedef pthread_allocator<_NewType> other;
};
pthread_allocator() __STL_NOTHROW {}
pthread_allocator(const pthread_allocator& a) __STL_NOTHROW {}
template <class _OtherType>
pthread_allocator(const pthread_allocator<_OtherType>&)
__STL_NOTHROW {}
~pthread_allocator() __STL_NOTHROW {}
pointer address(reference __x) const { return &__x; }
const_pointer address(const_reference __x) const { return &__x; }
// __n is permitted to be 0. The C++ standard says nothing about what
// the return value is when __n == 0.
_Tp* allocate(size_type __n, const void* = 0) {
return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp)))
: 0;
}
// p is not permitted to be a null pointer.
void deallocate(pointer __p, size_type __n)
{ _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
size_type max_size() const __STL_NOTHROW
{ return size_t(-1) / sizeof(_Tp); }
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
void destroy(pointer _p) { _p->~_Tp(); }
};
template<>
class pthread_allocator<void> {
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef void* pointer;
typedef const void* const_pointer;
typedef void value_type;
template <class _NewType> struct rebind {
typedef pthread_allocator<_NewType> other;
};
};
template <size_t _Max_size>
inline bool operator==(const _Pthread_alloc_template<_Max_size>&,
const _Pthread_alloc_template<_Max_size>&)
{
return true;
}
template <class _T1, class _T2>
inline bool operator==(const pthread_allocator<_T1>&,
const pthread_allocator<_T2>& a2)
{
return true;
}
template <class _T1, class _T2>
inline bool operator!=(const pthread_allocator<_T1>&,
const pthread_allocator<_T2>&)
{
return false;
}
template <class _Tp, size_t _Max_size>
struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type;
typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> >
allocator_type;
};
template <class _Tp, class _Atype, size_t _Max>
struct _Alloc_traits<_Tp, __allocator<_Atype, _Pthread_alloc_template<_Max> > >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type;
typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type;
};
template <class _Tp, class _Atype>
struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
{
static const bool _S_instanceless = true;
typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type;
typedef pthread_allocator<_Tp> allocator_type;
};
#endif /* __STL_USE_STD_ALLOCATORS */
__STL_END_NAMESPACE
#endif /* _CPP_BITS_PTHREAD_ALLOCIMPL_H */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,264 @@
// Streambuf iterators
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// XXX Should specialize copy, find algorithms for streambuf iterators.
#ifndef _CPP_BITS_SBUF_ITER_H
#define _CPP_BITS_SBUF_ITER_H 1
namespace std
{
template<typename _CharT, typename _Traits>
class ostreambuf_iterator
#if 0 // XXX this is standard:
: public iterator<output_iterator_tag,_CharT,void,void,void>
#else
: public output_iterator
#endif
{
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
typedef basic_streambuf<_CharT, _Traits> streambuf_type;
typedef basic_ostream<_CharT, _Traits> ostream_type;
inline
ostreambuf_iterator(ostream_type& __s) throw ()
: _M_sbuf(__s.rdbuf()), _M_failed(false) { }
ostreambuf_iterator(streambuf_type* __s) throw ()
: _M_sbuf(__s), _M_failed(false) { }
ostreambuf_iterator&
operator=(_CharT __c);
ostreambuf_iterator&
operator*() throw()
{ return *this; }
ostreambuf_iterator&
operator++(int) throw()
{ return *this; }
ostreambuf_iterator&
operator++() throw()
{ return *this; }
bool
failed() const throw()
{ return _M_failed; }
private:
streambuf_type* _M_sbuf;
bool _M_failed;
#if 0
template<>
friend char const*
copy(char const* __first, char const* __last,
ostreambuf_iterator<char,char_traits<char> > __to);
template<>
friend wchar_t const*
copy(wchar_t const* __first, wchar_t const* __last,
ostreambuf_iterator<wchar_t,char_traits<wchar_t> > __to);
#endif
};
template<typename _CharT, typename _Traits>
inline ostreambuf_iterator<_CharT, _Traits>&
ostreambuf_iterator<_CharT, _Traits>::operator=(_CharT __c)
{
if (!_M_failed &&
_Traits::eq_int_type(_M_sbuf->sputc(__c),_Traits::eof()))
_M_failed = true;
return *this;
}
#if 0
// Optimized specializations of standard algorithms
// These are specialized only for standard types
// (with no unbound arguments) to avoid creating
// overload problems with user specializations.
template<>
char const*
copy(char const* __first, char const* __last,
ostreambuf_iterator<char,char_traits<char> > __to)
{
if (!__to._M_failed)
__to._M_sbuf->sputn(__first, __last-__first);
return __last;
}
template<>
wchar_t const*
copy(wchar_t const* __first, wchar_t const* __last,
ostreambuf_iterator<whar_t,char_traits<wchar_t> > __to)
{
if (!__to._M_failed)
__to._M_sbuf->sputn(__first, __last-__first);
return __last;
}
#endif
// 24.5.3 Template class istreambuf_iterator
template<class _CharT, class _Traits>
class istreambuf_iterator
: public iterator<input_iterator_tag, _CharT, typename _Traits::off_type,
_CharT*, _CharT&>
{
public:
// Types:
typedef _CharT char_type;
typedef _Traits traits_type;
typedef typename _Traits::int_type int_type;
typedef basic_streambuf<_CharT, _Traits> streambuf_type;
typedef basic_istream<_CharT, _Traits> istream_type;
// Non-standard Types:
typedef istreambuf_iterator<_CharT, _Traits> __istreambufiter_type;
istreambuf_iterator() throw()
: _M_istreambuf(NULL), _M_c(-2) { }
istreambuf_iterator(istream_type& __s) throw()
: _M_istreambuf(__s.rdbuf()), _M_c(-2) { }
istreambuf_iterator(streambuf_type* __s) throw()
: _M_istreambuf(__s), _M_c(-2) { }
// NB: This should really have an int_type return
// value, so "end of stream" postion can be checked without
// hacking.
char_type
operator*() const
{
// The result of operator*() on an end of stream is undefined.
char_type __retval;
if (_M_istreambuf && _M_c != static_cast<int_type>(-2))
__retval = _M_c;
else if (_M_istreambuf)
__retval = traits_type::to_char_type(_M_istreambuf->sgetc());
else
__retval = static_cast<char_type>(traits_type::eof());
return __retval;
}
__istreambufiter_type&
operator++()
{
if (_M_istreambuf)
_M_istreambuf->sbumpc();
_M_c = -2;
return *this;
}
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 14882 says return a proxy object. It should be a const
// proxy object, but since this class is not mandated, it
// should allow this signature:
const __istreambufiter_type
operator++(int)
{
if (_M_istreambuf)
_M_c = _M_istreambuf->sbumpc();
return *this;
}
#endif
bool
equal(const __istreambufiter_type& __b)
{
int_type __eof = traits_type::eof();
bool __thiseof = !_M_istreambuf || _M_istreambuf->sgetc() == __eof;
bool __beof = !__b._M_istreambuf
|| __b._M_istreambuf->sgetc() == __eof;
return (__thiseof && __beof || (!__thiseof && !__beof));
}
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// 110 istreambuf_iterator::equal not const
// NB: there is also number 111 pending on this function.
bool
equal(const __istreambufiter_type& __b) const
{
int_type __eof = traits_type::eof();
bool __thiseof = !_M_istreambuf || _M_istreambuf->sgetc() == __eof;
bool __beof = !__b._M_istreambuf
|| __b._M_istreambuf->sgetc() == __eof;
return (__thiseof && __beof || (!__thiseof && !__beof));
}
#endif
private:
// 24.5.3 istreambuf_iterator
// p 1
// If the end of stream is reached (streambuf_type::sgetc()
// returns traits_type::eof()), the iterator becomes equal to
// the "end of stream" iterator value.
// NB: This implementation assumes the "end of stream" value
// is EOF, or -1.
streambuf_type* _M_istreambuf;
int_type _M_c;
};
template<typename _CharT, typename _Traits>
inline bool
operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
const istreambuf_iterator<_CharT, _Traits>& __b)
{ return __a.equal(__b); }
template<typename _CharT, typename _Traits>
inline bool
operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,
const istreambuf_iterator<_CharT, _Traits>& __b)
{ return !__a.equal(__b); }
} // std::
#endif /* _CPP_BITS_SBUF_ITER_H */

77
libstdc++-v3/bits/slice.h Normal file
View File

@ -0,0 +1,77 @@
// The template and inlines for the -*- C++ -*- slice class.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef _CPP_BITS_SLICE_H
#define _CPP_BITS_SLICE_H
namespace std {
class slice
{
public:
slice ();
slice (size_t, size_t, size_t);
size_t start () const;
size_t size () const;
size_t stride () const;
private:
size_t _M_off; // offset
size_t _M_sz; // size
size_t _M_st; // stride unit
};
inline slice::slice () {}
inline slice::slice (size_t __o, size_t __d, size_t __s)
: _M_off (__o), _M_sz (__d), _M_st (__s) {}
inline size_t
slice::start () const
{ return _M_off; }
inline size_t
slice::size () const
{ return _M_sz; }
inline size_t
slice::stride () const
{ return _M_st; }
} // std::
#endif /* _CPP_BITS_SLICE_H */
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,161 @@
// The template and inlines for the -*- C++ -*- slice_array class.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
#ifndef _CPP_BITS_SLICE_ARRAY_H
#define _CPP_BITS_SLICE_ARRAY_H 1
namespace std {
template<typename _Tp>
class slice_array
{
public:
typedef _Tp value_type;
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
void operator%= (const valarray<_Tp>&) const;
void operator+= (const valarray<_Tp>&) const;
void operator-= (const valarray<_Tp>&) const;
void operator^= (const valarray<_Tp>&) const;
void operator&= (const valarray<_Tp>&) const;
void operator|= (const valarray<_Tp>&) const;
void operator<<= (const valarray<_Tp>&) const;
void operator>>= (const valarray<_Tp>&) const;
void operator= (const _Tp &);
// ~slice_array ();
template<class _Dom>
void operator= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator*= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator/= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator%= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator+= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator-= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator^= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator&= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator|= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator<<= (const _Expr<_Dom,_Tp>&) const;
template<class _Dom>
void operator>>= (const _Expr<_Dom,_Tp>&) const;
private:
friend class valarray<_Tp>;
slice_array(_Array<_Tp>, const slice&);
const size_t _M_sz;
const size_t _M_stride;
const _Array<_Tp> _M_array;
// this constructor is implemented since we need to return a value.
slice_array (const slice_array&);
// not implemented
slice_array ();
slice_array& operator= (const slice_array&);
};
template<typename _Tp>
inline slice_array<_Tp>::slice_array (_Array<_Tp> __a, const slice& __s)
: _M_sz (__s.size ()), _M_stride (__s.stride ()),
_M_array (__a.begin () + __s.start ()) {}
template<typename _Tp>
inline slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)
: _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}
// template<typename _Tp>
// inline slice_array<_Tp>::~slice_array () {}
template<typename _Tp>
inline void
slice_array<_Tp>::operator= (const _Tp& __t)
{ __valarray_fill (_M_array, _M_sz, _M_stride, __t); }
template<typename _Tp>
inline void
slice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
{ __valarray_copy (_Array<_Tp> (__v), _M_array, _M_sz, _M_stride); }
template<typename _Tp>
template<class _Dom>
inline void
slice_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const
{ __valarray_copy (__e, _M_sz, _M_array, _M_stride); }
#undef _DEFINE_VALARRAY_OPERATOR
#define _DEFINE_VALARRAY_OPERATOR(op, name) \
template<typename _Tp> \
inline void \
slice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
{ \
_Array_augmented_##name (_M_array, _M_sz, _M_stride, _Array<_Tp> (__v));\
} \
\
template<typename _Tp> template<class _Dom> \
inline void \
slice_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \
{ \
_Array_augmented_##name (_M_array, _M_stride, __e, _M_sz); \
}
_DEFINE_VALARRAY_OPERATOR(*, multiplies)
_DEFINE_VALARRAY_OPERATOR(/, divides)
_DEFINE_VALARRAY_OPERATOR(%, modulus)
_DEFINE_VALARRAY_OPERATOR(+, plus)
_DEFINE_VALARRAY_OPERATOR(-, minus)
_DEFINE_VALARRAY_OPERATOR(^, xor)
_DEFINE_VALARRAY_OPERATOR(&, and)
_DEFINE_VALARRAY_OPERATOR(|, or)
_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
#undef _DEFINE_VALARRAY_OPERATOR
} // std::
#endif /* _CPP_BITS_SLICE_ARRAY_H */
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,221 @@
// String based streams -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.7 String-based streams
//
#ifndef _CPP_BITS_SSTREAM_TCC
#define _CPP_BITS_SSTREAM_TCC 1
#include <bits/std_sstream.h>
namespace std {
template <class _CharT, class _Traits, class _Alloc>
basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
basic_stringbuf<_CharT, _Traits, _Alloc>::
pbackfail(int_type __c)
{
int_type __retval = traits_type::eof();
bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
bool __testpos = _M_in_cur && _M_in_beg < _M_in_cur;
// Try to put back __c into input sequence in one of three ways.
// Order these tests done in is unspecified by the standard.
if (!__testeof && __testpos
&& traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]))
{
--_M_in_cur;
__retval = __c;
}
else if (!__testeof && __testpos)
{
--_M_in_cur;
*_M_in_cur = traits_type::to_char_type(__c);
__retval = __c;
}
else if (__testeof && __testpos)
{
--_M_in_cur;
__retval = traits_type::not_eof(__c);
}
return __retval;
}
template <class _CharT, class _Traits, class _Alloc>
basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
basic_stringbuf<_CharT, _Traits, _Alloc>::
overflow(int_type __c)
{
int_type __retval = traits_type::eof();
bool __testeof = traits_type::eq_int_type(__c, __retval);
bool __testwrite = _M_out_cur < _M_buf + _M_buf_size;
bool __testout = _M_mode & ios_base::out;
// Try to append __c into output sequence in one of two ways.
// Order these tests done in is unspecified by the standard.
if (__testout)
{
if (!__testeof)
{
// NB: Start ostringstream buffers at 1024 bytes. This
// is an experimental value (pronounced "arbitrary" in
// some of the hipper english-speaking countries), and
// can be changed to suite particular needs.
__size_type __len = max(_M_buf_size, static_cast<int_type>(512));
__len *= 2;
if (__testwrite)
__retval = this->sputc(__c);
else if (__len <= _M_string.max_size())
{
// Force-allocate, re-sync.
_M_string = this->str();
_M_string.reserve(__len);
_M_buf_size = static_cast<int_type>(__len);
_M_really_sync(_M_in_cur - _M_in_beg,
_M_out_cur - _M_out_beg);
*_M_out_cur = traits_type::to_char_type(__c);
_M_buf_bump(1);
__retval = __c;
}
}
else
__retval = traits_type::not_eof(__c);
}
return __retval;
}
template <class _CharT, class _Traits, class _Alloc>
basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
basic_stringbuf<_CharT, _Traits, _Alloc>::
seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)
{
pos_type __retval = pos_type(off_type(-1));
bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
bool __testboth = __testin && __testout && __way != ios_base::cur;
if (_M_buf_size && ((__testin != __testout) || __testboth))
{
char_type* __beg = _M_buf;
char_type* __curi = NULL;
char_type* __curo = NULL;
char_type* __endi = NULL;
char_type* __endo = NULL;
if (__testin)
{
__curi = this->gptr();
__endi = this->egptr();
}
if (__testout)
{
__curo = this->pptr();
__endo = this->epptr();
}
off_type __newoffi = 0;
off_type __newoffo = 0;
if (__way == ios_base::cur)
{
__newoffi = __curi - __beg;
__newoffo = __curo - __beg;
}
else if (__way == ios_base::end)
{
__newoffi = __endi - __beg;
__newoffo = __endo - __beg;
}
if (__testin
&& __newoffi + __off >= 0 && __endi - __beg >= __newoffi + __off)
{
_M_in_cur = __beg + __newoffi + __off;
__retval = pos_type(__newoffi);
}
if (__testout
&& __newoffo + __off >= 0 && __endo - __beg >= __newoffo + __off)
{
_M_buf_bump(__newoffo + __off - (_M_out_cur - __beg));
__retval = pos_type(__newoffo);
}
}
return __retval;
}
template <class _CharT, class _Traits, class _Alloc>
basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
basic_stringbuf<_CharT, _Traits, _Alloc>::
seekpos(pos_type __sp, ios_base::openmode __mode)
{
pos_type __retval = pos_type(off_type(-1));
off_type __pos = __sp._M_position();
char_type* __beg = NULL;
char_type* __end = NULL;
bool __testin = __mode & ios_base::in && _M_mode & ios_base::in;
bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
if (__testin)
{
__beg = this->eback();
__end = this->egptr();
}
if (__testout)
{
__beg = this->pbase();
__end = _M_buf + _M_buf_size;
}
if (0 <= __pos && __pos <= __end - __beg)
{
// Need to set both of these if applicable
if (__testin)
_M_in_cur = _M_in_beg + __pos;
if (__testout)
_M_buf_bump((__pos) - (_M_out_cur - __beg));
__retval = pos_type(off_type(__pos));
}
return __retval;
}
} // namespace std
#endif /* _CPP_BITS_SSTREAM_TCC */

View File

@ -0,0 +1,40 @@
/*
*
* 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.
*/
#ifndef _CPP_ALGORITHM
#define _CPP_ALGORITHM 1
#include <bits/stl_algobase.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_tempbuf.h>
#include <bits/stl_algo.h>
#endif /* _CPP_ALGORITHM */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 19.2 Assertions
//
// Note: This is not a conforming implementation.
// No include guards on this header...
# include_next <assert.h>

View File

@ -0,0 +1,210 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: <ccytpe>
//
#ifndef _CPP_CCTYPE
#define _CPP_CCTYPE 1
// This keeps isanum, et al from being propagated as macros.
#if __linux__
#define __NO_CTYPE 1
#endif
# include_next <ctype.h>
// Sequester the C non-inline implementations in the _C_Swamp::
// namespace, and provide C++ inlines for them in the std:: namespace
// where they belong.
namespace std
{
// NB: If not using namespaces, can't have any of these definitions,
// as they will duplicate what's in the global namespace.
#ifdef toupper
inline int
_S_toupper_helper(int __c) { return toupper(__c); }
# undef toupper
inline int
toupper(int __c) { return _S_toupper_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
toupper(int __c) { return ::toupper(__c); }
#endif
#ifdef tolower
inline int
_S_tolower_helper(int __c) { return tolower(__c); }
# undef tolower
inline int
tolower(int __c) { return _S_tolower_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
tolower(int __c) { return ::tolower(__c); }
#endif
#ifdef isspace
inline int
_S_isspace_helper(int __c) { return isspace(__c); }
# undef isspace
inline int
isspace(int __c) { return _S_isspace_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isspace(int __c) { return ::isspace(__c); }
#endif
#ifdef isprint
inline int
_S_isprint_helper(int __c) { return isprint(__c); }
# undef isprint
inline int
isprint(int __c) { return _S_isprint_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isprint(int __c) { return ::isprint(__c); }
#endif
#ifdef iscntrl
inline int
_S_iscntrl_helper(int __c) { return iscntrl(__c); }
# undef iscntrl
inline int
iscntrl(int __c) { return _S_iscntrl_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
iscntrl(int __c) { return ::iscntrl(__c); }
#endif
#ifdef isupper
inline int
_S_isupper_helper(int __c) { return isupper(__c); }
# undef isupper
inline int
isupper(int __c) { return _S_isupper_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isupper(int __c) { return ::isupper(__c); }
#endif
#ifdef islower
inline int
_S_islower_helper(int __c) { return islower(__c); }
# undef islower
inline int
islower(int __c) { return _S_islower_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
islower(int __c) { return ::islower(__c); }
#endif
#ifdef isalpha
inline int
_S_isalpha_helper(int __c) { return isalpha(__c); }
# undef isalpha
inline int
isalpha(int __c) { return _S_isalpha_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isalpha(int __c) { return ::isalpha(__c); }
#endif
#ifdef isdigit
inline int
_S_isdigit_helper(int __c) { return isdigit(__c); }
# undef isdigit
inline int
isdigit(int __c) { return _S_isdigit_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isdigit(int __c) { return ::isdigit(__c); }
#endif
#ifdef ispunct
inline int
_S_ispunct_helper(int __c) { return ispunct(__c); }
# undef ispunct
inline int
ispunct(int __c) { return _S_ispunct_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
ispunct(int __c) { return ::ispunct(__c); }
#endif
#ifdef isxdigit
inline int
_S_isxdigit_helper(int __c) { return isxdigit(__c); }
# undef isxdigit
inline int
isxdigit(int __c) { return _S_isxdigit_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isxdigit(int __c) { return ::isxdigit(__c); }
#endif
#ifdef isalnum
inline int
_S_isalnum_helper(int __c) { return isalnum(__c); }
# undef isalnum
inline int
isalnum(int __c) { return _S_isalnum_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isalnum(int __c) { return ::isalnum(__c); }
#endif
#ifdef isgraph
inline int
_S_isgraph_helper(int __c) { return isgraph(__c); }
# undef isgraph
inline int
isgraph(int __c) { return _S_isgraph_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
inline int
isgraph(int __c) { return ::isgraph(__c); }
#endif
} // namespace std
#endif // _CPP_CCTYPE

View File

@ -0,0 +1,39 @@
// The -*- C++ -*- error number header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 19.3 Error numbers
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CERRNO
#define _CPP_CERRNO 1
# include_next <errno.h>
#endif

View File

@ -0,0 +1,46 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 18.2.2 Implementation properties: C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CFLOAT
#define _CPP_CFLOAT 1
# include_next <float.h>
#if 0
# ifdef __GLIBC__
// For GNU libc we must also include this one:
# include <fenv.h>
# endif
#endif
#endif

View File

@ -0,0 +1,71 @@
// ciso646 -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: <ciso646>
//
#ifndef _CPP_ISO646
#define _CPP_ISO646 1
namespace std {
// 2.11 Keywords
// alternative representations
// and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
#ifndef __cplusplus
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
#endif
#if 0
template<typename _T1, typename _T2>
inline bool
operator and(const _T1& __lhs, const _T2& __rhs)
{ return (static_cast<bool>(__lhs) && static_cast<bool>(__rhs)); }
template<typename _T1, typename _T2>
inline bool
operator or(const _T1& __lhs, const _T2& __rhs)
{ return (static_cast<bool>(__lhs) || static_cast<bool>(__rhs)); }
#endif
} // namespace std
#endif // _CPP_ISO646

View File

@ -0,0 +1,39 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 18.2.2 Implementation properties: C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CLIMITS
#define _CPP_CLIMITS 1
# include_next <limits.h>
#endif

View File

@ -0,0 +1,40 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 18.2.2 Implementation properties: C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CLOCALE
#define _CPP_CLOCALE 1
# include_next <locale.h>
#endif

View File

@ -0,0 +1,247 @@
// -*- C++ -*- C math library.
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 26.5 C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CMATH
#define _CPP_CMATH 1
# include_next <math.h>
# include_next <stdlib.h>
#include <bits/c++config.h>
namespace std {
inline long
abs(long __l) { return ::labs(__l); }
inline ldiv_t
div(long __a, long __b) { return ::ldiv(__a, __b); }
// double
inline double
abs(double __x) { return ::fabs(__x); }
double
pow(double, int);
// float
inline float
ceil(float __x) { return ::ceil(static_cast<double>(__x)); }
inline float
floor(float __x) { return ::floor(static_cast<double>(__x)); }
inline float
fmod(float __x, float __y)
{ return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); }
inline float
frexp(float __x, int* __p)
{ return ::frexp(static_cast<double>(__x), __p); }
inline float
ldexp(float __x, int __i)
{ return ::ldexp(static_cast<double>(__x), __i); }
inline float
pow(float __x, float __y)
{ return ::pow(static_cast<double>(__x), static_cast<double>(__y)); }
float
pow(float, int);
#if _GLIBCPP_HAVE_ABSF
inline float
abs(float __x) { return ::absf(__x); }
#else
inline float
abs(float __x) { return ::fabs(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ACOSF
inline float
acos(float __x) { return ::acosf(__x); }
#else
inline float
acos(float __x) { return ::acos(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ASINF
inline float
asin(float __x) { return ::asinf(__x); }
#else
inline float
asin(float __x) { return ::asin(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ATANF
inline float
atan(float __x) { return ::atanf(__x); }
#else
inline float
atan(float __x) { return ::atan(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ATAN2F
inline float
atan2(float __x, float __y) { return ::atan2f(__x, __y); }
#else
inline float
atan2(float __x, float __y)
{ return ::atan2(static_cast<double>(__x), static_cast<double>(__y)); }
#endif
#if _GLIBCPP_HAVE_TANF
inline float
tan(float __x) { return ::tanf(__x); }
#else
inline float
tan(float __x) { return ::tan(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_SINHF
inline float
sinh(float __x) { return ::sinhf(__x); }
#else
inline float
sinh(float __x) { return ::sinh(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_TANHF
inline float
tanh(float __x) { return ::tanhf(__x); }
#else
inline float
tanh(float __x) { return ::tanh(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_COSHF
inline float
cosh(float __x) { return ::coshf(__x); }
#else
inline float
cosh(float __x) { return ::cosh(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_EXPF
inline float
exp(float __x) { return ::expf(__x); }
#else
inline float
exp(float __x) { return ::exp(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_LOGF
inline float
log(float __x) { return ::logf(__x); }
#else
inline float
log(float __x) { return ::log(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_LOG10F
inline float
log10(float __x) { return ::log10f(__x); }
#else
inline float
log10(float __x) { return ::log10(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_MODFF
inline float
modf(float __x, float* __p) { return ::modff(__x, __p); }
#else
inline float
modf(float __x, float* __p)
{
double __tmp;
double __res = ::modf(static_cast<double>(__x), &__tmp);
*__p = static_cast<float> (__tmp);
return __res;
}
#endif
#if GLIBCPP_HAS_BUILTIN_SINF
inline float
sin(float __x) { return __builtin_sinf(__x); }
#elif _GLIBCPP_HAVE_SINF
inline float
sin(float __x) { return ::sinf(__x); }
#else
inline float
sin(float __x) { return ::sin(static_cast<double>(__x)); }
#endif
#if GLIBCPP_HAS_BUILTIN_COSF
inline float
cos(float __x) { return __builtin_cosf(__x); }
#elif _GLIBCPP_HAVE_COSF
inline float
cos(float __x) { return ::cosf(__x); }
#else
inline float
cos(float __x) { return ::cos(static_cast<double>(__x)); }
#endif
#if GLIBCPP_HAS_BUILTIN_FABSF
inline float
fabs(float __x) { return __builtin_fabsf(__x); }
#elif _GLIBCPP_HAVE_FABSF
inline float
fabs(float __x) { return ::fabsf(__x); }
#else
inline float
fabs(float __x) { return ::fabs(static_cast<double>(__x)); }
#endif
#if GLIBCPP_HAS_BUILTIN_SQRTF
inline float
sqrt(float __x) { return __builtin_sqrtf(__x); }
#elif _GLIBCPP_HAVE_SQRTF
inline float
sqrt(float __x) { return ::sqrtf(__x); }
#else
inline float
sqrt(float __x) { return ::fabs(static_cast<double>(__x)); }
#endif
// XXX long double
long double
pow(long double, int);
} // std
#endif // _CPP_CMATH

View File

@ -0,0 +1,966 @@
// The template and inlines for the -*- C++ -*- complex number classes.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO 14882/26.2.1
// Note: this is not a conforming implementation.
// Initially implemented by Ulrich Drepper <drepper@cygnus.com>
// Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
//
#ifndef _CPP_COMPLEX
#define _CPP_COMPLEX 1
#include <bits/c++config.h>
#include <bits/std_iosfwd.h>
namespace std
{
// Forward declarations
template<typename _Tp> class complex;
template<> class complex<float>;
template<> class complex<double>;
template<> class complex<long double>;
template<typename _Tp> _Tp abs(const complex<_Tp>&);
template<typename _Tp> _Tp arg(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp&);
// Transcendentals:
template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
template<typename _Tp> complex<_Tp> pow (const complex<_Tp>&,
const complex<_Tp>&);
template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&);
template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&);
template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&);
//
// 26.2.2 Primary template class complex
//
template <typename _Tp>
class complex
{
public:
typedef _Tp value_type;
complex (const _Tp& = _Tp(), const _Tp & = _Tp());
// Let's the compiler synthetize the copy constructor
// complex (const complex<_Tp>&);
template <typename _Up>
complex (const complex<_Up>&);
_Tp real () const;
_Tp imag () const;
complex<_Tp>& operator= (const _Tp&);
complex<_Tp>& operator+= (const _Tp&);
complex<_Tp>& operator-= (const _Tp&);
complex<_Tp>& operator*= (const _Tp&);
complex<_Tp>& operator/= (const _Tp&);
// Let's the compiler synthetize the
// copy and assignment operator
// complex<_Tp>& operator= (const complex<_Tp>&);
template <typename _Up>
complex<_Tp>& operator= (const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator+= (const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator-= (const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator*= (const complex<_Up>&);
template <typename _Up>
complex<_Tp>& operator/= (const complex<_Up>&);
private:
_Tp _M_real, _M_imag;
};
template<typename _Tp>
inline _Tp
complex<_Tp>::real() const { return _M_real; }
template<typename _Tp>
inline _Tp
complex<_Tp>::imag() const { return _M_imag; }
//
// 26.2.3 complex specializations
//
//
// complex<float> specialization
//
template<> class complex<float>
{
public:
typedef float value_type;
complex(float = 0.0f, float = 0.0f);
#ifdef _GLIBCPP_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) {}
#endif
explicit complex(const complex<double>&);
explicit complex(const complex<long double>&);
float real() const;
float imag() const;
complex<float>& operator= (float);
complex<float>& operator+= (float);
complex<float>& operator-= (float);
complex<float>& operator*= (float);
complex<float>& operator/= (float);
// Let's the compiler synthetize the copy and assignment
// operator. It always does a pretty good job.
// complex& operator= (const complex&);
template <typename _Tp>
complex<float>&operator= (const complex<_Tp>&);
template <typename _Tp>
complex<float>& operator+= (const complex<_Tp>&);
template <class _Tp>
complex<float>& operator-= (const complex<_Tp>&);
template <class _Tp>
complex<float>& operator*= (const complex<_Tp>&);
template <class _Tp>
complex<float>&operator/= (const complex<_Tp>&);
private:
typedef __complex__ float _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) {}
friend class complex<double>;
friend class complex<long double>;
friend float abs<>(const complex<float>&);
friend float arg<>(const complex<float>&);
friend complex<float> conj<>(const complex<float>&);
friend complex<float> cos<>(const complex<float>&);
friend complex<float> cosh<>(const complex<float>&);
friend complex<float> exp<>(const complex<float>&);
friend complex<float> log<>(const complex<float>&);
friend complex<float> log10<>(const complex<float>&);
friend complex<float> pow<>(const complex<float>&, int);
friend complex<float> pow<>(const complex<float>&, const float&);
friend complex<float> pow<>(const complex<float>&,
const complex<float>&);
friend complex<float> pow<>(const float&, const complex<float>&);
friend complex<float> sin<>(const complex<float>&);
friend complex<float> sinh<>(const complex<float>&);
friend complex<float> sqrt<>(const complex<float>&);
friend complex<float> tan<>(const complex<float>&);
friend complex<float> tanh<>(const complex<float>&);
};
inline float
complex<float>::real() const
{ return __real__ _M_value; }
inline float
complex<float>::imag() const
{ return __imag__ _M_value; }
//
// complex<double> specialization
//
template<> class complex<double>
{
public:
typedef double value_type;
complex(double =0.0, double =0.0);
#ifdef _GLIBCPP_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) {}
#endif
complex(const complex<float>&);
explicit complex(const complex<long double>&);
double real () const;
double imag () const;
complex<double>& operator= (double);
complex<double>& operator+= (double);
complex<double>& operator-= (double);
complex<double>& operator*= (double);
complex<double>& operator/= (double);
// The compiler will synthetize this, efficiently.
// complex& operator= (const complex&);
template <typename _Tp>
complex<double>& operator= (const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator+= (const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator-= (const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator*= (const complex<_Tp>&);
template <typename _Tp>
complex<double>& operator/= (const complex<_Tp>&);
private:
typedef __complex__ double _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) {}
friend class complex<float>;
friend class complex<long double>;
friend double abs<>(const complex<double>&);
friend double arg<>(const complex<double>&);
friend complex<double> conj<>(const complex<double>&);
friend complex<double> cos<>(const complex<double>&);
friend complex<double> cosh<>(const complex<double>&);
friend complex<double> exp<>(const complex<double>&);
friend complex<double> log<>(const complex<double>&);
friend complex<double> log10<>(const complex<double>&);
friend complex<double> pow<>(const complex<double>&, int);
friend complex<double> pow<>(const complex<double>&, const double&);
friend complex<double> pow<>(const complex<double>&,
const complex<double>&);
friend complex<double> pow<>(const double&, const complex<double>&);
friend complex<double> sin<>(const complex<double>&);
friend complex<double> sinh<>(const complex<double>&);
friend complex<double> sqrt<>(const complex<double>&);
friend complex<double> tan<>(const complex<double>&);
friend complex<double> tanh<>(const complex<double>&);
};
inline double
complex<double>::real() const
{ return __real__ _M_value; }
inline double
complex<double>::imag() const
{ return __imag__ _M_value; }
//
// complex<long double> specialization
//
template<> class complex<long double>
{
public:
typedef long double value_type;
complex(long double = 0.0L, long double = 0.0L);
#ifdef _GLIBCPP_BUGGY_COMPLEX
complex(const complex& __z) : _M_value(__z._M_value) {}
#endif
complex(const complex<float>&);
complex(const complex<double>&);
long double real() const;
long double imag() const;
complex<long double>& operator= (long double);
complex<long double>& operator+= (long double);
complex<long double>& operator-= (long double);
complex<long double>& operator*= (long double);
complex<long double>& operator/= (long double);
// The compiler knows how to do this efficiently
// complex& operator= (const complex&);
template<typename _Tp>
complex<long double>& operator= (const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator+= (const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator-= (const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator*= (const complex<_Tp>&);
template<typename _Tp>
complex<long double>& operator/= (const complex<_Tp>&);
private:
typedef __complex__ long double _ComplexT;
_ComplexT _M_value;
complex(_ComplexT __z) : _M_value(__z) {}
friend class complex<float>;
friend class complex<double>;
friend long double abs<>(const complex<long double>&);
friend long double arg<>(const complex<long double>&);
friend complex<long double> conj<>(const complex<long double>&);
friend complex<long double> cos<>(const complex<long double>&);
friend complex<long double> cosh<>(const complex<long double>&);
friend complex<long double> exp<>(const complex<long double>&);
friend complex<long double> log<>(const complex<long double>&);
friend complex<long double> log10<>(const complex<long double>&);
friend complex<long double> pow<>(const complex<long double>&, int);
friend complex<long double> pow<>(const complex<long double>&,
const long double&);
friend complex<long double> pow<>(const complex<long double>&,
const complex<long double>&);
friend complex<long double> pow<>(const long double&,
const complex<long double>&);
friend complex<long double> sin<>(const complex<long double>&);
friend complex<long double> sinh<>(const complex<long double>&);
friend complex<long double> sqrt<>(const complex<long double>&);
friend complex<long double> tan<>(const complex<long double>&);
friend complex<long double> tanh<>(const complex<long double>&);
};
inline
complex<long double>::complex(long double __r, long double __i)
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
inline
complex<long double>::complex(const complex<float>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
inline
complex<long double>::complex(const complex<double>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
inline long double
complex<long double>::real() const
{ return __real__ _M_value; }
inline long double
complex<long double>::imag() const
{ return __imag__ _M_value; }
inline complex<long double>&
complex<long double>::operator= (long double __r)
{
__real__ _M_value = __r;
__imag__ _M_value = 0.0L;
return *this;
}
inline complex<long double>&
complex<long double>::operator+= (long double __r)
{
__real__ _M_value += __r;
return *this;
}
inline complex<long double>&
complex<long double>::operator-= (long double __r)
{
__real__ _M_value -= __r;
return *this;
}
inline complex<long double>&
complex<long double>::operator*= (long double __r)
{
__real__ _M_value *= __r;
return *this;
}
inline complex<long double>&
complex<long double>::operator/= (long double __r)
{
__real__ _M_value /= __r;
return *this;
}
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator= (const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator+= (const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
return *this;
}
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator-= (const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.imag();
return *this;
}
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator*= (const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value *= __t;
return *this;
}
template<typename _Tp>
inline complex<long double>&
complex<long double>::operator/= (const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value /= __t;
return *this;
}
//
// complex<float> continued.
//
inline
complex<float>::complex(float r, float i)
{
__real__ _M_value = r;
__imag__ _M_value = i;
}
inline
complex<float>::complex(const complex<double>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
inline
complex<float>::complex(const complex<long double>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
inline complex<float>&
complex<float>::operator= (float __f)
{
__real__ _M_value = __f;
__imag__ _M_value = 0.0f;
return *this;
}
inline complex<float>&
complex<float>::operator+= (float __f)
{
__real__ _M_value += __f;
return *this;
}
inline complex<float>&
complex<float>::operator-= (float __f)
{
__real__ _M_value -= __f;
return *this;
}
inline complex<float>&
complex<float>::operator*= (float __f)
{
_M_value *= __f;
return *this;
}
inline complex<float>&
complex<float>::operator/= (float __f)
{
_M_value /= __f;
return *this;
}
template<typename _Tp>
inline complex<float>&
complex<float>::operator= (const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
template<typename _Tp>
inline complex<float>&
complex<float>::operator+= (const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
return *this;
}
template<typename _Tp>
inline complex<float>&
complex<float>::operator-= (const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.real();
return *this;
}
template<typename _Tp>
inline complex<float>&
complex<float>::operator*= (const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value *= __t;
return *this;
}
template<typename _Tp>
inline complex<float>&
complex<float>::operator/= (const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value /= __t;
return *this;
}
//
// complex<double> continued.
//
inline
complex<double>::complex(double __r, double __i)
{
__real__ _M_value = __r;
__imag__ _M_value = __i;
}
inline
complex<double>::complex(const complex<float>& __z)
: _M_value(_ComplexT(__z._M_value)) {}
inline
complex<double>::complex(const complex<long double>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
}
inline complex<double>&
complex<double>::operator= (double __d)
{
__real__ _M_value = __d;
__imag__ _M_value = 0.0;
return *this;
}
inline complex<double>&
complex<double>::operator+= (double __d)
{
__real__ _M_value += __d;
return *this;
}
inline complex<double>&
complex<double>::operator-= (double __d)
{
__real__ _M_value -= __d;
return *this;
}
inline complex<double>&
complex<double>::operator*= (double __d)
{
_M_value *= __d;
return *this;
}
inline complex<double>&
complex<double>::operator/= (double __d)
{
_M_value /= __d;
return *this;
}
template<typename _Tp>
inline complex<double>&
complex<double>::operator= (const complex<_Tp>& __z)
{
__real__ _M_value = __z.real();
__imag__ _M_value = __z.imag();
return *this;
}
template<typename _Tp>
inline complex<double>&
complex<double>::operator+= (const complex<_Tp>& __z)
{
__real__ _M_value += __z.real();
__imag__ _M_value += __z.imag();
return *this;
}
template<typename _Tp>
inline complex<double>&
complex<double>::operator-= (const complex<_Tp>& __z)
{
__real__ _M_value -= __z.real();
__imag__ _M_value -= __z.imag();
return *this;
}
template<typename _Tp>
inline complex<double>&
complex<double>::operator*= (const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value *= __t;
return *this;
}
template<typename _Tp>
inline complex<double>&
complex<double>::operator/= (const complex<_Tp>& __z)
{
_ComplexT __t;
__real__ __t = __z.real();
__imag__ __t = __z.imag();
_M_value /= __t;
return *this;
}
//
// Primary template class complex continued.
//
// 26.2.4
template<typename _Tp>
inline
complex<_Tp>::complex(const _Tp& __r, const _Tp& __i)
: _M_real(__r), _M_imag(__i) {}
template<typename _Tp>
template<typename _Up>
inline
complex<_Tp>::complex(const complex<_Up>& __z)
: _M_real(__z.real()), _M_imag(__z.imag()) {}
// 26.2.7/6
template<typename _Tp>
inline complex<_Tp>
conj(const complex<_Tp>& __z)
{ return complex<_Tp>(__z.real(), -__z.imag()); }
// 26.2.7/4
template<typename _Tp>
inline _Tp
norm(const complex<_Tp>& __z)
{
// XXX: Grammar school computation
return __z.real() * __z.real() + __z.imag() * __z.imag();
}
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator= (const _Tp& __t)
{
_M_real = __t;
_M_imag = _Tp();
return *this;
}
// 26.2.5/1
template<typename _Tp>
inline complex<_Tp>&
complex<_Tp>::operator+= (const _Tp& __t)
{
_M_real += __t;
return *this;
}
// 26.2.5/3
template<typename _Tp>
inline complex<_Tp>&
complex<_Tp>::operator-= (const _Tp& __t)
{
_M_real -= __t;
return *this;
}
// 26.2.5/5
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator*= (const _Tp& __t)
{
_M_real *= __t;
_M_imag *= __t;
return *this;
}
// 26.2.5/7
template<typename _Tp>
complex<_Tp>&
complex<_Tp>::operator/= (const _Tp& __t)
{
_M_real /= __t;
_M_imag /= __t;
return *this;
}
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator= (const complex<_Up>& __z)
{
_M_real = __z.real();
_M_imag = __z.imag();
return *this;
}
// 26.2.5/9
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator+= (const complex<_Up>& __z)
{
_M_real += __z.real();
_M_imag += __z.imag();
return *this;
}
// 26.2.5/11
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator-= (const complex<_Up>& __z)
{
_M_real -= __z.real();
_M_imag -= __z.imag();
return *this;
}
// 26.2.5/13
// XXX: this is a grammar school implementation.
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator*= (const complex<_Up>& __z)
{
_Tp __r = _M_real * __z.real() - _M_imag * __z.imag();
_M_imag = _M_real * __z.imag() + _M_imag * __z.real();
_M_real = __r;
return *this;
}
// 26.2.5/15
// XXX: this is a grammar school implementation.
template<typename _Tp>
template<typename _Up>
complex<_Tp>&
complex<_Tp>::operator/= (const complex<_Up>& __z)
{
_Tp __r = _M_real * __z.real() + _M_imag * __z.imag();
_Tp __n = norm(__z);
_M_imag = (_M_real * __z.imag() - _M_imag * __z.real()) / __n;
_M_real = __r / __n;
return *this;
}
// Operators:
template<typename _Tp>
inline complex<_Tp>
operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__x) += __y; }
template<typename _Tp>
inline complex<_Tp>
operator+(const complex<_Tp>& __x, const _Tp& __y)
{ return complex<_Tp> (__x) += __y; }
template<typename _Tp>
inline complex<_Tp>
operator+(const _Tp& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__y) += __x; }
template<typename _Tp>
inline complex<_Tp>
operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__x) -= __y; }
template<typename _Tp>
inline complex<_Tp>
operator-(const complex<_Tp>& __x, const _Tp& __y)
{ return complex<_Tp> (__x) -= __y; }
template<typename _Tp>
inline complex<_Tp>
operator-(const _Tp& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__x) -= __y; }
template<typename _Tp>
inline complex<_Tp>
operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__x) *= __y; }
template<typename _Tp>
inline complex<_Tp>
operator*(const complex<_Tp>& __x, const _Tp& __y)
{ return complex<_Tp> (__x) *= __y; }
template<typename _Tp>
inline complex<_Tp>
operator*(const _Tp& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__y) *= __x; }
template<typename _Tp>
inline complex<_Tp>
operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__x) /= __y; }
template<typename _Tp>
inline complex<_Tp>
operator/(const complex<_Tp>& __x, const _Tp& __y)
{ return complex<_Tp> (__x) /= __y; }
template<typename _Tp>
inline complex<_Tp>
operator/(const _Tp& __x, const complex<_Tp>& __y)
{ return complex<_Tp> (__x) /= __y; }
template<typename _Tp>
inline complex<_Tp>
operator+(const complex<_Tp>& __x)
{ return __x; }
template<typename _Tp>
inline complex<_Tp>
operator-(const complex<_Tp>& __x)
{ return complex<_Tp>(-__x.real(), -__x.imag()); }
template<typename _Tp>
inline bool
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __x.real() == __y.real() && __x.imag == __y.imag(); }
template<typename _Tp>
inline bool
operator==(const complex<_Tp>& __x, const _Tp& __y)
{ return __x.real() == __y && __x.imag() == 0; }
template<typename _Tp>
inline bool
operator==(const _Tp& __x, const complex<_Tp>& __y)
{ return __x == __y.real() && 0 == __y.imag(); }
template<typename _Tp>
inline bool
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
{ return __x.real() != __y.real() || __x.imag() != __y.imag(); }
template<typename _Tp>
inline bool
operator!=(const complex<_Tp>& __x, const _Tp& __y)
{ return __x.real() != __y || __x.imag() != 0; }
template<typename _Tp>
inline bool
operator!=(const _Tp& __x, const complex<_Tp>& __y)
{ return __x != __y.real() || 0 != __y.imag(); }
template<typename _Tp, typename _CharT, class _Traits>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&);
template<typename _Tp, typename _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>&, const complex<_Tp>&);
// Values:
template <typename _Tp>
inline _Tp
real (const complex<_Tp>& __z)
{ return __z.real(); }
template <typename _Tp>
inline _Tp
imag (const complex<_Tp>& __z)
{ return __z.imag(); }
// We use here a few more specializations.
template<>
inline complex<float>
conj(const complex<float> &__x)
#ifdef _GLIBCPP_BUGGY_FLOAT_COMPLEX
{
complex<float> __tmpf(~__x._M_value);
return __tmpf;
}
#else
{ return complex<float>(~__x._M_value); }
#endif
template<>
inline complex<double>
conj(const complex<double> &__x)
{ return complex<double> (~__x._M_value); }
template<>
inline complex<long double>
conj(const complex<long double> &__x)
{
return complex<long double> (~__x._M_value);
}
} // namespace std
#endif /* _CPP_COMPLEX */

View File

@ -0,0 +1,39 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 20.4.6 C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CSETJMP
#define _CPP_CSETJMP 1
# include_next <setjmp.h>
#endif

View File

@ -0,0 +1,39 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 20.4.6 C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CSIGNAL
#define _CPP_CSIGNAL 1
# include_next <signal.h>
#endif

View File

@ -0,0 +1,39 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 20.4.6 C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CSTDARG
#define _CPP_CSTDARG 1
# include_next <stdarg.h>
#endif

View File

@ -0,0 +1,39 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 18.1 Types
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CSTDDEF
#define _CPP_CSTDDEF 1
# include_next <stddef.h>
#endif

View File

@ -0,0 +1,60 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.8.2 C Library files
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CSTDIO
#define _CPP_CSTDIO 1
# include_next <stdio.h>
#ifndef SEEK_CUR
#define SEEK_CUR 1
#endif
#ifndef SEEK_END
#define SEEK_END 2
#endif
#ifndef SEEK_SET
#define SEEK_SET 4
#endif
#endif

View File

@ -0,0 +1,53 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 20.4.6 C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CSTDLIB
#define _CPP_CSTDLIB 1
// This keeps isanum, et al from being propagated as macros.
#if __linux__
#define __USE_ISOC9X 1
#endif
# include_next <stdlib.h>
#endif // _CPP_CSTDLIB

View File

@ -0,0 +1,43 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 20.4.6 C library
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CSTRING
#define _CPP_CSTRING 1
# if defined __GLIBC__ && __GLIBC__ >= 2
// We must not see the optimized string functions GNU libc defines.
# define __NO_STRING_INLINES
# endif
# include_next <string.h>
#endif

View File

@ -0,0 +1,39 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 20.5 Date and time
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CTIME
#define _CPP_CTIME 1
# include_next <time.h>
#endif

View File

@ -0,0 +1,108 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: ???
//
// Note: this is not a conforming implementation.
#ifndef _CPP_CWCHAR
#define _CPP_CWCHAR 1
#include <bits/c++config.h>
#ifdef _GLIBCPP_USE_WCHAR_T
# include_next <wchar.h>
#endif
extern "C" {
#ifdef _GLIBCPP_USE_WCHAR_T
#ifndef _GLIBCPP_HAVE_WMEMCMP
int wmemcmp(const wchar_t* __s1, const wchar_t* __s2, size_t __n);
#endif
#ifndef _GLIBCPP_HAVE_WCSLEN
size_t wcslen(const wchar_t* __s);
#endif
#ifndef _GLIBCPP_HAVE_WMEMCHR
wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n);
#endif
#ifndef _GLIBCPP_HAVE_WMEMMOVE
wchar_t* wmemmove(wchar_t* __s1, const wchar_t* __s2, size_t __n);
#endif
#ifndef _GLIBCPP_HAVE_WMEMCPY
wchar_t* wmemcpy(wchar_t* __s1, const wchar_t* __s2, size_t __n);
#endif
#ifndef _GLIBCPP_HAVE_WMEMSET
wchar_t* wmemset(wchar_t* __s, wchar_t __c, size_t __n);
#endif
#endif //_GLIBCPP_USE_WCHAR_T
// NB: mbstate_t should be defined in <cwchar>, as per
// 21.2 p5
// If not, autoconf will
// detect this with some configure time magic and define
// _GLIBCPP_NEED_MBSTATE_T (see config.h in the build directory.)
#ifdef _GLIBCPP_NEED_MBSTATE_T
typedef struct
{
int __fill[6];
} mbstate_t;
#endif
}
#endif // _CPP_CWCHAR

View File

@ -0,0 +1,164 @@
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: <cwctype>
//
#ifndef _CPP_CWCTYPE
#define _CPP_CWCTYPE 1
// This keeps isanum, et al from being propagated as macros.
#if __linux__
#define __NO_WCTYPE 1
#endif
# include_next <wctype.h>
// Sequester the C non-inline implementations in the _C_Swamp::
// namespace, and provide C++ inlines for them in the std:: namespace
// where they belong.
namespace std
{
#ifdef towupper
inline wint_t
_S_towupper_helper(wint_t __wc) { return towupper(__wc); }
# undef towupper
inline wint_t
towupper(wint_t __wc) { return _S_towupper_helper(__wc); }
#endif
#ifdef towlower
inline wint_t
_S_towlower_helper(wint_t __wc) { return towlower(__wc); }
# undef towlower
inline wint_t
towlower(wint_t __wc) { return _S_towlower_helper(__wc); }
#endif
#ifdef iswspace
inline int
_S_iswspace_helper(wint_t __wc) { return iswspace(__wc); }
# undef iswspace
inline int
iswspace(wint_t __wc) { return _S_iswspace_helper(__wc); }
#endif
#ifdef iswprint
inline int
_S_iswprint_helper(wint_t __wc) { return iswprint(__wc); }
# undef iswprint
inline int
iswprint(wint_t __wc) { return _S_iswprint_helper(__wc); }
#endif
#ifdef iswcntrl
inline int
_S_iswcntrl_helper(wint_t __wc) { return iswcntrl(__wc); }
# undef iswcntrl
inline int
iswcntrl(wint_t __wc) { return _S_iswcntrl_helper(__wc); }
#endif
#ifdef iswupper
inline int
_S_iswupper_helper(wint_t __wc) { return iswupper(__wc); }
# undef iswupper
inline int
iswupper(wint_t __wc) { return _S_iswupper_helper(__wc); }
#endif
#ifdef iswlower
inline int
_S_iswlower_helper(wint_t __wc) { return iswlower(__wc); }
# undef iswlower
inline int
iswlower(wint_t __wc) { return _S_iswlower_helper(__wc); }
#endif
#ifdef iswalpha
inline int
_S_iswalpha_helper(wint_t __wc) { return iswalpha(__wc); }
# undef iswalpha
inline int
iswalpha(wint_t __wc) { return _S_iswalpha_helper(__wc); }
#endif
#ifdef iswdigit
inline int
_S_iswdigit_helper(wint_t __wc) { return iswdigit(__wc); }
# undef iswdigit
inline int
iswdigit(wint_t __wc) { return _S_iswdigit_helper(__wc); }
#endif
#ifdef iswpunct
inline int
_S_iswpunct_helper(wint_t __wc) { return iswpunct(__wc); }
# undef iswpunct
inline int
iswpunct(wint_t __wc) { return _S_iswpunct_helper(__wc); }
#endif
#ifdef iswxdigit
inline int
_S_iswxdigit_helper (wint_t __wc) { return iswxdigit(__wc); }
# undef iswxdigit
inline int
iswxdigit(wint_t __wc) { return _S_iswxdigit_helper(__wc); }
#endif
#ifdef iswalnum
inline int
_S_iswalnum_helper(wint_t __wc) { return iswalnum(__wc); }
# undef iswalnum
inline int
iswalnum(wint_t __wc) { return _S_iswalnum_helper(__wc); }
#endif
#ifdef iswgraph
inline int
_S_iswgraph_helper(wint_t __wc) { return iswgraph(__wc); }
# undef iswgraph
inline int
iswgraph(wint_t __wc) { return _S_iswgraph_helper(__wc); }
#endif
} // namespace std
#endif // _CPP_CWCTYPE

View File

@ -0,0 +1,41 @@
/*
*
* 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) 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.
*/
#ifndef _CPP_DEQUE
#define _CPP_DEQUE 1
#include <bits/stl_range_errors.h>
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_deque.h>
#endif /* _CPP_DEQUE */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,80 @@
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _CPP_EXCEPTION
#define _CPP_EXCEPTION 1
#ifdef __GNUG__
#include_next <exception>
#else
#include <bits/stl_config.h>
__STL_BEGIN_NAMESPACE
// 18.6 Exception handling
class exception;
class bad_exception;
typedef void (*unexpected_handler)();
unexpected_handler set_unexpected(unexpected_handler) throw();
void unexpected();
typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler) throw();
void terminate();
bool uncaught_exception();
// 18.6.1 Class exception
class exception {
public:
exception() throw();
exception(const exception&) throw();
exception& operator=(const exception&) throw();
virtual ~exception() throw();
virtual const char* what() const throw();
};
// 18.6.2.1 Class bad_exception
class bad_exception : public exception {
public:
bad_exception() throw();
bad_exception(const bad_exception&) throw();
bad_exception& operator=(const bad_exception&) throw();
virtual ~bad_exception() throw();
virtual const char* what() const throw();
};
__STL_END_NAMESPACE
#endif /* __GNUG__ */
#endif /* _CPP_EXCEPTION */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,386 @@
// File based streams -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.8 File-based streams
//
#ifndef _CPP_FSTREAM
#define _CPP_FSTREAM 1
#include <bits/std_istream.h>
#include <bits/std_ostream.h>
#include <bits/basic_file.h>
#include <bits/std_locale.h> // For codecvt
#include <bits/c++threads.h> // For __mutext_type
namespace std {
template<typename _CharT, typename _Traits>
class basic_filebuf : public basic_streambuf<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard Types:
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
typedef __basic_file __file_type;
typedef typename _Traits::state_type __state_type;
typedef codecvt<_CharT, char, __state_type> __codecvt_type;
typedef codecvt<_CharT, char, __state_type>::result __res_type;
friend ios_base; // For sync_with_stdio.
private:
// Data Members:
__file_type* _M_file;
bool _M_last_overflowed; // XXX Needed?
__state_type _M_state_cur;// Current state type for codecvt.
__state_type _M_state_beg;
const __codecvt_type* _M_fcvt; // Cached value from use_facet.
__mutext_type _M_lock;
public:
// Constructors/destructor:
basic_filebuf();
// Non-standard ctor:
basic_filebuf(int __fd, const char* __name = "unknown",
ios_base::openmode __mode = ios_base::in | ios_base::out);
virtual
~basic_filebuf()
{
this->close();
_M_fcvt = NULL;
delete _M_file;
_M_file = NULL;
_M_last_overflowed = false;
}
// Members:
bool
is_open(void) const { return _M_file ? _M_file->is_open() : false; }
__filebuf_type*
open(const char* __s, ios_base::openmode __mode);
__filebuf_type*
close(void);
protected:
// Common initialization code for both ctors goes here.
void
_M_init_filebuf(void);
// Overridden virtual functions:
virtual streamsize
showmanyc(void);
// Stroustrup, 1998, p. 628
// underflow() and uflow() functions are called to get the next
// charater from the real input source when the buffer is empty.
// Buffered input uses underflow()
virtual int_type
underflow(void);
virtual int_type
pbackfail(int_type __c = _Traits::eof());
// NB: For what the standard expects of the overflow function,
// see _M_really_overflow(), below. Because basic_streambuf's
// sputc/sputn call overflow directly, and the complications of
// this implementation's setting of the initial pointers all
// equal to _M_buf when initializing, it seems essential to have
// this in actuality be a helper function that checks for the
// eccentricities of this implementation, and then call
// overflow() if indeed the buffer is full.
virtual int_type
overflow(int_type __c = _Traits::eof());
// Stroustrup, 1998, p 648
// The overflow() function is called to transfer characters to the
// real output destination when the buffer is full. A call to
// overflow(c) outputs the contents of the buffer plus the
// character c.
// 27.5.2.4.5
// Consume some sequence of the characters in the pending sequence.
int_type
_M_really_overflow(int_type __c = _Traits::eof());
virtual __streambuf_type*
setbuf(char_type* __s, streamsize __n)
{
if (!this->is_open() && __s == 0 && __n == 0)
_M_buf_size = 0;
_M_last_overflowed = false;
return this;
}
virtual pos_type
seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode __mode = ios_base::in | ios_base::out);
virtual pos_type
seekpos(pos_type __pos,
ios_base::openmode __mode = ios_base::in | ios_base::out);
virtual int
sync(void)
{
bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
if (__testput)
{
// Make sure that libio resyncs its idea of the file position
// with the external file.
_M_file->sync();
// Need to restore current position. This interpreted as
// the position of the external byte sequence (_M_file)
// plus the offset in the current internal buffer
// (_M_out_beg - _M_out_cur)
__c_streampos __cur = _M_file->seekoff(0, ios_base::cur);
off_type __off = _M_out_cur - _M_out_beg;
this->_M_really_overflow();
_M_file->seekpos(__cur + __off);
}
_M_last_overflowed = false;
return 0;
}
virtual void
imbue(const locale& __loc);
void
_M_output_unshift();
};
typedef basic_filebuf<char> filebuf;
typedef basic_filebuf<wchar_t> wfilebuf;
// 27.8.1.5 Template class basic_ifstream
template<typename _CharT, typename _Traits>
class basic_ifstream : public basic_istream<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard types:
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
typedef basic_istream<_CharT, _Traits> __istream_type;
// Constructors/Destructors:
basic_ifstream()
: __istream_type(new __filebuf_type())
{ }
explicit
basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
: __istream_type(new __filebuf_type())
{ this->open(__s, __mode); }
~basic_ifstream()
{
delete _M_streambuf;
_M_streambuf = NULL;
}
// Members:
__filebuf_type*
rdbuf() const
{ return static_cast<__filebuf_type*>(_M_streambuf); }
bool
is_open(void) { return rdbuf()->is_open(); }
void
open(const char* __s, ios_base::openmode __mode = ios_base::in)
{
if (rdbuf()->open(__s, __mode | ios_base::in) == NULL)
this->setstate(ios_base::failbit);
}
void
close(void)
{
if (!rdbuf()->close())
this->setstate(ios_base::failbit);
}
};
// 27.8.1.8 Template class basic_ofstream
template<typename _CharT, typename _Traits>
class basic_ofstream : public basic_ostream<_CharT,_Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard types:
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
typedef basic_ostream<_CharT, _Traits> __ostream_type;
// Constructors:
basic_ofstream()
: __ostream_type(new __filebuf_type())
{ }
explicit
basic_ofstream(const char* __s,
ios_base::openmode __mode = ios_base::out|ios_base::trunc)
: __ostream_type(new __filebuf_type())
{ this->open(__s, __mode); }
~basic_ofstream()
{
delete _M_streambuf;
_M_streambuf = NULL;
}
// Members:
__filebuf_type*
rdbuf(void) const
{ return static_cast<__filebuf_type*>(_M_streambuf); }
bool
is_open(void) { return rdbuf()->is_open(); }
void
open(const char* __s,
ios_base::openmode __mode = ios_base::out | ios_base::trunc)
{
if (!rdbuf()->open(__s, __mode | ios_base::out))
this->setstate (ios_base::failbit);
}
void
close(void)
{
if (!rdbuf()->close())
setstate (ios_base::failbit);
}
};
typedef basic_ofstream<char> ofstream;
typedef basic_ofstream<wchar_t> wofstream;
// 27.8.1.11 Template class basic_fstream
template<typename _CharT, typename _Traits>
class basic_fstream : public basic_iostream<_CharT, _Traits>
{
public:
// Types:
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard types:
typedef basic_filebuf<_CharT, _Traits> __filebuf_type;
typedef basic_ios<_CharT, _Traits> __ios_type;
typedef basic_iostream<_CharT, _Traits> __iostream_type;
// Constructors/destructor:
basic_fstream()
: __iostream_type(new __filebuf_type())
{ }
explicit
basic_fstream(const char* __s,
ios_base::openmode __mode = ios_base::in | ios_base::out)
: __iostream_type(new __filebuf_type())
{ this->open(__s, __mode); }
~basic_fstream()
{
delete _M_streambuf;
_M_streambuf = NULL;
}
// Members:
__filebuf_type*
rdbuf(void) const
{ return static_cast<__filebuf_type*>(_M_streambuf); }
bool
is_open(void) { return rdbuf()->is_open(); }
void
open(const char* __s,
ios_base::openmode __mode = ios_base::in | ios_base::out)
{
if (!rdbuf()->open(__s, __mode))
setstate (ios_base::failbit);
}
void
close(void)
{
if (!rdbuf()->close())
setstate (ios_base::failbit);
}
};
typedef basic_fstream<char> fstream;
typedef basic_fstream<wchar_t> wfstream;
} // namespace std
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
# define export
#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
# include <bits/fstream.tcc>
#endif
#endif
#endif /* _CPP_FSTREAM */

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 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.
*
*/
#ifndef _CPP_FUNCTIONAL
#define _CPP_FUNCTIONAL
#include <bits/stl_config.h>
#include <bits/std_cstddef.h>
#include <bits/stl_function.h>
#endif /* _CPP_FUNCTIONAL */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,219 @@
// Standard stream manipulators -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.6.3 Standard manipulators
//
#ifndef _CPP_IOMANIP
#define _CPP_IOMANIP 1
#include <bits/c++config.h>
#include <bits/std_istream.h>
#include <bits/std_functional.h>
namespace std {
struct _Resetiosflags { ios_base::fmtflags _M_mask; };
inline _Resetiosflags
resetiosflags(ios_base::fmtflags __mask)
{
_Resetiosflags __x;
__x._M_mask = __mask;
return __x;
}
template <class _CharT, class _Traits>
basic_istream<_CharT,_Traits>&
operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
{
__is.setf(ios_base::fmtflags(0), __f._M_mask);
return __is;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT,_Traits>&
operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
{
__os.setf(ios_base::fmtflags(0), __f._M_mask);
return __os;
}
struct _Setiosflags { ios_base::fmtflags _M_mask; };
inline _Setiosflags
setiosflags (ios_base::fmtflags __mask)
{
_Setiosflags __x;
__x._M_mask = __mask;
return __x;
}
template <class _CharT, class _Traits>
basic_istream<_CharT,_Traits>&
operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
{
__is.setf(__f._M_mask);
return __is;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT,_Traits>&
operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
{
__os.setf(__f._M_mask);
return __os;
}
struct _Setbase { int _M_base; };
inline _Setbase
setbase (int __base)
{
_Setbase __x;
__x._M_base = __base;
return __x;
}
template <class _CharT, class _Traits>
basic_istream<_CharT,_Traits>&
operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
{
__is.setf(__f._M_base == 8 ? ios_base::oct :
__f._M_base == 10 ? ios_base::dec :
__f._M_base == 16 ? ios_base::hex :
ios_base::fmtflags(0), ios_base::basefield);
return __is;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT,_Traits>&
operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
{
__os.setf(__f._M_base == 8 ? ios_base::oct :
__f._M_base == 10 ? ios_base::dec :
__f._M_base == 16 ? ios_base::hex :
ios_base::fmtflags(0), ios_base::basefield);
return __os;
}
template<class _CharT>
struct _Setfill { _CharT _M_c; };
template<class _CharT>
_Setfill<_CharT>
setfill(_CharT __c)
{
_Setfill<_CharT> __x;
__x._M_c = __c;
return __x;
}
template <class _CharT, class _Traits>
basic_istream<_CharT,_Traits>&
operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
{
__is.fill(__f._M_c);
return __is;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT,_Traits>&
operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
{
__os.fill(__f._M_c);
return __os;
}
struct _Setprecision { int _M_n; };
inline _Setprecision
setprecision(int __n)
{
_Setprecision __x;
__x._M_n = __n;
return __x;
}
template <class _CharT, class _Traits>
basic_istream<_CharT,_Traits>&
operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
{
__is.precision(__f._M_n);
return __is;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT,_Traits>&
operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
{
__os.precision(__f._M_n);
return __os;
}
struct _Setw { int _M_n; };
inline _Setw
setw(int __n)
{
_Setw __x;
__x._M_n = __n;
return __x;
}
template <class _CharT, class _Traits>
basic_istream<_CharT,_Traits>&
operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
{
__is.width(__f._M_n);
return __is;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT,_Traits>&
operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
{
__os.width(__f._M_n);
return __os;
}
} // namespace std
#endif /* __IOMANIP */

View File

@ -0,0 +1,52 @@
// Iostreams base classes -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.4 Iostreams base classes
//
#ifndef _CPP_IOS
#define _CPP_IOS 1
#include <bits/std_iosfwd.h>
#include <bits/std_exception.h> // For ios_base::failure
#include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos
#include <bits/stl_string_fwd.h>// For string.
#include <bits/std_cstdio.h> // For SEEK_SET, SEEK_CUR, SEEK_END
# include <bits/localefwd.h> // For class locale
#include <bits/ios_base.h> // For ios_base declarations.
#include <bits/std_streambuf.h>
#include <bits/basic_ios.h>
#endif /* _CPP_IOS */

View File

@ -0,0 +1,157 @@
// Forwarding declarations -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.2 Forward declarations
//
#ifndef _CPP_IOSFWD
#define _CPP_IOSFWD 1
#include <bits/c++config.h>
#include <bits/std_cwchar.h> //For mbstate_t
namespace std {
// Generic declarations.
template<typename _CharT> struct char_traits;
template<typename _Alloc> class allocator;
// Forward declarations
template<> class char_traits<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> class char_traits<wchar_t>;
#endif
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_ios;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_streambuf;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_istream;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_ostream;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_iostream;
template<typename _CharT, typename _Traits = char_traits<_CharT>,
typename _Alloc = allocator<_CharT> >
class basic_stringbuf;
template<typename _CharT, typename _Traits = char_traits<_CharT>,
typename _Alloc = allocator<_CharT> >
class basic_istringstream;
template<typename _CharT, typename _Traits = char_traits<_CharT>,
typename _Alloc = allocator<_CharT> >
class basic_ostringstream;
template<typename _CharT, typename _Traits = char_traits<_CharT>,
typename _Alloc = allocator<_CharT> >
class basic_stringstream;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_filebuf;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_ifstream;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_ofstream;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_fstream;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class istreambuf_iterator;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class ostreambuf_iterator;
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Not included.
class ios_base;
#endif
template<class _State> struct fpos;
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Can't have self-recursive types for streampos.
// 21.1.3.1 char_traits sets size_type to streampos
// 27.4.1
// And here, where streampos is typedefed to fpos<traits::state_type>
typedef fpos<mbstate_t> streampos;
# ifdef _GLIBCPP_USE_WCHAR_T
typedef fpos<mbstate_t> wstreampos;
# endif
#endif
typedef basic_ios<char> ios;
typedef basic_streambuf<char> streambuf;
typedef basic_istream<char> istream;
typedef basic_ostream<char> ostream;
typedef basic_iostream<char> iostream;
typedef basic_stringbuf<char> stringbuf;
typedef basic_istringstream<char> istringstream;
typedef basic_ostringstream<char> ostringstream;
typedef basic_stringstream<char> stringstream;
typedef basic_filebuf<char> filebuf;
typedef basic_ifstream<char> ifstream;
typedef basic_ofstream<char> ofstream;
typedef basic_fstream<char> fstream;
#ifdef _GLIBCPP_USE_WCHAR_T
typedef basic_ios<wchar_t> wios;
typedef basic_streambuf<wchar_t> wstreambuf;
typedef basic_istream<wchar_t> wistream;
typedef basic_ostream<wchar_t> wostream;
typedef basic_iostream<wchar_t> wiostream;
typedef basic_stringbuf<wchar_t> wstringbuf;
typedef basic_istringstream<wchar_t> wistringstream;
typedef basic_ostringstream<wchar_t> wostringstream;
typedef basic_stringstream<wchar_t> wstringstream;
typedef basic_filebuf<wchar_t> wfilebuf;
typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
#endif
} // namespace std
#endif // _CPP_IOSFWD

View File

@ -0,0 +1,58 @@
// Standard iostream objects -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.3 Standard iostream objects
//
#ifndef _CPP_IOSTREAM
#define _CPP_IOSTREAM 1
#include <bits/c++config.h>
#include <bits/std_ostream.h>
#include <bits/std_istream.h>
namespace std {
extern istream cin;
extern ostream cout;
extern ostream cerr;
extern ostream clog;
#ifdef _GLIBCPP_USE_WCHAR_T
extern wistream wcin;
extern wostream wcout;
extern wostream wcerr;
extern wostream wclog;
#endif
// For construction of filebuffers for cout, cin, cerr, clog et. al.
static ios_base::Init __ioinit;
} // namespace std
#endif /* _CPP_IOSTREAM */

View File

@ -0,0 +1,307 @@
// Input streams -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.6.1 Input streams
//
#ifndef _CPP_ISTREAM
#define _CPP_ISTREAM 1
#include <bits/std_ios.h>
#include <bits/std_limits.h> // For numeric_limits
namespace std {
// 27.6.1.1 Template class basic_istream
template<typename _CharT, typename _Traits>
class basic_istream : virtual public basic_ios<_CharT, _Traits>
{
public:
// Types (inherited from basic_ios (27.4.4)):
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard Types:
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
typedef basic_ios<_CharT, _Traits> __ios_type;
typedef basic_istream<_CharT, _Traits> __istream_type;
typedef istreambuf_iterator<_CharT> __istreambuf_iter;
typedef num_get<_CharT, __istreambuf_iter> __numget_type;
typedef ctype<_CharT> __ctype_type;
protected:
// Data Members:
streamsize _M_gcount;
public:
// 27.6.1.1.1 Constructor/destructor:
explicit
basic_istream(__streambuf_type* __sb)
{
this->init(__sb);
_M_gcount = streamsize(0);
}
virtual
~basic_istream()
{
_M_gcount = streamsize(0);
_M_fnumget = NULL;
}
// 27.6.1.1.2 Prefix/suffix:
class sentry;
friend class sentry;
// 27.6.1.2 Formatted input:
// 27.6.1.2.3 basic_istream::operator>>
__istream_type&
operator>>(__istream_type& (*__pf)(__istream_type&));
__istream_type&
operator>>(__ios_type& (*__pf)(__ios_type&));
__istream_type&
operator>>(ios_base& (*__pf)(ios_base&));
// 27.6.1.2.2 Arithmetic Extractors
__istream_type&
operator>>(bool& __n);
__istream_type&
operator>>(short& __n);
__istream_type&
operator>>(unsigned short& __n);
__istream_type&
operator>>(int& __n);
__istream_type&
operator>>(unsigned int& __n);
__istream_type&
operator>>(long& __n);
__istream_type&
operator>>(unsigned long& __n);
#ifdef _GLIBCPP_USE_LONG_LONG
__istream_type&
operator>>(long long& __n);
__istream_type&
operator>>(unsigned long long& __n);
#endif
__istream_type&
operator>>(float& __f);
__istream_type&
operator>>(double& __f);
__istream_type&
operator>>(long double& __f);
__istream_type&
operator>>(void*& __p);
__istream_type&
operator>>(__streambuf_type* __sb);
// 27.6.1.3 Unformatted input:
inline streamsize
gcount(void) const
{ return _M_gcount; }
int_type
get(void);
__istream_type&
get(char_type& __c);
__istream_type&
get(char_type* __s, streamsize __n, char_type __delim);
inline __istream_type&
get(char_type* __s, streamsize __n)
{ return get(__s, __n, this->widen('\n')); }
__istream_type&
get(__streambuf_type& __sb, char_type __delim);
inline __istream_type&
get(__streambuf_type& __sb)
{ return get(__sb, this->widen('\n')); }
__istream_type&
getline(char_type* __s, streamsize __n, char_type __delim);
inline __istream_type&
getline(char_type* __s, streamsize __n)
{ return getline(__s, __n, this->widen('\n')); }
__istream_type&
ignore(streamsize __n = 1, int_type __delim = traits_type::eof());
int_type
peek(void);
__istream_type&
read(char_type* __s, streamsize __n);
streamsize
readsome(char_type* __s, streamsize __n);
__istream_type&
putback(char_type __c);
__istream_type&
unget(void);
int
sync(void);
pos_type
tellg(void);
__istream_type&
seekg(pos_type);
__istream_type&
seekg(off_type, ios_base::seekdir);
private:
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Not defined.
__istream_type&
operator=(const __istream_type&);
basic_istream(const __istream_type&);
#endif
};
template<typename _CharT, typename _Traits>
class basic_istream<_CharT, _Traits>::sentry
{
public:
typedef _Traits traits_type;
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
typedef basic_istream<_CharT, _Traits> __istream_type;
typedef __istream_type::__ctype_type __ctype_type;
typedef typename _Traits::int_type __int_type;
explicit
sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
operator bool() { return _M_ok; }
private:
bool _M_ok;
};
// 27.6.1.2.3 Character extraction templates
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
template<class _Traits>
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
{ return (__in >> static_cast<char>(__c)); }
template<class _Traits>
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
{ return (__in >> static_cast<char>(__c)); }
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
template<class _Traits>
basic_istream<char,_Traits>&
operator>>(basic_istream<char,_Traits>& __in, unsigned char* __s)
{ return (__in >> reinterpret_cast<char*>(__s)); }
template<class _Traits>
basic_istream<char,_Traits>&
operator>>(basic_istream<char,_Traits>& __in, signed char* __s)
{ return (__in >> reinterpret_cast<char*>(__s)); }
// 27.6.1.5 Template class basic_iostream
template<typename _CharT, typename _Traits>
class basic_iostream
: public basic_istream<_CharT, _Traits>,
public basic_ostream<_CharT, _Traits>
{
public:
// Non-standard Types:
typedef basic_istream<_CharT, _Traits> __istream_type;
typedef basic_ostream<_CharT, _Traits> __ostream_type;
explicit
basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
: __istream_type(__sb), __ostream_type(__sb)
{ }
virtual
~basic_iostream() { }
};
// 27.6.1.4 Standard basic_istream manipulators
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
ws(basic_istream<_CharT, _Traits>& __is);
} // namespace std
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
# define export
#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
# include <bits/istream.tcc>
#endif
#endif
#endif /* _CPP_ISTREAM */

View File

@ -0,0 +1,46 @@
/*
*
* 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.
*/
#ifndef _CPP_ITERATOR
#define _CPP_ITERATOR 1
#include <bits/stl_config.h>
#include <bits/stl_relops.h>
#include <bits/std_cstddef.h>
#include <bits/std_iosfwd.h>
#include <bits/stl_iterator_base.h>
#include <bits/stl_iterator.h>
#endif /* _CPP_ITERATOR */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,40 @@
/*
*
* 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.
*/
#ifndef _CPP_LIST
#define _CPP_LIST 1
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_list.h>
#endif /* _CPP_LIST */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,44 @@
// Locale support -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 22.1 Locales
//
#ifndef _CPP_LOCALE
#define _CPP_LOCALE 1
#include <bits/localefwd.h>
#include <bits/locale_facets.h>
#endif
// Local Variables:
// mode:c++
// End:

View File

@ -0,0 +1,40 @@
/*
*
* 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.
*/
#ifndef _CPP_MAP
#define _CPP_MAP 1
#ifndef _CPP_BITS_STL_TREE_H /* XXX is this guard necessary? */
#include <bits/stl_tree.h>
#endif
#include <bits/stl_map.h>
#include <bits/stl_multimap.h>
#endif /* _CPP_MAP */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,124 @@
/*
* Copyright (c) 1997-1999
* 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.
*
*/
#ifndef _CPP_MEMORY
#define _CPP_MEMORY 1
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
#include <bits/stl_iterator_base.h> //for iterator_traits
#include <bits/stl_tempbuf.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_raw_storage_iter.h>
__STL_BEGIN_NAMESPACE
#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
defined(__STL_MEMBER_TEMPLATES)
template<class _Tp1> struct auto_ptr_ref {
_Tp1* _M_ptr;
auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
};
#endif
template <class _Tp> class auto_ptr {
private:
_Tp* _M_ptr;
public:
typedef _Tp element_type;
explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
: _M_ptr(__a.release()) {}
#endif /* __STL_MEMBER_TEMPLATES */
auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
reset(__a.release());
return *this;
}
#ifdef __STL_MEMBER_TEMPLATES
template <class _Tp1>
auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
reset(__a.release());
return *this;
}
#endif /* __STL_MEMBER_TEMPLATES */
~auto_ptr() __STL_NOTHROW { delete _M_ptr; }
_Tp& operator*() const __STL_NOTHROW {
return *_M_ptr;
}
_Tp* operator->() const __STL_NOTHROW {
return _M_ptr;
}
_Tp* get() const __STL_NOTHROW {
return _M_ptr;
}
_Tp* release() __STL_NOTHROW {
_Tp* __tmp = _M_ptr;
_M_ptr = 0;
return __tmp;
}
void reset(_Tp* __p = 0) __STL_NOTHROW {
if (__p != _M_ptr) {
delete _M_ptr;
_M_ptr = __p;
}
}
// According to the C++ standard, these conversions are required. Most
// present-day compilers, however, do not enforce that requirement---and,
// in fact, most present-day compilers do not support the language
// features that these conversions rely on.
#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \
defined(__STL_MEMBER_TEMPLATES)
public:
auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
: _M_ptr(__ref._M_ptr) {}
auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW {
if (__ref._M_ptr != this->get()) {
delete _M_ptr;
_M_ptr = __ref._M_ptr;
}
return *this;
}
template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
{ return auto_ptr_ref<_Tp>(this->release()); }
template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
{ return auto_ptr<_Tp1>(this->release()); }
#endif /* auto ptr conversions && member templates */
};
__STL_END_NAMESPACE
#endif /* _CPP_MEMORY */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,81 @@
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#ifndef _CPP_NEW
#define _CPP_NEW 1
#include <bits/c++config.h>
#ifdef __GNUG__
# include_next <new>
#else
#include <bits/std_exception.h>
// 18.4 Dynamic memory management
__STL_BEGIN_NAMESPACE
class bad_alloc;
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
new_handler set_new_handler(new_handler) throw();
class bad_alloc : public exception {
public:
bad_alloc() throw();
bad_alloc(const bad_alloc&) throw();
bad_alloc& operator=(const bad_alloc&) throw();
virtual ~bad_alloc() throw();
virtual const char* what() const throw();
};
__STL_END_NAMESPACE
void* operator new(__STD::size_t) throw(__STD::bad_alloc);
void* operator new(__STD::size_t, const __STD::nothrow_t&) throw();
void operator delete(void*) throw();
void operator delete(void*, const __STD::nothrow_t&) throw();
void* operator new[](__STD::size_t) throw(__STD::bad_alloc);
void* operator new[](__STD::size_t, const __STD::nothrow_t&) throw();
void operator delete[](void*) throw();
void operator delete[](void*, const __STD::nothrow_t&) throw();
void* operator new (__STD::size_t, void*) throw();
void* operator new[](__STD::size_t, void*) throw();
void operator delete (void*, void*) throw();
void operator delete[](void*, void*) throw();
#endif
#endif /* _CPP_NEW */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,41 @@
/*
*
* 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.
*/
#ifndef _CPP_NUMERIC
#define _CPP_NUMERIC 1
#include <bits/stl_config.h>
#include <bits/stl_relops.h>
#include <bits/std_cstddef.h>
#include <bits/std_iterator.h>
#include <bits/stl_function.h>
#include <bits/stl_numeric.h>
#endif /* _CPP_NUMERIC */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,288 @@
// Output streams -*- C++ -*-
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
//
// ISO C++ 14882: 27.6.2 Output streams
//
#ifndef _CPP_OSTREAM
#define _CPP_OSTREAM 1
#include <bits/std_ios.h>
namespace std {
// 27.6.2.1 Template class basic_ostream
template<typename _CharT, typename _Traits>
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
{
public:
// Types (inherited from basic_ios (27.4.4)):
typedef _CharT char_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef _Traits traits_type;
// Non-standard Types:
typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
typedef basic_ios<_CharT, _Traits> __ios_type;
typedef basic_ostream<_CharT, _Traits> __ostream_type;
typedef ostreambuf_iterator<_CharT> __ostreambuf_iter;
typedef num_put<_CharT, __ostreambuf_iter> __numput_type;
typedef ctype<_CharT> __ctype_type;
// 27.6.2.2 Constructor/destructor:
explicit
basic_ostream(__streambuf_type* __sb)
{ this->init(__sb); }
virtual
~basic_ostream()
{ _M_fnumput = NULL; }
// 27.6.2.3 Prefix/suffix:
class sentry;
friend class sentry;
// 27.6.2.5 Formatted output:
// 27.6.2.5.3 basic_ostream::operator<<
__ostream_type&
operator<<(__ostream_type& (*__pf)(__ostream_type&));
__ostream_type&
operator<<(__ios_type& (*__pf)(__ios_type&));
__ostream_type&
operator<<(ios_base& (*__pf) (ios_base&));
// 27.6.2.5.2 Arithmetic Inserters
__ostream_type&
operator<<(long __n);
__ostream_type&
operator<<(unsigned long __n);
__ostream_type&
operator<<(bool __n);
__ostream_type&
operator<<(short __n)
{
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt & ios_base::oct || __fmt & ios_base::hex)
return this->operator<<(static_cast<unsigned long>
(static_cast<unsigned short>(__n)));
else
return this->operator<<(static_cast<long>(__n));
}
__ostream_type&
operator<<(unsigned short __n)
{ return this->operator<<(static_cast<unsigned long>(__n)); }
__ostream_type&
operator<<(int __n)
{
ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt & ios_base::oct || __fmt & ios_base::hex)
return this->operator<<(static_cast<unsigned long>
(static_cast<unsigned int>(__n)));
else
return this->operator<<(static_cast<long>(__n));
}
__ostream_type&
operator<<(unsigned int __n)
{ return this->operator<<(static_cast<unsigned long>(__n)); }
#ifdef _GLIBCPP_USE_LONG_LONG
__ostream_type&
operator<<(long long __n);
__ostream_type&
operator<<(unsigned long long __n);
#endif
__ostream_type&
operator<<(double __f);
__ostream_type&
operator<<(float __f)
{ return this->operator<<(static_cast<double>(__f)); }
__ostream_type&
operator<<(long double __f);
__ostream_type&
operator<<(const void* __p);
__ostream_type&
operator<<(__streambuf_type* __sb);
// Unformatted output:
__ostream_type&
put(char_type __c);
__ostream_type&
write(const char_type* __s, streamsize __n);
__ostream_type&
flush();
// Seeks:
pos_type
tellp();
__ostream_type&
seekp(pos_type);
__ostream_type&
seekp(off_type, ios_base::seekdir);
private:
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Not defined.
__ostream_type&
operator=(const __ostream_type&);
basic_ostream(const __ostream_type&);
#endif
};
// 27.6.2.3 Class basic_ostream::sentry
template <typename _CharT, typename _Traits>
class basic_ostream<_CharT, _Traits>::sentry
{
// Data Members:
bool _M_ok;
basic_ostream<_CharT,_Traits>& _M_os;
public:
explicit
sentry(basic_ostream<_CharT,_Traits>& __os);
~sentry()
{
// XXX MT
if (_M_os.flags() & ios_base::unitbuf && !uncaught_exception())
{
// Can't call flush directly or else will get into recursive lock.
if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
_M_os.setstate(ios_base::badbit);
}
}
operator bool()
{ return _M_ok; }
};
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c);
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
{ return (__out << __out.widen(__c)); }
// Specialization
template <class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, char __c);
// Signed and unsigned
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
{ return (__out << static_cast<char>(__c)); }
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
{ return (__out << static_cast<char>(__c)); }
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s);
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits> &
operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s);
// Partial specializationss
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, const char* __s);
// Signed and unsigned
template<class _Traits>
basic_ostream<char, _Traits>&
operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
{ return (__out << reinterpret_cast<const char*>(__s)); }
template<class _Traits>
basic_ostream<char, _Traits> &
operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
{ return (__out << reinterpret_cast<const char*>(__s)); }
// 27.6.2.7 Standard basic_ostream manipulators
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
endl(basic_ostream<_CharT, _Traits>& __os)
{ return flush(__os.put(__os.widen('\n'))); }
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
ends(basic_ostream<_CharT, _Traits>& __os)
{ return __os.put(_Traits::eos()); }
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
flush(basic_ostream<_CharT, _Traits>& __os)
{ return __os.flush(); }
} // namespace std
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
# define export
#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
# include <bits/ostream.tcc>
#endif
#endif
#endif /* _CPP_OSTREAM */

View File

@ -0,0 +1,45 @@
/*
*
* 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.
*/
#ifndef _CPP_QUEUE
#define _CPP_QUEUE 1
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_vector.h>
#include <ext/stl_bvector.h>
#include <bits/stl_heap.h>
#include <bits/stl_deque.h>
#include <bits/stl_function.h>
#include <bits/stl_queue.h>
#endif /* _CPP_QUEUE */
// Local Variables:
// mode:C++
// End:

View File

@ -0,0 +1,40 @@
/*
*
* 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.
*/
#ifndef _CPP_SET
#define _CPP_SET 1
#ifndef _CPP_BITS_STL_TREE_H /* XXX is this guard needed? */
#include <bits/stl_tree.h>
#endif
#include <bits/stl_set.h>
#include <bits/stl_multiset.h>
#endif /* _CPP_SET */
// Local Variables:
// mode:C++
// End:

Some files were not shown because too many files have changed in this diff Show More