Remove V2 C++ library.
* configure.in: Remove --enable-libstdcxx_v3 support. * Makefile.in (site.exp): Always set HAVE_LIBSTDCXX_V3. * configure.in: Remove --enable-libstdcxx_v3 support. * configure: Regenerated. From-SVN: r39445
This commit is contained in:
parent
4322eb6c0e
commit
22fdd65e59
@ -1,3 +1,8 @@
|
||||
2001-02-04 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
Remove V2 C++ library.
|
||||
* configure.in: Remove --enable-libstdcxx_v3 support.
|
||||
|
||||
2001-01-31 Bryce McKinlay <bryce@albatross.co.nz>
|
||||
|
||||
* include/demangle.h: Add prototype for java_demangle_v3.
|
||||
|
12
configure.in
12
configure.in
@ -48,15 +48,9 @@ if [ "${enable_gdbgui}" = "yes" ] ; then
|
||||
host_libs="${host_libs} libgui"
|
||||
fi
|
||||
|
||||
# Set up configure/Makefile variables if libstdc++-v3 is to be built.
|
||||
if [ "${enable_libstdcxx_v3}" = "yes" ] && test -d $srcdir/libstdc++-v3; then
|
||||
libstdcxx_version="target-libstdc++-v3"
|
||||
# Don't use libstdc++-v3's flags to configure/build itself.
|
||||
libstdcxx_flags='`case $$dir in libstdc++-v3) ;; *) cat $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/libstdc++.INC 2>/dev/null || : ;; esac` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
|
||||
else
|
||||
libstdcxx_version="target-libio target-libstdc++"
|
||||
libstdcxx_flags='-isystem $$s/libstdc++ -isystem $$s/libstdc++/std -isystem $$s/libstdc++/stl -isystem $$s/libio -isystem $$r/$(TARGET_SUBDIR)/libio -L$$r/$(TARGET_SUBDIR)/libstdc++'
|
||||
fi
|
||||
libstdcxx_version="target-libstdc++-v3"
|
||||
# Don't use libstdc++-v3's flags to configure/build itself.
|
||||
libstdcxx_flags='`case $$dir in libstdc++-v3) ;; *) cat $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/libstdc++.INC 2>/dev/null || : ;; esac` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs'
|
||||
|
||||
# these tools are built for the host environment
|
||||
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
|
||||
|
@ -1,3 +1,9 @@
|
||||
2001-02-04 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* Makefile.in (site.exp): Always set HAVE_LIBSTDCXX_V3.
|
||||
* configure.in: Remove --enable-libstdcxx_v3 support.
|
||||
* configure: Regenerated.
|
||||
|
||||
Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* diagnostic.h (set_internal_error_function): Renamed.
|
||||
|
@ -2740,7 +2740,7 @@ site.exp: ./config.status Makefile
|
||||
# CFLAGS is set even though it's empty to show we reserve the right to set it.
|
||||
@echo "set CFLAGS \"\"" >> ./tmp0
|
||||
@echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0
|
||||
@echo "set HAVE_LIBSTDCXX_V3 @HAVE_LIBSTDCXX_V3@" >> ./tmp0
|
||||
@echo "set HAVE_LIBSTDCXX_V3 1" >> ./tmp0
|
||||
# If newlib has been configured, we need to pass -B to gcc so it can find
|
||||
# newlib's crt0.o if it exists. This will cause a "path prefix not used"
|
||||
# message if it doesn't, but the testsuite is supposed to ignore the message -
|
||||
|
513
gcc/configure
vendored
513
gcc/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -151,23 +151,6 @@ if test x$local_prefix = x; then
|
||||
local_prefix=/usr/local
|
||||
fi
|
||||
|
||||
# Build a new-libstdc++ system (ie libstdc++-v3)
|
||||
AC_MSG_CHECKING([for libstdc++ to install])
|
||||
AC_ARG_ENABLE(libstdcxx-v3,
|
||||
[ --enable-libstdcxx-v3
|
||||
enable libstdc++-v3 for building and installation],
|
||||
[enable_libstdcxx_v3="$enableval"], [enable_libstdcxx_v3=yes])
|
||||
|
||||
if test x$enable_libstdcxx_v3 = xyes; then
|
||||
AC_MSG_RESULT(v3)
|
||||
HAVE_LIBSTDCXX_V3=1
|
||||
ac_esn=1
|
||||
else
|
||||
AC_MSG_RESULT(v2)
|
||||
HAVE_LIBSTDCXX_V3=0
|
||||
ac_esn=0
|
||||
fi
|
||||
|
||||
# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
|
||||
# passed in by the toplevel make and thus we'd get different behavior
|
||||
# depending on where we built the sources.
|
||||
@ -1599,9 +1582,8 @@ else
|
||||
fi
|
||||
AC_SUBST(GXX_ABI_FLAG)
|
||||
|
||||
AC_DEFINE_UNQUOTED(ENABLE_STD_NAMESPACE, $ac_esn,
|
||||
AC_DEFINE_UNQUOTED(ENABLE_STD_NAMESPACE, 1,
|
||||
[Define to 1 if you want to enable namespaces (-fhonor-std) by default.])
|
||||
AC_SUBST(HAVE_LIBSTDCXX_V3)
|
||||
|
||||
dnl Very limited version of automake's enable-maintainer-mode
|
||||
|
||||
|
1539
libstdc++/ChangeLog
1539
libstdc++/ChangeLog
File diff suppressed because it is too large
Load Diff
@ -1,411 +0,0 @@
|
||||
# Copyright (C) 1994, 1995, 1999, 2000 Free Software Foundation
|
||||
|
||||
# This file is part of the GNU ANSI 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.
|
||||
|
||||
VERSION = 2.10.0
|
||||
INTERFACE = 3
|
||||
|
||||
gxx_include_dir=${includedir}/g++
|
||||
|
||||
OBJS = cstringi.o stdexcepti.o cstdlibi.o cmathi.o stlinst.o valarray.o \
|
||||
del_op.o del_opnt.o del_opv.o del_opvnt.o exception.o new_handler.o \
|
||||
new_op.o new_opnt.o new_opv.o new_opvnt.o tinfo.o tinfo2.o vec.o \
|
||||
pure.o
|
||||
|
||||
SUBLIBS = $(STAMP)-string $(STAMP)-complx
|
||||
|
||||
# C++ headers with no extension
|
||||
HEADERS= cassert cctype cerrno cfloat ciso646 climits clocale cmath complex \
|
||||
csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime \
|
||||
cwchar cwctype string stdexcept \
|
||||
algorithm deque functional hash_map hash_set iterator list map \
|
||||
memory numeric pthread_alloc queue rope set slist stack utility \
|
||||
vector fstream iomanip iostream strstream iosfwd bitset valarray \
|
||||
sstream exception new typeinfo
|
||||
|
||||
ARLIB = libstdc++.a.$(VERSION)
|
||||
ARLINK = libstdc++.a
|
||||
MARLINK = libstdc++.a.`echo $(VERSION) | sed 's/\([0-9]*[.][0-9]*\).*/\1/'`
|
||||
SHLIB = libstdc++.so.$(VERSION)
|
||||
SHARLIB = libstdc++-sh.a
|
||||
SHLINK = libstdc++.so
|
||||
MSHLINK = libstdc++.so.`echo $(VERSION) | sed 's/\([0-9]*[.][0-9]*\).*/\1/'`
|
||||
SHFLAGS =
|
||||
SHDEPS =
|
||||
SHOPT = -shared
|
||||
|
||||
STAMP = bigstmp
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK)
|
||||
|
||||
#### package, host, target, and site dependent Makefile fragments come in here.
|
||||
##
|
||||
|
||||
IO_DIR = ../libio
|
||||
LIBIBERTY_DIR = ../libiberty
|
||||
|
||||
LIBIBERTY_OBJS = `cat $(LIBIBERTY_DIR)/needed-list` strerror.o
|
||||
|
||||
tooldir = $(exec_prefix)/$(target)
|
||||
# This is where the libraries will be installed; note, it will be set
|
||||
# at make runtime now. See below at target install.
|
||||
INSTALLDIR = $(libdir)
|
||||
|
||||
MOSTLYCLEAN_JUNK = *stmp-* tlib*.a *.s *.ii stdlist piclist
|
||||
CLEAN_JUNK = $(LIBS)
|
||||
|
||||
.PHONY: libs
|
||||
libs: $(LIBS)
|
||||
|
||||
# The "pic" subdir must be created before we can put any object
|
||||
# files into it.
|
||||
$(OBJS): stamp-picdir
|
||||
|
||||
stdlist: $(IO_DIR)/iostream.list $(OBJS) $(SUBLIBS) $(LIBIBERTY_DIR)/libiberty.a
|
||||
-rm -f tlist
|
||||
touch tlist
|
||||
echo *.o >> tlist
|
||||
for f in `cat $(IO_DIR)/iostream.list` ; do \
|
||||
echo "$(IO_DIR)/$$f" >> tlist ; \
|
||||
done
|
||||
for f in $(LIBIBERTY_OBJS) ; do \
|
||||
echo "$(LIBIBERTY_DIR)/$$f" >> tlist ; \
|
||||
done
|
||||
mv tlist stdlist
|
||||
|
||||
piclist: stdlist
|
||||
-rm -f tlist
|
||||
cp stdlist tlist
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
sed 's,\([A-Za-z_0-9]*\.o\),pic/\1,g' tlist > tlist2 ; \
|
||||
mv tlist2 tlist ; \
|
||||
else true ; fi
|
||||
mv tlist piclist
|
||||
|
||||
$(ARLIB): stdlist
|
||||
-rm -f t$(ARLIB)
|
||||
$(AR) $(AR_FLAGS) t$(ARLIB) `cat stdlist`
|
||||
mv t$(ARLIB) $(ARLIB)
|
||||
$(RANLIB) $(ARLIB)
|
||||
|
||||
$(ARLINK):
|
||||
-rm -f $(ARLINK)
|
||||
$(LN_S) $(ARLIB) $(ARLINK) || cp $(ARLIB) $(ARLINK)
|
||||
|
||||
marlink:
|
||||
@$(MAKE) $(MARLINK) "ARLINK=$(MARLINK)"
|
||||
|
||||
$(SHLIB): piclist
|
||||
$(CC) $(LIBCXXFLAGS) $(SHFLAGS) $(SHOPT) -o $(SHLIB) `cat piclist` $(SHDEPS)
|
||||
|
||||
$(SHARLIB): $(SHLIB)
|
||||
-rm -f t$(SHARLIB)
|
||||
$(AR) $(AR_FLAGS) t$(SHARLIB) $(SHLIB)
|
||||
mv t$(SHARLIB) $(SHARLIB)
|
||||
$(RANLIB) $(SHARLIB)
|
||||
|
||||
$(SHLINK):
|
||||
-rm -f $(SHLINK)
|
||||
$(LN_S) $(SHLIB) $(SHLINK) || cp $(ARLIB) $(ARLINK)
|
||||
|
||||
mshlink:
|
||||
@$(MAKE) $(MSHLINK) "SHLINK=$(MSHLINK)"
|
||||
|
||||
$(IO_DIR)/iostream.list: force
|
||||
cd $(IO_DIR) ; $(MAKE) $(FLAGS_TO_PASS) iostream.list
|
||||
|
||||
$(LIBIBERTY_DIR)/libiberty.a:
|
||||
cd $(LIBIBERTY_DIR) ; $(MAKE) $(FLAGS_TO_PASS)
|
||||
|
||||
STRFUNCS = REP MAIN TRAITS ADDSS ADDPS ADDCS ADDSP ADDSC \
|
||||
EQSS EQPS EQSP NESS NEPS NESP LTSS LTPS LTSP GTSS GTPS GTSP \
|
||||
LESS LEPS LESP GESS GEPS GESP
|
||||
STRIO = EXTRACT INSERT GETLINE
|
||||
|
||||
# These are here for SunOS VPATH.
|
||||
cinst.o: cinst.cc
|
||||
cmathi.o: cmathi.cc
|
||||
cstdlibi.o: cstdlibi.cc
|
||||
cstringi.o: cstringi.cc
|
||||
del_op.o: del_op.cc new
|
||||
del_opnt.o: del_opnt.cc new
|
||||
del_opv.o: del_opv.cc new
|
||||
del_opvnt.o: del_opvnt.cc new
|
||||
exception.o: exception.cc typeinfo $(srcdir)/../gcc/gansidecl.h \
|
||||
$(srcdir)/../include/ansidecl.h $(srcdir)/../gcc/eh-common.h
|
||||
new_handler.o: new_handler.cc new
|
||||
new_op.o: new_op.cc new
|
||||
new_opnt.o: new_opnt.cc new
|
||||
new_opv.o: new_opv.cc new
|
||||
new_opvnt.o: new_opvnt.cc new
|
||||
sinst.o: sinst.cc
|
||||
stdexcepti.o: stdexcepti.cc
|
||||
stlinst.o: stlinst.cc
|
||||
tinfo.o: tinfo.cc tinfo.hP typeinfo new
|
||||
tinfo2.o: tinfo2.cc tinfo.hP typeinfo new
|
||||
valarray.o: valarray.cc
|
||||
vec.o: vec.cc
|
||||
pure.o: pure.c
|
||||
|
||||
# Later do wide strings, too.
|
||||
stmp-string: ${srcdir}/sinst.cc ${srcdir}/std/bastring.h \
|
||||
${srcdir}/std/bastring.cc ${srcdir}/std/straits.h
|
||||
for name in $(STRFUNCS) $(STRIO); do \
|
||||
echo c$${name}; \
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DC -D$${name} ${srcdir}/sinst.cc \
|
||||
-o pic/c$${name}.o; \
|
||||
else true ; fi; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
$(COMPILE.cc) -DC -D$${name} ${srcdir}/sinst.cc -o c$${name}.o; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
done
|
||||
touch stmp-string
|
||||
|
||||
bigstmp-string: ${srcdir}/sinst.cc ${srcdir}/std/bastring.h \
|
||||
${srcdir}/std/bastring.cc ${srcdir}/std/straits.h
|
||||
echo cstring
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DC \
|
||||
`for N in $(STRFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/sinst.cc -o pic/cstrmain.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DC `for N in $(STRFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/sinst.cc -o cstrmain.o
|
||||
echo cstrio
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DC \
|
||||
`for N in $(STRIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/sinst.cc -o pic/cstrio.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DC `for N in $(STRIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/sinst.cc -o cstrio.o
|
||||
touch bigstmp-string
|
||||
|
||||
COMFUNCS = MAIN ADDCC ADDCF ADDFC SUBCC SUBCF SUBFC MULCC MULCF MULFC DIVCC \
|
||||
DIVCF DIVFC PLUS MINUS EQCC EQCF EQFC NECC NECF NEFC ABS ARG POLAR \
|
||||
CONJ NORM COS COSH EXP LOG POWCC POWCF POWCI POWFC SIN SINH SQRT
|
||||
COMIO = EXTRACT INSERT
|
||||
|
||||
stmp-complx: ${srcdir}/cinst.cc ${srcdir}/std/complext.h \
|
||||
${srcdir}/std/complext.cc ${srcdir}/std/dcomplex.h \
|
||||
${srcdir}/std/ldcomplex.h
|
||||
for N in $(COMFUNCS) $(COMIO); do \
|
||||
echo f$${N}; \
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DF -D$${N} $(srcdir)/cinst.cc \
|
||||
-o pic/f$${N}.o; \
|
||||
else true ; fi; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
$(COMPILE.cc) -DF -D$${N} ${srcdir}/cinst.cc -o f$${N}.o; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
echo d$${N}; \
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DD -D$${N} $(srcdir)/cinst.cc \
|
||||
-o pic/d$${N}.o; \
|
||||
else true ; fi; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
$(COMPILE.cc) -DD -D$${N} ${srcdir}/cinst.cc -o d$${N}.o; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
echo ld$${N}; \
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DLD -D$${N} $(srcdir)/cinst.cc \
|
||||
-o pic/ld$${N}.o; \
|
||||
else true ; fi; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
$(COMPILE.cc) -DLD -D$${N} ${srcdir}/cinst.cc -o ld$${N}.o; \
|
||||
if [ $$? -eq 0 ]; then true; else exit 1; fi; \
|
||||
done
|
||||
touch stmp-complx
|
||||
|
||||
bigstmp-complx: ${srcdir}/cinst.cc ${srcdir}/std/complext.h \
|
||||
${srcdir}/std/complext.cc ${srcdir}/std/dcomplex.h \
|
||||
${srcdir}/std/ldcomplex.h
|
||||
echo fcomplex
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DF \
|
||||
`for N in $(COMFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o pic/fcomplex.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DF `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o fcomplex.o
|
||||
echo fcomio
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DF \
|
||||
`for N in $(COMIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o pic/fcomio.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DF `for N in $(COMIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o fcomio.o
|
||||
echo dcomplex
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DD \
|
||||
`for N in $(COMFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o pic/dcomplex.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DD `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o dcomplex.o
|
||||
echo dcomio
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DD \
|
||||
`for N in $(COMIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o pic/dcomio.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DD `for N in $(COMIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o dcomio.o
|
||||
echo ldcomplex
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DLD \
|
||||
`for N in $(COMFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o pic/ldcomplex.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DLD `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o ldcomplex.o
|
||||
echo ldcomio
|
||||
if [ x"$(PICFLAG)" != x ]; then \
|
||||
$(COMPILE.cc) $(PICFLAG) -DLD \
|
||||
`for N in $(COMIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o pic/ldcomio.o; \
|
||||
else true ; fi
|
||||
$(COMPILE.cc) -DLD `for N in $(COMIO); do echo " -D$${N}"; done` \
|
||||
$(srcdir)/cinst.cc -o ldcomio.o
|
||||
touch bigstmp-complx
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
rootme=`pwd`/ ; export rootme ; \
|
||||
if [ -z "$(MULTISUBDIR)" ]; then \
|
||||
cd $(srcdir); \
|
||||
for FILE in $(HEADERS); do \
|
||||
rm -f $(gxx_include_dir)/$$FILE ; \
|
||||
if [ -f stl/$$FILE ]; then \
|
||||
$(INSTALL_DATA) stl/$$FILE $(gxx_include_dir)/$$FILE ; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
|
||||
fi ; \
|
||||
chmod a-x $(gxx_include_dir)/$$FILE ; \
|
||||
done ; \
|
||||
for FILE in *.h std/*.h std/*.cc std/*.tcc; do \
|
||||
rm -f $(gxx_include_dir)/$$FILE ; \
|
||||
$(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
|
||||
chmod a-x $(gxx_include_dir)/$$FILE ; \
|
||||
done ; \
|
||||
cd stl; \
|
||||
for FILE in *.h; do \
|
||||
rm -f $(gxx_include_dir)/$$FILE ; \
|
||||
$(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
|
||||
chmod a-x $(gxx_include_dir)/$$FILE ; \
|
||||
done ; \
|
||||
else true ; \
|
||||
fi
|
||||
rootme=`pwd`/ ; export rootme ; \
|
||||
if [ x$(enable_version_specific_runtime_libs) != xyes ]; then \
|
||||
INSTALLDIR=$(libdir); \
|
||||
else \
|
||||
INSTALLDIR=$(libsubdir); \
|
||||
fi; \
|
||||
INSTALLLINKDIR=$(libsubdir); \
|
||||
if [ $${INSTALLLINKDIR}$(MULTISUBDIR) = $${INSTALLDIR}$(MULTISUBDIR) ]; then \
|
||||
RELINSTALLDIR=; \
|
||||
elif [ x$(MULTISUBDIR) = x ]; then \
|
||||
if [ $(build_alias) = $(target_alias) ]; then \
|
||||
RELINSTALLDIR=../../../; \
|
||||
else \
|
||||
RELINSTALLDIR=../../../../$(target_alias)/lib/; \
|
||||
fi; \
|
||||
else \
|
||||
if [ $(build_alias) = $(target_alias) ]; then \
|
||||
RELINSTALLDIR=../../..`echo $(MULTISUBDIR) | sed -e 's,/[^/]*,/..,g'`$(MULTISUBDIR)/; \
|
||||
else \
|
||||
RELINSTALLDIR=../../../..`echo $(MULTISUBDIR) | sed -e 's,/[^/]*,/..,g'`/$(target_alias)/lib$(MULTISUBDIR)/; \
|
||||
fi; \
|
||||
fi; \
|
||||
if [ $(build_alias) != $(target_alias) ]; then \
|
||||
case $$RELINSTALLDIR in \
|
||||
../../../|../../../../) \
|
||||
RELINSTALLDIR=../$${RELINSTALLDIR}$(target_alias)/lib/;; \
|
||||
esac; \
|
||||
fi; \
|
||||
rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$(SHLINK) ; \
|
||||
rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$(ARLINK) ; \
|
||||
for FILE in $(LIBS) ; do \
|
||||
rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
if [ $$FILE = $(SHLINK) ] ; then \
|
||||
if [ -f $${INSTALLDIR}/$(MSHLINK) ]; then \
|
||||
rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
$(LN_S) $${RELINSTALLDIR}$(MSHLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
|
||||
|| cp $${RELINSTALLDIR}$(MSHLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
else \
|
||||
rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
$(LN_S) $${RELINSTALLDIR}$(SHLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
|
||||
|| cp $${RELINSTALLDIR}$(SHLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
fi; \
|
||||
elif [ $$FILE = $(ARLINK) ] ; then \
|
||||
if [ -f $${INSTALLDIR}/$(MARLINK) ]; then \
|
||||
rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
$(LN_S) $${RELINSTALLDIR}$(MARLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
|
||||
|| cp $${RELINSTALLDIR}$(MARLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
else \
|
||||
rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
$(LN_S) $${RELINSTALLDIR}$(ARLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
|
||||
|| cp $${RELINSTALLDIR}$(ARLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
fi; \
|
||||
elif [ $$FILE = mshlink ]; then \
|
||||
for FILE in $(MSHLINK) ; do \
|
||||
rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
$(LN_S) $(SHLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE \
|
||||
|| cp $(SHLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
done; \
|
||||
elif [ $$FILE = marlink ]; then \
|
||||
for FILE in $(MARLINK) ; do \
|
||||
rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
$(LN_S) $(ARLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE \
|
||||
|| cp $(ARLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
done; \
|
||||
elif [ $$FILE = $(SHLIB) ]; then \
|
||||
$(INSTALL_PROGRAM) $$FILE $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
: On the HP, shared libraries must be mode 555. ;\
|
||||
chmod 555 $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
else \
|
||||
$(INSTALL_DATA) $$FILE $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
$(RANLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
chmod a-x $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
|
||||
fi ; \
|
||||
done
|
||||
@rootme=`pwd`/ ; export rootme ; \
|
||||
$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
|
||||
|
||||
.PHONY: force
|
||||
force:
|
||||
|
||||
MYCXXFLAGS = $(CXXFLAGS) -g -O2 -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Winline -Wwrite-strings -pedantic -Wno-long-long
|
||||
MYCFLAGS = $(CFLAGS) -g -O2 -Wpointer-arith -Wnested-externs
|
||||
|
||||
.PHONY: stuff
|
||||
stuff:
|
||||
$(MAKE) stuff1
|
||||
$(MAKE) stuff2
|
||||
|
||||
stuff1:
|
||||
$(MAKE) clean
|
||||
$(MAKE) -C ../libio c++clean
|
||||
rm -f ../../gcc/cplib2.txt
|
||||
|
||||
stuff2:
|
||||
$(MAKE) -C ../../gcc/ LANGUAGES='c c++' libgcc.a
|
||||
$(MAKE) CXXFLAGS="$(MYCXXFLAGS)" CFLAGS="$(MYCFLAGS)"
|
||||
-$(MAKE) check
|
||||
-$(MAKE) -C ../libio check
|
||||
-$(MAKE) -C ../../gcc check-g++
|
@ -1,9 +0,0 @@
|
||||
SUMMARY OF RECENT MAJOR CHANGES to LIBSTDC++.
|
||||
(Also check ../libio/NEWS.)
|
||||
|
||||
*** Noteworthy changes in libstdc++ for EGCS
|
||||
|
||||
* EGCS includes the SGI STL implementation without changes.
|
||||
|
||||
* As a result of these and other changes, libstc++ for EGCS is not binary
|
||||
compatible with previous releases of libstdc++.
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CASSERT__
|
||||
#define __CASSERT__
|
||||
#include <assert.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- character type header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CCTYPE__
|
||||
#define __CCTYPE__
|
||||
#include <ctype.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- error number header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CERRNO__
|
||||
#define __CERRNO__
|
||||
#include <errno.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CFLOAT__
|
||||
#define __CFLOAT__
|
||||
#include <float.h>
|
||||
#endif
|
@ -1,154 +0,0 @@
|
||||
// Instantiation file for the -*- C++ -*- complex number classes.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
#ifdef F
|
||||
typedef float f;
|
||||
#endif
|
||||
#ifdef D
|
||||
typedef double f;
|
||||
#endif
|
||||
#ifdef LD
|
||||
typedef long double f;
|
||||
#endif
|
||||
|
||||
#if defined (MAIN) && defined (__GNUG__)
|
||||
#ifdef F
|
||||
#pragma implementation "fcomplex"
|
||||
#endif
|
||||
#ifdef D
|
||||
#pragma implementation "dcomplex"
|
||||
#endif
|
||||
#ifdef LD
|
||||
#pragma implementation "ldcomplex"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define _G_NO_EXTERN_TEMPLATES
|
||||
#endif
|
||||
#include <std/complext.cc>
|
||||
|
||||
typedef complex<f> c;
|
||||
typedef const c& ccr;
|
||||
|
||||
#ifdef MAIN
|
||||
template c& __doapl (c*, ccr);
|
||||
template c& __doaml (c*, ccr);
|
||||
template c& __doami (c*, ccr);
|
||||
template c& __doadv (c*, ccr);
|
||||
#endif
|
||||
|
||||
#ifdef ADDCC
|
||||
template c operator+ (ccr, ccr);
|
||||
#endif
|
||||
#ifdef ADDCF
|
||||
template c operator+ (ccr, f);
|
||||
#endif
|
||||
#ifdef ADDFC
|
||||
template c operator+ (f, ccr);
|
||||
#endif
|
||||
#ifdef SUBCC
|
||||
template c operator- (ccr, ccr);
|
||||
#endif
|
||||
#ifdef SUBCF
|
||||
template c operator- (ccr, f);
|
||||
#endif
|
||||
#ifdef SUBFC
|
||||
template c operator- (f, ccr);
|
||||
#endif
|
||||
#ifdef MULCC
|
||||
template c operator* (ccr, ccr);
|
||||
#endif
|
||||
#ifdef MULCF
|
||||
template c operator* (ccr, f);
|
||||
#endif
|
||||
#ifdef MULFC
|
||||
template c operator* (f, ccr);
|
||||
#endif
|
||||
#ifdef DIVCC
|
||||
template c operator/ (ccr, ccr);
|
||||
#endif
|
||||
#ifdef DIVCF
|
||||
template c operator/ (ccr, f);
|
||||
#endif
|
||||
#ifdef DIVFC
|
||||
template c operator/ (f, ccr);
|
||||
#endif
|
||||
#ifdef PLUS
|
||||
template c operator+ (ccr);
|
||||
#endif
|
||||
#ifdef MINUS
|
||||
template c operator- (ccr);
|
||||
#endif
|
||||
#ifdef EQCC
|
||||
template bool operator== (ccr, ccr);
|
||||
#endif
|
||||
#ifdef EQCF
|
||||
template bool operator== (ccr, f);
|
||||
#endif
|
||||
#ifdef EQFC
|
||||
template bool operator== (f, ccr);
|
||||
#endif
|
||||
#ifdef NECC
|
||||
template bool operator!= (ccr, ccr);
|
||||
#endif
|
||||
#ifdef NECF
|
||||
template bool operator!= (ccr, f);
|
||||
#endif
|
||||
#ifdef NEFC
|
||||
template bool operator!= (f, ccr);
|
||||
#endif
|
||||
#ifdef ABS
|
||||
template f abs (ccr);
|
||||
#endif
|
||||
#ifdef ARG
|
||||
template f arg (ccr);
|
||||
#endif
|
||||
#ifdef POLAR
|
||||
template c polar (f, f);
|
||||
#endif
|
||||
#ifdef CONJ
|
||||
template c conj (ccr);
|
||||
#endif
|
||||
#ifdef NORM
|
||||
template f norm (ccr);
|
||||
#endif
|
||||
#ifdef COS
|
||||
template c cos (ccr);
|
||||
#endif
|
||||
#ifdef COSH
|
||||
template c cosh (ccr);
|
||||
#endif
|
||||
#ifdef EXP
|
||||
template c exp (ccr);
|
||||
#endif
|
||||
#ifdef LOG
|
||||
template c log (ccr);
|
||||
#endif
|
||||
#ifdef POWCC
|
||||
template c pow (ccr, ccr);
|
||||
#endif
|
||||
#ifdef POWCF
|
||||
template c pow (ccr, f);
|
||||
#endif
|
||||
#ifdef POWCI
|
||||
template c pow (ccr, int);
|
||||
#endif
|
||||
#ifdef POWFC
|
||||
template c pow (f, ccr);
|
||||
#endif
|
||||
#ifdef SIN
|
||||
template c sin (ccr);
|
||||
#endif
|
||||
#ifdef SINH
|
||||
template c sinh (ccr);
|
||||
#endif
|
||||
#ifdef SQRT
|
||||
template c sqrt (ccr);
|
||||
#endif
|
||||
#ifdef EXTRACT
|
||||
template istream& operator>> (istream&, complex<f>&);
|
||||
#endif
|
||||
#ifdef INSERT
|
||||
template ostream& operator<< (ostream&, const complex<f>&);
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CISO646__
|
||||
#define __CISO646__
|
||||
#include <iso646.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CLIMITS__
|
||||
#define __CLIMITS__
|
||||
#include <limits.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- locale support header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CLOCALE__
|
||||
#define __CLOCALE__
|
||||
#include <locale.h>
|
||||
#endif
|
@ -1,76 +0,0 @@
|
||||
// The -*- C++ -*- math functions header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CMATH__
|
||||
#define __CMATH__
|
||||
#include <_G_config.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "cmath"
|
||||
#endif
|
||||
|
||||
extern "C++" {
|
||||
#if 0
|
||||
float acos (float);
|
||||
float asin (float);
|
||||
float atan (float);
|
||||
float atan2(float, float);
|
||||
float ceil (float);
|
||||
float cos (float);
|
||||
float cosh (float);
|
||||
float exp (float);
|
||||
float fabs (float);
|
||||
float floor(float);
|
||||
float fmod (float, float);
|
||||
float frexp(float, int*);
|
||||
float modf (float, float*);
|
||||
float ldexp(float, int);
|
||||
float log (float);
|
||||
float log10(float);
|
||||
float pow (float, float);
|
||||
float pow (float, int);
|
||||
float sin (float);
|
||||
float sinh (float);
|
||||
float sqrt (float);
|
||||
float tan (float);
|
||||
float tanh (float);
|
||||
#endif
|
||||
|
||||
inline float abs (float x) { return fabs (x); }
|
||||
#if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */
|
||||
inline double abs (double x) { return fabs (x); }
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
double pow(double, int);
|
||||
|
||||
long double acos (long double);
|
||||
long double asin (long double);
|
||||
long double atan (long double);
|
||||
long double atan2(long double, long double);
|
||||
long double ceil (long double);
|
||||
long double cos (long double);
|
||||
long double cosh (long double);
|
||||
long double exp (long double);
|
||||
long double fabs (long double);
|
||||
long double floor(long double);
|
||||
long double frexp(long double, int*);
|
||||
long double fmod (long double, long double);
|
||||
long double frexp(long double, int*);
|
||||
long double log (long double);
|
||||
long double log10(long double);
|
||||
long double modf (long double, long double*);
|
||||
long double pow (long double, long double);
|
||||
long double pow (long double, int);
|
||||
long double sin (long double);
|
||||
long double sinh (long double);
|
||||
long double sqrt (long double);
|
||||
long double tan (long double);
|
||||
long double tanh (long double);
|
||||
#endif
|
||||
inline long double abs (long double x) { return fabs (x); }
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// Implementation file for the -*- C++ -*- math functions header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "cmath"
|
||||
#endif
|
||||
#include <cmath>
|
@ -1,18 +0,0 @@
|
||||
// Main header for the -*- C++ -*- complex number classes.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __COMPLEX__
|
||||
#define __COMPLEX__
|
||||
|
||||
#include <std/complext.h>
|
||||
|
||||
extern "C++" {
|
||||
#define __STD_COMPLEX
|
||||
|
||||
// ANSI complex types
|
||||
typedef complex<float> float_complex;
|
||||
typedef complex<double> double_complex;
|
||||
typedef complex<long double> long_double_complex;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
// -*- C++ -*- backward compatiblity header.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
#ifndef __COMPLEX_H__
|
||||
#include <complex>
|
||||
#endif
|
@ -1,30 +0,0 @@
|
||||
# AIX has weird shared/non-shared libraries.
|
||||
|
||||
ARLIB =
|
||||
ARLINK =
|
||||
|
||||
# Build shared object with interface versioning in name.
|
||||
# Archive resulting shared object in a library.
|
||||
AIXLINK = libstdc++.a
|
||||
AIXLIB = libstdc++-$(VERSION).a
|
||||
AIXSHLIB = shr$(LIBSTDCXX_INTERFACE)$(CXX_INTERFACE).o
|
||||
SHFLAGS = -Wl,-bexpall
|
||||
SHDEPS = -lm
|
||||
SHOPT = -shared
|
||||
|
||||
LIBS = $(AIXLIB) $(AIXLINK)
|
||||
|
||||
$(AIXSHLIB): stdlist
|
||||
$(CC) $(LIBCXXFLAGS) $(SHFLAGS) $(SHOPT) -o $(AIXSHLIB) `cat stdlist` $(SHDEPS)
|
||||
|
||||
# Delete $(AIXSHLIB) so that it is not included in stdlist if rebuilding.
|
||||
$(AIXLIB): $(AIXSHLIB)
|
||||
-rm -f t$(AIXLIB)
|
||||
$(AR) $(AR_FLAGS) t$(AIXLIB) $(AIXSHLIB)
|
||||
mv t$(AIXLIB) $(AIXLIB)
|
||||
-rm -f $(AIXSHLIB)
|
||||
|
||||
$(AIXLINK):
|
||||
-rm -f $(AIXLINK)
|
||||
$(LN_S) $(AIXLIB) $(AIXLINK) || cp $(AIXLIB) $(AIXLINK)
|
||||
|
@ -1 +0,0 @@
|
||||
MT_CFLAGS = `case "$(CXXFLAGS)" in *-pthread* ) echo -D_PTHREADS ;; esac`
|
@ -1,4 +0,0 @@
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) mshlink $(SHLINK)
|
||||
SHFLAGS = -Wl,-soname,$(MSHLINK)
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
SHOPT = -nostart
|
@ -1,6 +0,0 @@
|
||||
# We don't need -fpic on the alpha, so let's install both the shared and
|
||||
# non-shared versions.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
SHDEPS = -lm
|
@ -1,2 +0,0 @@
|
||||
# If FPU instructions are generated by default, we have to use a special libm.a
|
||||
MLDLIBS = $(LDLIBS) `case "$(CXXFLAGS)" in *-m68000* | *-mc68000* | *-msoft-float* ) echo -lm ;; * ) echo -lm881 ;; esac`
|
@ -1,8 +0,0 @@
|
||||
# Elf without shared libm -- we have to link with the archive library, even
|
||||
# for programs that don't use complex.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
|
||||
SHFLAGS = -h $(SHLIB)
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
LDLIBS = -L.. -lstdc++ -lm
|
||||
MLDLIBS = -L.. -lstdc++ -lm
|
@ -1,6 +0,0 @@
|
||||
# Elf with shared libm, so we can link it into the shared libstdc++.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
|
||||
SHFLAGS = -h $(SHLIB)
|
||||
SHDEPS = -lm
|
||||
DEPLIBS = ../$(SHLIB)
|
@ -1,6 +0,0 @@
|
||||
# Elf with shared libm, so we can link it into the shared libstdc++.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink
|
||||
SHFLAGS = -Wl,-soname,$(MSHLINK)
|
||||
SHDEPS = -lm
|
||||
DEPLIBS = ../$(SHLIB)
|
@ -1,6 +0,0 @@
|
||||
# Elf with shared libm, so we can link it into the shared libstdc++.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
|
||||
SHFLAGS = -Wl,-soname,$(SHLIB)
|
||||
SHDEPS = -lm
|
||||
DEPLIBS = ../$(SHLIB)
|
@ -1,6 +0,0 @@
|
||||
# HPUX uses the .sl suffix for shared libraries.
|
||||
|
||||
SHLIB = libstdc++.sl
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB)
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
SHFLAGS = $(PICFLAG)
|
@ -1,6 +0,0 @@
|
||||
# We don't need -fpic on IRIX, so let's install both the shared and
|
||||
# non-shared versions.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
SHDEPS = -lm
|
@ -1,11 +0,0 @@
|
||||
# Elf with shared libm, so we can link it into the shared libstdc++.
|
||||
|
||||
ARLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).a
|
||||
MARLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).a.$(LIBSTDCXX_INTERFACE)
|
||||
SHLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).so
|
||||
MSHLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).so.$(LIBSTDCXX_INTERFACE)
|
||||
|
||||
LIBS = $(ARLIB) marlink $(ARLINK) $(SHLIB) mshlink $(SHLINK)
|
||||
SHFLAGS = -Wl,-soname,$(MSHLINK)
|
||||
SHDEPS = -lm
|
||||
DEPLIBS = ../$(SHLIB)
|
@ -1,2 +0,0 @@
|
||||
# tell we want the mt-safe version
|
||||
MT_CFLAGS = -D_IO_MTSAFE_IO
|
@ -1,7 +0,0 @@
|
||||
# Base shared lib for OpenBSD i386
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink
|
||||
SHFLAGS = -nostdlib -Wl,-Bshareable,-Bforcearchive
|
||||
SHDEPS = -lm
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
|
@ -1,3 +0,0 @@
|
||||
# tell we want the mt-safe version
|
||||
MT_CFLAGS = -D_IO_MTSAFE_IO -D_PTHREADS
|
||||
|
@ -1 +0,0 @@
|
||||
MT_CFLAGS = -D_PTHREADS
|
@ -1 +0,0 @@
|
||||
MT_CFLAGS = -D_PTHREADS
|
@ -1,6 +0,0 @@
|
||||
# Solaris2 with shared libm, so we can link it into the shared libstdc++.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
|
||||
SHFLAGS = -h $(SHLIB)
|
||||
SHDEPS = -lm
|
||||
DEPLIBS = ../$(SHLIB)
|
@ -1 +0,0 @@
|
||||
MT_CFLAGS = -D_SOLTHREADS
|
@ -1,9 +0,0 @@
|
||||
# SunOS doesn't provide a shared libm, so we have to link with the archive
|
||||
# library, even for programs that don't use complex.
|
||||
# SunOS requires a version number in shared library filenames.
|
||||
|
||||
LIBS = $(ARLIB) $(ARLINK) $(SHLIB)
|
||||
SHFLAGS = $(PICFLAG)
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
LDLIBS = -L.. -lstdc++ -lm
|
||||
MLDLIBS = -L.. -lstdc++ -lm
|
@ -1,9 +0,0 @@
|
||||
# x86 Interix. SHLINK is defined to be .dummy to avoid running into
|
||||
# the lack of symbolic links.
|
||||
|
||||
SHLINK = .dummy
|
||||
SHLIB = libstdc++.so
|
||||
LIBS = $(ARLIB) $(SHLIB)
|
||||
DEPLIBS = ../$(SHLIB)
|
||||
SHFLAGS = $(PICFLAG)
|
||||
|
@ -1,209 +0,0 @@
|
||||
# This file is a shell script fragment that supplies the information
|
||||
# necessary for a configure script to process the program in
|
||||
# this directory. For more information, look at ../configure.
|
||||
|
||||
# If the language specific compiler does not exist, but the "gcc" directory
|
||||
# does, we do not build anything. Note, $r is set by the top-level Makefile.
|
||||
# Note that when we look for the compiler, we search both with and without
|
||||
# extension to handle cross and canadian cross builds.
|
||||
# Note that if $norecursion is set we're being called from config.status,
|
||||
# so don't check for the compiler; we might be doing a make clean.
|
||||
compiler_name=cc1plus
|
||||
rm -f skip-this-dir
|
||||
if test -n "$r" && [ -z "$norecursion" ] ; then
|
||||
if test -d "$r"/gcc; then
|
||||
if test -f "$r"/gcc/$compiler_name \
|
||||
|| test -f "$r"/gcc/$compiler_name.exe; then
|
||||
true
|
||||
else
|
||||
echo "rm -f multilib.out" > skip-this-dir
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${srcdir}" = "." ] ; then
|
||||
if [ "${with_target_subdir}" != "." ] ; then
|
||||
topsrcdir=${with_multisrctop}../..
|
||||
else
|
||||
topsrcdir=${with_multisrctop}..
|
||||
fi
|
||||
else
|
||||
topsrcdir=${srcdir}/..
|
||||
fi
|
||||
|
||||
if [ -d ${topsrcdir}/gcc ] ; then
|
||||
configdirs="tests testsuite"
|
||||
else
|
||||
configdirs="tests"
|
||||
fi
|
||||
srctrigger=sinst.cc
|
||||
srcname="ANSI C++ library"
|
||||
package_makefile_frag=Make.pack
|
||||
package_makefile_rules_frag=Make.pack.r
|
||||
|
||||
# per-host:
|
||||
|
||||
# per-target:
|
||||
|
||||
echo "# Warning: this fragment is automatically generated" > temp.mt
|
||||
frags=
|
||||
|
||||
# If they didn't specify --enable-shared, don't generate shared libs.
|
||||
case "${enable_shared}" in
|
||||
yes) shared=yes ;;
|
||||
no) shared=no ;;
|
||||
*libstdc++*) shared=yes ;;
|
||||
*) shared=no ;;
|
||||
esac
|
||||
|
||||
if [ "${shared}" = "yes" ]; then
|
||||
case "${target}" in
|
||||
alpha*-*-linux*) frags=../../config/mh-elfalphapic ;;
|
||||
arm*-*-*) frags=../../config/mh-armpic ;;
|
||||
hppa*-*-*) frags=../../config/mh-papic ;;
|
||||
i[3456]86-*-*) frags=../../config/mh-x86pic ;;
|
||||
powerpc*-*-aix*) ;;
|
||||
powerpc*-*-*) frags=../../config/mh-ppcpic ;;
|
||||
sparc*-*-*) frags=../../config/mh-sparcpic ;;
|
||||
*-*-*) frags=../../config/mh-${target_cpu}pic ;;
|
||||
esac
|
||||
case "${target}" in
|
||||
*-*-aix*) frags="${frags} aix.ml" ;;
|
||||
*-*-beos*) frags="${frags} beos.ml" ;;
|
||||
*-dec-osf*) frags="${frags} dec-osf.ml";;
|
||||
*-*-freebsd2*) ;;
|
||||
*-*-freebsd*) frags="${frags} freebsd.ml" ;;
|
||||
*-*-hpux*) frags="${frags} hpux.ml" ;;
|
||||
*-*-irix[56]*) frags="${frags} irix5.ml" ;;
|
||||
*-*-linux*aout*) ;;
|
||||
*-*-linux*) frags="${frags} linux.ml" ;;
|
||||
# This must come after *-*-linux*
|
||||
*-*-gnu*) frags="${frags} gnu.ml" ;;
|
||||
*-*-openbsd*) frags="${frags} openbsd.ml" ;;
|
||||
*-*-sysv[45]*|*-*-udk*) frags="${frags} elf.ml" ;;
|
||||
*-*-solaris*) frags="${frags} sol2shm.ml" ;;
|
||||
*-*-sunos4*) frags="${frags} sunos4.ml" ;;
|
||||
i[3456]86-*-interix*) frags="${frags} x86-interix.ml" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Make sure the right flags are defined for multi-threading.
|
||||
case "${target}" in
|
||||
*-*-aix*)
|
||||
frags="${frags} aix.mt" ;;
|
||||
*-*-linux*)
|
||||
case "x${enable_threads}" in
|
||||
xyes|xposix) frags="${frags} linux.mt" ;;
|
||||
esac;;
|
||||
*-*-openbsd*)
|
||||
case "x${enable_threads}" in
|
||||
xyes|xposix) frags="${frags} openbsd.mt" ;;
|
||||
esac;;
|
||||
m68k-motorola-sysv) frags="${frags} delta.mt" ;;
|
||||
*-*-solaris*)
|
||||
case "x${enable_threads}" in
|
||||
xposix) frags="${frags} sol2pth.mt" ;;
|
||||
xsolaris) frags="${frags} sol2solth.mt" ;;
|
||||
esac ;;
|
||||
*)
|
||||
case "x${enable_threads}" in
|
||||
xposix) frags="${frags} posix.mt" ;;
|
||||
esac ;;
|
||||
esac
|
||||
|
||||
for frag in ${frags}; do
|
||||
case ${frag} in
|
||||
../* )
|
||||
if [ ${srcdir} = . ]; then
|
||||
[ -n "${with_target_subdir}" ] && frag=../${frag}
|
||||
[ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
frag=${srcdir}/config/$frag
|
||||
if [ -f ${frag} ]; then
|
||||
echo "Appending ${frag} to target-mkfrag"
|
||||
echo "# Following fragment copied from ${frag}" >> temp.mt
|
||||
cat ${frag} >> temp.mt
|
||||
fi
|
||||
done
|
||||
|
||||
target_makefile_frag=target-mkfrag
|
||||
${moveifchange} temp.mt target-mkfrag
|
||||
|
||||
LIBDIR=yes
|
||||
TO_TOPDIR=../
|
||||
ALL='libs'
|
||||
XCXXINCLUDES="-I${srcdir} -I${srcdir}/stl -I${TO_TOPDIR}libio -I${srcdir}/${TO_TOPDIR}libio -I${srcdir}/${TO_TOPDIR}include -I${srcdir}/${TO_TOPDIR}gcc"
|
||||
MOSTLYCLEAN='*.o pic stamp-picdir core so_locations $(MOSTLYCLEAN_JUNK)'
|
||||
CLEAN='$(CLEAN_JUNK)'
|
||||
EXTRA_DISTCLEAN='target-mkfrag'
|
||||
|
||||
(. ${srcdir}/${TO_TOPDIR}libio/config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag}
|
||||
|
||||
. ${topsrcdir}/config.if
|
||||
echo "
|
||||
LIBSTDCXX_INTERFACE=${libstdcxx_interface}
|
||||
CXX_INTERFACE=${cxx_interface}
|
||||
LIBC_INTERFACE=${libc_interface}
|
||||
" >> ${package_makefile_frag}
|
||||
|
||||
# This duplicated the AC_PROG_LN_S macro in GNU autoconf.
|
||||
rm -f conttestdata
|
||||
if ln -s X conftestdata 2>/dev/null
|
||||
then
|
||||
rm -f conftestdata
|
||||
LN_S="ln -s"
|
||||
else
|
||||
LN_S=ln
|
||||
fi
|
||||
echo "
|
||||
LN_S=$LN_S
|
||||
" >> ${package_makefile_frag}
|
||||
|
||||
# post-target:
|
||||
|
||||
# If cross-compiling, we install in $(tooldir)/lib or in $(libsubdir)
|
||||
# depending on --enable-version-specific-runtime-libs.
|
||||
if [ -n "${with_cross_host}" ] ; then
|
||||
rm -f Makefile.tem
|
||||
sed \
|
||||
-e 's|^\([ ]*INSTALLDIR[ ]*=[ ]*\)\$(libdir)|\1$(tooldir)/lib|' \
|
||||
Makefile >Makefile.tem
|
||||
mv -f Makefile.tem Makefile
|
||||
fi
|
||||
|
||||
# enable multilib-ing by default.
|
||||
if [ -z "${enable_multilib}" ]; then
|
||||
enable_multilib=yes
|
||||
fi
|
||||
|
||||
. ${topsrcdir}/config-ml.in
|
||||
|
||||
gxx_include_dir=
|
||||
# Specify the g++ header file directory
|
||||
# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
|
||||
if test "${with_gxx_include_dir+set}" = set; then
|
||||
withval="$with_gxx_include_dir"
|
||||
case "${withval}" in
|
||||
yes)
|
||||
echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
no) ;;
|
||||
*) gxx_include_dir=$with_gxx_include_dir ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test x${gxx_include_dir} = x; then
|
||||
if test x${enable_version_specific_runtime_libs} = xyes; then
|
||||
gxx_include_dir='${libsubdir}/include/g++'
|
||||
else
|
||||
gxx_include_dir='${prefix}/include/g++'-${libstdcxx_interface}
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f Makefile.tem
|
||||
sed -e "s%^gxx_include_dir[ ]*=.*$%gxx_include_dir=${gxx_include_dir}%" \
|
||||
Makefile >Makefile.tem
|
||||
mv -f Makefile.tem Makefile
|
@ -1,8 +0,0 @@
|
||||
// The -*- C++ -*- setjmp/longjmp header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSETJMP__
|
||||
#define __CSETJMP__
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- signal handling header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSIGNAL__
|
||||
#define __CSIGNAL__
|
||||
#include <signal.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSTDARG__
|
||||
#define __CSTDARG__
|
||||
#include <stdarg.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSTDDEF__
|
||||
#define __CSTDDEF__
|
||||
#include <stddef.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- standard I/O header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSTDIO__
|
||||
#define __CSTDIO__
|
||||
#include <stdio.h>
|
||||
#endif
|
@ -1,23 +0,0 @@
|
||||
// The -*- C++ -*- standard library header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSTDLIB__
|
||||
#define __CSTDLIB__
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "cstdlib"
|
||||
#endif
|
||||
|
||||
extern "C++" {
|
||||
|
||||
#if _G_HAS_LABS
|
||||
inline long abs(long x) { return labs (x); }
|
||||
#else
|
||||
inline long abs(long x) { return x >= 0 ? x : -x; }
|
||||
#endif
|
||||
//inline ldiv_t div(long x, long y) { return ldiv (x, y); }
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// Implementation file for the -*- C++ -*- standard library header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "cstdlib"
|
||||
#endif
|
||||
#include <cstdlib>
|
@ -1,96 +0,0 @@
|
||||
// The -*- C++ -*- null-terminated string header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CSTRING__
|
||||
#define __CSTRING__
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if 0 // Let's not bother with this just yet.
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "cstring"
|
||||
#endif
|
||||
|
||||
// The ANSI C prototypes for these functions have a const argument type and
|
||||
// non-const return type, so we can't use them.
|
||||
|
||||
extern "C++" {
|
||||
extern inline const char *
|
||||
_G_strchr (const char *s, int c)
|
||||
{
|
||||
return strchr (s, c);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strchr (char *s, int c)
|
||||
{
|
||||
return const_cast<char *> (strchr (s, c));
|
||||
}
|
||||
|
||||
extern inline const char *
|
||||
_G_strpbrk (const char *s1, const char *s2)
|
||||
{
|
||||
return strpbrk (s1, s2);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strpbrk (char *s1, const char *s2)
|
||||
{
|
||||
return const_cast<char *> (strpbrk (s1, s2));
|
||||
}
|
||||
|
||||
extern inline const char *
|
||||
_G_strrchr (const char *s, int c)
|
||||
{
|
||||
return strrchr (s, c);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strrchr (char *s, int c)
|
||||
{
|
||||
return const_cast<char *> (strrchr (s, c));
|
||||
}
|
||||
|
||||
extern inline const char *
|
||||
_G_strstr (const char *s1, const char *s2)
|
||||
{
|
||||
return strstr (s1, s2);
|
||||
}
|
||||
|
||||
extern inline char *
|
||||
_G_strstr (char *s1, const char *s2)
|
||||
{
|
||||
return const_cast<char *> (strstr (s1, s2));
|
||||
}
|
||||
|
||||
extern inline const void *
|
||||
_G_memchr (const void *s, int c, size_t n)
|
||||
{
|
||||
return memchr (s, c, n);
|
||||
}
|
||||
|
||||
extern inline void *
|
||||
_G_memchr (void *s, int c, size_t n)
|
||||
{
|
||||
return const_cast<void *> (memchr (s, c, n));
|
||||
}
|
||||
} // extern "C++"
|
||||
|
||||
// Lose any vendor macros for these functions.
|
||||
#undef strchr
|
||||
#undef strpbrk
|
||||
#undef strrchr
|
||||
#undef strstr
|
||||
#undef memchr
|
||||
|
||||
// Ewww, namespace pollution. Anyone have a better idea?
|
||||
#define strchr _G_strchr
|
||||
#define strpbrk _G_strpbrk
|
||||
#define strrchr _G_strrchr
|
||||
#define strstr _G_strstr
|
||||
#define memchr _G_memchr
|
||||
#endif // 0
|
||||
|
||||
#endif // !defined (__CSTRING__)
|
@ -1,7 +0,0 @@
|
||||
// Implementation file for the -*- C++ -*- null-terminated string header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "cstring"
|
||||
#endif
|
||||
#include <cstring>
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- time header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CTIME__
|
||||
#define __CTIME__
|
||||
#include <time.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- wide character header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CWCHAR__
|
||||
#define __CWCHAR__
|
||||
#include <wchar.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// The -*- C++ -*- wide character type header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __CWCTYPE__
|
||||
#define __CWCTYPE__
|
||||
#include <wctype.h>
|
||||
#endif
|
@ -1,519 +0,0 @@
|
||||
/* new abi support -*- C++ -*-
|
||||
Copyright (C) 2000
|
||||
Free Software Foundation, Inc.
|
||||
Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com> */
|
||||
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/* This file declares the new abi entry points into the runtime. It is not
|
||||
normally necessary for user programs to include this header, or use the
|
||||
entry points directly. However, this header is available should that be
|
||||
needed.
|
||||
|
||||
Some of the entry points are intended for both C and C++, thus this header
|
||||
is includable from both C and C++. Though the C++ specific parts are not
|
||||
available in C, naturally enough. */
|
||||
|
||||
#ifndef __CXXABI_H
|
||||
#define __CXXABI_H 1
|
||||
|
||||
#if defined(__cplusplus) && (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100)
|
||||
/* These structures only make sense when targeting the new abi, catch a
|
||||
bonehead error early rather than let the user get very confused. */
|
||||
#error "Not targetting the new abi, supply -fnew-abi"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// We use the compiler builtins __SIZE_TYPE__ and __PTRDIFF_TYPE__ instead of
|
||||
// std::size_t and std::ptrdiff_t respectively. This makes us independant of
|
||||
// the conformance level of <cstddef> and whether -fhonor-std was supplied.
|
||||
// <cstddef> is not currently available during compiler building anyway.
|
||||
// Including <stddef.h> would be wrong, as that would rudely place size_t in
|
||||
// the global namespace.
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
namespace __cxxabiv1
|
||||
{
|
||||
|
||||
/* type information for int, float etc */
|
||||
class __fundamental_type_info
|
||||
: public std::type_info
|
||||
{
|
||||
public:
|
||||
virtual ~__fundamental_type_info ();
|
||||
public:
|
||||
explicit __fundamental_type_info (const char *__n)
|
||||
: std::type_info (__n)
|
||||
{ }
|
||||
};
|
||||
|
||||
/* type information for array objects */
|
||||
class __array_type_info
|
||||
: public std::type_info
|
||||
{
|
||||
/* abi defined member functions */
|
||||
protected:
|
||||
virtual ~__array_type_info ();
|
||||
public:
|
||||
explicit __array_type_info (const char *__n)
|
||||
: std::type_info (__n)
|
||||
{ }
|
||||
};
|
||||
|
||||
/* type information for functions (both member and non-member) */
|
||||
class __function_type_info
|
||||
: public std::type_info
|
||||
{
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__function_type_info ();
|
||||
public:
|
||||
explicit __function_type_info (const char *__n)
|
||||
: std::type_info (__n)
|
||||
{ }
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __is_function_p () const;
|
||||
};
|
||||
|
||||
/* type information for enumerations */
|
||||
class __enum_type_info
|
||||
: public std::type_info
|
||||
{
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__enum_type_info ();
|
||||
public:
|
||||
explicit __enum_type_info (const char *__n)
|
||||
: std::type_info (__n)
|
||||
{ }
|
||||
};
|
||||
|
||||
/* common type information for simple pointers and pointers to member */
|
||||
class __pbase_type_info
|
||||
: public std::type_info
|
||||
{
|
||||
/* abi defined member variables */
|
||||
public:
|
||||
unsigned int __qualifier_flags; /* qualification of the target object */
|
||||
const std::type_info *__pointee; /* type of pointed to object */
|
||||
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__pbase_type_info ();
|
||||
public:
|
||||
explicit __pbase_type_info (const char *__n,
|
||||
int __quals,
|
||||
const std::type_info *__type)
|
||||
: std::type_info (__n), __qualifier_flags (__quals), __pointee (__type)
|
||||
{ }
|
||||
|
||||
/* implementation defined types */
|
||||
public:
|
||||
enum __qualifier_masks {
|
||||
__const_mask = 0x1,
|
||||
__volatile_mask = 0x2,
|
||||
__restrict_mask = 0x4,
|
||||
__incomplete_mask = 0x8,
|
||||
__incomplete_class_mask = 0x10
|
||||
};
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __do_catch (const std::type_info *__thr_type,
|
||||
void **__thr_obj,
|
||||
unsigned __outer) const;
|
||||
protected:
|
||||
inline virtual bool __pointer_catch (const __pbase_type_info *__thr_type,
|
||||
void **__thr_obj,
|
||||
unsigned __outer) const;
|
||||
};
|
||||
|
||||
/* type information for simple pointers */
|
||||
class __pointer_type_info
|
||||
: public __pbase_type_info
|
||||
{
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__pointer_type_info ();
|
||||
public:
|
||||
explicit __pointer_type_info (const char *__n,
|
||||
int __quals,
|
||||
const std::type_info *__type)
|
||||
: __pbase_type_info (__n, __quals, __type)
|
||||
{ }
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __is_pointer_p () const;
|
||||
|
||||
protected:
|
||||
virtual bool __pointer_catch (const __pbase_type_info *__thr_type,
|
||||
void **__thr_obj,
|
||||
unsigned __outer) const;
|
||||
};
|
||||
|
||||
/* type information for a pointer to member variable */
|
||||
class __pointer_to_member_type_info
|
||||
: public __pbase_type_info
|
||||
{
|
||||
/* abi defined member variables */
|
||||
public:
|
||||
__class_type_info *__context_class; /* class of the member */
|
||||
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__pointer_to_member_type_info ();
|
||||
public:
|
||||
explicit __pointer_to_member_type_info (const char *__n,
|
||||
int __quals,
|
||||
const std::type_info *__type,
|
||||
__class_type_info *__klass)
|
||||
: __pbase_type_info (__n, __quals, __type), __context_class (__klass)
|
||||
{ }
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __pointer_catch (const __pbase_type_info *__thr_type,
|
||||
void **__thr_obj,
|
||||
unsigned __outer) const;
|
||||
};
|
||||
|
||||
class __class_type_info;
|
||||
|
||||
/* helper class for __vmi_class_type */
|
||||
class __base_class_info
|
||||
{
|
||||
/* abi defined member variables */
|
||||
public:
|
||||
const __class_type_info *__base; /* base class type */
|
||||
long __offset_flags; /* offset and info */
|
||||
|
||||
/* implementation defined types */
|
||||
public:
|
||||
enum __offset_flags_masks {
|
||||
__virtual_mask = 0x1,
|
||||
__public_mask = 0x2,
|
||||
hwm_bit = 2,
|
||||
offset_shift = 8 /* bits to shift offset by */
|
||||
};
|
||||
|
||||
/* implementation defined member functions */
|
||||
public:
|
||||
bool __is_virtual_p () const
|
||||
{ return __offset_flags & __virtual_mask; }
|
||||
bool __is_public_p () const
|
||||
{ return __offset_flags & __public_mask; }
|
||||
__PTRDIFF_TYPE__ __offset () const
|
||||
{
|
||||
// This shift, being of a signed type, is implementation defined. GCC
|
||||
// implements such shifts as arithmetic, which is what we want.
|
||||
return static_cast<__PTRDIFF_TYPE__> (__offset_flags) >> offset_shift;
|
||||
}
|
||||
};
|
||||
|
||||
/* type information for a class */
|
||||
class __class_type_info
|
||||
: public std::type_info
|
||||
{
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__class_type_info ();
|
||||
public:
|
||||
explicit __class_type_info (const char *__n)
|
||||
: type_info (__n)
|
||||
{ }
|
||||
|
||||
/* implementation defined types */
|
||||
public:
|
||||
/* sub_kind tells us about how a base object is contained within a derived
|
||||
object. We often do this lazily, hence the UNKNOWN value. At other times
|
||||
we may use NOT_CONTAINED to mean not publicly contained. */
|
||||
enum __sub_kind
|
||||
{
|
||||
__unknown = 0, /* we have no idea */
|
||||
__not_contained, /* not contained within us (in some */
|
||||
/* circumstances this might mean not contained */
|
||||
/* publicly) */
|
||||
__contained_ambig, /* contained ambiguously */
|
||||
|
||||
__contained_virtual_mask = __base_class_info::__virtual_mask, /* via a virtual path */
|
||||
__contained_public_mask = __base_class_info::__public_mask, /* via a public path */
|
||||
__contained_mask = 1 << __base_class_info::hwm_bit, /* contained within us */
|
||||
|
||||
__contained_private = __contained_mask,
|
||||
__contained_public = __contained_mask | __contained_public_mask
|
||||
};
|
||||
|
||||
public:
|
||||
struct __upcast_result;
|
||||
struct __dyncast_result;
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __do_upcast (const __class_type_info *__dst_type, void **__obj_ptr) const;
|
||||
|
||||
protected:
|
||||
virtual bool __do_catch (const type_info *__thr_type, void **__thr_obj,
|
||||
unsigned __outer) const;
|
||||
|
||||
|
||||
public:
|
||||
/* Helper for upcast. See if DST is us, or one of our bases. */
|
||||
/* Return false if not found, true if found. */
|
||||
virtual bool __do_upcast (const __class_type_info *__dst,
|
||||
const void *__obj,
|
||||
__upcast_result &__restrict __result) const;
|
||||
|
||||
public:
|
||||
/* Indicate whether SRC_PTR of type SRC_TYPE is contained publicly within
|
||||
OBJ_PTR. OBJ_PTR points to a base object of our type, which is the
|
||||
destination type. SRC2DST indicates how SRC objects might be contained
|
||||
within this type. If SRC_PTR is one of our SRC_TYPE bases, indicate the
|
||||
virtuality. Returns not_contained for non containment or private
|
||||
containment. */
|
||||
inline __sub_kind __find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr) const;
|
||||
|
||||
public:
|
||||
/* dynamic cast helper. ACCESS_PATH gives the access from the most derived
|
||||
object to this base. DST_TYPE indicates the desired type we want. OBJ_PTR
|
||||
points to a base of our type within the complete object. SRC_TYPE
|
||||
indicates the static type started from and SRC_PTR points to that base
|
||||
within the most derived object. Fill in RESULT with what we find. Return
|
||||
true if we have located an ambiguous match. */
|
||||
virtual bool __do_dyncast (__PTRDIFF_TYPE__ __src2dst,
|
||||
__sub_kind __access_path,
|
||||
const __class_type_info *__dst_type,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr,
|
||||
__dyncast_result &__result) const;
|
||||
public:
|
||||
/* Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE bases are
|
||||
inherited by the type started from -- which is not necessarily the
|
||||
current type. The current type will be a base of the destination type.
|
||||
OBJ_PTR points to the current base. */
|
||||
virtual __sub_kind __do_find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr) const;
|
||||
};
|
||||
|
||||
/* type information for a class with a single non-virtual base */
|
||||
class __si_class_type_info
|
||||
: public __class_type_info
|
||||
{
|
||||
/* abi defined member variables */
|
||||
public:
|
||||
const __class_type_info *__base_type;
|
||||
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__si_class_type_info ();
|
||||
public:
|
||||
explicit __si_class_type_info (const char *__n,
|
||||
const __class_type_info *__base)
|
||||
: __class_type_info (__n), __base_type (__base)
|
||||
{ }
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __do_dyncast (__PTRDIFF_TYPE__ __src2dst,
|
||||
__sub_kind __access_path,
|
||||
const __class_type_info *__dst_type,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr,
|
||||
__dyncast_result &__result) const;
|
||||
virtual __sub_kind __do_find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__sub_ptr) const;
|
||||
virtual bool __do_upcast (const __class_type_info *__dst,
|
||||
const void *__obj,
|
||||
__upcast_result &__restrict __result) const;
|
||||
};
|
||||
|
||||
/* type information for a class with multiple and/or virtual bases */
|
||||
class __vmi_class_type_info : public __class_type_info {
|
||||
/* abi defined member variables */
|
||||
public:
|
||||
unsigned int __flags; /* details about the class heirarchy */
|
||||
unsigned int __base_count; /* number of direct bases */
|
||||
__base_class_info const __base_info[1]; /* array of bases */
|
||||
/* The array of bases uses the trailing array struct hack
|
||||
so this class is not constructable with a normal constructor. It is
|
||||
internally generated by the compiler. */
|
||||
|
||||
/* abi defined member functions */
|
||||
public:
|
||||
virtual ~__vmi_class_type_info ();
|
||||
public:
|
||||
explicit __vmi_class_type_info (const char *__n,
|
||||
int ___flags)
|
||||
: __class_type_info (__n), __flags (___flags), __base_count (0)
|
||||
{ }
|
||||
|
||||
/* implementation defined types */
|
||||
public:
|
||||
enum __flags_masks {
|
||||
__non_diamond_repeat_mask = 0x1, /* distinct instance of repeated base */
|
||||
__diamond_shaped_mask = 0x2, /* diamond shaped multiple inheritance */
|
||||
non_public_base_mask = 0x4, /* has non-public direct or indirect base */
|
||||
public_base_mask = 0x8, /* has public base (direct) */
|
||||
|
||||
__flags_unknown_mask = 0x10
|
||||
};
|
||||
|
||||
/* implementation defined member functions */
|
||||
protected:
|
||||
virtual bool __do_dyncast (__PTRDIFF_TYPE__ __src2dst,
|
||||
__sub_kind __access_path,
|
||||
const __class_type_info *__dst_type,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr,
|
||||
__dyncast_result &__result) const;
|
||||
virtual __sub_kind __do_find_public_src (__PTRDIFF_TYPE__ __src2dst,
|
||||
const void *__obj_ptr,
|
||||
const __class_type_info *__src_type,
|
||||
const void *__src_ptr) const;
|
||||
virtual bool __do_upcast (const __class_type_info *__dst,
|
||||
const void *__obj,
|
||||
__upcast_result &__restrict __result) const;
|
||||
};
|
||||
|
||||
/* dynamic cast runtime */
|
||||
extern "C"
|
||||
void *__dynamic_cast (const void *__src_ptr, /* object started from */
|
||||
const __class_type_info *__src_type, /* static type of object */
|
||||
const __class_type_info *__dst_type, /* desired target type */
|
||||
__PTRDIFF_TYPE__ __src2dst); /* how src and dst are related */
|
||||
|
||||
/* src2dst has the following possible values
|
||||
>= 0: src_type is a unique public non-virtual base of dst_type
|
||||
dst_ptr + src2dst == src_ptr
|
||||
-1: unspecified relationship
|
||||
-2: src_type is not a public base of dst_type
|
||||
-3: src_type is a multiple public non-virtual base of dst_type */
|
||||
|
||||
/* array ctor/dtor routines */
|
||||
|
||||
/* allocate and construct array */
|
||||
extern "C"
|
||||
void *__cxa_vec_new (__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__constructor) (void *),
|
||||
void (*__destructor) (void *));
|
||||
|
||||
extern "C"
|
||||
void *__cxa_vec_new2 (__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__constructor) (void *),
|
||||
void (*__destructor) (void *),
|
||||
void *(*__alloc) (__SIZE_TYPE__),
|
||||
void (*__dealloc) (void *));
|
||||
|
||||
extern "C"
|
||||
void *__cxa_vec_new3 (__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__constructor) (void *),
|
||||
void (*__destructor) (void *),
|
||||
void *(*__alloc) (__SIZE_TYPE__),
|
||||
void (*__dealloc) (void *, __SIZE_TYPE__));
|
||||
|
||||
/* construct array */
|
||||
extern "C"
|
||||
void __cxa_vec_ctor (void *__array_address,
|
||||
__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
void (*__constructor) (void *),
|
||||
void (*__destructor) (void *));
|
||||
|
||||
extern "C"
|
||||
void __cxa_vec_cctor (void *dest_array,
|
||||
void *src_array,
|
||||
__SIZE_TYPE__ element_count,
|
||||
__SIZE_TYPE__ element_size,
|
||||
void (*constructor) (void *, void *),
|
||||
void (*destructor) (void *));
|
||||
|
||||
/* destruct array */
|
||||
extern "C"
|
||||
void __cxa_vec_dtor (void *__array_address,
|
||||
__SIZE_TYPE__ __element_count,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
void (*__destructor) (void *));
|
||||
|
||||
/* destruct and release array */
|
||||
extern "C"
|
||||
void __cxa_vec_delete (void *__array_address,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__destructor) (void *));
|
||||
|
||||
extern "C"
|
||||
void __cxa_vec_delete2 (void *__array_address,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__destructor) (void *),
|
||||
void (*__dealloc) (void *));
|
||||
|
||||
extern "C"
|
||||
void __cxa_vec_delete3 (void *__array_address,
|
||||
__SIZE_TYPE__ __element_size,
|
||||
__SIZE_TYPE__ __padding_size,
|
||||
void (*__destructor) (void *),
|
||||
void (*__dealloc) (void *, __SIZE_TYPE__));
|
||||
|
||||
/* demangling routines */
|
||||
|
||||
extern "C"
|
||||
char *__cxa_demangle (const char *__mangled_name,
|
||||
char *__output_buffer,
|
||||
__SIZE_TYPE__ *__length,
|
||||
int *__status);
|
||||
|
||||
} /* namespace __cxxabiv1 */
|
||||
|
||||
/* User programs should use the alias `abi'. */
|
||||
namespace abi = __cxxabiv1;
|
||||
|
||||
#else
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __CXXABI_H */
|
@ -1,39 +0,0 @@
|
||||
// Boilerplate support routines for -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
|
||||
extern "C" void free (void *);
|
||||
|
||||
void
|
||||
operator delete (void *ptr) throw ()
|
||||
{
|
||||
if (ptr)
|
||||
free (ptr);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
// Boilerplate support routines for -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
|
||||
extern "C" void free (void *);
|
||||
|
||||
void
|
||||
operator delete (void *ptr, const std::nothrow_t&) throw ()
|
||||
{
|
||||
if (ptr)
|
||||
free (ptr);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Boilerplate support routines for -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
|
||||
void
|
||||
operator delete[] (void *ptr) throw ()
|
||||
{
|
||||
::operator delete (ptr);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Boilerplate support routines for -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
|
||||
void
|
||||
operator delete[] (void *ptr, const std::nothrow_t&) throw ()
|
||||
{
|
||||
::operator delete (ptr);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
// Exception Handling support header for -*- C++ -*-
|
||||
// Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation
|
||||
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#ifndef __EXCEPTION__
|
||||
#define __EXCEPTION__
|
||||
|
||||
#pragma interface "exception"
|
||||
|
||||
extern "C++" {
|
||||
|
||||
namespace std {
|
||||
|
||||
class exception {
|
||||
public:
|
||||
exception () { }
|
||||
virtual ~exception () { }
|
||||
virtual const char* what () const;
|
||||
};
|
||||
|
||||
class bad_exception : public exception {
|
||||
public:
|
||||
bad_exception () { }
|
||||
virtual ~bad_exception () { }
|
||||
};
|
||||
|
||||
typedef void (*terminate_handler) ();
|
||||
typedef void (*unexpected_handler) ();
|
||||
|
||||
terminate_handler set_terminate (terminate_handler);
|
||||
void terminate () __attribute__ ((__noreturn__));
|
||||
unexpected_handler set_unexpected (unexpected_handler);
|
||||
void unexpected () __attribute__ ((__noreturn__));
|
||||
bool uncaught_exception ();
|
||||
|
||||
} // namespace std
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,404 +0,0 @@
|
||||
// Functions for Exception Support for -*- C++ -*-
|
||||
// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
|
||||
// This file is part of GNU CC.
|
||||
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#pragma implementation "exception"
|
||||
|
||||
#include "typeinfo"
|
||||
#include "exception"
|
||||
#include <stddef.h>
|
||||
#include "gansidecl.h" /* Needed to support macros used in eh-common.h. */
|
||||
#include "eh-common.h"
|
||||
|
||||
/* Define terminate, unexpected, set_terminate, set_unexpected as
|
||||
well as the default terminate func and default unexpected func. */
|
||||
|
||||
/* __terminate and __terminate_set_func, defined in libgcc2. */
|
||||
typedef void (*__terminate_func_ptr)(void) __attribute__ ((__noreturn__));
|
||||
extern "C" void __terminate (void) __attribute__ ((__noreturn__));
|
||||
extern "C" __terminate_func_ptr __terminate_set_func (__terminate_func_ptr);
|
||||
|
||||
using std::terminate;
|
||||
|
||||
void
|
||||
std::terminate ()
|
||||
{
|
||||
__terminate ();
|
||||
}
|
||||
|
||||
void
|
||||
__default_unexpected ()
|
||||
{
|
||||
terminate ();
|
||||
}
|
||||
|
||||
static std::unexpected_handler __unexpected_func __attribute__((__noreturn__))
|
||||
= __default_unexpected;
|
||||
|
||||
std::terminate_handler
|
||||
std::set_terminate (std::terminate_handler func)
|
||||
{
|
||||
return __terminate_set_func (func);
|
||||
}
|
||||
|
||||
std::unexpected_handler
|
||||
std::set_unexpected (std::unexpected_handler func)
|
||||
{
|
||||
std::unexpected_handler old = __unexpected_func;
|
||||
|
||||
__unexpected_func = func;
|
||||
return old;
|
||||
}
|
||||
|
||||
void
|
||||
std::unexpected ()
|
||||
{
|
||||
__unexpected_func ();
|
||||
}
|
||||
|
||||
/* The type of a function called to clean up an exception object.
|
||||
(These will be destructors.) Under the old ABI, these take a
|
||||
second argument (the `in-charge' argument), that indicates whether
|
||||
or not do delete the object, and whether or not to destroy virtual
|
||||
bases. Under the new ABI, there is no second argument. */
|
||||
#if !defined (__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
|
||||
typedef void (*cleanup_fn)(void *, int);
|
||||
/* The `2' is the value for the in-charge parameter that indicates
|
||||
that virtual bases should be destroyed. */
|
||||
#define CALL_CLEANUP(FN, THIS) FN (THIS, 2)
|
||||
#else
|
||||
typedef void (*cleanup_fn)(void *);
|
||||
#define CALL_CLEANUP(FN, THIS) FN (THIS)
|
||||
#endif
|
||||
|
||||
/* C++-specific state about the current exception.
|
||||
This must match init_exception_processing().
|
||||
|
||||
Note that handlers and caught are not redundant; when rethrown, an
|
||||
exception can have multiple active handlers and still be considered
|
||||
uncaught. */
|
||||
|
||||
struct cp_eh_info
|
||||
{
|
||||
__eh_info eh_info;
|
||||
void *value;
|
||||
void *type;
|
||||
cleanup_fn cleanup;
|
||||
bool caught;
|
||||
cp_eh_info *next;
|
||||
long handlers;
|
||||
void *original_value;
|
||||
};
|
||||
|
||||
/* Language-specific EH info pointer, defined in libgcc2. */
|
||||
|
||||
extern "C" cp_eh_info **__get_eh_info (); // actually void **
|
||||
|
||||
/* Exception allocate and free, defined in libgcc2. */
|
||||
extern "C" void *__eh_alloc(size_t);
|
||||
extern "C" void __eh_free(void *);
|
||||
|
||||
/* Is P the type_info node for a pointer of some kind? */
|
||||
|
||||
extern bool __is_pointer (void *);
|
||||
|
||||
|
||||
/* OLD Compiler hook to return a pointer to the info for the current exception.
|
||||
Used by get_eh_info (). This fudges the actualy returned value to
|
||||
point to the beginning of what USE to be the cp_eh_info structure.
|
||||
THis is so that old code that dereferences this pointer will find
|
||||
things where it expects it to be.*/
|
||||
extern "C" void *
|
||||
__cp_exception_info (void)
|
||||
{
|
||||
return &((*__get_eh_info ())->value);
|
||||
}
|
||||
|
||||
#define CP_EH_INFO ((cp_eh_info *) *__get_eh_info ())
|
||||
|
||||
/* Old Compiler hook to return a pointer to the info for the current exception.
|
||||
Used by get_eh_info (). */
|
||||
|
||||
extern "C" cp_eh_info *
|
||||
__cp_eh_info (void)
|
||||
{
|
||||
cp_eh_info *p = CP_EH_INFO;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Compiler hook to return a pointer to the info for the current exception,
|
||||
Set the caught bit, and increment the number of handlers that are
|
||||
looking at this exception. This makes handlers smaller. */
|
||||
|
||||
extern "C" cp_eh_info *
|
||||
__start_cp_handler (void)
|
||||
{
|
||||
cp_eh_info *p = CP_EH_INFO;
|
||||
p->caught = 1;
|
||||
p->handlers++;
|
||||
return p;
|
||||
}
|
||||
|
||||
extern "C" int __throw_type_match_rtti_2 (const void *, const void *,
|
||||
void *, void **);
|
||||
|
||||
extern "C" void *
|
||||
__cplus_type_matcher (__eh_info *info_, void *match_info,
|
||||
exception_descriptor *exception_table)
|
||||
{
|
||||
cp_eh_info *info = (cp_eh_info *)info_;
|
||||
|
||||
/* No exception table implies the old style mechanism, so don't check. */
|
||||
if (exception_table != NULL
|
||||
&& exception_table->lang.language != EH_LANG_C_plus_plus)
|
||||
return NULL;
|
||||
|
||||
if (match_info == CATCH_ALL_TYPE)
|
||||
return (void *)1;
|
||||
|
||||
/* we don't worry about version info yet, there is only one version! */
|
||||
|
||||
void *match_type = match_info;
|
||||
|
||||
#if !defined (__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100
|
||||
match_type = ((void *(*)())match_type) ();
|
||||
#endif
|
||||
|
||||
if (__throw_type_match_rtti_2 (match_type, info->type,
|
||||
info->original_value, &info->value))
|
||||
// Arbitrary non-null pointer.
|
||||
return (void *)1;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Compiler hook to push a new exception onto the stack.
|
||||
Used by expand_throw(). */
|
||||
|
||||
extern "C" void
|
||||
__cp_push_exception (void *value, void *type, cleanup_fn cleanup)
|
||||
{
|
||||
cp_eh_info *p = (cp_eh_info *) __eh_alloc (sizeof (cp_eh_info));
|
||||
|
||||
p->value = value;
|
||||
p->type = type;
|
||||
p->cleanup = cleanup;
|
||||
p->handlers = 0;
|
||||
p->caught = false;
|
||||
p->original_value = value;
|
||||
|
||||
p->eh_info.match_function = __cplus_type_matcher;
|
||||
p->eh_info.language = EH_LANG_C_plus_plus;
|
||||
p->eh_info.version = 1;
|
||||
|
||||
cp_eh_info **q = __get_eh_info ();
|
||||
|
||||
p->next = *q;
|
||||
*q = p;
|
||||
}
|
||||
|
||||
/* Compiler hook to pop an exception that has been finalized. Used by
|
||||
push_eh_cleanup(). P is the info for the exception caught by the
|
||||
current catch block. */
|
||||
|
||||
extern "C" void
|
||||
__cp_pop_exception (cp_eh_info *p)
|
||||
{
|
||||
cp_eh_info **stack = __get_eh_info ();
|
||||
cp_eh_info **q = stack;
|
||||
|
||||
--p->handlers;
|
||||
|
||||
/* Do nothing if our exception is being rethrown (i.e. if the active
|
||||
exception is our exception and it is uncaught). */
|
||||
if (p == *q && !p->caught)
|
||||
return;
|
||||
|
||||
/* Don't really pop if there are still active handlers for our exception;
|
||||
rather, push it down past any uncaught exceptions. */
|
||||
if (p->handlers != 0)
|
||||
{
|
||||
if (p == *q && p->next && !p->next->caught)
|
||||
{
|
||||
q = &(p->next);
|
||||
while (1)
|
||||
{
|
||||
if (*q == 0 || (*q)->caught)
|
||||
break;
|
||||
|
||||
q = &((*q)->next);
|
||||
}
|
||||
*stack = p->next;
|
||||
p->next = *q;
|
||||
*q = p;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (; *q; q = &((*q)->next))
|
||||
if (*q == p)
|
||||
break;
|
||||
|
||||
if (! *q)
|
||||
terminate ();
|
||||
|
||||
*q = p->next;
|
||||
|
||||
if (p->cleanup)
|
||||
// value may have been adjusted.
|
||||
CALL_CLEANUP (p->cleanup, p->original_value);
|
||||
|
||||
if (! __is_pointer (p->type))
|
||||
__eh_free (p->original_value); // value may have been adjusted.
|
||||
|
||||
__eh_free (p);
|
||||
}
|
||||
|
||||
/* We're doing a rethrow. Find the currently handled exception, mark it
|
||||
uncaught, and move it to the top of the EH stack. */
|
||||
|
||||
extern "C" void
|
||||
__uncatch_exception (void)
|
||||
{
|
||||
cp_eh_info **stack = __get_eh_info ();
|
||||
cp_eh_info **q = stack;
|
||||
cp_eh_info *p;
|
||||
|
||||
while (1)
|
||||
{
|
||||
p = *q;
|
||||
|
||||
if (p == 0)
|
||||
terminate ();
|
||||
if (p->caught)
|
||||
break;
|
||||
|
||||
q = &(p->next);
|
||||
}
|
||||
|
||||
if (q != stack)
|
||||
{
|
||||
*q = p->next;
|
||||
p->next = *stack;
|
||||
*stack = p;
|
||||
}
|
||||
|
||||
p->caught = false;
|
||||
}
|
||||
|
||||
/* As per [except.unexpected]:
|
||||
If an exception is thrown, we check it against the spec. If it doesn't
|
||||
match, we call unexpected (). If unexpected () throws, we check that
|
||||
exception against the spec. If it doesn't match, if the spec allows
|
||||
bad_exception we throw that; otherwise we call terminate ().
|
||||
|
||||
The compiler treats an exception spec as a try block with a generic
|
||||
handler that just calls this function with a list of the allowed
|
||||
exception types, so we have an active exception that can be rethrown.
|
||||
|
||||
This function does not return. */
|
||||
|
||||
extern "C" void
|
||||
__check_eh_spec (int n, const void **spec)
|
||||
{
|
||||
cp_eh_info *p = CP_EH_INFO;
|
||||
void *d;
|
||||
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
if (__throw_type_match_rtti_2 (spec[i], p->type, p->value, &d))
|
||||
throw;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
std::unexpected ();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// __exception_info is an artificial var pushed into each catch block.
|
||||
if (p != __exception_info)
|
||||
{
|
||||
p = __exception_info;
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
if (__throw_type_match_rtti_2 (spec[i], p->type, p->value, &d))
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
const std::type_info &bad_exc = typeid (std::bad_exception);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
if (__throw_type_match_rtti_2 (spec[i], &bad_exc, p->value, &d))
|
||||
throw std::bad_exception ();
|
||||
}
|
||||
|
||||
terminate ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Special case of the above for throw() specs. */
|
||||
|
||||
extern "C" void
|
||||
__check_null_eh_spec (void)
|
||||
{
|
||||
__check_eh_spec (0, 0);
|
||||
}
|
||||
|
||||
// Helpers for rtti. Although these don't return, we give them return types so
|
||||
// that the type system is not broken.
|
||||
|
||||
extern "C" void *
|
||||
__throw_bad_cast ()
|
||||
{
|
||||
throw std::bad_cast ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" std::type_info const &
|
||||
__throw_bad_typeid ()
|
||||
{
|
||||
throw std::bad_typeid ();
|
||||
return typeid (void);
|
||||
}
|
||||
|
||||
/* Has the current exception been caught? */
|
||||
|
||||
bool
|
||||
std::uncaught_exception ()
|
||||
{
|
||||
cp_eh_info *p = CP_EH_INFO;
|
||||
return p && ! p->caught;
|
||||
}
|
||||
|
||||
const char * std::exception::
|
||||
what () const
|
||||
{
|
||||
return typeid (*this).name ();
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __FSTREAM__
|
||||
#define __FSTREAM__
|
||||
#include <fstream.h>
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __IOMANIP__
|
||||
#define __IOMANIP__
|
||||
#include <iomanip.h>
|
||||
#endif
|
@ -1,15 +0,0 @@
|
||||
// -*- C++ -*- I/O forward declaration header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __IOSFWD__
|
||||
#define __IOSFWD__
|
||||
class ios;
|
||||
class streambuf;
|
||||
class istream;
|
||||
class ostream;
|
||||
class iostream;
|
||||
class filebuf;
|
||||
class ifstream;
|
||||
class ofstream;
|
||||
class fstream;
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifndef __IOSTREAM__
|
||||
#define __IOSTREAM__
|
||||
#include <iostream.h>
|
||||
#endif
|
@ -1,68 +0,0 @@
|
||||
// The -*- C++ -*- dynamic memory management header.
|
||||
// Copyright (C) 1994, 1996, 1997, 1998, 2000 Free Software Foundation
|
||||
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#ifndef __NEW__
|
||||
#define __NEW__
|
||||
|
||||
#pragma interface "new"
|
||||
#include <stddef.h>
|
||||
#include <exception>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
namespace std {
|
||||
|
||||
class bad_alloc : public exception {
|
||||
public:
|
||||
virtual const char* what() const throw() { return "bad_alloc"; }
|
||||
};
|
||||
|
||||
struct nothrow_t {};
|
||||
extern const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
new_handler set_new_handler (new_handler);
|
||||
|
||||
} // namespace std
|
||||
|
||||
// replaceable signatures
|
||||
void *operator new (size_t) throw (std::bad_alloc);
|
||||
void *operator new[] (size_t) throw (std::bad_alloc);
|
||||
void operator delete (void *) throw();
|
||||
void operator delete[] (void *) throw();
|
||||
void *operator new (size_t, const std::nothrow_t&) throw();
|
||||
void *operator new[] (size_t, const std::nothrow_t&) throw();
|
||||
void operator delete (void *, const std::nothrow_t&) throw();
|
||||
void operator delete[] (void *, const std::nothrow_t&) throw();
|
||||
|
||||
// default placement versions of operator new
|
||||
inline void *operator new(size_t, void *place) throw() { return place; }
|
||||
inline void *operator new[](size_t, void *place) throw() { return place; }
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,38 +0,0 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
// Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#ifndef __NEW_H__
|
||||
#define __NEW_H__
|
||||
|
||||
#include <new>
|
||||
|
||||
using std::new_handler;
|
||||
using std::set_new_handler;
|
||||
|
||||
#endif // __NEW_H__
|
@ -1,44 +0,0 @@
|
||||
// Implementation file for the -*- C++ -*- dynamic memory management header.
|
||||
// Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#pragma implementation "new"
|
||||
#include "new"
|
||||
|
||||
const std::nothrow_t std::nothrow = { };
|
||||
|
||||
using std::new_handler;
|
||||
new_handler __new_handler;
|
||||
|
||||
new_handler
|
||||
std::set_new_handler (new_handler handler)
|
||||
{
|
||||
new_handler prev_handler = __new_handler;
|
||||
__new_handler = handler;
|
||||
return prev_handler;
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
// Support routines for the -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
using std::new_handler;
|
||||
using std::bad_alloc;
|
||||
|
||||
extern "C" void *malloc (size_t);
|
||||
extern new_handler __new_handler;
|
||||
|
||||
void *
|
||||
operator new (size_t sz) throw (std::bad_alloc)
|
||||
{
|
||||
void *p;
|
||||
|
||||
/* malloc (0) is unpredictable; avoid it. */
|
||||
if (sz == 0)
|
||||
sz = 1;
|
||||
p = (void *) malloc (sz);
|
||||
while (p == 0)
|
||||
{
|
||||
new_handler handler = __new_handler;
|
||||
if (! handler)
|
||||
throw bad_alloc ();
|
||||
handler ();
|
||||
p = (void *) malloc (sz);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
// Support routines for the -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
using std::new_handler;
|
||||
using std::bad_alloc;
|
||||
|
||||
extern "C" void *malloc (size_t);
|
||||
extern new_handler __new_handler;
|
||||
|
||||
void *
|
||||
operator new (size_t sz, const std::nothrow_t&) throw()
|
||||
{
|
||||
void *p;
|
||||
|
||||
/* malloc (0) is unpredictable; avoid it. */
|
||||
if (sz == 0)
|
||||
sz = 1;
|
||||
p = (void *) malloc (sz);
|
||||
while (p == 0)
|
||||
{
|
||||
new_handler handler = __new_handler;
|
||||
if (! handler)
|
||||
return 0;
|
||||
try
|
||||
{
|
||||
handler ();
|
||||
}
|
||||
catch (bad_alloc &)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
p = (void *) malloc (sz);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Boilerplate support routines for -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
|
||||
void *
|
||||
operator new[] (size_t sz) throw (std::bad_alloc)
|
||||
{
|
||||
return ::operator new(sz);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Boilerplate support routines for -*- C++ -*- dynamic memory management.
|
||||
// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
||||
//
|
||||
// This file is part of GNU CC.
|
||||
//
|
||||
// GNU CC is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// GNU CC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with GNU CC; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
#include "new"
|
||||
|
||||
void *
|
||||
operator new[] (size_t sz, const std::nothrow_t& nothrow) throw()
|
||||
{
|
||||
return ::operator new(sz, nothrow);
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* Avoid forcing the library's meaning of `write' on the user program
|
||||
by using the "internal" name (for use within the library) */
|
||||
#define write(fd, buf, n) __write((fd), (buf), (n))
|
||||
#endif
|
||||
|
||||
#define MESSAGE "pure virtual method called\n"
|
||||
|
||||
void
|
||||
__pure_virtual (void)
|
||||
{
|
||||
write (2, MESSAGE, sizeof (MESSAGE) - 1);
|
||||
__terminate ();
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
// Instantiation file for the -*- C++ -*- string classes.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification by Takanori Adachi
|
||||
// in ANSI X3J16/94-0013R2.
|
||||
|
||||
#ifdef __GNUG__
|
||||
#ifdef TRAITS
|
||||
#ifdef C
|
||||
#pragma implementation "std/straits.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef C
|
||||
typedef char c;
|
||||
#endif
|
||||
#ifdef W
|
||||
typedef wchar_t c;
|
||||
#endif
|
||||
|
||||
#if defined(TRAITS) && !defined(C)
|
||||
template class string_char_traits <c>;
|
||||
#else
|
||||
/* string_char_traits<char> is already explicitly specialized in
|
||||
std/straits.h. */
|
||||
#endif
|
||||
|
||||
typedef basic_string <c> s;
|
||||
|
||||
#ifdef MAIN
|
||||
template class basic_string <c>;
|
||||
#endif
|
||||
|
||||
#ifdef ADDSS
|
||||
template s operator+ (const s&, const s&);
|
||||
#endif
|
||||
#ifdef ADDPS
|
||||
template s operator+ (const c*, const s&);
|
||||
#endif
|
||||
#ifdef ADDCS
|
||||
template s operator+ (c, const s&);
|
||||
#endif
|
||||
#ifdef ADDSP
|
||||
template s operator+ (const s&, const c*);
|
||||
#endif
|
||||
#ifdef ADDSC
|
||||
template s operator+ (const s&, c);
|
||||
#endif
|
||||
#ifdef EQSS
|
||||
template bool operator== (const s&, const s&);
|
||||
#endif
|
||||
#ifdef EQPS
|
||||
template bool operator== (const c*, const s&);
|
||||
#endif
|
||||
#ifdef EQSP
|
||||
template bool operator== (const s&, const c*);
|
||||
#endif
|
||||
#ifdef NESS
|
||||
template bool operator!= (const s&, const s&);
|
||||
#endif
|
||||
#ifdef NEPS
|
||||
template bool operator!= (const c*, const s&);
|
||||
#endif
|
||||
#ifdef NESP
|
||||
template bool operator!= (const s&, const c*);
|
||||
#endif
|
||||
#ifdef LTSS
|
||||
template bool operator< (const s&, const s&);
|
||||
#endif
|
||||
#ifdef LTPS
|
||||
template bool operator< (const c*, const s&);
|
||||
#endif
|
||||
#ifdef LTSP
|
||||
template bool operator< (const s&, const c*);
|
||||
#endif
|
||||
#ifdef GTSS
|
||||
template bool operator> (const s&, const s&);
|
||||
#endif
|
||||
#ifdef GTPS
|
||||
template bool operator> (const c*, const s&);
|
||||
#endif
|
||||
#ifdef GTSP
|
||||
template bool operator> (const s&, const c*);
|
||||
#endif
|
||||
#ifdef LESS
|
||||
template bool operator<= (const s&, const s&);
|
||||
#endif
|
||||
#ifdef LEPS
|
||||
template bool operator<= (const c*, const s&);
|
||||
#endif
|
||||
#ifdef LESP
|
||||
template bool operator<= (const s&, const c*);
|
||||
#endif
|
||||
#ifdef GESS
|
||||
template bool operator>= (const s&, const s&);
|
||||
#endif
|
||||
#ifdef GEPS
|
||||
template bool operator>= (const c*, const s&);
|
||||
#endif
|
||||
#ifdef GESP
|
||||
template bool operator>= (const s&, const c*);
|
||||
#endif
|
||||
#ifdef EXTRACT
|
||||
template istream& operator>> (istream&, s&);
|
||||
#endif // EXTRACT
|
||||
#ifdef INSERT
|
||||
template ostream& operator<< (ostream&, const s&);
|
||||
#endif // INSERT
|
||||
#ifdef GETLINE
|
||||
template istream& getline (istream&, s&, c);
|
||||
#endif
|
@ -1,343 +0,0 @@
|
||||
/* This is part of libio/iostream, providing -*- C++ -*- input/output.
|
||||
Copyright (C) 2000 Free Software Foundation
|
||||
|
||||
This file is part of the GNU IO 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, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does not 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 Magnus Fromreide (magfr@lysator.liu.se). */
|
||||
/* seekoff and ideas for overflow is largely borrowed from libstdc++-v3 */
|
||||
|
||||
#ifndef __SSTREAM__
|
||||
#define __SSTREAM__
|
||||
|
||||
#include <iostream.h>
|
||||
#include <streambuf.h>
|
||||
#include <string>
|
||||
|
||||
namespace std
|
||||
{
|
||||
class stringbuf : public streambuf
|
||||
{
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef int int_type;
|
||||
typedef streampos pos_type;
|
||||
typedef streamoff off_type;
|
||||
|
||||
explicit
|
||||
stringbuf(int which=ios::in|ios::out)
|
||||
: streambuf(), mode(static_cast<ios::open_mode>(which)),
|
||||
stream(NULL), stream_len(0)
|
||||
{
|
||||
stringbuf_init();
|
||||
}
|
||||
|
||||
explicit
|
||||
stringbuf(const string &str, int which=ios::in|ios::out)
|
||||
: streambuf(), mode(static_cast<ios::open_mode>(which)),
|
||||
stream(NULL), stream_len(0)
|
||||
{
|
||||
if (mode & (ios::in|ios::out))
|
||||
{
|
||||
stream_len = str.size();
|
||||
stream = new char_type[stream_len];
|
||||
str.copy(stream, stream_len);
|
||||
}
|
||||
stringbuf_init();
|
||||
}
|
||||
|
||||
virtual
|
||||
~stringbuf()
|
||||
{
|
||||
delete[] stream;
|
||||
}
|
||||
|
||||
string
|
||||
str() const
|
||||
{
|
||||
if (pbase() != 0)
|
||||
return string(stream, pptr()-pbase());
|
||||
else
|
||||
return string();
|
||||
}
|
||||
|
||||
void
|
||||
str(const string& str)
|
||||
{
|
||||
delete[] stream;
|
||||
stream_len = str.size();
|
||||
stream = new char_type[stream_len];
|
||||
str.copy(stream, stream_len);
|
||||
stringbuf_init();
|
||||
}
|
||||
|
||||
protected:
|
||||
// The buffer is already in gptr, so if it ends then it is out of data.
|
||||
virtual int
|
||||
underflow()
|
||||
{
|
||||
return EOF;
|
||||
}
|
||||
|
||||
virtual int
|
||||
overflow(int c = EOF)
|
||||
{
|
||||
int res;
|
||||
if (mode & ios::out)
|
||||
{
|
||||
if (c != EOF)
|
||||
{
|
||||
streamsize old_stream_len = stream_len;
|
||||
stream_len += 1;
|
||||
char_type* new_stream = new char_type[stream_len];
|
||||
memcpy(new_stream, stream, old_stream_len);
|
||||
delete[] stream;
|
||||
stream = new_stream;
|
||||
stringbuf_sync(gptr()-eback(), pptr()-pbase());
|
||||
sputc(c);
|
||||
res = c;
|
||||
}
|
||||
else
|
||||
res = EOF;
|
||||
}
|
||||
else
|
||||
res = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
virtual streambuf*
|
||||
setbuf(char_type* s, streamsize n)
|
||||
{
|
||||
if (n != 0)
|
||||
{
|
||||
delete[] stream;
|
||||
stream = new char_type[n];
|
||||
memcpy(stream, s, n);
|
||||
stream_len = n;
|
||||
stringbuf_sync(0, 0);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
virtual pos_type
|
||||
seekoff(off_type off, ios::seek_dir way, int which = ios::in | ios::out)
|
||||
{
|
||||
pos_type ret = pos_type(off_type(-1));
|
||||
bool testin = which & ios::in && mode & ios::in;
|
||||
bool testout = which & ios::out && mode & ios::out;
|
||||
bool testboth = testin && testout && way != ios::cur;
|
||||
|
||||
if (stream_len && ((testin != testout) || testboth))
|
||||
{
|
||||
char_type* beg = stream;
|
||||
char_type* curi = NULL;
|
||||
char_type* curo = NULL;
|
||||
char_type* endi = NULL;
|
||||
char_type* endo = NULL;
|
||||
|
||||
if (testin)
|
||||
{
|
||||
curi = gptr();
|
||||
endi = egptr();
|
||||
}
|
||||
if (testout)
|
||||
{
|
||||
curo = pptr();
|
||||
endo = epptr();
|
||||
}
|
||||
|
||||
off_type newoffi = 0;
|
||||
off_type newoffo = 0;
|
||||
if (way == ios::beg)
|
||||
{
|
||||
newoffi = beg - curi;
|
||||
newoffo = beg - curo;
|
||||
}
|
||||
else if (way == ios::end)
|
||||
{
|
||||
newoffi = endi - curi;
|
||||
newoffo = endo - curo;
|
||||
}
|
||||
|
||||
if (testin && newoffi + off + curi - beg >= 0 &&
|
||||
endi - beg >= newoffi + off + curi - beg)
|
||||
{
|
||||
gbump(newoffi + off);
|
||||
ret = pos_type(newoffi + off + curi);
|
||||
}
|
||||
if (testout && newoffo + off + curo - beg >= 0 &&
|
||||
endo - beg >= newoffo + off + curo - beg)
|
||||
{
|
||||
pbump(newoffo + off);
|
||||
ret = pos_type(newoffo + off + curo);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual pos_type
|
||||
seekpos(pos_type sp, int which = ios::in | ios::out)
|
||||
{
|
||||
pos_type ret = seekoff(sp, ios::beg, which);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
void
|
||||
stringbuf_sync(streamsize i, streamsize o)
|
||||
{
|
||||
if (mode & ios::in)
|
||||
setg(stream, stream + i, stream + stream_len);
|
||||
if (mode & ios::out)
|
||||
{
|
||||
setp(stream, stream + stream_len);
|
||||
pbump(o);
|
||||
}
|
||||
}
|
||||
void
|
||||
stringbuf_init()
|
||||
{
|
||||
if (mode & ios::ate)
|
||||
stringbuf_sync(0, stream_len);
|
||||
else
|
||||
stringbuf_sync(0, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
ios::open_mode mode;
|
||||
char_type* stream;
|
||||
streamsize stream_len;
|
||||
};
|
||||
|
||||
class istringstream : public istream {
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef int int_type;
|
||||
typedef streampos pos_type;
|
||||
typedef streamoff off_type;
|
||||
|
||||
explicit
|
||||
istringstream(int which=ios::in)
|
||||
: istream(&sb), sb(which | ios::in)
|
||||
{ }
|
||||
|
||||
explicit
|
||||
istringstream(const string& str, int which=ios::in)
|
||||
: istream(&sb), sb(str, which | ios::in)
|
||||
{ }
|
||||
|
||||
stringbuf*
|
||||
rdbuf() const
|
||||
{
|
||||
return const_cast<stringbuf*>(&sb);
|
||||
}
|
||||
|
||||
string
|
||||
str() const
|
||||
{
|
||||
return rdbuf()->str();
|
||||
}
|
||||
void
|
||||
str(const string& s)
|
||||
{
|
||||
rdbuf()->str(s);
|
||||
}
|
||||
private:
|
||||
stringbuf sb;
|
||||
};
|
||||
|
||||
class ostringstream : public ostream {
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef int int_type;
|
||||
typedef streampos pos_type;
|
||||
typedef streamoff off_type;
|
||||
|
||||
explicit
|
||||
ostringstream(int which=ios::out)
|
||||
: ostream(&sb), sb(which | ios::out)
|
||||
{ }
|
||||
|
||||
explicit
|
||||
ostringstream(const string& str, int which=ios::out)
|
||||
: ostream(&sb), sb(str, which | ios::out)
|
||||
{ }
|
||||
|
||||
stringbuf*
|
||||
rdbuf() const
|
||||
{
|
||||
return const_cast<stringbuf*>(&sb);
|
||||
}
|
||||
|
||||
string
|
||||
str() const
|
||||
{
|
||||
return rdbuf()->str();
|
||||
}
|
||||
|
||||
void str(const string& s)
|
||||
{
|
||||
rdbuf()->str(s);
|
||||
}
|
||||
private:
|
||||
stringbuf sb;
|
||||
};
|
||||
|
||||
class stringstream : public iostream {
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef int int_type;
|
||||
typedef streampos pos_type;
|
||||
typedef streamoff off_type;
|
||||
|
||||
explicit
|
||||
stringstream(int which=ios::out|ios::in)
|
||||
: iostream(&sb), sb(which)
|
||||
{ }
|
||||
|
||||
explicit
|
||||
stringstream(const string& str, int which=ios::out|ios::in)
|
||||
: iostream(&sb), sb(str, which)
|
||||
{ }
|
||||
|
||||
stringbuf*
|
||||
rdbuf() const
|
||||
{
|
||||
return const_cast<stringbuf*>(&sb);
|
||||
}
|
||||
|
||||
string
|
||||
str() const
|
||||
{
|
||||
return rdbuf()->str();
|
||||
}
|
||||
|
||||
void
|
||||
str(const string& s)
|
||||
{
|
||||
rdbuf()->str(s);
|
||||
}
|
||||
private:
|
||||
stringbuf sb;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* not __STRSTREAM__ */
|
@ -1,526 +0,0 @@
|
||||
// Member templates for the -*- C++ -*- string classes.
|
||||
// Copyright (C) 1994, 1999, 2000 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification by Takanori Adachi
|
||||
// in ANSI X3J16/94-0013R2.
|
||||
|
||||
extern "C++" {
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline void * basic_string <charT, traits, Allocator>::Rep::
|
||||
operator new (size_t s, size_t extra)
|
||||
{
|
||||
return Allocator::allocate(s + extra * sizeof (charT));
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline void basic_string <charT, traits, Allocator>::Rep::
|
||||
operator delete (void * ptr)
|
||||
{
|
||||
Allocator::deallocate(ptr, sizeof(Rep) +
|
||||
reinterpret_cast<Rep *>(ptr)->res *
|
||||
sizeof (charT));
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline size_t basic_string <charT, traits, Allocator>::Rep::
|
||||
frob_size (size_t s)
|
||||
{
|
||||
size_t i = 16;
|
||||
while (i < s) i *= 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline basic_string <charT, traits, Allocator>::Rep *
|
||||
basic_string <charT, traits, Allocator>::Rep::
|
||||
create (size_t extra)
|
||||
{
|
||||
extra = frob_size (extra + 1);
|
||||
Rep *p = new (extra) Rep;
|
||||
p->res = extra;
|
||||
p->ref = 1;
|
||||
p->selfish = false;
|
||||
return p;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
charT * basic_string <charT, traits, Allocator>::Rep::
|
||||
clone ()
|
||||
{
|
||||
Rep *p = Rep::create (len);
|
||||
p->copy (0, data (), len);
|
||||
p->len = len;
|
||||
return p->data ();
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool basic_string <charT, traits, Allocator>::Rep::
|
||||
excess_slop (size_t s, size_t r)
|
||||
{
|
||||
return 2 * (s <= 16 ? 16 : s) < r;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool basic_string <charT, traits, Allocator>::
|
||||
check_realloc (basic_string::size_type s) const
|
||||
{
|
||||
s += sizeof (charT);
|
||||
rep ()->selfish = false;
|
||||
return (rep ()->ref > 1
|
||||
|| s > capacity ()
|
||||
|| Rep::excess_slop (s, capacity ()));
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
void basic_string <charT, traits, Allocator>::
|
||||
alloc (basic_string::size_type __size, bool __save)
|
||||
{
|
||||
if (! check_realloc (__size))
|
||||
return;
|
||||
|
||||
Rep *p = Rep::create (__size);
|
||||
|
||||
if (__save)
|
||||
{
|
||||
p->copy (0, data (), length ());
|
||||
p->len = length ();
|
||||
}
|
||||
else
|
||||
p->len = 0;
|
||||
|
||||
repup (p);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>&
|
||||
basic_string <charT, traits, Allocator>::
|
||||
replace (size_type pos1, size_type n1,
|
||||
const basic_string& str, size_type pos2, size_type n2)
|
||||
{
|
||||
const size_t len2 = str.length ();
|
||||
|
||||
if (pos1 == 0 && n1 >= length () && pos2 == 0 && n2 >= len2)
|
||||
return operator= (str);
|
||||
|
||||
OUTOFRANGE (pos2 > len2);
|
||||
|
||||
if (n2 > len2 - pos2)
|
||||
n2 = len2 - pos2;
|
||||
|
||||
return replace (pos1, n1, str.data () + pos2, n2);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline void basic_string <charT, traits, Allocator>::Rep::
|
||||
copy (size_t pos, const charT *s, size_t n)
|
||||
{
|
||||
if (n)
|
||||
traits::copy (data () + pos, s, n);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline void basic_string <charT, traits, Allocator>::Rep::
|
||||
move (size_t pos, const charT *s, size_t n)
|
||||
{
|
||||
if (n)
|
||||
traits::move (data () + pos, s, n);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>&
|
||||
basic_string <charT, traits, Allocator>::
|
||||
replace (size_type pos, size_type n1, const charT* s, size_type n2)
|
||||
{
|
||||
const size_type len = length ();
|
||||
OUTOFRANGE (pos > len);
|
||||
if (n1 > len - pos)
|
||||
n1 = len - pos;
|
||||
LENGTHERROR (len - n1 > max_size () - n2);
|
||||
size_t newlen = len - n1 + n2;
|
||||
|
||||
if (check_realloc (newlen))
|
||||
{
|
||||
Rep *p = Rep::create (newlen);
|
||||
p->copy (0, data (), pos);
|
||||
p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
|
||||
p->copy (pos, s, n2);
|
||||
repup (p);
|
||||
}
|
||||
else
|
||||
{
|
||||
rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
|
||||
rep ()->copy (pos, s, n2);
|
||||
}
|
||||
rep ()->len = newlen;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline void basic_string <charT, traits, Allocator>::Rep::
|
||||
set (size_t pos, const charT c, size_t n)
|
||||
{
|
||||
traits::set (data () + pos, c, n);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
|
||||
replace (size_type pos, size_type n1, size_type n2, charT c)
|
||||
{
|
||||
const size_t len = length ();
|
||||
OUTOFRANGE (pos > len);
|
||||
if (n1 > len - pos)
|
||||
n1 = len - pos;
|
||||
LENGTHERROR (len - n1 > max_size () - n2);
|
||||
size_t newlen = len - n1 + n2;
|
||||
|
||||
if (check_realloc (newlen))
|
||||
{
|
||||
Rep *p = Rep::create (newlen);
|
||||
p->copy (0, data (), pos);
|
||||
p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
|
||||
p->set (pos, c, n2);
|
||||
repup (p);
|
||||
}
|
||||
else
|
||||
{
|
||||
rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
|
||||
rep ()->set (pos, c, n2);
|
||||
}
|
||||
rep ()->len = newlen;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
void basic_string <charT, traits, Allocator>::
|
||||
resize (size_type n, charT c)
|
||||
{
|
||||
LENGTHERROR (n > max_size ());
|
||||
|
||||
if (n > length ())
|
||||
append (n - length (), c);
|
||||
else
|
||||
erase (n);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
copy (charT* s, size_type n, size_type pos) const
|
||||
{
|
||||
OUTOFRANGE (pos > length ());
|
||||
|
||||
if (n > length () - pos)
|
||||
n = length () - pos;
|
||||
|
||||
traits::copy (s, data () + pos, n);
|
||||
return n;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find (const charT* s, size_type pos, size_type n) const
|
||||
{
|
||||
size_t xpos = pos;
|
||||
for (; xpos + n <= length (); ++xpos)
|
||||
if (traits::eq (data () [xpos], *s)
|
||||
&& traits::compare (data () + xpos, s, n) == 0)
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
_find (const charT* ptr, charT c, size_type xpos, size_type len)
|
||||
{
|
||||
for (; xpos < len; ++xpos)
|
||||
if (traits::eq (ptr [xpos], c))
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find (charT c, size_type pos) const
|
||||
{
|
||||
return _find (data (), c, pos, length ());
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
rfind (const charT* s, size_type pos, size_type n) const
|
||||
{
|
||||
if (n > length ())
|
||||
return npos;
|
||||
|
||||
size_t xpos = length () - n;
|
||||
if (xpos > pos)
|
||||
xpos = pos;
|
||||
|
||||
for (++xpos; xpos-- > 0; )
|
||||
if (traits::eq (data () [xpos], *s)
|
||||
&& traits::compare (data () + xpos, s, n) == 0)
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
rfind (charT c, size_type pos) const
|
||||
{
|
||||
if (1 > length ())
|
||||
return npos;
|
||||
|
||||
size_t xpos = length () - 1;
|
||||
if (xpos > pos)
|
||||
xpos = pos;
|
||||
|
||||
for (++xpos; xpos-- > 0; )
|
||||
if (traits::eq (data () [xpos], c))
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find_first_of (const charT* s, size_type pos, size_type n) const
|
||||
{
|
||||
size_t xpos = pos;
|
||||
for (; xpos < length (); ++xpos)
|
||||
if (_find (s, data () [xpos], 0, n) != npos)
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find_last_of (const charT* s, size_type pos, size_type n) const
|
||||
{
|
||||
if (length() == 0)
|
||||
return npos;
|
||||
size_t xpos = length () - 1;
|
||||
if (xpos > pos)
|
||||
xpos = pos;
|
||||
for (++xpos; xpos-- > 0;)
|
||||
if (_find (s, data () [xpos], 0, n) != npos)
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find_first_not_of (const charT* s, size_type pos, size_type n) const
|
||||
{
|
||||
size_t xpos = pos;
|
||||
for (; xpos < length (); ++xpos)
|
||||
if (_find (s, data () [xpos], 0, n) == npos)
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find_first_not_of (charT c, size_type pos) const
|
||||
{
|
||||
size_t xpos = pos;
|
||||
for (; xpos < length (); ++xpos)
|
||||
if (traits::ne (data () [xpos], c))
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find_last_not_of (const charT* s, size_type pos, size_type n) const
|
||||
{
|
||||
if (length() == 0)
|
||||
return npos;
|
||||
size_t xpos = length () - 1;
|
||||
if (xpos > pos)
|
||||
xpos = pos;
|
||||
for (++xpos; xpos-- > 0;)
|
||||
if (_find (s, data () [xpos], 0, n) == npos)
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::
|
||||
find_last_not_of (charT c, size_type pos) const
|
||||
{
|
||||
if (length() == 0)
|
||||
return npos;
|
||||
size_t xpos = length () - 1;
|
||||
if (xpos > pos)
|
||||
xpos = pos;
|
||||
for (++xpos; xpos-- > 0;)
|
||||
if (traits::ne (data () [xpos], c))
|
||||
return xpos;
|
||||
return npos;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
int basic_string <charT, traits, Allocator>::
|
||||
compare (const basic_string& str, size_type pos, size_type n) const
|
||||
{
|
||||
OUTOFRANGE (pos > length ());
|
||||
|
||||
size_t rlen = length () - pos;
|
||||
if (rlen > n)
|
||||
rlen = n;
|
||||
if (rlen > str.length ())
|
||||
rlen = str.length ();
|
||||
int r = traits::compare (data () + pos, str.data (), rlen);
|
||||
if (r != 0)
|
||||
return r;
|
||||
if (rlen == n)
|
||||
return 0;
|
||||
return (length () - pos) - str.length ();
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
int basic_string <charT, traits, Allocator>::
|
||||
compare (const charT* s, size_type pos, size_type n) const
|
||||
{
|
||||
OUTOFRANGE (pos > length ());
|
||||
|
||||
size_t rlen = length () - pos;
|
||||
if (rlen > n)
|
||||
rlen = n;
|
||||
int r = traits::compare (data () + pos, s, rlen);
|
||||
if (r != 0)
|
||||
return r;
|
||||
if (rlen == n)
|
||||
return 0;
|
||||
return (length () - pos) - n;
|
||||
}
|
||||
|
||||
#include <iostream.h>
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
istream &
|
||||
operator>> (istream &is, basic_string <charT, traits, Allocator> &s)
|
||||
{
|
||||
int w = is.width (0);
|
||||
if (is.ipfx0 ())
|
||||
{
|
||||
register streambuf *sb = is.rdbuf ();
|
||||
s.resize (0);
|
||||
while (1)
|
||||
{
|
||||
int ch = sb->sbumpc ();
|
||||
if (ch == EOF)
|
||||
{
|
||||
is.setstate (ios::eofbit);
|
||||
break;
|
||||
}
|
||||
else if (traits::is_del (ch))
|
||||
{
|
||||
sb->sungetc ();
|
||||
break;
|
||||
}
|
||||
s += static_cast<charT> (ch);
|
||||
if (--w == 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
is.isfx ();
|
||||
if (s.length () == 0)
|
||||
is.setstate (ios::failbit);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
ostream &
|
||||
operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
|
||||
{
|
||||
return o.write (s.data (), s.length ());
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
istream&
|
||||
getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim)
|
||||
{
|
||||
if (is.ipfx1 ())
|
||||
{
|
||||
_IO_size_t count = 0;
|
||||
streambuf *sb = is.rdbuf ();
|
||||
s.resize (0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int ch = sb->sbumpc ();
|
||||
if (ch == EOF)
|
||||
{
|
||||
is.setstate (count == 0
|
||||
? (ios::failbit|ios::eofbit)
|
||||
: ios::eofbit);
|
||||
break;
|
||||
}
|
||||
|
||||
++count;
|
||||
|
||||
if (ch == delim)
|
||||
break;
|
||||
|
||||
s += static_cast<charT> (ch);
|
||||
|
||||
if (s.length () == s.npos - 1)
|
||||
{
|
||||
is.setstate (ios::failbit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We need to be friends with istream to do this.
|
||||
// is._gcount = count;
|
||||
is.isfx ();
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>::Rep
|
||||
basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1, false };
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
const basic_string <charT, traits, Allocator>::size_type
|
||||
basic_string <charT, traits, Allocator>::npos;
|
||||
|
||||
} // extern "C++"
|
@ -1,671 +0,0 @@
|
||||
// Main templates for the -*- C++ -*- string classes.
|
||||
// Copyright (C) 1994, 1995, 1999 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification by Takanori Adachi
|
||||
// in ANSI X3J16/94-0013R2.
|
||||
|
||||
#ifndef __BASTRING__
|
||||
#define __BASTRING__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <std/straits.h>
|
||||
|
||||
// NOTE : This does NOT conform to the draft standard and is likely to change
|
||||
#include <alloc.h>
|
||||
|
||||
extern "C++" {
|
||||
class istream; class ostream;
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#ifdef __STL_USE_EXCEPTIONS
|
||||
|
||||
extern void __out_of_range (const char *);
|
||||
extern void __length_error (const char *);
|
||||
|
||||
#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 <cassert>
|
||||
#define OUTOFRANGE(cond) assert (!(cond))
|
||||
#define LENGTHERROR(cond) assert (!(cond))
|
||||
|
||||
#endif
|
||||
|
||||
template <class charT, class traits = string_char_traits<charT>,
|
||||
class Allocator = alloc >
|
||||
class basic_string
|
||||
{
|
||||
private:
|
||||
struct Rep {
|
||||
size_t len, res, ref;
|
||||
bool selfish;
|
||||
|
||||
charT* data () { return reinterpret_cast<charT *>(this + 1); }
|
||||
charT& operator[] (size_t s) { return data () [s]; }
|
||||
#if defined __i486__ || defined __i586__ || defined __i686__
|
||||
charT* grab () { if (selfish) return clone ();
|
||||
asm ("lock; addl %0, (%1)"
|
||||
: : "a" (1), "d" (&ref)
|
||||
: "memory");
|
||||
return data (); }
|
||||
|
||||
void release ()
|
||||
{
|
||||
size_t __val;
|
||||
// This opcode exists as a .byte instead of as a mnemonic for the
|
||||
// benefit of SCO OpenServer 5. The system assembler (which is
|
||||
// essentially required on this target) can't assemble xaddl in
|
||||
//COFF mode.
|
||||
asm (".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx)
|
||||
: "=a" (__val)
|
||||
: "0" (-1), "m" (ref), "d" (&ref)
|
||||
: "memory");
|
||||
|
||||
if (__val == 1)
|
||||
delete this;
|
||||
}
|
||||
#elif defined __sparc_v9__
|
||||
charT* grab () { if (selfish) return clone (); ++ref; return data (); }
|
||||
void release ()
|
||||
{
|
||||
size_t __newval, __oldval = ref;
|
||||
do
|
||||
{
|
||||
__newval = __oldval - 1;
|
||||
__asm__ (
|
||||
#ifdef __arch64__
|
||||
"casx [%4], %2, %0"
|
||||
#else
|
||||
"cas [%4], %2, %0"
|
||||
#endif
|
||||
: "=r" (__oldval), "=m" (ref)
|
||||
: "r" (__oldval), "m" (ref), "r"(&(ref)), "0" (__newval));
|
||||
}
|
||||
while (__newval != __oldval);
|
||||
|
||||
if (__oldval == 0)
|
||||
delete this;
|
||||
}
|
||||
#else
|
||||
charT* grab () { if (selfish) return clone (); ++ref; return data (); }
|
||||
void release () { if (--ref == 0) delete this; }
|
||||
#endif
|
||||
|
||||
inline static void * operator new (size_t, size_t);
|
||||
inline static void operator delete (void *);
|
||||
inline static Rep* create (size_t);
|
||||
charT* clone ();
|
||||
|
||||
inline void copy (size_t, const charT *, size_t);
|
||||
inline void move (size_t, const charT *, size_t);
|
||||
inline void set (size_t, const charT, size_t);
|
||||
|
||||
inline static bool excess_slop (size_t, size_t);
|
||||
inline static size_t frob_size (size_t);
|
||||
|
||||
private:
|
||||
Rep &operator= (const Rep &);
|
||||
};
|
||||
|
||||
public:
|
||||
// types:
|
||||
typedef traits traits_type;
|
||||
typedef typename traits::char_type value_type;
|
||||
typedef Allocator allocator_type;
|
||||
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef charT& reference;
|
||||
typedef const charT& const_reference;
|
||||
typedef charT* pointer;
|
||||
typedef const charT* const_pointer;
|
||||
typedef pointer iterator;
|
||||
typedef const_pointer const_iterator;
|
||||
typedef ::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef ::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
static const size_type npos = static_cast<size_type>(-1);
|
||||
|
||||
private:
|
||||
Rep *rep () const { return reinterpret_cast<Rep *>(dat) - 1; }
|
||||
void repup (Rep *p) { rep ()->release (); dat = p->data (); }
|
||||
|
||||
public:
|
||||
const charT* data () const
|
||||
{ return rep ()->data(); }
|
||||
size_type length () const
|
||||
{ return rep ()->len; }
|
||||
size_type size () const
|
||||
{ return rep ()->len; }
|
||||
size_type capacity () const
|
||||
{ return rep ()->res; }
|
||||
size_type max_size () const
|
||||
{ return (npos - 1)/sizeof (charT); } // XXX
|
||||
bool empty () const
|
||||
{ return size () == 0; }
|
||||
|
||||
// _lib.string.cons_ construct/copy/destroy:
|
||||
basic_string& operator= (const basic_string& str)
|
||||
{
|
||||
if (&str != this) { rep ()->release (); dat = str.rep ()->grab (); }
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit basic_string (): dat (nilRep.grab ()) { }
|
||||
basic_string (const basic_string& str): dat (str.rep ()->grab ()) { }
|
||||
basic_string (const basic_string& str, size_type pos, size_type n = npos)
|
||||
: dat (nilRep.grab ()) { assign (str, pos, n); }
|
||||
basic_string (const charT* s, size_type n)
|
||||
: dat (nilRep.grab ()) { assign (s, n); }
|
||||
basic_string (const charT* s)
|
||||
: dat (nilRep.grab ()) { assign (s); }
|
||||
basic_string (size_type n, charT c)
|
||||
: dat (nilRep.grab ()) { assign (n, c); }
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template<class InputIterator>
|
||||
basic_string(InputIterator __begin, InputIterator __end)
|
||||
#else
|
||||
basic_string(const_iterator __begin, const_iterator __end)
|
||||
#endif
|
||||
: dat (nilRep.grab ()) { assign (__begin, __end); }
|
||||
|
||||
~basic_string ()
|
||||
{ rep ()->release (); }
|
||||
|
||||
void swap (basic_string &s) { charT *d = dat; dat = s.dat; s.dat = d; }
|
||||
|
||||
basic_string& append (const basic_string& str, size_type pos = 0,
|
||||
size_type n = npos)
|
||||
{ return replace (length (), 0, str, pos, n); }
|
||||
basic_string& append (const charT* s, size_type n)
|
||||
{ return replace (length (), 0, s, n); }
|
||||
basic_string& append (const charT* s)
|
||||
{ return append (s, traits::length (s)); }
|
||||
basic_string& append (size_type n, charT c)
|
||||
{ return replace (length (), 0, n, c); }
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template<class InputIterator>
|
||||
basic_string& append(InputIterator first, InputIterator last)
|
||||
#else
|
||||
basic_string& append(const_iterator first, const_iterator last)
|
||||
#endif
|
||||
{ return replace (iend (), iend (), first, last); }
|
||||
|
||||
void push_back(charT __c)
|
||||
{ append(1, __c); }
|
||||
|
||||
basic_string& assign (const basic_string& str, size_type pos = 0,
|
||||
size_type n = npos)
|
||||
{ return replace (0, npos, str, pos, n); }
|
||||
basic_string& assign (const charT* s, size_type n)
|
||||
{ return replace (0, npos, s, n); }
|
||||
basic_string& assign (const charT* s)
|
||||
{ return assign (s, traits::length (s)); }
|
||||
basic_string& assign (size_type n, charT c)
|
||||
{ return replace (0, npos, n, c); }
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template<class InputIterator>
|
||||
basic_string& assign(InputIterator first, InputIterator last)
|
||||
#else
|
||||
basic_string& assign(const_iterator first, const_iterator last)
|
||||
#endif
|
||||
{ return replace (ibegin (), iend (), first, last); }
|
||||
|
||||
basic_string& operator= (const charT* s)
|
||||
{ return assign (s); }
|
||||
basic_string& operator= (charT c)
|
||||
{ return assign (1, c); }
|
||||
|
||||
basic_string& operator+= (const basic_string& rhs)
|
||||
{ return append (rhs); }
|
||||
basic_string& operator+= (const charT* s)
|
||||
{ return append (s); }
|
||||
basic_string& operator+= (charT c)
|
||||
{ return append (1, c); }
|
||||
|
||||
basic_string& insert (size_type pos1, const basic_string& str,
|
||||
size_type pos2 = 0, size_type n = npos)
|
||||
{ return replace (pos1, 0, str, pos2, n); }
|
||||
basic_string& insert (size_type pos, const charT* s, size_type n)
|
||||
{ return replace (pos, 0, s, n); }
|
||||
basic_string& insert (size_type pos, const charT* s)
|
||||
{ return insert (pos, s, traits::length (s)); }
|
||||
basic_string& insert (size_type pos, size_type n, charT c)
|
||||
{ return replace (pos, 0, n, c); }
|
||||
iterator insert(iterator p, charT c)
|
||||
{ size_type __o = p - ibegin ();
|
||||
insert (p - ibegin (), 1, c); selfish ();
|
||||
return ibegin () + __o; }
|
||||
iterator insert(iterator p, size_type n, charT c)
|
||||
{ size_type __o = p - ibegin ();
|
||||
insert (p - ibegin (), n, c); selfish ();
|
||||
return ibegin () + __o; }
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template<class InputIterator>
|
||||
void insert(iterator p, InputIterator first, InputIterator last)
|
||||
#else
|
||||
void insert(iterator p, const_iterator first, const_iterator last)
|
||||
#endif
|
||||
{ replace (p, p, first, last); }
|
||||
|
||||
basic_string& erase (size_type pos = 0, size_type n = npos)
|
||||
{ return replace (pos, n, (size_type)0, (charT)0); }
|
||||
iterator erase(iterator p)
|
||||
{ size_type __o = p - begin();
|
||||
replace (__o, 1, (size_type)0, (charT)0); selfish ();
|
||||
return ibegin() + __o; }
|
||||
iterator erase(iterator f, iterator l)
|
||||
{ size_type __o = f - ibegin();
|
||||
replace (__o, l-f, (size_type)0, (charT)0);selfish ();
|
||||
return ibegin() + __o; }
|
||||
|
||||
basic_string& replace (size_type pos1, size_type n1, const basic_string& str,
|
||||
size_type pos2 = 0, size_type n2 = npos);
|
||||
basic_string& replace (size_type pos, size_type n1, const charT* s,
|
||||
size_type n2);
|
||||
basic_string& replace (size_type pos, size_type n1, const charT* s)
|
||||
{ return replace (pos, n1, s, traits::length (s)); }
|
||||
basic_string& replace (size_type pos, size_type n1, size_type n2, charT c);
|
||||
basic_string& replace (size_type pos, size_type n, charT c)
|
||||
{ return replace (pos, n, 1, c); }
|
||||
basic_string& replace (iterator i1, iterator i2, const basic_string& str)
|
||||
{ return replace (i1 - ibegin (), i2 - i1, str); }
|
||||
basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n)
|
||||
{ return replace (i1 - ibegin (), i2 - i1, s, n); }
|
||||
basic_string& replace (iterator i1, iterator i2, const charT* s)
|
||||
{ return replace (i1 - ibegin (), i2 - i1, s); }
|
||||
basic_string& replace (iterator i1, iterator i2, size_type n, charT c)
|
||||
{ return replace (i1 - ibegin (), i2 - i1, n, c); }
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template<class InputIterator>
|
||||
basic_string& replace(iterator i1, iterator i2,
|
||||
InputIterator j1, InputIterator j2);
|
||||
#else
|
||||
basic_string& replace(iterator i1, iterator i2,
|
||||
const_iterator j1, const_iterator j2);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static charT eos () { return traits::eos (); }
|
||||
void unique () { if (rep ()->ref > 1) alloc (length (), true); }
|
||||
void selfish () { unique (); rep ()->selfish = true; }
|
||||
|
||||
public:
|
||||
charT operator[] (size_type pos) const
|
||||
{
|
||||
if (pos == length ())
|
||||
return eos ();
|
||||
return data ()[pos];
|
||||
}
|
||||
|
||||
reference operator[] (size_type pos)
|
||||
{ selfish (); return (*rep ())[pos]; }
|
||||
|
||||
reference at (size_type pos)
|
||||
{
|
||||
OUTOFRANGE (pos >= length ());
|
||||
return (*this)[pos];
|
||||
}
|
||||
const_reference at (size_type pos) const
|
||||
{
|
||||
OUTOFRANGE (pos >= length ());
|
||||
return data ()[pos];
|
||||
}
|
||||
|
||||
private:
|
||||
void terminate () const
|
||||
{ traits::assign ((*rep ())[length ()], eos ()); }
|
||||
|
||||
public:
|
||||
const charT* c_str () const
|
||||
{ if (length () == 0) return ""; terminate (); return data (); }
|
||||
void resize (size_type n, charT c);
|
||||
void resize (size_type n)
|
||||
{ resize (n, eos ()); }
|
||||
void reserve (size_type) { }
|
||||
|
||||
void clear() { erase(begin(), end()); }
|
||||
|
||||
size_type copy (charT* s, size_type n, size_type pos = 0) const;
|
||||
|
||||
size_type find (const basic_string& str, size_type pos = 0) const
|
||||
{ return find (str.data(), pos, str.length()); }
|
||||
size_type find (const charT* s, size_type pos, size_type n) const;
|
||||
size_type find (const charT* s, size_type pos = 0) const
|
||||
{ return find (s, pos, traits::length (s)); }
|
||||
size_type find (charT c, size_type pos = 0) const;
|
||||
|
||||
size_type rfind (const basic_string& str, size_type pos = npos) const
|
||||
{ return rfind (str.data(), pos, str.length()); }
|
||||
size_type rfind (const charT* s, size_type pos, size_type n) const;
|
||||
size_type rfind (const charT* s, size_type pos = npos) const
|
||||
{ return rfind (s, pos, traits::length (s)); }
|
||||
size_type rfind (charT c, size_type pos = npos) const;
|
||||
|
||||
size_type find_first_of (const basic_string& str, size_type pos = 0) const
|
||||
{ return find_first_of (str.data(), pos, str.length()); }
|
||||
size_type find_first_of (const charT* s, size_type pos, size_type n) const;
|
||||
size_type find_first_of (const charT* s, size_type pos = 0) const
|
||||
{ return find_first_of (s, pos, traits::length (s)); }
|
||||
size_type find_first_of (charT c, size_type pos = 0) const
|
||||
{ return find (c, pos); }
|
||||
|
||||
size_type find_last_of (const basic_string& str, size_type pos = npos) const
|
||||
{ return find_last_of (str.data(), pos, str.length()); }
|
||||
size_type find_last_of (const charT* s, size_type pos, size_type n) const;
|
||||
size_type find_last_of (const charT* s, size_type pos = npos) const
|
||||
{ return find_last_of (s, pos, traits::length (s)); }
|
||||
size_type find_last_of (charT c, size_type pos = npos) const
|
||||
{ return rfind (c, pos); }
|
||||
|
||||
size_type find_first_not_of (const basic_string& str, size_type pos = 0) const
|
||||
{ return find_first_not_of (str.data(), pos, str.length()); }
|
||||
size_type find_first_not_of (const charT* s, size_type pos, size_type n) const;
|
||||
size_type find_first_not_of (const charT* s, size_type pos = 0) const
|
||||
{ return find_first_not_of (s, pos, traits::length (s)); }
|
||||
size_type find_first_not_of (charT c, size_type pos = 0) const;
|
||||
|
||||
size_type find_last_not_of (const basic_string& str, size_type pos = npos) const
|
||||
{ return find_last_not_of (str.data(), pos, str.length()); }
|
||||
size_type find_last_not_of (const charT* s, size_type pos, size_type n) const;
|
||||
size_type find_last_not_of (const charT* s, size_type pos = npos) const
|
||||
{ return find_last_not_of (s, pos, traits::length (s)); }
|
||||
size_type find_last_not_of (charT c, size_type pos = npos) const;
|
||||
|
||||
basic_string substr (size_type pos = 0, size_type n = npos) const
|
||||
{ return basic_string (*this, pos, n); }
|
||||
|
||||
int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const;
|
||||
// There is no 'strncmp' equivalent for charT pointers.
|
||||
int compare (const charT* s, size_type pos, size_type n) const;
|
||||
int compare (const charT* s, size_type pos = 0) const
|
||||
{ return compare (s, pos, traits::length (s)); }
|
||||
|
||||
iterator begin () { selfish (); return &(*this)[0]; }
|
||||
iterator end () { selfish (); return &(*this)[length ()]; }
|
||||
|
||||
private:
|
||||
iterator ibegin () const { return &(*rep ())[0]; }
|
||||
iterator iend () const { return &(*rep ())[length ()]; }
|
||||
|
||||
public:
|
||||
const_iterator begin () const { return ibegin (); }
|
||||
const_iterator end () const { return iend (); }
|
||||
|
||||
reverse_iterator rbegin() { return reverse_iterator (end ()); }
|
||||
const_reverse_iterator rbegin() const
|
||||
{ return const_reverse_iterator (end ()); }
|
||||
reverse_iterator rend() { return reverse_iterator (begin ()); }
|
||||
const_reverse_iterator rend() const
|
||||
{ return const_reverse_iterator (begin ()); }
|
||||
|
||||
private:
|
||||
void alloc (size_type size, bool save);
|
||||
static size_type _find (const charT* ptr, charT c, size_type xpos, size_type len);
|
||||
inline bool check_realloc (size_type s) const;
|
||||
|
||||
static Rep nilRep;
|
||||
charT *dat;
|
||||
};
|
||||
|
||||
#ifdef __STL_MEMBER_TEMPLATES
|
||||
template <class charT, class traits, class Allocator> template <class InputIterator>
|
||||
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
|
||||
replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2)
|
||||
#else
|
||||
template <class charT, class traits, class Allocator>
|
||||
basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
|
||||
replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2)
|
||||
#endif
|
||||
{
|
||||
const size_type len = length ();
|
||||
size_type pos = i1 - ibegin ();
|
||||
size_type n1 = i2 - i1;
|
||||
size_type n2 = j2 - j1;
|
||||
|
||||
OUTOFRANGE (pos > len);
|
||||
if (n1 > len - pos)
|
||||
n1 = len - pos;
|
||||
LENGTHERROR (len - n1 > max_size () - n2);
|
||||
size_t newlen = len - n1 + n2;
|
||||
|
||||
if (check_realloc (newlen))
|
||||
{
|
||||
Rep *p = Rep::create (newlen);
|
||||
p->copy (0, data (), pos);
|
||||
p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
|
||||
for (; j1 != j2; ++j1, ++pos)
|
||||
traits::assign ((*p)[pos], *j1);
|
||||
repup (p);
|
||||
}
|
||||
else
|
||||
{
|
||||
rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
|
||||
for (; j1 != j2; ++j1, ++pos)
|
||||
traits::assign ((*rep ())[pos], *j1);
|
||||
}
|
||||
rep ()->len = newlen;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline basic_string <charT, traits, Allocator>
|
||||
operator+ (const basic_string <charT, traits, Allocator>& lhs,
|
||||
const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
basic_string <charT, traits, Allocator> str (lhs);
|
||||
str.append (rhs);
|
||||
return str;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline basic_string <charT, traits, Allocator>
|
||||
operator+ (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
basic_string <charT, traits, Allocator> str (lhs);
|
||||
str.append (rhs);
|
||||
return str;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline basic_string <charT, traits, Allocator>
|
||||
operator+ (charT lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
basic_string <charT, traits, Allocator> str (1, lhs);
|
||||
str.append (rhs);
|
||||
return str;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline basic_string <charT, traits, Allocator>
|
||||
operator+ (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
|
||||
{
|
||||
basic_string <charT, traits, Allocator> str (lhs);
|
||||
str.append (rhs);
|
||||
return str;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline basic_string <charT, traits, Allocator>
|
||||
operator+ (const basic_string <charT, traits, Allocator>& lhs, charT rhs)
|
||||
{
|
||||
basic_string <charT, traits, Allocator> str (lhs);
|
||||
str.append (1, rhs);
|
||||
return str;
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator== (const basic_string <charT, traits, Allocator>& lhs,
|
||||
const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) == 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator== (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (rhs.compare (lhs) == 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator== (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) == 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator!= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (rhs.compare (lhs) != 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator!= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) != 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator< (const basic_string <charT, traits, Allocator>& lhs,
|
||||
const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) < 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator< (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (rhs.compare (lhs) > 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator< (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) < 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator> (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (rhs.compare (lhs) < 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator> (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) > 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator<= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (rhs.compare (lhs) >= 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator<= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) <= 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator>= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (rhs.compare (lhs) <= 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator>= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) >= 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator!= (const basic_string <charT, traits, Allocator>& lhs,
|
||||
const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) != 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator> (const basic_string <charT, traits, Allocator>& lhs,
|
||||
const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) > 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator<= (const basic_string <charT, traits, Allocator>& lhs,
|
||||
const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) <= 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits, class Allocator>
|
||||
inline bool
|
||||
operator>= (const basic_string <charT, traits, Allocator>& lhs,
|
||||
const basic_string <charT, traits, Allocator>& rhs)
|
||||
{
|
||||
return (lhs.compare (rhs) >= 0);
|
||||
}
|
||||
|
||||
class istream; class ostream;
|
||||
template <class charT, class traits, class Allocator> istream&
|
||||
operator>> (istream&, basic_string <charT, traits, Allocator>&);
|
||||
template <class charT, class traits, class Allocator> ostream&
|
||||
operator<< (ostream&, const basic_string <charT, traits, Allocator>&);
|
||||
template <class charT, class traits, class Allocator> istream&
|
||||
getline (istream&, basic_string <charT, traits, Allocator>&, charT delim = '\n');
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#include <std/bastring.cc>
|
||||
|
||||
#endif
|
@ -1,273 +0,0 @@
|
||||
// Member templates for the -*- C++ -*- complex number classes.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification in the 27 May 1994
|
||||
// C++ working paper, ANSI document X3J16/94-0098.
|
||||
|
||||
#include <complex>
|
||||
|
||||
extern "C++" {
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
cos (const complex<FLOAT>& x)
|
||||
{
|
||||
return complex<FLOAT> (cos (real (x)) * cosh (imag (x)),
|
||||
- sin (real (x)) * sinh (imag (x)));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
cosh (const complex<FLOAT>& x)
|
||||
{
|
||||
return complex<FLOAT> (cosh (real (x)) * cos (imag (x)),
|
||||
sinh (real (x)) * sin (imag (x)));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
exp (const complex<FLOAT>& x)
|
||||
{
|
||||
return polar (FLOAT (exp (real (x))), imag (x));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
log (const complex<FLOAT>& x)
|
||||
{
|
||||
return complex<FLOAT> (log (abs (x)), arg (x));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
pow (const complex<FLOAT>& x, const complex<FLOAT>& y)
|
||||
{
|
||||
FLOAT logr = log (abs (x));
|
||||
FLOAT t = arg (x);
|
||||
|
||||
return polar (FLOAT (exp (logr * real (y) - imag (y) * t)),
|
||||
FLOAT (imag (y) * logr + real (y) * t));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
pow (const complex<FLOAT>& x, FLOAT y)
|
||||
{
|
||||
return exp (FLOAT (y) * log (x));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
pow (FLOAT x, const complex<FLOAT>& y)
|
||||
{
|
||||
return exp (y * FLOAT (log (x)));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
sin (const complex<FLOAT>& x)
|
||||
{
|
||||
return complex<FLOAT> (sin (real (x)) * cosh (imag (x)),
|
||||
cos (real (x)) * sinh (imag (x)));
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
sinh (const complex<FLOAT>& x)
|
||||
{
|
||||
return complex<FLOAT> (sinh (real (x)) * cos (imag (x)),
|
||||
cosh (real (x)) * sin (imag (x)));
|
||||
}
|
||||
|
||||
#include <iostream.h>
|
||||
|
||||
template <class FLOAT> istream&
|
||||
operator >> (istream& is, complex<FLOAT>& x)
|
||||
{
|
||||
FLOAT re, im = 0;
|
||||
char ch = 0;
|
||||
|
||||
if (is.ipfx0 ())
|
||||
{
|
||||
if (is.peek () == '(')
|
||||
is >> ch;
|
||||
is >> re;
|
||||
if (ch == '(')
|
||||
{
|
||||
is >> ch;
|
||||
if (ch == ',')
|
||||
is >> im >> ch;
|
||||
}
|
||||
}
|
||||
is.isfx ();
|
||||
|
||||
if (ch != 0 && ch != ')')
|
||||
is.setstate (ios::failbit);
|
||||
else if (is.good ())
|
||||
x = complex<FLOAT> (re, im);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
template <class FLOAT> ostream&
|
||||
operator << (ostream& os, const complex<FLOAT>& x)
|
||||
{
|
||||
return os << '(' << real (x) << ',' << imag (x) << ')';
|
||||
}
|
||||
|
||||
// The code below is adapted from f2c's libF77, and is subject to this
|
||||
// copyright:
|
||||
|
||||
/****************************************************************
|
||||
Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
and its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the names of AT&T Bell Laboratories or
|
||||
Bellcore or any of their entities not be used in advertising or
|
||||
publicity pertaining to distribution of the software without
|
||||
specific, written prior permission.
|
||||
|
||||
AT&T and Bellcore disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall AT&T or Bellcore be liable for
|
||||
any special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
****************************************************************/
|
||||
|
||||
template <class FLOAT> complex<FLOAT>&
|
||||
__doadv (complex<FLOAT>* ths, const complex<FLOAT>& y)
|
||||
{
|
||||
FLOAT ar = abs (y.re);
|
||||
FLOAT ai = abs (y.im);
|
||||
FLOAT nr, ni;
|
||||
FLOAT t, d;
|
||||
if (ar <= ai)
|
||||
{
|
||||
t = y.re / y.im;
|
||||
d = y.im * (1 + t*t);
|
||||
nr = (ths->re * t + ths->im) / d;
|
||||
ni = (ths->im * t - ths->re) / d;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = y.im / y.re;
|
||||
d = y.re * (1 + t*t);
|
||||
nr = (ths->re + ths->im * t) / d;
|
||||
ni = (ths->im - ths->re * t) / d;
|
||||
}
|
||||
ths->re = nr;
|
||||
ths->im = ni;
|
||||
return *ths;
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
operator / (const complex<FLOAT>& x, const complex<FLOAT>& y)
|
||||
{
|
||||
FLOAT ar = abs (real (y));
|
||||
FLOAT ai = abs (imag (y));
|
||||
FLOAT nr, ni;
|
||||
FLOAT t, d;
|
||||
if (ar <= ai)
|
||||
{
|
||||
t = real (y) / imag (y);
|
||||
d = imag (y) * (1 + t*t);
|
||||
nr = (real (x) * t + imag (x)) / d;
|
||||
ni = (imag (x) * t - real (x)) / d;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = imag (y) / real (y);
|
||||
d = real (y) * (1 + t*t);
|
||||
nr = (real (x) + imag (x) * t) / d;
|
||||
ni = (imag (x) - real (x) * t) / d;
|
||||
}
|
||||
return complex<FLOAT> (nr, ni);
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
operator / (FLOAT x, const complex<FLOAT>& y)
|
||||
{
|
||||
FLOAT ar = abs (real (y));
|
||||
FLOAT ai = abs (imag (y));
|
||||
FLOAT nr, ni;
|
||||
FLOAT t, d;
|
||||
if (ar <= ai)
|
||||
{
|
||||
t = real (y) / imag (y);
|
||||
d = imag (y) * (1 + t*t);
|
||||
nr = x * t / d;
|
||||
ni = -x / d;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = imag (y) / real (y);
|
||||
d = real (y) * (1 + t*t);
|
||||
nr = x / d;
|
||||
ni = -x * t / d;
|
||||
}
|
||||
return complex<FLOAT> (nr, ni);
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
pow (const complex<FLOAT>& xin, int y)
|
||||
{
|
||||
if (y == 0)
|
||||
return complex<FLOAT> (1.0);
|
||||
complex<FLOAT> r (1.0);
|
||||
complex<FLOAT> x (xin);
|
||||
if (y < 0)
|
||||
{
|
||||
y = -y;
|
||||
x = FLOAT(1)/x;
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
if (y & 1)
|
||||
r *= x;
|
||||
if (y >>= 1)
|
||||
x *= x;
|
||||
else
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
template <class FLOAT> complex<FLOAT>
|
||||
sqrt (const complex<FLOAT>& x)
|
||||
{
|
||||
FLOAT r = abs (x);
|
||||
FLOAT nr, ni;
|
||||
if (r == 0.0)
|
||||
nr = ni = r;
|
||||
else if (real (x) > 0)
|
||||
{
|
||||
nr = sqrt (0.5 * (r + real (x)));
|
||||
ni = imag (x) / nr / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ni = sqrt (0.5 * (r - real (x)));
|
||||
if (imag (x) < 0)
|
||||
ni = - ni;
|
||||
nr = imag (x) / ni / 2;
|
||||
}
|
||||
return complex<FLOAT> (nr, ni);
|
||||
}
|
||||
} // extern "C++"
|
@ -1,400 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- complex number classes.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files compiled
|
||||
// with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification in the 27 May 1994
|
||||
// C++ working paper, ANSI document X3J16/94-0098.
|
||||
|
||||
#ifndef __COMPLEXT__
|
||||
#define __COMPLEXT__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#if ! defined (__GNUG__) && ! defined (__attribute__)
|
||||
#define __attribute__(foo) /* Ignore. */
|
||||
#endif
|
||||
|
||||
class istream;
|
||||
class ostream;
|
||||
|
||||
extern "C++" {
|
||||
template <class _FLT> class complex;
|
||||
template <class _FLT> complex<_FLT>&
|
||||
__doapl (complex<_FLT>* ths, const complex<_FLT>& r);
|
||||
template <class _FLT> complex<_FLT>&
|
||||
__doami (complex<_FLT>* ths, const complex<_FLT>& r);
|
||||
template <class _FLT> complex<_FLT>&
|
||||
__doaml (complex<_FLT>* ths, const complex<_FLT>& r);
|
||||
template <class _FLT> complex<_FLT>&
|
||||
__doadv (complex<_FLT>* ths, const complex<_FLT>& r);
|
||||
|
||||
template <class _FLT>
|
||||
class complex
|
||||
{
|
||||
public:
|
||||
complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { }
|
||||
complex& operator += (const complex&);
|
||||
complex& operator -= (const complex&);
|
||||
complex& operator *= (const complex&);
|
||||
complex& operator /= (const complex&);
|
||||
_FLT real () const { return re; }
|
||||
_FLT imag () const { return im; }
|
||||
private:
|
||||
_FLT re, im;
|
||||
|
||||
friend complex& __doapl<> (complex *, const complex&);
|
||||
friend complex& __doami<> (complex *, const complex&);
|
||||
friend complex& __doaml<> (complex *, const complex&);
|
||||
friend complex& __doadv<> (complex *, const complex&);
|
||||
};
|
||||
|
||||
// Declare specializations.
|
||||
class complex<float>;
|
||||
class complex<double>;
|
||||
class complex<long double>;
|
||||
|
||||
template <class _FLT>
|
||||
inline complex<_FLT>&
|
||||
__doapl (complex<_FLT>* ths, const complex<_FLT>& r)
|
||||
{
|
||||
ths->re += r.re;
|
||||
ths->im += r.im;
|
||||
return *ths;
|
||||
}
|
||||
template <class _FLT>
|
||||
inline complex<_FLT>&
|
||||
complex<_FLT>::operator += (const complex<_FLT>& r)
|
||||
{
|
||||
return __doapl (this, r);
|
||||
}
|
||||
|
||||
template <class _FLT>
|
||||
inline complex<_FLT>&
|
||||
__doami (complex<_FLT>* ths, const complex<_FLT>& r)
|
||||
{
|
||||
ths->re -= r.re;
|
||||
ths->im -= r.im;
|
||||
return *ths;
|
||||
}
|
||||
template <class _FLT>
|
||||
inline complex<_FLT>&
|
||||
complex<_FLT>::operator -= (const complex<_FLT>& r)
|
||||
{
|
||||
return __doami (this, r);
|
||||
}
|
||||
|
||||
template <class _FLT>
|
||||
inline complex<_FLT>&
|
||||
__doaml (complex<_FLT>* ths, const complex<_FLT>& r)
|
||||
{
|
||||
_FLT f = ths->re * r.re - ths->im * r.im;
|
||||
ths->im = ths->re * r.im + ths->im * r.re;
|
||||
ths->re = f;
|
||||
return *ths;
|
||||
}
|
||||
template <class _FLT>
|
||||
inline complex<_FLT>&
|
||||
complex<_FLT>::operator *= (const complex<_FLT>& r)
|
||||
{
|
||||
return __doaml (this, r);
|
||||
}
|
||||
|
||||
template <class _FLT>
|
||||
inline complex<_FLT>&
|
||||
complex<_FLT>::operator /= (const complex<_FLT>& r)
|
||||
{
|
||||
return __doadv (this, r);
|
||||
}
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
imag (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
imag (const complex<_FLT>& x)
|
||||
{
|
||||
return x.imag ();
|
||||
}
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
real (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
real (const complex<_FLT>& x)
|
||||
{
|
||||
return x.real ();
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (const complex<_FLT>& x, const complex<_FLT>& y)
|
||||
{
|
||||
return complex<_FLT> (real (x) + real (y), imag (x) + imag (y));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (const complex<_FLT>& x, _FLT y)
|
||||
{
|
||||
return complex<_FLT> (real (x) + y, imag (x));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (_FLT x, const complex<_FLT>& y)
|
||||
{
|
||||
return complex<_FLT> (x + real (y), imag (y));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (const complex<_FLT>& x, const complex<_FLT>& y)
|
||||
{
|
||||
return complex<_FLT> (real (x) - real (y), imag (x) - imag (y));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (const complex<_FLT>& x, _FLT y)
|
||||
{
|
||||
return complex<_FLT> (real (x) - y, imag (x));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (_FLT x, const complex<_FLT>& y)
|
||||
{
|
||||
return complex<_FLT> (x - real (y), - imag (y));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator * (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator * (const complex<_FLT>& x, const complex<_FLT>& y)
|
||||
{
|
||||
return complex<_FLT> (real (x) * real (y) - imag (x) * imag (y),
|
||||
real (x) * imag (y) + imag (x) * real (y));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator * (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator * (const complex<_FLT>& x, _FLT y)
|
||||
{
|
||||
return complex<_FLT> (real (x) * y, imag (x) * y);
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator * (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator * (_FLT x, const complex<_FLT>& y)
|
||||
{
|
||||
return complex<_FLT> (x * real (y), x * imag (y));
|
||||
}
|
||||
|
||||
template <class _FLT> complex<_FLT>
|
||||
operator / (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> complex<_FLT>
|
||||
operator / (const complex<_FLT>& x, _FLT y)
|
||||
{
|
||||
return complex<_FLT> (real (x) / y, imag (x) / y);
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator + (const complex<_FLT>& x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
operator - (const complex<_FLT>& x)
|
||||
{
|
||||
return complex<_FLT> (-real (x), -imag (x));
|
||||
}
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator == (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator == (const complex<_FLT>& x, const complex<_FLT>& y)
|
||||
{
|
||||
return real (x) == real (y) && imag (x) == imag (y);
|
||||
}
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator == (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator == (const complex<_FLT>& x, _FLT y)
|
||||
{
|
||||
return real (x) == y && imag (x) == 0;
|
||||
}
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator == (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator == (_FLT x, const complex<_FLT>& y)
|
||||
{
|
||||
return x == real (y) && imag (y) == 0;
|
||||
}
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator != (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator != (const complex<_FLT>& x, const complex<_FLT>& y)
|
||||
{
|
||||
return real (x) != real (y) || imag (x) != imag (y);
|
||||
}
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator != (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator != (const complex<_FLT>& x, _FLT y)
|
||||
{
|
||||
return real (x) != y || imag (x) != 0;
|
||||
}
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator != (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline bool
|
||||
operator != (_FLT x, const complex<_FLT>& y)
|
||||
{
|
||||
return x != real (y) || imag (y) != 0;
|
||||
}
|
||||
|
||||
// Some targets don't provide a prototype for hypot when -ansi.
|
||||
extern "C" double hypot (double, double) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
abs (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
abs (const complex<_FLT>& x)
|
||||
{
|
||||
return hypot (real (x), imag (x));
|
||||
}
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
arg (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
arg (const complex<_FLT>& x)
|
||||
{
|
||||
return atan2 (imag (x), real (x));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
polar (_FLT r, _FLT t) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
polar (_FLT r, _FLT t)
|
||||
{
|
||||
return complex<_FLT> (r * cos (t), r * sin (t));
|
||||
}
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
conj (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline complex<_FLT>
|
||||
conj (const complex<_FLT>& x)
|
||||
{
|
||||
return complex<_FLT> (real (x), -imag (x));
|
||||
}
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
norm (const complex<_FLT>& x) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> inline _FLT
|
||||
norm (const complex<_FLT>& x)
|
||||
{
|
||||
return real (x) * real (x) + imag (x) * imag (x);
|
||||
}
|
||||
|
||||
// Declarations of templates in complext.ccI
|
||||
|
||||
template <class _FLT> complex<_FLT>
|
||||
operator / (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
operator / (_FLT, const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
cos (const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
cosh (const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
exp (const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
log (const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
pow (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
pow (const complex<_FLT>&, _FLT) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
pow (const complex<_FLT>&, int) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
pow (_FLT, const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
sin (const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
sinh (const complex<_FLT>&) __attribute__ ((const));
|
||||
template <class _FLT> complex<_FLT>
|
||||
sqrt (const complex<_FLT>&) __attribute__ ((const));
|
||||
|
||||
template <class _FLT> istream& operator >> (istream&, complex<_FLT>&);
|
||||
template <class _FLT> ostream& operator << (ostream&, const complex<_FLT>&);
|
||||
} // extern "C++"
|
||||
|
||||
// Specializations and such
|
||||
|
||||
#include <std/fcomplex.h>
|
||||
#include <std/dcomplex.h>
|
||||
#include <std/ldcomplex.h>
|
||||
|
||||
#endif
|
@ -1,299 +0,0 @@
|
||||
// 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 iintegral constant
|
||||
// expressions.
|
||||
// Secondly, from the point of view of ease of use, type-based compile-time
|
||||
// information is -not- *that* convenient. One 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. Please, direct
|
||||
// any comment to <dosreis@cmla.ens-cachan.fr>.
|
||||
//
|
||||
// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.
|
||||
//
|
||||
|
||||
extern "C++" {
|
||||
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
|
||||
};
|
||||
};
|
||||
|
||||
# if 0
|
||||
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
|
||||
};
|
||||
};
|
||||
|
||||
# if 0
|
||||
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
|
||||
};
|
||||
};
|
||||
} // extern "C++"
|
||||
|
||||
#endif //_CPP_BITS_CPP_TYPE_TRAITS_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,91 +0,0 @@
|
||||
// The -*- C++ -*- double_complex class.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification in the 27 May 1994
|
||||
// C++ working paper, ANSI document X3J16/94-0098.
|
||||
|
||||
#ifndef __DCOMPLEX__
|
||||
#define __DCOMPLEX__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dcomplex"
|
||||
#endif
|
||||
|
||||
extern "C++" {
|
||||
class complex<double>
|
||||
{
|
||||
public:
|
||||
complex (double r = 0, double i = 0): re (r), im (i) { }
|
||||
complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { }
|
||||
explicit complex (const complex<long double>& r);
|
||||
|
||||
complex& operator+= (const complex& r) { return __doapl (this, r); }
|
||||
complex& operator-= (const complex& r) { return __doami (this, r); }
|
||||
complex& operator*= (const complex& r) { return __doaml (this, r); }
|
||||
complex& operator/= (const complex& r) { return __doadv (this, r); }
|
||||
|
||||
double real () const { return re; }
|
||||
double imag () const { return im; }
|
||||
private:
|
||||
double re, im;
|
||||
|
||||
friend complex& __doapl<> (complex *, const complex&);
|
||||
friend complex& __doami<> (complex *, const complex&);
|
||||
friend complex& __doaml<> (complex *, const complex&);
|
||||
friend complex& __doadv<> (complex *, const complex&);
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
friend inline complex operator + (const complex& x, double y)
|
||||
{ return operator+<> (x, y); }
|
||||
friend inline complex operator + (double x, const complex& y)
|
||||
{ return operator+<> (x, y); }
|
||||
friend inline complex operator - (const complex& x, double y)
|
||||
{ return operator-<> (x, y); }
|
||||
friend inline complex operator - (double x, const complex& y)
|
||||
{ return operator-<> (x, y); }
|
||||
friend inline complex operator * (const complex& x, double y)
|
||||
{ return operator*<> (x, y); }
|
||||
friend inline complex operator * (double x, const complex& y)
|
||||
{ return operator*<> (x, y); }
|
||||
friend inline complex operator / (const complex& x, double y)
|
||||
{ return operator/<> (x, y); }
|
||||
friend inline complex operator / (double x, const complex& y)
|
||||
{ return operator/<> (x, y); }
|
||||
friend inline bool operator == (const complex& x, double y)
|
||||
{ return operator==<> (x, y); }
|
||||
friend inline bool operator == (double x, const complex& y)
|
||||
{ return operator==<> (x, y); }
|
||||
friend inline bool operator != (const complex& x, double y)
|
||||
{ return operator!=<> (x, y); }
|
||||
friend inline bool operator != (double x, const complex& y)
|
||||
{ return operator!=<> (x, y); }
|
||||
#endif /* __STRICT_ANSI__ */
|
||||
};
|
||||
|
||||
inline complex<float>::complex (const complex<double>& r)
|
||||
: re (r.real ()), im (r.imag ())
|
||||
{ }
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,87 +0,0 @@
|
||||
// The -*- C++ -*- float_complex class.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification in the 27 May 1994
|
||||
// C++ working paper, ANSI document X3J16/94-0098.
|
||||
|
||||
#ifndef __FCOMPLEX__
|
||||
#define __FCOMPLEX__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "fcomplex"
|
||||
#endif
|
||||
|
||||
extern "C++" {
|
||||
class complex<float>
|
||||
{
|
||||
public:
|
||||
complex (float r = 0, float i = 0): re (r), im (i) { }
|
||||
explicit complex (const complex<double>& r);
|
||||
explicit complex (const complex<long double>& r);
|
||||
|
||||
complex& operator+= (const complex& r) { return __doapl (this, r); }
|
||||
complex& operator-= (const complex& r) { return __doami (this, r); }
|
||||
complex& operator*= (const complex& r) { return __doaml (this, r); }
|
||||
complex& operator/= (const complex& r) { return __doadv (this, r); }
|
||||
|
||||
float real () const { return re; }
|
||||
float imag () const { return im; }
|
||||
private:
|
||||
float re, im;
|
||||
|
||||
friend complex& __doapl<> (complex *, const complex&);
|
||||
friend complex& __doami<> (complex *, const complex&);
|
||||
friend complex& __doaml<> (complex *, const complex&);
|
||||
friend complex& __doadv<> (complex *, const complex&);
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
friend inline complex operator + (const complex& x, float y)
|
||||
{ return operator+<> (x, y); }
|
||||
friend inline complex operator + (float x, const complex& y)
|
||||
{ return operator+<> (x, y); }
|
||||
friend inline complex operator - (const complex& x, float y)
|
||||
{ return operator-<> (x, y); }
|
||||
friend inline complex operator - (float x, const complex& y)
|
||||
{ return operator-<> (x, y); }
|
||||
friend inline complex operator * (const complex& x, float y)
|
||||
{ return operator*<> (x, y); }
|
||||
friend inline complex operator * (float x, const complex& y)
|
||||
{ return operator*<> (x, y); }
|
||||
friend inline complex operator / (const complex& x, float y)
|
||||
{ return operator/<> (x, y); }
|
||||
friend inline complex operator / (float x, const complex& y)
|
||||
{ return operator/<> (x, y); }
|
||||
friend inline bool operator == (const complex& x, float y)
|
||||
{ return operator==<> (x, y); }
|
||||
friend inline bool operator == (float x, const complex& y)
|
||||
{ return operator==<> (x, y); }
|
||||
friend inline bool operator != (const complex& x, float y)
|
||||
{ return operator!=<> (x, y); }
|
||||
friend inline bool operator != (float x, const complex& y)
|
||||
{ return operator!=<> (x, y); }
|
||||
#endif /* __STRICT_ANSI__ */
|
||||
};
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,111 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- gslice class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __GSLICE__
|
||||
#define __GSLICE__
|
||||
|
||||
extern "C++" {
|
||||
|
||||
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; }
|
||||
};
|
||||
|
||||
|
||||
class gslice
|
||||
{
|
||||
public:
|
||||
gslice ();
|
||||
gslice (size_t, const valarray<size_t>&, const valarray<size_t>&);
|
||||
gslice(const gslice&);
|
||||
~gslice();
|
||||
|
||||
gslice& operator= (const gslice&);
|
||||
size_t start () const;
|
||||
valarray<size_t> size () const;
|
||||
valarray<size_t> stride () const;
|
||||
|
||||
private:
|
||||
_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 _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;
|
||||
}
|
||||
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif // __GSLICE__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,170 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- gslice_array class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __GSLICE_ARRAY__
|
||||
#define __GSLICE_ARRAY__
|
||||
|
||||
extern "C++" {
|
||||
|
||||
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
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
|
||||
#endif // __GSLICE_ARRAY__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,157 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- indirect_array class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __INDIRECT_ARRAY__
|
||||
#define __INDIRECT_ARRAY__
|
||||
|
||||
extern "C++" {
|
||||
|
||||
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&);
|
||||
|
||||
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 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
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif // __INDIRECT_ARRAY__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,95 +0,0 @@
|
||||
// The -*- C++ -*- long_double_complex class.
|
||||
// Copyright (C) 1994 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification in the 27 May 1994
|
||||
// C++ working paper, ANSI document X3J16/94-0098.
|
||||
|
||||
#ifndef __LDCOMPLEX__
|
||||
#define __LDCOMPLEX__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "ldcomplex"
|
||||
#endif
|
||||
|
||||
extern "C++" {
|
||||
class complex<long double>
|
||||
{
|
||||
public:
|
||||
complex (long double r = 0, long double i = 0): re (r), im (i) { }
|
||||
complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { }
|
||||
complex (const complex<double>& r): re (r.real ()), im (r.imag ()) { }
|
||||
|
||||
complex& operator+= (const complex& r) { return __doapl (this, r); }
|
||||
complex& operator-= (const complex& r) { return __doami (this, r); }
|
||||
complex& operator*= (const complex& r) { return __doaml (this, r); }
|
||||
complex& operator/= (const complex& r) { return __doadv (this, r); }
|
||||
|
||||
long double real () const { return re; }
|
||||
long double imag () const { return im; }
|
||||
private:
|
||||
long double re, im;
|
||||
|
||||
friend complex& __doapl<> (complex *, const complex&);
|
||||
friend complex& __doami<> (complex *, const complex&);
|
||||
friend complex& __doaml<> (complex *, const complex&);
|
||||
friend complex& __doadv<> (complex *, const complex&);
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
friend inline complex operator + (const complex& x, long double y)
|
||||
{ return operator+<> (x, y); }
|
||||
friend inline complex operator + (long double x, const complex& y)
|
||||
{ return operator+<> (x, y); }
|
||||
friend inline complex operator - (const complex& x, long double y)
|
||||
{ return operator-<> (x, y); }
|
||||
friend inline complex operator - (long double x, const complex& y)
|
||||
{ return operator-<> (x, y); }
|
||||
friend inline complex operator * (const complex& x, long double y)
|
||||
{ return operator*<> (x, y); }
|
||||
friend inline complex operator * (long double x, const complex& y)
|
||||
{ return operator*<> (x, y); }
|
||||
friend inline complex operator / (const complex& x, long double y)
|
||||
{ return operator/<> (x, y); }
|
||||
friend inline complex operator / (long double x, const complex& y)
|
||||
{ return operator/<> (x, y); }
|
||||
friend inline bool operator == (const complex& x, long double y)
|
||||
{ return operator==<> (x, y); }
|
||||
friend inline bool operator == (long double x, const complex& y)
|
||||
{ return operator==<> (x, y); }
|
||||
friend inline bool operator != (const complex& x, long double y)
|
||||
{ return operator!=<> (x, y); }
|
||||
friend inline bool operator != (long double x, const complex& y)
|
||||
{ return operator!=<> (x, y); }
|
||||
#endif /* __STRICT_ANSI__ */
|
||||
};
|
||||
|
||||
inline complex<float>::complex (const complex<long double>& r)
|
||||
: re (r.real ()), im (r.imag ())
|
||||
{ }
|
||||
|
||||
inline complex<double>::complex (const complex<long double>& r)
|
||||
: re (r.real ()), im (r.imag ())
|
||||
{ }
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,154 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- mask_array class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __MASK_ARRAY__
|
||||
#define __MASK_ARRAY__
|
||||
|
||||
extern "C++" {
|
||||
|
||||
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&);
|
||||
|
||||
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 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
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif // __MASK_ARRAY__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,76 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- slice class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __SLICE__
|
||||
#define __SLICE__
|
||||
|
||||
extern "C++" {
|
||||
|
||||
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; }
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif // __SLICE__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,156 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- slice_array class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __SLICE_ARRAY__
|
||||
#define __SLICE_ARRAY__
|
||||
|
||||
extern "C++" {
|
||||
|
||||
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 &);
|
||||
|
||||
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 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
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif // __SLICE_ARRAY__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,737 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- valarray class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __STD_VALARRAY__
|
||||
#define __STD_VALARRAY__
|
||||
#define _G_NO_VALARRAY_TEMPLATE_EXPORT 1
|
||||
|
||||
#include <cstddef>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <numeric>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef alloca
|
||||
#ifdef __GNUC__
|
||||
#define alloca __builtin_alloca
|
||||
#else /* not GNU C. */
|
||||
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
|
||||
#include <alloca.h>
|
||||
#else /* not sparc */
|
||||
#if defined (MSDOS) && !defined (__TURBOC__)
|
||||
#include <malloc.h>
|
||||
#else /* not MSDOS, or __TURBOC__ */
|
||||
#if defined(_AIX)
|
||||
#include <malloc.h>
|
||||
#pragma alloca
|
||||
#else /* not MSDOS, __TURBOC__, or _AIX */
|
||||
#ifdef __hpux
|
||||
#endif /* __hpux */
|
||||
#endif /* not _AIX */
|
||||
#endif /* not MSDOS, or __TURBOC__ */
|
||||
#endif /* not sparc. */
|
||||
#endif /* not GNU C. */
|
||||
#endif /* alloca not defined. */
|
||||
|
||||
extern "C" {
|
||||
void* alloca(size_t);
|
||||
}
|
||||
|
||||
extern "C++" {
|
||||
|
||||
template<class _Clos, typename _Tp> class _Expr;
|
||||
|
||||
template<typename _Tp1, typename _Tp2> class _ValArray;
|
||||
|
||||
template<template<class> class _Oper,
|
||||
template<class, class> class _Meta, class _Dom> struct _UnClos;
|
||||
|
||||
template<template<class> class _Oper,
|
||||
template<class, class> class _Meta1,
|
||||
template<class, class> class _Meta2,
|
||||
class _Dom1, class _Dom2> class _BinClos;
|
||||
|
||||
template<template<class, class> class _Meta, class _Dom> class _SClos;
|
||||
|
||||
template<template<class, class> class _Meta, class _Dom> class _GClos;
|
||||
|
||||
template<template<class, class> class _Meta, class _Dom> class _IClos;
|
||||
|
||||
template<template<class, class> class _Meta, class _Dom> class _ValFunClos;
|
||||
|
||||
template<template<class, class> class _Meta, class _Dom> class _RefFunClos;
|
||||
|
||||
template<class _Tp> struct _Unary_plus;
|
||||
template<class _Tp> struct _Bitwise_and;
|
||||
template<class _Tp> struct _Bitwise_or;
|
||||
template<class _Tp> struct _Bitwise_xor;
|
||||
template<class _Tp> struct _Bitwise_not;
|
||||
template<class _Tp> struct _Shift_left;
|
||||
template<class _Tp> struct _Shift_right;
|
||||
|
||||
template<class _Tp> class valarray; // An array of type _Tp
|
||||
class slice; // BLAS-like slice out of an array
|
||||
template<class _Tp> class slice_array;
|
||||
class gslice; // generalized slice out of an array
|
||||
template<class _Tp> class gslice_array;
|
||||
template<class _Tp> class mask_array; // masked array
|
||||
template<class _Tp> class indirect_array; // indirected array
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#include <std/valarray_array.h>
|
||||
#include <std/valarray_meta.h>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
template<class _Tp> class valarray
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
// _lib.valarray.cons_ construct/destroy:
|
||||
valarray();
|
||||
explicit valarray(size_t);
|
||||
valarray(const _Tp&, size_t);
|
||||
valarray(const _Tp* __restrict__, size_t);
|
||||
valarray(const valarray&);
|
||||
valarray(const slice_array<_Tp>&);
|
||||
valarray(const gslice_array<_Tp>&);
|
||||
valarray(const mask_array<_Tp>&);
|
||||
valarray(const indirect_array<_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray(const _Expr<_Dom,_Tp>& __e);
|
||||
~valarray();
|
||||
|
||||
// _lib.valarray.assign_ assignment:
|
||||
valarray<_Tp>& operator=(const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator=(const _Tp&);
|
||||
valarray<_Tp>& operator=(const slice_array<_Tp>&);
|
||||
valarray<_Tp>& operator=(const gslice_array<_Tp>&);
|
||||
valarray<_Tp>& operator=(const mask_array<_Tp>&);
|
||||
valarray<_Tp>& operator=(const indirect_array<_Tp>&);
|
||||
|
||||
template<class _Dom> valarray<_Tp>&
|
||||
operator= (const _Expr<_Dom,_Tp>&);
|
||||
|
||||
// _lib.valarray.access_ element access:
|
||||
_Tp operator[](size_t) const;
|
||||
_Tp& operator[](size_t);
|
||||
// _lib.valarray.sub_ subset operations:
|
||||
_Expr<_SClos<_ValArray,_Tp>, _Tp> operator[](slice) const;
|
||||
slice_array<_Tp> operator[](slice);
|
||||
_Expr<_GClos<_ValArray,_Tp>, _Tp> operator[](const gslice&) const;
|
||||
gslice_array<_Tp> operator[](const gslice&);
|
||||
valarray<_Tp> operator[](const valarray<bool>&) const;
|
||||
mask_array<_Tp> operator[](const valarray<bool>&);
|
||||
_Expr<_IClos<_ValArray, _Tp>, _Tp>
|
||||
operator[](const valarray<size_t>&) const;
|
||||
indirect_array<_Tp> operator[](const valarray<size_t>&);
|
||||
|
||||
// _lib.valarray.unary_ unary operators:
|
||||
_Expr<_UnClos<_Unary_plus,_ValArray,_Tp>,_Tp> operator+ () const;
|
||||
_Expr<_UnClos<negate,_ValArray,_Tp>,_Tp> operator- () const;
|
||||
_Expr<_UnClos<_Bitwise_not,_ValArray,_Tp>,_Tp> operator~ () const;
|
||||
_Expr<_UnClos<logical_not,_ValArray,_Tp>,bool> operator! () const;
|
||||
|
||||
// _lib.valarray.cassign_ computed assignment:
|
||||
valarray<_Tp>& operator*= (const _Tp&);
|
||||
valarray<_Tp>& operator/= (const _Tp&);
|
||||
valarray<_Tp>& operator%= (const _Tp&);
|
||||
valarray<_Tp>& operator+= (const _Tp&);
|
||||
valarray<_Tp>& operator-= (const _Tp&);
|
||||
valarray<_Tp>& operator^= (const _Tp&);
|
||||
valarray<_Tp>& operator&= (const _Tp&);
|
||||
valarray<_Tp>& operator|= (const _Tp&);
|
||||
valarray<_Tp>& operator<<=(const _Tp&);
|
||||
valarray<_Tp>& operator>>=(const _Tp&);
|
||||
valarray<_Tp>& operator*= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator/= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator%= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator+= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator-= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator^= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator|= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator&= (const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator<<=(const valarray<_Tp>&);
|
||||
valarray<_Tp>& operator>>=(const valarray<_Tp>&);
|
||||
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator*= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator/= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator%= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator+= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator-= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator^= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator|= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator&= (const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator<<=(const _Expr<_Dom,_Tp>&);
|
||||
template<class _Dom>
|
||||
valarray<_Tp>& operator>>=(const _Expr<_Dom,_Tp>&);
|
||||
|
||||
|
||||
// _lib.valarray.members_ member functions:
|
||||
size_t size() const;
|
||||
_Tp sum() const;
|
||||
_Tp min() const;
|
||||
_Tp max() const;
|
||||
|
||||
valarray<_Tp> shift (int) const;
|
||||
valarray<_Tp> cshift(int) const;
|
||||
_Expr<_ValFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(_Tp)) const;
|
||||
_Expr<_RefFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(const _Tp&)) const;
|
||||
void resize(size_t __size, _Tp __c = _Tp());
|
||||
|
||||
private:
|
||||
size_t _M_size;
|
||||
_Tp* __restrict__ _M_data;
|
||||
|
||||
friend class _Array<_Tp>;
|
||||
};
|
||||
|
||||
|
||||
template<typename _Tp> struct _Unary_plus : unary_function<_Tp,_Tp> {
|
||||
_Tp operator() (const _Tp& __t) const { return __t; }
|
||||
};
|
||||
|
||||
template<typename _Tp> struct _Bitwise_and : binary_function<_Tp,_Tp,_Tp> {
|
||||
_Tp operator() (_Tp __x, _Tp __y) const { return __x & __y; }
|
||||
};
|
||||
|
||||
template<typename _Tp> struct _Bitwise_or : binary_function<_Tp,_Tp,_Tp> {
|
||||
_Tp operator() (_Tp __x, _Tp __y) const { return __x | __y; }
|
||||
};
|
||||
|
||||
template<typename _Tp> struct _Bitwise_xor : binary_function<_Tp,_Tp,_Tp> {
|
||||
_Tp operator() (_Tp __x, _Tp __y) const { return __x ^ __y; }
|
||||
};
|
||||
|
||||
template<typename _Tp> struct _Bitwise_not : unary_function<_Tp,_Tp> {
|
||||
_Tp operator() (_Tp __t) const { return ~__t; }
|
||||
};
|
||||
|
||||
template<typename _Tp> struct _Shift_left : unary_function<_Tp,_Tp> {
|
||||
_Tp operator() (_Tp __x, _Tp __y) const { return __x << __y; }
|
||||
};
|
||||
|
||||
template<typename _Tp> struct _Shift_right : unary_function<_Tp,_Tp> {
|
||||
_Tp operator() (_Tp __x, _Tp __y) const { return __x >> __y; }
|
||||
};
|
||||
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp
|
||||
valarray<_Tp>::operator[] (size_t __i) const
|
||||
{ return _M_data[__i]; }
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp&
|
||||
valarray<_Tp>::operator[] (size_t __i)
|
||||
{ return _M_data[__i]; }
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#include <std/slice.h>
|
||||
#include <std/slice_array.h>
|
||||
#include <std/gslice.h>
|
||||
#include <std/gslice_array.h>
|
||||
#include <std/mask_array.h>
|
||||
#include <std/indirect_array.h>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray () : _M_size (0), _M_data (0) {}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (size_t __n)
|
||||
: _M_size (__n), _M_data(__valarray_get_storage<_Tp>(__n))
|
||||
{ __valarray_default_construct(_M_data, _M_data + __n); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (const _Tp& __t, size_t __n)
|
||||
: _M_size (__n), _M_data(__valarray_get_storage<_Tp>(__n))
|
||||
{ __valarray_fill_construct(_M_data, _M_data + __n, __t); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (const _Tp* __restrict__ __pT, size_t __n)
|
||||
: _M_size (__n), _M_data(__valarray_get_storage<_Tp>(__n))
|
||||
{ __valarray_copy_construct(__pT, __pT + __n, _M_data); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (const valarray<_Tp>& __v)
|
||||
: _M_size (__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size))
|
||||
{ __valarray_copy_construct (__v._M_data, __v._M_data + _M_size, _M_data); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (const slice_array<_Tp>& __sa)
|
||||
: _M_size (__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz))
|
||||
{
|
||||
__valarray_copy
|
||||
(__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data));
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (const gslice_array<_Tp>& __ga)
|
||||
: _M_size (__ga._M_index.size()),
|
||||
_M_data(__valarray_get_storage<_Tp>(_M_size))
|
||||
{
|
||||
__valarray_copy
|
||||
(__ga._M_array, _Array<size_t>(__ga._M_index),
|
||||
_Array<_Tp>(_M_data), _M_size);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (const mask_array<_Tp>& __ma)
|
||||
: _M_size (__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz))
|
||||
{
|
||||
__valarray_copy
|
||||
(__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::valarray (const indirect_array<_Tp>& __ia)
|
||||
: _M_size (__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_size))
|
||||
{
|
||||
__valarray_copy
|
||||
(__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size);
|
||||
}
|
||||
|
||||
template<typename _Tp> template<class _Dom>
|
||||
inline valarray<_Tp>::valarray (const _Expr<_Dom, _Tp>& __e)
|
||||
: _M_size (__e.size ()), _M_data (__valarray_get_storage<_Tp>(_M_size))
|
||||
{ __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data)); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>::~valarray ()
|
||||
{
|
||||
__valarray_destroy_elements(_M_data, _M_data + _M_size);
|
||||
__valarray_release_storage(_M_data);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>&
|
||||
valarray<_Tp>::operator= (const valarray<_Tp>& __v)
|
||||
{
|
||||
__valarray_copy(__v._M_data, _M_size, _M_data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>&
|
||||
valarray<_Tp>::operator= (const _Tp& __t)
|
||||
{
|
||||
__valarray_fill (_M_data, _M_size, __t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>&
|
||||
valarray<_Tp>::operator= (const slice_array<_Tp>& __sa)
|
||||
{
|
||||
__valarray_copy (__sa._M_array, __sa._M_sz,
|
||||
__sa._M_stride, _Array<_Tp>(_M_data));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>&
|
||||
valarray<_Tp>::operator= (const gslice_array<_Tp>& __ga)
|
||||
{
|
||||
__valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index),
|
||||
_Array<_Tp>(_M_data), _M_size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>&
|
||||
valarray<_Tp>::operator= (const mask_array<_Tp>& __ma)
|
||||
{
|
||||
__valarray_copy (__ma._M_array, __ma._M_mask,
|
||||
_Array<_Tp>(_M_data), _M_size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>&
|
||||
valarray<_Tp>::operator= (const indirect_array<_Tp>& __ia)
|
||||
{
|
||||
__valarray_copy (__ia._M_array, __ia._M_index,
|
||||
_Array<_Tp>(_M_data), _M_size);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp> template<class _Dom>
|
||||
inline valarray<_Tp>&
|
||||
valarray<_Tp>::operator= (const _Expr<_Dom, _Tp>& __e)
|
||||
{
|
||||
__valarray_copy (__e, _M_size, _Array<_Tp>(_M_data));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
|
||||
valarray<_Tp>::operator[] (slice __s) const
|
||||
{
|
||||
typedef _SClos<_ValArray,_Tp> _Closure;
|
||||
return _Expr<_Closure, _Tp> (_Closure (_Array<_Tp>(_M_data), __s));
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline slice_array<_Tp>
|
||||
valarray<_Tp>::operator[] (slice __s)
|
||||
{
|
||||
return slice_array<_Tp> (_Array<_Tp>(_M_data), __s);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
|
||||
valarray<_Tp>::operator[] (const gslice& __gs) const
|
||||
{
|
||||
typedef _GClos<_ValArray,_Tp> _Closure;
|
||||
return _Expr<_Closure, _Tp>
|
||||
(_Closure (_Array<_Tp>(_M_data), __gs._M_index->_M_index));
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline gslice_array<_Tp>
|
||||
valarray<_Tp>::operator[] (const gslice& __gs)
|
||||
{
|
||||
return gslice_array<_Tp>
|
||||
(_Array<_Tp>(_M_data), __gs._M_index->_M_index);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline valarray<_Tp>
|
||||
valarray<_Tp>::operator[] (const valarray<bool>& __m) const
|
||||
{
|
||||
size_t __s (0);
|
||||
size_t __e (__m.size ());
|
||||
for (size_t __i=0; __i<__e; ++__i)
|
||||
if (__m[__i]) ++__s;
|
||||
return valarray<_Tp> (mask_array<_Tp> (_Array<_Tp>(_M_data), __s,
|
||||
_Array<bool> (__m)));
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline mask_array<_Tp>
|
||||
valarray<_Tp>::operator[] (const valarray<bool>& __m)
|
||||
{
|
||||
size_t __s (0);
|
||||
size_t __e (__m.size ());
|
||||
for (size_t __i=0; __i<__e; ++__i)
|
||||
if (__m[__i]) ++__s;
|
||||
return mask_array<_Tp> (_Array<_Tp>(_M_data), __s, _Array<bool> (__m));
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
|
||||
valarray<_Tp>::operator[] (const valarray<size_t>& __i) const
|
||||
{
|
||||
typedef _IClos<_ValArray,_Tp> _Closure;
|
||||
return _Expr<_Closure, _Tp> (_Closure (*this, __i));
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline indirect_array<_Tp>
|
||||
valarray<_Tp>::operator[] (const valarray<size_t>& __i)
|
||||
{
|
||||
return indirect_array<_Tp> (_Array<_Tp>(_M_data), __i.size(),
|
||||
_Array<size_t> (__i));
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline size_t valarray<_Tp>::size () const { return _M_size; }
|
||||
|
||||
template<class _Tp>
|
||||
inline _Tp
|
||||
valarray<_Tp>::sum () const
|
||||
{
|
||||
return __valarray_sum(_M_data, _M_data + _M_size);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline valarray<_Tp>
|
||||
valarray<_Tp>::shift (int __n) const
|
||||
{
|
||||
_Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size));
|
||||
if (! __n) // __n == 0: no shift
|
||||
__valarray_copy_construct (_M_data, _M_size, __a);
|
||||
else if (__n > 0) { // __n > 0: shift left
|
||||
if (__n > _M_size)
|
||||
__valarray_default_construct(__a, __a + __n);
|
||||
else {
|
||||
__valarray_copy_construct (_M_data+__n, _M_size-__n, __a);
|
||||
__valarray_default_construct (__a+_M_size-__n, __a + _M_size);
|
||||
}
|
||||
}
|
||||
else { // __n < 0: shift right
|
||||
__valarray_copy_construct (_M_data, _M_data+_M_size+__n, __a-__n);
|
||||
__valarray_default_construct(__a, __a-__n);
|
||||
}
|
||||
return valarray<_Tp> (__a, _M_size);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline valarray<_Tp>
|
||||
valarray<_Tp>::cshift (int __n) const
|
||||
{
|
||||
_Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size));
|
||||
if (__n == 0) // __n == 0: no cshift
|
||||
__valarray_copy_construct(_M_data, _M_data + _M_size, __a);
|
||||
else if (__n > 0) { // __n > 0: cshift left
|
||||
__valarray_copy_construct (_M_data, _M_data + __n, __a + _M_size-__n);
|
||||
__valarray_copy_construct (_M_data + __n, _M_data + _M_size, __a);
|
||||
}
|
||||
else { // __n < 0: cshift right
|
||||
__valarray_copy_construct
|
||||
(_M_data + _M_size + __n, _M_data + _M_size, __a);
|
||||
__valarray_copy_construct
|
||||
(_M_data, _M_data + _M_size + __n, __a - __n);
|
||||
}
|
||||
return valarray<_Tp> (__a, _M_size);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline void
|
||||
valarray<_Tp>::resize (size_t __n, _Tp __c)
|
||||
{
|
||||
// this is so to make valarray<valarray<T> > work
|
||||
// even though it is not required by the standard.
|
||||
__valarray_destroy_elements(_M_data, _M_data + _M_size);
|
||||
if (_M_size != __n) {
|
||||
__valarray_release_storage(_M_data);
|
||||
_M_size = __n;
|
||||
_M_data = __valarray_get_storage<_Tp>(__n);
|
||||
}
|
||||
__valarray_fill_construct (_M_data, _M_data + _M_size, __c);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp
|
||||
valarray<_Tp>::min() const
|
||||
{
|
||||
return *min_element (_M_data, _M_data+_M_size);
|
||||
}
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp
|
||||
valarray<_Tp>::max() const
|
||||
{
|
||||
return *max_element (_M_data, _M_data+_M_size);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _Expr<_ValFunClos<_ValArray,_Tp>,_Tp>
|
||||
valarray<_Tp>::apply (_Tp func (_Tp)) const
|
||||
{
|
||||
typedef _ValFunClos<_ValArray,_Tp> _Closure;
|
||||
return _Expr<_Closure,_Tp> (_Closure (*this, func));
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _Expr<_RefFunClos<_ValArray,_Tp>,_Tp>
|
||||
valarray<_Tp>::apply (_Tp func (const _Tp &)) const
|
||||
{
|
||||
typedef _RefFunClos<_ValArray,_Tp> _Closure;
|
||||
return _Expr<_Closure,_Tp> (_Closure (*this, func));
|
||||
}
|
||||
|
||||
#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
|
||||
template<typename _Tp> \
|
||||
inline _Expr<_UnClos<_Name,_ValArray,_Tp>, _Tp> \
|
||||
valarray<_Tp>::operator _Op() const \
|
||||
{ \
|
||||
typedef _UnClos<_Name,_ValArray,_Tp> _Closure; \
|
||||
return _Expr<_Closure, _Tp> (_Closure (*this)); \
|
||||
}
|
||||
|
||||
_DEFINE_VALARRAY_UNARY_OPERATOR(+, _Unary_plus)
|
||||
_DEFINE_VALARRAY_UNARY_OPERATOR(-, negate)
|
||||
_DEFINE_VALARRAY_UNARY_OPERATOR(~, _Bitwise_not)
|
||||
|
||||
#undef _DEFINE_VALARRAY_UNARY_OPERATOR
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Expr<_UnClos<logical_not,_ValArray,_Tp>, bool>
|
||||
valarray<_Tp>::operator!() const
|
||||
{
|
||||
typedef _UnClos<logical_not,_ValArray,_Tp> _Closure;
|
||||
return _Expr<_Closure, bool> (_Closure (*this));
|
||||
}
|
||||
|
||||
#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
|
||||
template<class _Tp> \
|
||||
inline valarray<_Tp> & \
|
||||
valarray<_Tp>::operator _Op##= (const _Tp &__t) \
|
||||
{ \
|
||||
_Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t); \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
template<class _Tp> \
|
||||
inline valarray<_Tp> & \
|
||||
valarray<_Tp>::operator _Op##= (const valarray<_Tp> &__v) \
|
||||
{ \
|
||||
_Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, \
|
||||
_Array<_Tp>(__v._M_data)); \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, plus)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, minus)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, multiplies)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, divides)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, modulus)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, xor)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, and)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, or)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, shift_left)
|
||||
_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, shift_right)
|
||||
|
||||
#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
|
||||
|
||||
|
||||
#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
|
||||
template<class _Tp> template<class _Dom> \
|
||||
inline valarray<_Tp> & \
|
||||
valarray<_Tp>::operator _Op##= (const _Expr<_Dom,_Tp> &__e) \
|
||||
{ \
|
||||
_Array_augmented_##_Name (_Array<_Tp>(_M_data), __e, _M_size); \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, plus)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, minus)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, multiplies)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, divides)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, modulus)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, xor)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, and)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, or)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, shift_left)
|
||||
_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, shift_right)
|
||||
|
||||
#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
|
||||
|
||||
|
||||
#define _DEFINE_BINARY_OPERATOR(_Op, _Name) \
|
||||
template<typename _Tp> \
|
||||
inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>, _Tp> \
|
||||
operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \
|
||||
{ \
|
||||
typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
|
||||
return _Expr<_Closure, _Tp> (_Closure (__v, __w)); \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,_Tp> \
|
||||
operator _Op (const valarray<_Tp> &__v, const _Tp &__t) \
|
||||
{ \
|
||||
typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \
|
||||
return _Expr<_Closure, _Tp> (_Closure (__v, __t)); \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,_Tp> \
|
||||
operator _Op (const _Tp &__t, const valarray<_Tp> &__v) \
|
||||
{ \
|
||||
typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \
|
||||
return _Expr<_Closure, _Tp> (_Closure (__t, __v)); \
|
||||
}
|
||||
|
||||
_DEFINE_BINARY_OPERATOR(+, plus)
|
||||
_DEFINE_BINARY_OPERATOR(-, minus)
|
||||
_DEFINE_BINARY_OPERATOR(*, multiplies)
|
||||
_DEFINE_BINARY_OPERATOR(/, divides)
|
||||
_DEFINE_BINARY_OPERATOR(%, modulus)
|
||||
_DEFINE_BINARY_OPERATOR(^, _Bitwise_xor)
|
||||
_DEFINE_BINARY_OPERATOR(&, _Bitwise_and)
|
||||
_DEFINE_BINARY_OPERATOR(|, _Bitwise_or)
|
||||
_DEFINE_BINARY_OPERATOR(<<, _Shift_left)
|
||||
_DEFINE_BINARY_OPERATOR(>>, _Shift_right)
|
||||
|
||||
#undef _DEFINE_BINARY_OPERATOR
|
||||
|
||||
#define _DEFINE_LOGICAL_OPERATOR(_Op, _Name) \
|
||||
template<typename _Tp> \
|
||||
inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,bool> \
|
||||
operator _Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \
|
||||
{ \
|
||||
typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
|
||||
return _Expr<_Closure, bool> (_Closure (__v, __w)); \
|
||||
} \
|
||||
\
|
||||
template<class _Tp> \
|
||||
inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,bool> \
|
||||
operator _Op (const valarray<_Tp> &__v, const _Tp &__t) \
|
||||
{ \
|
||||
typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \
|
||||
return _Expr<_Closure, bool> (_Closure (__v, __t)); \
|
||||
} \
|
||||
\
|
||||
template<class _Tp> \
|
||||
inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool> \
|
||||
operator _Op (const _Tp &__t, const valarray<_Tp> &__v) \
|
||||
{ \
|
||||
typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \
|
||||
return _Expr<_Closure, bool> (_Closure (__t, __v)); \
|
||||
}
|
||||
|
||||
_DEFINE_LOGICAL_OPERATOR(&&, logical_and)
|
||||
_DEFINE_LOGICAL_OPERATOR(||, logical_or)
|
||||
_DEFINE_LOGICAL_OPERATOR(==, equal_to)
|
||||
_DEFINE_LOGICAL_OPERATOR(!=, not_equal_to)
|
||||
_DEFINE_LOGICAL_OPERATOR(<, less)
|
||||
_DEFINE_LOGICAL_OPERATOR(>, greater)
|
||||
_DEFINE_LOGICAL_OPERATOR(<=, less_equal)
|
||||
_DEFINE_LOGICAL_OPERATOR(>=, greater_equal)
|
||||
|
||||
#undef _DEFINE_VALARRAY_OPERATOR
|
||||
|
||||
#undef _G_NO_VALARRAY_TEMPLATE_EXPORT
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif // __STD_VALARRAY__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,161 +0,0 @@
|
||||
// Character traits template for the -*- C++ -*- string classes.
|
||||
// Copyright (C) 1994, 2000 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Jason Merrill based upon the specification by Takanori Adachi
|
||||
// in ANSI X3J16/94-0013R2.
|
||||
|
||||
#ifndef __STRING_CHAR_TRAITS__
|
||||
#define __STRING_CHAR_TRAITS__
|
||||
|
||||
#ifdef __GNUG__
|
||||
// For string_char_traits <char>
|
||||
#pragma interface "std/straits.h"
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
extern "C++" {
|
||||
template <class charT>
|
||||
struct string_char_traits {
|
||||
typedef charT char_type; // for users to acquire the basic character type
|
||||
|
||||
// constraints
|
||||
|
||||
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 ne (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 char_type eos () { return char_type(); } // the null character
|
||||
static bool is_del(char_type a) { return 0; }
|
||||
// characteristic function for delimiters of charT
|
||||
|
||||
// speed-up functions
|
||||
|
||||
static int compare (const char_type* s1, const char_type* s2, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < n; ++i)
|
||||
if (ne (s1[i], s2[i]))
|
||||
return lt (s1[i], s2[i]) ? -1 : 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t length (const char_type* s)
|
||||
{
|
||||
size_t l = 0;
|
||||
while (ne (*s++, eos ()))
|
||||
++l;
|
||||
return l;
|
||||
}
|
||||
|
||||
static char_type* copy (char_type* s1, const char_type* s2, size_t n)
|
||||
{
|
||||
for (; n--; )
|
||||
assign (s1[n], s2[n]);
|
||||
return s1;
|
||||
}
|
||||
|
||||
static char_type* move (char_type* s1, const char_type* s2, size_t n)
|
||||
{
|
||||
char_type a[n];
|
||||
size_t i;
|
||||
for (i = 0; i < n; ++i)
|
||||
assign (a[i], s2[i]);
|
||||
for (i = 0; i < n; ++i)
|
||||
assign (s1[i], a[i]);
|
||||
return s1;
|
||||
}
|
||||
|
||||
static char_type* set (char_type* s1, const char_type& c, size_t n)
|
||||
{
|
||||
for (; n--; )
|
||||
assign (s1[n], c);
|
||||
return s1;
|
||||
}
|
||||
};
|
||||
|
||||
class istream;
|
||||
class ostream;
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
|
||||
struct string_char_traits <char> {
|
||||
typedef char char_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 ne (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 char_type eos () { return 0; }
|
||||
static bool is_del(char_type a) { return !!isspace(a); }
|
||||
|
||||
static int compare (const char_type* s1, const char_type* s2, size_t n)
|
||||
{ return memcmp (s1, s2, n); }
|
||||
static size_t length (const char_type* s)
|
||||
{ return strlen (s); }
|
||||
static char_type* copy (char_type* s1, const char_type* s2, size_t n)
|
||||
{ return (char_type*) memcpy (s1, s2, n); }
|
||||
static char_type* move (char_type* s1, const char_type* s2, size_t n)
|
||||
{ return (char_type*) memmove (s1, s2, n); }
|
||||
static char_type* set (char_type* s1, const char_type& c, size_t n)
|
||||
{ return (char_type*) memset (s1, c, n); }
|
||||
};
|
||||
|
||||
#if 0
|
||||
#include <cwctype>
|
||||
struct string_char_traits <wchar_t> {
|
||||
typedef wchar_t char_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 ne (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 char_type eos () { return 0; }
|
||||
static bool is_del(char_type a) { return !!iswspace(a); }
|
||||
|
||||
static int compare (const char_type* s1, const char_type* s2, size_t n)
|
||||
{ return wmemcmp (s1, s2, n); }
|
||||
static size_t length (const char_type* s)
|
||||
{ return wcslen (s); }
|
||||
static char_type* copy (char_type* s1, const char_type* s2, size_t n)
|
||||
{ return wmemcpy (s1, s2, n); }
|
||||
static char_type* set (char_type* s1, const char_type& c, size_t n)
|
||||
{ return wmemset (s1, c, n); }
|
||||
};
|
||||
#endif
|
||||
} // extern "C++"
|
||||
#endif
|
@ -1,538 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- internal _Array helper class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __VALARRAY_ARRAY__
|
||||
#define __VALARRAY_ARRAY__
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <std/cpp_type_traits.h>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
//
|
||||
// Helper functions on raw pointers
|
||||
//
|
||||
|
||||
inline void*
|
||||
__valarray_get_memory(size_t __n)
|
||||
{ return operator new(__n); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp*__restrict__
|
||||
__valarray_get_storage(size_t __n)
|
||||
{
|
||||
return static_cast<_Tp*__restrict__>
|
||||
(__valarray_get_memory(__n * sizeof(_Tp)));
|
||||
}
|
||||
|
||||
// Return memory to the system
|
||||
inline void
|
||||
__valarray_release_storage(void* __p)
|
||||
{ operator delete(__p); }
|
||||
|
||||
// Turn a raw-memory into an array of _Tp filled with _Tp()
|
||||
// This is required in 'valarray<T> v(n);'
|
||||
template<typename _Tp, bool>
|
||||
struct _Array_default_ctor
|
||||
{
|
||||
// Please note that this isn't exception safe. But
|
||||
// valarrays aren't required to be exception safe.
|
||||
inline static void
|
||||
_S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
|
||||
{ while (__b != __e) new(__b++) _Tp(); }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Array_default_ctor<_Tp, true>
|
||||
{
|
||||
// For fundamental types, it suffices to say 'memset()'
|
||||
inline static void
|
||||
_S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
|
||||
{ memset(__b, 0, (__e - __b)*sizeof(_Tp)); }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_default_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
|
||||
{
|
||||
_Array_default_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
|
||||
_S_do_it(__b, __e);
|
||||
}
|
||||
|
||||
// Turn a raw-memory into an array of _Tp filled with __t
|
||||
// This is the required in valarray<T> v(n, t). Also
|
||||
// used in valarray<>::resize().
|
||||
template<typename _Tp, bool>
|
||||
struct _Array_init_ctor
|
||||
{
|
||||
// Please note that this isn't exception safe. But
|
||||
// valarrays aren't required to be exception safe.
|
||||
inline static void
|
||||
_S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e, const _Tp __t)
|
||||
{ while (__b != __e) new(__b++) _Tp(__t); }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Array_init_ctor<_Tp, true>
|
||||
{
|
||||
inline static void
|
||||
_S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e, const _Tp __t)
|
||||
{ while (__b != __e) *__b++ = __t; }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_fill_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e,
|
||||
const _Tp __t)
|
||||
{
|
||||
_Array_init_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
|
||||
_S_do_it(__b, __e, __t);
|
||||
}
|
||||
|
||||
//
|
||||
// copy-construct raw array [__o, *) from plain array [__b, __e)
|
||||
// We can't just say 'memcpy()'
|
||||
//
|
||||
template<typename _Tp, bool>
|
||||
struct _Array_copy_ctor
|
||||
{
|
||||
// Please note that this isn't exception safe. But
|
||||
// valarrays aren't required to be exception safe.
|
||||
inline static void
|
||||
_S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,
|
||||
_Tp* __restrict__ __o)
|
||||
{ while (__b != __e) new(__o++) _Tp(*__b++); }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Array_copy_ctor<_Tp, true>
|
||||
{
|
||||
inline static void
|
||||
_S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,
|
||||
_Tp* __restrict__ __o)
|
||||
{ memcpy(__o, __b, (__e - __b)*sizeof(_Tp)); }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy_construct(const _Tp* __restrict__ __b,
|
||||
const _Tp* __restrict__ __e,
|
||||
_Tp* __restrict__ __o)
|
||||
{
|
||||
_Array_copy_ctor<_Tp, __is_fundamental<_Tp>::_M_type>::
|
||||
_S_do_it(__b, __e, __o);
|
||||
}
|
||||
|
||||
// copy-construct raw array [__o, *) from strided array __a[<__n : __s>]
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n,
|
||||
size_t __s, _Tp* __restrict__ __o)
|
||||
{
|
||||
if (__is_fundamental<_Tp>::_M_type)
|
||||
while (__n--) { *__o++ = *__a; __a += __s; }
|
||||
else
|
||||
while (__n--) { new(__o++) _Tp(*__a); __a += __s; }
|
||||
}
|
||||
|
||||
// copy-construct raw array [__o, *) from indexed array __a[__i[<__n>]]
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy_construct (const _Tp* __restrict__ __a,
|
||||
const size_t* __restrict__ __i,
|
||||
_Tp* __restrict__ __o, size_t __n)
|
||||
{
|
||||
if (__is_fundamental<_Tp>::_M_type)
|
||||
while (__n--) *__o++ = __a[*__i++];
|
||||
else
|
||||
while (__n--) new (__o++) _Tp(__a[*__i++]);
|
||||
}
|
||||
|
||||
// Do the necessary cleanup when we're done with arrays.
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_destroy_elements(_Tp* __restrict__ __b, _Tp* __restrict__ __e)
|
||||
{
|
||||
if (!__is_fundamental<_Tp>::_M_type)
|
||||
while (__b != __e) { __b->~_Tp(); ++__b; }
|
||||
}
|
||||
|
||||
|
||||
// fill plain array __a[<__n>] with __t
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_fill (_Tp* __restrict__ __a, size_t __n, const _Tp& __t)
|
||||
{ while (__n--) *__a++ = __t; }
|
||||
|
||||
// fill strided array __a[<__n-1 : __s>] with __t
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_fill (_Tp* __restrict__ __a, size_t __n,
|
||||
size_t __s, const _Tp& __t)
|
||||
{ for (size_t __i=0; __i<__n; ++__i, __a+=__s) *__a = __t; }
|
||||
|
||||
// fill indirect array __a[__i[<__n>]] with __i
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i,
|
||||
size_t __n, const _Tp& __t)
|
||||
{ for (size_t __j=0; __j<__n; ++__j, ++__i) __a[*__i] = __t; }
|
||||
|
||||
// copy plain array __a[<__n>] in __b[<__n>]
|
||||
// For non-fundamental types, it is wrong to say 'memcpy()'
|
||||
template<typename _Tp, bool>
|
||||
struct _Array_copier
|
||||
{
|
||||
inline static void
|
||||
_S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)
|
||||
{ while (__n--) *__b++ = *__a++; }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Array_copier<_Tp, true>
|
||||
{
|
||||
inline static void
|
||||
_S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)
|
||||
{ memcpy (__b, __a, __n * sizeof (_Tp)); }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (const _Tp* __restrict__ __a, size_t __n,
|
||||
_Tp* __restrict__ __b)
|
||||
{
|
||||
_Array_copier<_Tp, __is_fundamental<_Tp>::_M_type>::
|
||||
_S_do_it(__a, __n, __b);
|
||||
}
|
||||
|
||||
// copy strided array __a[<__n : __s>] in plain __b[<__n>]
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (const _Tp* __restrict__ __a, size_t __n, size_t __s,
|
||||
_Tp* __restrict__ __b)
|
||||
{ for (size_t __i=0; __i<__n; ++__i, ++__b, __a += __s) *__b = *__a; }
|
||||
|
||||
// copy plain __a[<__n>] in strided __b[<__n : __s>]
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (const _Tp* __restrict__ __a, _Tp* __restrict__ __b,
|
||||
size_t __n, size_t __s)
|
||||
{ for (size_t __i=0; __i<__n; ++__i, ++__a, __b+=__s) *__b = *__a; }
|
||||
|
||||
// copy indexed __a[__i[<__n>]] in plain __b[<__n>]
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (const _Tp* __restrict__ __a,
|
||||
const size_t* __restrict__ __i,
|
||||
_Tp* __restrict__ __b, size_t __n)
|
||||
{ for (size_t __j=0; __j<__n; ++__j, ++__b, ++__i) *__b = __a[*__i]; }
|
||||
|
||||
// copy plain __a[<__n>] in indexed __b[__i[<__n>]]
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (const _Tp* __restrict__ __a, size_t __n,
|
||||
_Tp* __restrict__ __b, const size_t* __restrict__ __i)
|
||||
{ for (size_t __j=0; __j<__n; ++__j, ++__a, ++__i) __b[*__i] = *__a; }
|
||||
|
||||
//
|
||||
// Compute the sum of elements in range [__f, __l)
|
||||
// This is a naive algorithm. It suffers from cancelling.
|
||||
// In the future try to specialize
|
||||
// for _Tp = float, double, long double using a more accurate
|
||||
// algorithm.
|
||||
//
|
||||
template<typename _Tp>
|
||||
inline _Tp
|
||||
__valarray_sum(const _Tp* __restrict__ __f, const _Tp* __restrict__ __l)
|
||||
{
|
||||
_Tp __r = _Tp();
|
||||
while (__f != __l) __r = __r + *__f++;
|
||||
return __r;
|
||||
}
|
||||
|
||||
// Compute the product of all elements in range [__f, __l)
|
||||
template<typename _Tp>
|
||||
inline _Tp
|
||||
__valarray_product(const _Tp* __restrict__ __f,
|
||||
const _Tp* __restrict__ __l)
|
||||
{
|
||||
_Tp __r = _Tp(1);
|
||||
while (__f != __l) __r = __r * *__f++;
|
||||
return __r;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Helper class _Array, first layer of valarray abstraction.
|
||||
// All operations on valarray should be forwarded to this class
|
||||
// whenever possible. -- gdr
|
||||
//
|
||||
|
||||
template<typename _Tp> struct _Array {
|
||||
|
||||
explicit _Array (size_t);
|
||||
explicit _Array (_Tp* const __restrict__);
|
||||
explicit _Array (const valarray<_Tp>&);
|
||||
_Array (const _Tp* __restrict__, size_t);
|
||||
|
||||
_Tp* begin () const;
|
||||
|
||||
_Tp* const __restrict__ _M_data;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t)
|
||||
{ __valarray_fill (__a._M_data, __n, __t); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_fill (_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t)
|
||||
{ __valarray_fill (__a._M_data, __n, __s, __t); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_fill (_Array<_Tp> __a, _Array<size_t> __i,
|
||||
size_t __n, const _Tp& __t)
|
||||
{ __valarray_fill (__a._M_data, __i._M_data, __n, __t); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b)
|
||||
{ __valarray_copy (__a._M_data, __n, __b._M_data); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b)
|
||||
{ __valarray_copy(__a._M_data, __n, __s, __b._M_data); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s)
|
||||
{ __valarray_copy (__a._M_data, __b._M_data, __n, __s); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (_Array<_Tp> __a, _Array<size_t> __i,
|
||||
_Array<_Tp> __b, size_t __n)
|
||||
{ __valarray_copy (__a._M_data, __i._M_data, __b._M_data, __n); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline void
|
||||
__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,
|
||||
_Array<size_t> __i)
|
||||
{ __valarray_copy (__a._M_data, __n, __b._M_data, __i._M_data); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline
|
||||
_Array<_Tp>::_Array (size_t __n)
|
||||
: _M_data (__valarray_get_storage<_Tp>(__n))
|
||||
{ __valarray_default_construct(_M_data, _M_data + __n); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline
|
||||
_Array<_Tp>::_Array (_Tp* const __restrict__ __p) : _M_data (__p) {}
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Array<_Tp>::_Array (const valarray<_Tp>& __v)
|
||||
: _M_data (__v._M_data) {}
|
||||
|
||||
template<typename _Tp>
|
||||
inline
|
||||
_Array<_Tp>::_Array (const _Tp* __restrict__ __b, size_t __s)
|
||||
: _M_data (__valarray_get_storage<_Tp>(__s ))
|
||||
{ __valarray_copy_construct(__b, __s, _M_data); }
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp*
|
||||
_Array<_Tp>::begin () const
|
||||
{ return _M_data; }
|
||||
|
||||
#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \
|
||||
template<typename _Tp> \
|
||||
inline void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, const _Tp& __t) \
|
||||
{ \
|
||||
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p) \
|
||||
*__p _Op##= __t; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
inline void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \
|
||||
{ \
|
||||
_Tp* __p (__a._M_data); \
|
||||
for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__p, ++__q) \
|
||||
*__p _Op##= *__q; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp, class _Dom> \
|
||||
void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, \
|
||||
const _Expr<_Dom,_Tp>& __e, size_t __n) \
|
||||
{ \
|
||||
_Tp* __p (__a._M_data); \
|
||||
for (size_t __i=0; __i<__n; ++__i, ++__p) *__p _Op##= __e[__i]; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
inline void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, size_t __s, \
|
||||
_Array<_Tp> __b) \
|
||||
{ \
|
||||
_Tp* __q (__b._M_data); \
|
||||
for (_Tp* __p=__a._M_data; __p<__a._M_data+__s*__n; __p+=__s, ++__q) \
|
||||
*__p _Op##= *__q; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
inline void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<_Tp> __b, \
|
||||
size_t __n, size_t __s) \
|
||||
{ \
|
||||
_Tp* __q (__b._M_data); \
|
||||
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, __q+=__s) \
|
||||
*__p _Op##= *__q; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp, class _Dom> \
|
||||
void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __s, \
|
||||
const _Expr<_Dom,_Tp>& __e, size_t __n) \
|
||||
{ \
|
||||
_Tp* __p (__a._M_data); \
|
||||
for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p _Op##= __e[__i]; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
inline void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
|
||||
_Array<_Tp> __b, size_t __n) \
|
||||
{ \
|
||||
_Tp* __q (__b._M_data); \
|
||||
for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__q) \
|
||||
__a._M_data[*__j] _Op##= *__q; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
inline void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
|
||||
_Array<_Tp> __b, _Array<size_t> __i) \
|
||||
{ \
|
||||
_Tp* __p (__a._M_data); \
|
||||
for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__p) \
|
||||
*__p _Op##= __b._M_data[*__j]; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp, class _Dom> \
|
||||
void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
|
||||
const _Expr<_Dom, _Tp>& __e, size_t __n) \
|
||||
{ \
|
||||
size_t* __j (__i._M_data); \
|
||||
for (size_t __k=0; __k<__n; ++__k, ++__j) \
|
||||
__a._M_data[*__j] _Op##= __e[__k]; \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
|
||||
_Array<_Tp> __b, size_t __n) \
|
||||
{ \
|
||||
bool* ok (__m._M_data); \
|
||||
_Tp* __p (__a._M_data); \
|
||||
for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++ok, ++__p) { \
|
||||
while (! *ok) { \
|
||||
++ok; \
|
||||
++__p; \
|
||||
} \
|
||||
*__p _Op##= *__q; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp> \
|
||||
void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
|
||||
_Array<_Tp> __b, _Array<bool> __m) \
|
||||
{ \
|
||||
bool* ok (__m._M_data); \
|
||||
_Tp* __q (__b._M_data); \
|
||||
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++ok, ++__q) { \
|
||||
while (! *ok) { \
|
||||
++ok; \
|
||||
++__q; \
|
||||
} \
|
||||
*__p _Op##= *__q; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template<typename _Tp, class _Dom> \
|
||||
void \
|
||||
_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
|
||||
const _Expr<_Dom, _Tp>& __e, size_t __n) \
|
||||
{ \
|
||||
bool* ok(__m._M_data); \
|
||||
_Tp* __p (__a._M_data); \
|
||||
for (size_t __i=0; __i<__n; ++__i, ++ok, ++__p) { \
|
||||
while (! *ok) { \
|
||||
++ok; \
|
||||
++__p; \
|
||||
} \
|
||||
*__p _Op##= __e[__i]; \
|
||||
} \
|
||||
}
|
||||
|
||||
_DEFINE_ARRAY_FUNCTION(+, plus)
|
||||
_DEFINE_ARRAY_FUNCTION(-, minus)
|
||||
_DEFINE_ARRAY_FUNCTION(*, multiplies)
|
||||
_DEFINE_ARRAY_FUNCTION(/, divides)
|
||||
_DEFINE_ARRAY_FUNCTION(%, modulus)
|
||||
_DEFINE_ARRAY_FUNCTION(^, xor)
|
||||
_DEFINE_ARRAY_FUNCTION(|, or)
|
||||
_DEFINE_ARRAY_FUNCTION(&, and)
|
||||
_DEFINE_ARRAY_FUNCTION(<<, shift_left)
|
||||
_DEFINE_ARRAY_FUNCTION(>>, shift_right)
|
||||
|
||||
#undef _DEFINE_ARRAY_FUNCTION
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#ifdef _G_NO_VALARRAY_TEMPLATE_EXPORT
|
||||
# define export
|
||||
# include <std/valarray_array.tcc>
|
||||
#endif
|
||||
|
||||
#endif // __VALARRAY_ARRAY__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
@ -1,130 +0,0 @@
|
||||
// The template and inlines for the -*- C++ -*- internal _Array helper class.
|
||||
|
||||
// Copyright (C) 1997-1999 Cygnus Solutions
|
||||
//
|
||||
// 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 __VALARRAY_ARRAY_TCC__
|
||||
#define __VALARRAY_ARRAY_TCC__
|
||||
|
||||
extern "C++" {
|
||||
|
||||
export template<typename _Tp>
|
||||
void
|
||||
__valarray_fill (_Array<_Tp> __a, size_t __n, _Array<bool> __m, const _Tp& __t)
|
||||
{
|
||||
_Tp* __p = __a._M_data;
|
||||
bool* __ok (__m._M_data);
|
||||
for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
|
||||
while (! *__ok) {
|
||||
++__ok;
|
||||
++__p;
|
||||
}
|
||||
*__p = __t;
|
||||
}
|
||||
}
|
||||
|
||||
export template<typename _Tp>
|
||||
void
|
||||
__valarray_copy (_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b, size_t __n)
|
||||
{
|
||||
_Tp* __p (__a._M_data);
|
||||
bool* __ok (__m._M_data);
|
||||
for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++__ok, ++__p) {
|
||||
while (! *__ok) {
|
||||
++__ok;
|
||||
++__p;
|
||||
}
|
||||
*__q = *__p;
|
||||
}
|
||||
}
|
||||
|
||||
export template<typename _Tp>
|
||||
void
|
||||
__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array<bool> __m)
|
||||
{
|
||||
_Tp* __q (__b._M_data);
|
||||
bool* __ok (__m._M_data);
|
||||
for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++__ok, ++__q) {
|
||||
while (! *__ok) {
|
||||
++__ok;
|
||||
++__q;
|
||||
}
|
||||
*__q = *__p;
|
||||
}
|
||||
}
|
||||
|
||||
export template<typename _Tp, class _Dom>
|
||||
void
|
||||
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a)
|
||||
{
|
||||
_Tp* __p (__a._M_data);
|
||||
for (size_t __i=0; __i<__n; ++__i, ++__p) *__p = __e[__i];
|
||||
}
|
||||
|
||||
export template<typename _Tp, class _Dom>
|
||||
void
|
||||
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
|
||||
_Array<_Tp> __a, size_t __s)
|
||||
{
|
||||
_Tp* __p (__a._M_data);
|
||||
for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p = __e[__i];
|
||||
}
|
||||
|
||||
export template<typename _Tp, class _Dom>
|
||||
void
|
||||
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
|
||||
_Array<_Tp> __a, _Array<size_t> __i)
|
||||
{
|
||||
size_t* __j (__i._M_data);
|
||||
for (size_t __k=0; __k<__n; ++__k, ++__j) __a._M_data[*__j] = __e[__k];
|
||||
}
|
||||
|
||||
export template<typename _Tp, class _Dom>
|
||||
void
|
||||
__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
|
||||
_Array<_Tp> __a, _Array<bool> __m)
|
||||
{
|
||||
bool* __ok (__m._M_data);
|
||||
_Tp* __p (__a._M_data);
|
||||
for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
|
||||
while (! *__ok) {
|
||||
++__ok;
|
||||
++__p;
|
||||
}
|
||||
*__p = __e[__i];
|
||||
}
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif // __VALARRAY_ARRAY_TCC__
|
||||
|
||||
// Local Variables:
|
||||
// mode:c++
|
||||
// End:
|
File diff suppressed because it is too large
Load Diff
@ -1,97 +0,0 @@
|
||||
// Methods for Exception Support for -*- C++ -*-
|
||||
// Copyright (C) 1994, 1995, 1997 Free Software Foundation
|
||||
|
||||
// This file is part of the GNU ANSI 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, if you link this library with files
|
||||
// compiled with a GNU compiler to produce an executable, this does not 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 Mike Stump based upon the specification in the 20 September 1994
|
||||
// C++ working paper, ANSI document X3J16/94-0158.
|
||||
|
||||
#ifndef __STDEXCEPT__
|
||||
#define __STDEXCEPT__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "stdexcept"
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
namespace std {
|
||||
|
||||
class logic_error : public exception {
|
||||
string _what;
|
||||
public:
|
||||
logic_error(const string& what_arg): _what (what_arg) { }
|
||||
virtual const char* what () const { return _what.c_str (); }
|
||||
};
|
||||
|
||||
class domain_error : public logic_error {
|
||||
public:
|
||||
domain_error (const string& what_arg): logic_error (what_arg) { }
|
||||
};
|
||||
|
||||
class invalid_argument : public logic_error {
|
||||
public:
|
||||
invalid_argument (const string& what_arg): logic_error (what_arg) { }
|
||||
};
|
||||
|
||||
class length_error : public logic_error {
|
||||
public:
|
||||
length_error (const string& what_arg): logic_error (what_arg) { }
|
||||
};
|
||||
|
||||
class out_of_range : public logic_error {
|
||||
public:
|
||||
out_of_range (const string& what_arg): logic_error (what_arg) { }
|
||||
};
|
||||
|
||||
class runtime_error : public exception {
|
||||
string _what;
|
||||
public:
|
||||
runtime_error(const string& what_arg): _what (what_arg) { }
|
||||
virtual const char* what () const { return _what.c_str (); }
|
||||
protected:
|
||||
runtime_error(): exception () { }
|
||||
};
|
||||
|
||||
class range_error : public runtime_error {
|
||||
public:
|
||||
range_error (const string& what_arg): runtime_error (what_arg) { }
|
||||
};
|
||||
|
||||
class overflow_error : public runtime_error {
|
||||
public:
|
||||
overflow_error (const string& what_arg): runtime_error (what_arg) { }
|
||||
};
|
||||
|
||||
class underflow_error : public runtime_error {
|
||||
public:
|
||||
underflow_error (const string& what_arg): runtime_error (what_arg) { }
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
@ -1,21 +0,0 @@
|
||||
// Implementation file for Exception Support for -*- C++ -*-
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "stdexcept"
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
// Entry points for string.
|
||||
|
||||
void
|
||||
__out_of_range (const char *s)
|
||||
{
|
||||
throw std::out_of_range (s);
|
||||
}
|
||||
|
||||
void __length_error (const char *s)
|
||||
{
|
||||
throw std::length_error (s);
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
// -*- C++ -*- compatibility header.
|
||||
// This file is part of the GNU ANSI C++ Library.
|
||||
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <set>
|
||||
#include <stack>
|
||||
#include <utility>
|
||||
#include <vector>
|
@ -1,387 +0,0 @@
|
||||
2000-11-08 Jan van Male <jan.vanmale@fenk.wau.nl>
|
||||
Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
|
||||
|
||||
* README: Fix typo. Remove incorrect reference to Cygnus.
|
||||
|
||||
2000-08-22 Geoff Berry <geoffb@bops.com>
|
||||
|
||||
* bitset (bitset::_M_is_any): Don't use __BITSET_WORDS macro
|
||||
on _Nw since _Nw is already the number of words in the bitset.
|
||||
|
||||
2000-07-10 Martin v. Löwis (loewis@informatik.hu-berlin.de)
|
||||
|
||||
* stl_function.h (bind1st, bind2nd): Rename __opr to __oper,
|
||||
as __opr is used internally by egcs.
|
||||
* stl_numeric.h (__power, power): Likewise.
|
||||
|
||||
2000-07-10 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* stl_algo.h (transform): Rename __opr to __oper, as __opr is used
|
||||
internally by egcs.
|
||||
Reported by Harri Porten <porten@tu-harburg.de>
|
||||
|
||||
2000-01-19 Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
|
||||
|
||||
* stl_iterator.h: Make it possible to use standard class
|
||||
`iterator'.
|
||||
|
||||
1999-12-14 Mumit Khan <khan@xraylith.wisc.edu>
|
||||
|
||||
* stl_config.h (__MINGW32__): Define __STL_WIN32THREADS for thread
|
||||
safe runtime.
|
||||
|
||||
1999-11-10 Benjamin Kosnik <bkoz@haight.constant.com>
|
||||
Matthias Klose <doko@cs.tu-berlin.de>
|
||||
|
||||
* stl_rope.h: Fix initialization order.
|
||||
* stl_deque.h: Use static_casts<size_type>(signed_type).
|
||||
|
||||
1999-11-06 Martin v. Löwis <loewis@informatik.hu-berlin.de>
|
||||
|
||||
* bitset (class bitset): Declare reference as our friend.
|
||||
* bitset: Include limits.h.
|
||||
|
||||
1999-08-08 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* pthread_alloc: Solaris' ctype.h defines _U to 01; use _Up as
|
||||
template parameter instead.
|
||||
|
||||
1999-06-18 Martin von Löwis <loewis@informatik.hu-berlin.de>
|
||||
|
||||
* stl_queue.h: Rename _M_c to c, and _M_comp to comp.
|
||||
|
||||
1999-05-17 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
* stl_config.h: Only define __STL_PTHREADS with GLIBC >= 2 for
|
||||
Linux.
|
||||
|
||||
Mon May 17 03:33:47 1999 Mumit Khan <khan@xraylith.wisc.edu>
|
||||
|
||||
* stl_config.h (__CYGWIN__): Cygwin newlib RTL lacks drand48.
|
||||
|
||||
1999-05-07 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* stl_alloc.h: Make it possible to compile with __USE_MALLOC.
|
||||
|
||||
Tue Apr 13 00:32:57 1999 Mumit Khan <khan@xraylith.wisc.edu>
|
||||
|
||||
* stl_config.h (__MINGW32__): Mingw32 RTL lacks drand48.
|
||||
|
||||
Sun Apr 11 23:48:30 1999 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* bitset: Re-install Alexandre's lost patch from 1998-11-27.
|
||||
|
||||
1999-01-20 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* stl_construct.h (__destroy_aux): Use != instead of < for
|
||||
ForwardIterator comparison.
|
||||
Patch by jmaurer@menuett.rhein-main.de (Jens Maurer).
|
||||
|
||||
1999-01-20 Mark Mitchell <mark@markmitchell.com>
|
||||
|
||||
* stl_config.h (__STL_USE_NAMESPACES): Define.
|
||||
|
||||
1998-11-27 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* bitset: Explicitly convert basic_string<...>::npos to size_t in
|
||||
default argument to constructor, to avoid parse error at `>'.
|
||||
(__STL_EXPLICIT_FUNCTION_TMPL_ARGS): Replace #if with #ifdef.
|
||||
|
||||
1998-11-01 Mark Mitchell <mark@markmitchell.com>
|
||||
|
||||
* stl_alloc.h (default_alloc_template::_S_free_list): Don't
|
||||
qualify _NFREELISTS.
|
||||
|
||||
1998-10-11 Mark Mitchell <mark@markmitchell.com>
|
||||
|
||||
* stl_config.h (__SGI_STL_USE_AUTO_PTR_CONVERSIONS): Define.
|
||||
* memory (auto_ptr::operator auto_ptr_ref<_Tp1>): Fix typo.
|
||||
(auto_ptr::operator auto_ptr<_Tp1>): Add missing
|
||||
semicolon.
|
||||
|
||||
1998-09-03 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* stl_config.h: Define __STL_HAS_WCHAR_T,
|
||||
__STL_MEMBER_TEMPLATE_CLASSES, __STL_HAS_NAMESPACES,
|
||||
__STL_NO_NAMESPACES and __STL_LONG_LONG.
|
||||
|
||||
1998-09-02 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* algorithm alloc.h defalloc.h hash_map.h hash_set.h iterator
|
||||
memory pthread_alloc pthread_alloc.h rope ropeimpl.h stl_algo.h
|
||||
stl_algobase.h stl_alloc.h stl_bvector.h stl_config.h
|
||||
stl_construct.h stl_deque.h stl_function.h stl_hash_fun.h
|
||||
stl_hash_map.h stl_hash_set.h stl_hashtable.h stl_heap.h
|
||||
stl_iterator.h stl_list.h stl_map.h stl_multimap.h stl_multiset.h
|
||||
stl_numeric.h stl_pair.h stl_queue.h stl_raw_storage_iter.h
|
||||
stl_relops.h stl_rope.h stl_set.h stl_slist.h stl_stack.h
|
||||
stl_tempbuf.h stl_tree.h stl_uninitialized.h stl_vector.h
|
||||
tempbuf.h type_traits.h: Update to SGI STL 3.11.
|
||||
|
||||
Fri Jul 10 15:20:09 1998 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
|
||||
|
||||
* stl_tempbuf.h (temporary_buffer): Add missing typename.
|
||||
* type_traits.h: update comments.
|
||||
|
||||
Sun Jun 28 00:49:42 1998 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* stl_config.h (__STL_PTHREADS): Don't define for glibc 2 if
|
||||
_G_USING_THUNKS is not defined.
|
||||
|
||||
1998-04-07 18:32 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* stl_hashtable.h (__stl_prime_list): Mark last two numbers as
|
||||
unsigned long since they are otherwise too large for long int on
|
||||
32bit machines.
|
||||
|
||||
Fri Feb 20 16:15:05 1998 H.J. Lu (hjl@gnu.org)
|
||||
Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* ropeimpl.h: Check __STL_PTHREADS instead of _PTHREADS.
|
||||
* stl_alloc.h: Ditto.
|
||||
* stl_config.h: Ditto.
|
||||
* stl_rope.h: Ditto.
|
||||
|
||||
* stl_config.h: include <_G_config.h> if __GNUG__ is defined.
|
||||
(__STL_PTHREADS): Defined if _PTHREADS is defined or
|
||||
__GLIBC__ >= 2.
|
||||
|
||||
Tue Jan 27 12:01:25 1998 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* stl_algo.h (__lg): Fix for n == 0.
|
||||
|
||||
Sat Nov 8 00:45:17 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* stl_hash_set.h (swap): Fix typo.
|
||||
|
||||
Fri Nov 7 10:27:40 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* stl_hashtable.h: Fix typo.
|
||||
|
||||
Thu Nov 6 11:19:09 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* stl_algo.h, stl_algobase.h, stl_bvector.h,
|
||||
stl_deque.h: Update to October 28 SGI release.
|
||||
|
||||
Sun Nov 2 12:14:56 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* algo.h, algobase.h, alloc.h, bvector.h, defalloc.h, deque.h,
|
||||
function.h, hash_map.h, hash_set.h, hashtable.h, heap.h, iterator.h,
|
||||
list.h, map.h, multimap.h, multiset.h, pair.h, pthread_alloc.h,
|
||||
rope.h, ropeimpl.h, set.h, slist.h, stack.h, stl_config.h, tempbuf.h,
|
||||
tree.h, type_traits.h, vector.h: Update to October 27 SGI snapshot.
|
||||
* algorithm, deque, functional, hash_map, hash_set, iterator, list,
|
||||
map, memory, numeric, pthread_alloc, queue, rope, set, slist, stack,
|
||||
stl_algo.h, stl_algobase.h, stl_alloc.h, stl_bvector.h,
|
||||
stl_construct.h, stl_deque.h, stl_function.h, stl_hash_fun.h,
|
||||
stl_hash_map.h, stl_hash_set.h, stl_hashtable.h, stl_heap.h,
|
||||
stl_iterator.h, stl_list.h, stl_map.h, stl_multimap.h, stl_multiset.h,
|
||||
stl_numeric.h, stl_pair.h, stl_queue.h, stl_raw_storage_iter.h,
|
||||
stl_relops.h, stl_rope.h, stl_set.h, stl_slist.h, stl_stack.h,
|
||||
stl_tempbuf.h, stl_tree.h, stl_uninitialized.h, stl_vector.h,
|
||||
utility, vector: New files in October 27 SGI snapshot.
|
||||
|
||||
Fri Oct 17 19:07:42 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* tree.h, vector.h: Fix accidental divergence from SGI release.
|
||||
|
||||
Tue Sep 9 19:47:28 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* algo.h, algobase.h, alloc.h, bvector.h, deque.h, hashtable.h,
|
||||
iterator.h, list.h, rope.h, ropeimpl.h, slist.h, stl_config.h,
|
||||
tree.h, vector.h: Update To September 8 SGI release.
|
||||
|
||||
Tue Sep 9 17:38:47 1997 Mark Mitchell <mmitchell@usa.net>
|
||||
|
||||
* stl_config.h (__STL_MEMBER_TEMPLATES): Enable.
|
||||
|
||||
Tue Aug 5 17:06:01 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* deque.h, function.h, hashtable.h, list.h, rope.h, ropeimpl.h,
|
||||
tree.h: Update to July 31 SGI release.
|
||||
|
||||
Fri Jul 18 10:06:56 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* algo.h, defalloc.h, hashtable.h, rope.h, ropeimpl.h, slist.h:
|
||||
Update to June 30 SGI release.
|
||||
|
||||
Fri Jul 04 02:17:15 1997 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* tree.h (rb_tree): Reverse order of member initializations
|
||||
to prevent warnings.
|
||||
|
||||
Sun Jun 15 18:17:21 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* *.h: Update to 6/13 SGI release.
|
||||
|
||||
Fri May 23 10:56:18 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* stl_config.h: Add support for exceptions with g++.
|
||||
|
||||
* *.h: Update to 5/8 SGI release.
|
||||
|
||||
Thu Apr 24 19:00:23 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* *.h: Update to 3/24 SGI release.
|
||||
|
||||
Wed Feb 19 18:19:18 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* *.h: Update to 2/18 SGI release.
|
||||
|
||||
* bool.h: Lose.
|
||||
|
||||
Mon Feb 10 16:33:23 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* alloc.h: Don't define __USE_MALLOC for g++.
|
||||
* bool.h: Lose g++ case.
|
||||
|
||||
* *.h: Update to 2/4 SGI release.
|
||||
|
||||
Mon Jan 13 14:39:16 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* *.h: Update to 1/8 SGI release.
|
||||
|
||||
Mon Sep 30 17:56:43 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* alloc.h (__unlock): Never use __lock_release.
|
||||
|
||||
Fri Sep 27 19:03:06 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* alloc.h (__default_alloc_template): lock is a friend.
|
||||
|
||||
Thu Sep 19 20:10:37 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
Propagate these changes to new STL code:
|
||||
* tree.h: Rearrange member initializers in rb_tree constructors.
|
||||
* vector.h (insert): Cast iterator difference to size_type to
|
||||
avoid warning.
|
||||
|
||||
* *.h: Update to SGI snapshot (fixed).
|
||||
* *.c, Makefile.in, configure.in: Removed.
|
||||
|
||||
Sat Sep 14 09:43:06 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* deque.h, list.h, tree.h: Remove kludge obsoleted by new
|
||||
overloading code.
|
||||
|
||||
Sat Aug 10 14:59:50 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* tempbuf.cc (__stl_temp_buffer): Align like a pointer.
|
||||
|
||||
Wed Jun 26 13:00:44 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* iterator.h: Add default template parameters.
|
||||
|
||||
Wed Apr 24 10:45:22 1996 Doug Evans <dje@blues.cygnus.com>
|
||||
|
||||
* Makefile.in (tempbuf.o,random.o): Add rules for SunOS VPATH.
|
||||
|
||||
Fri Apr 5 17:52:31 1996 Per Bothner <bothner@kalessin.cygnus.com>
|
||||
|
||||
* configure.in (EXTRA_MOSTLYCLEAN): New, to remove stl.list.
|
||||
|
||||
Fri Mar 22 14:58:30 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
Propagate these changes to new STL code:
|
||||
* tree.h: Rearrange member initializers in rb_tree constructors.
|
||||
* vector.h (insert): Cast iterator difference to size_type to
|
||||
avoid warning.
|
||||
|
||||
Sun Mar 10 07:49:03 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* deque.h (distance_type): Add overload for g++.
|
||||
From Joe Buck.
|
||||
|
||||
Thu Feb 22 14:07:12 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* bool.h: Revert.
|
||||
* algo.h bvector.h deque.h function.h iterator.h list.h
|
||||
pair.h stack.h tree.h vector.h: Wrap #include <bool.h> with
|
||||
#ifndef __GNUG__.
|
||||
* defalloc.h list.h deque.h tree.h: Use __GNUG__ to control
|
||||
workarounds.
|
||||
|
||||
Wed Feb 21 17:13:02 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* bool.h (TRUE, FALSE): Define for people expecting the bool.h
|
||||
from libg++. Is this a good idea?
|
||||
|
||||
Tue Feb 20 18:40:02 1996 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* algo.h bool.h bvector.h defalloc.h deque.h function.h heap.h
|
||||
iterator.h list.h map.h pair.h random.cc stack.h tree.c tree.h
|
||||
vector.h: Revert to HP release with workarounds for missing
|
||||
overloading functionality.
|
||||
* Makefile.in (STL_OBJECTS): Remove tree.o.
|
||||
|
||||
Thu Nov 9 17:05:23 1995 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* algo.h algobase.h bvector.h defalloc.h deque.h function.h heap.h
|
||||
iterator.h list.h map.h multimap.h multiset.h pair.h projectn.h
|
||||
set.h stack.h tempbuf.h tree.h vector.h: Wrap #include <bool.h>
|
||||
with #ifndef __GNUG__.
|
||||
|
||||
Thu Nov 2 17:05:44 1995 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* deque.h (deque<T>::insert): Fix merge typo.
|
||||
* vector.h (value_type): Lose.
|
||||
|
||||
Thu Nov 2 14:33:47 1995 Per Bothner <bothner@kalessin.cygnus.com>
|
||||
|
||||
* algo.h, algobase.h, deque.h, function.h, list.h, pair.h, random.cc:
|
||||
Merge in Oct 31 1995 release from HP.
|
||||
|
||||
Fri Aug 11 17:11:12 1995 Per Bothner <bothner@kalessin.cygnus.com>
|
||||
|
||||
* list.h: Avoid duplicate construction and destruction of list_nodes.
|
||||
Patch from Klamer Schutte <klamer@ph.tn.tudelft.nl>.
|
||||
|
||||
Fri Aug 11 16:45:18 1995 Per Bothner <bothner@kalessin.cygnus.com>
|
||||
|
||||
* algo.h, algobase.h, deque.h: Merged in Jul 12 1995 release from HP.
|
||||
|
||||
Mon Jun 5 18:38:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
|
||||
|
||||
* Makefile.in (stl.list): Depend on stamp-picdir.
|
||||
|
||||
Wed May 17 02:30:47 1995 Jason Merrill <jason@phydeaux.cygnus.com>
|
||||
|
||||
* tree.h: Rearrange member initializers in rb_tree constructors.
|
||||
|
||||
* Update to HP's February 7, 1995 release.
|
||||
|
||||
Fri May 5 10:45:31 1995 Mike Stump <mrs@cygnus.com>
|
||||
|
||||
* random.cc (seed): Move `for' decl out of `for' statement.
|
||||
|
||||
Wed Apr 26 13:09:16 1995 Jason Merrill <jason@phydeaux.cygnus.com>
|
||||
|
||||
* configure.in (XCXXINCLUDES): Rename.
|
||||
|
||||
Wed Mar 29 19:24:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
|
||||
|
||||
* tree.h (insert): Return a value.
|
||||
|
||||
* vector.h (insert): Cast iterator difference to size_type to
|
||||
avoid warning.
|
||||
|
||||
Sun Feb 12 09:12:17 1995 Mike Stump <mrs@cygnus.com>
|
||||
|
||||
* tree.h (rb_tree::max_size): Add definition when using GNU
|
||||
workaround.
|
||||
|
||||
Thu Jan 12 01:37:42 1995 deanm@medulla.LABS.TEK.COM (Dean Messing)
|
||||
|
||||
* configure.in (LIBDIR): Set to yes.
|
||||
|
||||
Fri Dec 30 18:26:20 1994 Mike Stump <mrs@cygnus.com>
|
||||
|
||||
* iterator.h: Add default template parameters where possible.
|
||||
|
||||
Fri Dec 30 16:29:39 1994 Mike Stump <mrs@cygnus.com>
|
||||
|
||||
* algo.h: Change rand to __rand to fix make check on linux systems.
|
||||
|
||||
Tue Nov 29 15:30:30 1994 Per Bothner <bothner@kalessin.cygnus.com>
|
||||
|
||||
* Initial check-in, based on HP's October 21, 1994.
|
@ -1,13 +0,0 @@
|
||||
This directory contains an SGI release of the C++ Standard Template
|
||||
Library, slightly modified to work with g++.
|
||||
|
||||
Note that this is based on a pre-Draft Standard for C++.
|
||||
Things are likely to change. For example, the header file names
|
||||
are very likely to change. The Allocator interface will change. Etc, etc.
|
||||
WE MAKE NO COMMITMENT (yet) TO SUPPORT BACKWARD COMPATIBILITY FOR STL.
|
||||
|
||||
For examples of things that should work, look in the ../tests directory.
|
||||
|
||||
DOCUMENTATION:
|
||||
See http://www.sgi.com/Technology/STL/ or http://www.dinkumware.com/
|
||||
on the World-Wide Web.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user