diff options
Diffstat (limited to 'contrib/libg++/libstdc++')
158 files changed, 0 insertions, 14918 deletions
diff --git a/contrib/libg++/libstdc++/ChangeLog b/contrib/libg++/libstdc++/ChangeLog deleted file mode 100644 index fc08f0d7d90b..000000000000 --- a/contrib/libg++/libstdc++/ChangeLog +++ /dev/null @@ -1,620 +0,0 @@ -Tue Jun 18 18:36:58 1996 Jason Merrill <jason@yorick.cygnus.com> - - * Version 2.7.2. - -Mon Jun 17 13:57:24 1996 Per Bothner <bothner@deneb.cygnus.com> - - * std/bastring.h (class basic_string::remove): Add casts. - - * configure.in: Use EXTRA_DISTCLEAN rather than DISTCLEAN. - -Wed Apr 24 10:43:07 1996 Doug Evans <dje@blues.cygnus.com> - - * Makefile.in (newi.o,cstringi.o,stddefi.o,cstdlibi.o,cmathi.o): Add - rules for SunOS VPATH. - -Mon Apr 8 15:20:32 1996 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Permit --enable-shared to specify a list of - directories. - -Thu Mar 7 07:29:00 1996 Lee Iverson <leei@Canada.AI.SRI.COM> - - * Makefile.in (install): Restore deleted chdir to stl subdir. - -Tue Feb 20 18:29:30 1996 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (CXXFLAGS): Remove -pedantic -ansi. - (CFLAGS): Ditto. - -Wed Feb 14 14:39:07 1996 Jason Merrill <jason@yorick.cygnus.com> - - * std/bastring.cc (check_realloc): Fix for sizeof (charT) > 1. - From John Hickin <hickin@bnr.ca>. - -Wed Jan 10 11:05:04 1996 Jason Merrill <jason@yorick.cygnus.com> - - * std/bastring.h (insert): Fix iterator handling. - From Joe Buck <jbuck@synopsys.com>. - -Mon Jan 8 11:48:03 1996 Jason Merrill <jason@yorick.cygnus.com> - - * std/bastring.h (max_size): Fix for sizeof (charT) > 1. - * std/bastring.cc (replace): Use it. - - * std/bastring.cc (rfind): Fix for n > length (). - -Tue Dec 19 15:13:08 1995 Jason Merrill <jason@yorick.cygnus.com> - - * config/aix.ml (SHFLAGS): Add -Wl,-unix. - -Mon Dec 18 12:48:25 1995 Mike Stump <mrs@cygnus.com> - - * Makefile.in (exceptioni.o): Compile with -fhandle-exceptions, so - we can unwind through unexpected on machines that don't have a - working __unwind_function. - -Sun Dec 17 00:28:31 1995 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (install): Make sure shared libraries - are installed with mode 555. - -Mon Nov 27 15:01:56 1995 Jason Merrill <jason@yorick.cygnus.com> - - * Makefile.in (install): Make shared library links relative. - (install): Break up -sf into -s -f. - ({M,}SHLINK): Ditto. - -Sun Nov 26 22:48:06 1995 Jason Merrill <jason@yorick.cygnus.com> - - * queue: Include <stack.h> instead of <queue.h>. - -Sat Nov 25 11:33:13 1995 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (install): Fix setting of rootme. - -Tue Nov 21 14:20:34 1995 Ian Lance Taylor <ian@cygnus.com> - - * configure.in: Check ${with_cross_host} rather than comparing - ${host} and ${target}. - -Tue Nov 14 01:50:52 1995 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (IO_DIR): Delete MULTITOP, MULTISUBDIR. - (LIBIBERTY_DIR): Likewise. - (INSTALLDIR): Delete MULTISUBDIR. - * configure.in: Delete call to cfg-ml-com.in. Call config-ml.in - instead of cfg-ml-pos.in. - (XCXXINCLUDES): Delete MULTITOP. - * stl/configure.in (XCXXINCLUDES): Delete MULTITOP. - (config-ml.in): Call instead of cfg-ml-pos.in. - -Sun Nov 12 16:44:25 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in (VERSION): Set to 2.7.1. - -Thu Nov 9 17:39:28 1995 Jason Merrill <jason@yorick.cygnus.com> - - * config/{aix,dec-osf,irix5,linux,sol2shm}.ml: Remove LDLIBS defn; - no longer needed now that make check sets LD_LIBRARY_PATH. - -Wed Nov 8 19:46:35 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * std/bastring.h: Wrap with #ifndef/#define/#endif. - * std/cassert.h: Likewise. - * std/cinst.h: Likewise. - * std/complext.h: Likewise. - * std/dcomplex.h: Likewise. - * std/fcomplex.h: Likewise. - * std/ldcomplex.h: Likewise. - * std/sinst.h: Likewise. - -Wed Nov 8 16:15:48 1995 Jason Merrill <jason@yorick.cygnus.com> - - * std/bastring.cc (getline): Update to September 95 WP. Now we - don't set failbit when reading an empty line. - -Tue Nov 7 16:09:04 1995 Jason Merrill <jason@yorick.cygnus.com> - - * std/bastring.cc (new): Fix for sizeof (charT) != 1. - -Sat Nov 4 17:37:16 1995 Jason Merrill <jason@yorick.cygnus.com> - - * std/complext.cc (operator / (FLOAT, const complex<FLOAT>&)): - Reimplement along the lines of the other operator / templates. - From John Eaton <jwe@bevo.che.wisc.edu>. - -Sat Nov 4 13:33:50 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in (DISTCLEAN): New, to add target-mkfrag. - -Tue Oct 31 13:59:32 1995 Jason Merrill <jason@yorick.cygnus.com> - - * std/bastring.h: Use size_t for the reference count. - * std/bastring.cc (create): Set selfish. - From Joe Buck (jbuck@synopsys.com). - -Mon Oct 30 23:09:48 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in: Don't bother changing LIBIBERTY for cross, - now that we are using target-libiberty instead. - * Makefile.in (LIBIBERTY_DIR): Simplify. - (LIBIBERTY): Remove. - -Wed Oct 11 14:56:49 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * config/sol2shm.ml: New files with -rpath. - * configure (*-*-solaris*): Use sol2shm.ml. - -Thu Sep 28 09:26:52 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/straits.h (compare, copy, move, set): Fix for non-char charT's. - * std/bastring.h (basic_string::remove): Fix for non-char charT's. - -Tue Sep 26 15:22:56 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * config/irix5.ml: Pass -rpath to links. - -Fri Sep 15 00:17:47 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * config/linux.ml: Conform to Linux shared library numbering - scheme. - * Makefile.in: Ditto. - -Tue Sep 12 00:28:56 1995 Mike Stump <mrs@cygnus.com> - - * typeinfoi.cc: (__pointer_type_info::__rtti_match): Moved from - the headerfile, include all sorts of pointer conversions from 15.3 - para 2. - * std/typeinfo.h (__pointer_type_info::__rtti_match): Moved from here. - -Mon Sep 11 23:27:59 1995 Mike Stump <mrs@cygnus.com> - - * std/typeinfo.h (__pointer_type_info::__rtti_match): We no longer - have to dereference the object pointer, as the pointer is always - passed directly. - -Mon Sep 11 19:29:51 1995 Mike Stump <mrs@cygnus.com> - - * std/typeinfo.h (__pointer_type_info::__rtti_match): Define so - that pointer conversions can happen on catch type matching. - * typeinfoi.cc (__throw_type_match_rtti): Arrange for __rtti_match - to be used on pointers. - -Tue Sep 5 14:49:19 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * string.h: Remove for now. - -Thu Aug 31 14:14:01 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.cc (operator>>): Simplify and fix. - (resize): Fix order of arguments to append. - (getline): Simplify and fix. - -Thu Aug 24 17:44:09 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/cstdlib.h (abs): Provide default implementation for peons - without labs. - -Tue Aug 22 08:43:07 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/cstdlib.h: Comment out definition of div(long,long) for now, - since not all targets have ldiv. - -Mon Aug 21 11:46:03 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/cmath.h: Wrap abs(double) with #if ! _G_MATH_H_INLINES. - - * stl.h: Add, for compatibility with ObjectSpace STL. - - * std/complext.cc (operator /): Use abs instead of fabs. - - * std/bastring.h (replace): Update single-character replace method - as per my proposal. - - * std/cmath.h: Add abs(float), abs(double) and abs(long double). - Add commented-out declarations for other float and long double - math functions. - - * std/cstdlib.h: Add abs(long) and div(long,long). - - * Makefile.in (install): Make shared library executable and - non-writable. Tidy. - (OBJS): Add cstdlibi.o and cmathi.o. - - * Rename implementation files to have different basenames. - -Mon Aug 21 00:57:03 1995 Jeffrey A. Law <law@rtl.cygnus.com> - - * Makefile.in (install): Use "cd stl"; no need for $(srcdir) - prefix because we're already in $(srcdir). - -Tue Jul 25 18:41:29 1995 Per Bothner <bothner@kalessin.cygnus.com> - - * std/stddef.h: Remove obsolete definition of enum capacity. - -Sat Jul 22 13:37:01 1995 Doug Evans <dje@canuck.cygnus.com> - - * Makefile.in (IO_DIR): Add multilib support. - (LIBIBERTY, LIBIBERTY_OBJS, INSTALLDIR, stdlist): Likewise. - (libiberty.a, install): Likewise. - * configure.in: Likewise. - (XCXXINCLUDES): Likewise. - * stl/configure.in: Likewise. - (XCXXINCLUDES): Likewise. - -Mon Jul 17 09:29:31 1995 Brendan Kehoe <brendan@lisa.cygnus.com> - - * Makefile.in (typeinfo.o, stdexcept.o): Put an else for the if - stmt checking PICFLAG. - (stmp-string, bigstmp-string, stmp-complex, bigstmp-complex): Likewise. - -Wed Jun 28 17:05:29 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/*.h: Wrap with extern "C++". - - * std/ciso646.h: Don't worry about #undefing the keywords. - -Mon Jun 26 19:05:38 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.h (operator!=): If they've included the STL - function.h, don't overload the operator templates that it defines. - -Fri Jun 23 16:54:17 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (SHLINK): Force link. - (install): Ditto. - - * std/bastring.h (terminate): Never reallocate. - (alloc): No longer const. - - * std/bastring.cc (create): Always allocate an extra byte. - (check_realloc): Always leave room for an extra byte. - (*find*): Add missing 'const'. - - * Makefile.in (SHARLIB): Provide a default value. - -Tue Jun 20 16:29:52 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/cstring.h: Don't bother tweaking prototypes for now. When - we do, we will use new-style casts. - -Fri Jun 16 13:57:53 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (VERSION): Update to 2.7.0. - - * config/aix.ml: Build both shared and archive libraries. - -Wed Jun 14 21:44:21 1995 Jason Merrill <jason@python.cygnus.com> - - * configure.in (frags): Use linux.ml for Linux/ELF. - * config/linux.ml: New file. - -Wed Jun 14 17:56:23 1995 Niclas Andersson <nican@ida.liu.se> - - * configure.in: Use xiberty when building cross-compiler. - -Wed Jun 14 12:57:47 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/*complex*, std/cinst.h, cinst.cc: Pass by reference to const - rather than by value. - * std/*complex*: Add member functions real() and imag(). - -Sat Jun 10 12:14:38 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (bigstmp-string): Call main string object cstrmain.o - instead of cstring.o. - -Wed Jun 7 11:15:15 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/cstring.h: Use #include_next to pick up <string.h>. - - * string.h: New file. - - * Makefile.in (MOSTLYCLEAN_JUNK): Remove piclist. - - * configure.in (MOSTLYCLEAN): Remove stamp-picdir. - -Mon Jun 5 18:36:39 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * config/*.ml: Build both shared and archive libraries. - - * configure.in (MOSTLYCLEAN): Remove pic. - (frags): Use toplevel pic frags. - - * Makefile.in (piclist): New rule. - (SHLIB): Use it. - (stl.list): Removed. - (typeinfo.o): Also build pic version. - (stdexcept.o): Ditto. - (*stmp-*): Ditto. - -Tue May 30 12:01:14 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/{complext,{f,d,ld}complex}.h: To declare specializations, - use friend declarations in the class body... - * std/cinst.h: ...rather than macro hackery. - - * Makefile.in (stdlist): Renamed from list. - - * cstdarg: Don't define __CSTDARG__. - * complex.h: Similarly. - -Tue May 9 19:31:20 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.cc (operator>>): Use an int to store the return value - of streambuf::sbumpc. - (getline): Ditto. - * std/bastring.* (replace): Reverse size_t and charT arguments. - - * configure.in (enable_shared): Support enable_shared under AIX. - - * Makefile.in (SHARLIB): New variable and rule for building an - archive library containing a single shared object (for AIX). - -Mon May 8 01:43:19 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.h (remove): Forgot one. - (empty): And this. - Disable copy-on-write if someone takes an iterator. - - * std/bastring.cc (getline): Avoid resizing down if unnecessary. - (operator>>): Don't use private methods. - -Sun May 7 02:39:56 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.h (insert, replace): Fix. - * std/bastring.cc (find_*_of): Fix. - -Fri May 5 01:45:10 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.h: Add iterator remove fn. Remove evil default - arguments. - - * std/*complex*, std/cinst.h, cinst.cc: s/__complex/complex/g. - complex<float> is now specialized. Lose _*_complex in favor of - 'explicit' constructors. - * std/complex.h: Lose typedef of complex. - * std/fcomplex.h: New file. - * std/complext.cc (operator<<): Accept more input forms. - - * std/bastring.h: Add iterator insert fns. - -Thu May 4 02:30:04 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.*: Update to current draft. - - * std/bastring.*: Reorganize so that the pointer in a string - object points to the data rather than the bsrep object, for - debugging. - -Tue Apr 25 17:15:09 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * configure.in: Update to stay in sync with config.shared. - -Mon Apr 24 13:08:46 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/complext.h: Declare hypot. Declare appropriate functions const. - -Wed Apr 12 15:26:25 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (typeinfo.o): Don't use $<. - (stdexcept.o): Ditto. - -Sat Apr 8 15:35:00 1995 Mike Stump <mrs@cygnus.com> - - * std/typeinfo.h: Move bad_cast, bad_typeid and __bad_cast_object - from here to stdexcept. - * std/stdexcept.h: Ditto. - * Makefile.in (stdexcept.o): Added rule to build typeinfo.o with - -frtti to support matching of thrown objects with rtti info for - bad_cast. - -Mon Apr 3 18:13:14 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * typeinfo: New file. - - * Makefile.in (HEADERS): Add typeinfo. - -Mon Apr 3 15:06:58 1995 Mike Stump <mrs@cygnus.com> - - * Makefile.in (typeinfo.o): Added rule to build typeinfo.o with - -frtti to support matching of thrown objects with rtti info for - bad_cast. - -Wed Mar 29 15:56:06 1995 Mike Stump <mrs@cygnus.com> - - * typeinfo.cc: (__throw_type_match_rtti): Added to support - matching of thrown objects with rtti info. - -Thu Mar 23 18:42:30 1995 Jason Merrill <jason@deneb.cygnus.com> - - * Makefile.in (HEADERS): Add stdexcept. - -Sun Mar 12 01:25:27 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/typeinfo.h: Add return statements to dummy methods. - -Wed Mar 8 16:09:50 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * config/dec-osf.ml: Use -rpath flag. - -Fri Feb 17 18:16:46 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/typeinfo.h: Add copyright header. - - * Makefile.in (CXXFLAGS): Add a bunch of warning options to keep - me honest. - -Thu Feb 16 00:04:49 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in, config/*.ml: Generate shared library on most hosts - as libstdc++.so.$(VERSION), with a symlink to libstdc++.so, so that - multiple versions can coexist. - -Fri Feb 10 02:59:39 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/exception.h: {set_,}{terminate,unexpected} have C++ linkage. - - * Makefile.in: Allow string and complex to be split up either by - individual function or into I/O and non-I/O. Default to the - latter. - -Wed Feb 8 02:39:47 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.h: Start thinking about throwing exceptions. - - * typeinfo.cc: Remove private functions; defining them to call - abort () just delays errors until runtime. Define - __bad_cast_object. - - * std/exception.h: Standard exceptions are now defined in - stdexcept.h. This header now contains declarations of terminate() - et al. - * exception.cc: Move code from libg++/src/except.c here. - * std/typeinfo.h: Define RTTI-related exceptions here. - * stdexcept{,.cc},std/stdexcept.h: New files. - -Mon Feb 6 18:51:31 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (HEADERS): Resurrect, add new STL header names. - (install): Install extensionless headers again. - * extensionless headers: Resurrect, add new STL headers. - Currently only forward to std/whatever or stl/whatever. - -Mon Jan 30 13:53:22 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.h (basic_string (charT, size_t)): Mark explicit. - - * Makefile.in (install): Set rootme when installing stl headers. - Only install *.* from std. - -Wed Jan 25 02:29:30 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * std/bastring.h (operator=): grab before releasing. - -Mon Jan 23 19:54:02 1995 Ronald F. Guilmette <rfg@segfault.us.com> - - * Makefile.in (install): Also install STL headers. - -Mon Jan 23 04:09:35 1995 Jason Merrill <jason@python.cygnus.com> - - * Makefile.in (list): Set $rootme before calling make. - -Wed Jan 11 19:24:47 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * typeinfo.cc (__rtti_match): Don't try to do pointer arithmetic - with a void *. - - * move all headers into std subdirectory and update files accordingly. - -Thu Jan 5 01:51:49 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * bastring.ccI (basic_string (size_t, capacity)): s/reserve/::reserve/. - -Wed Jan 4 17:27:32 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * exception: s/string/__string/g. - - * configure.in (MOSTLYCLEAN): Add so_locations. - - * bastring.ccI (basic_string (size_t, capacity)): Fix thinko. - (various find functions): Ditto. - -Fri Dec 30 18:04:00 1994 Mike Stump <mrs@cygnus.com> - - * typeinfo.h: Add support for the built-in type bool. - -Fri Dec 30 14:57:02 1994 Mike Stump <mrs@cygnus.com> - - * typeinfo.{cc, h}: Guard against multiple inclusions, and add #p i/i. - -Fri Dec 2 17:56:05 1994 Mike Stump <mrs@cygnus.com> - - * libg++ 2.6.2 released. - - * typeinfo.{cc, h} (__rtti_match): Change interface to compiler - for dynamic_casting to gear up for exception handling's use of - rtti for argument matching. - -Tue Nov 29 16:49:32 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in (configdirs): Add stl. - * Makefile.in: Build stl, and merge .o files from it. - -Thu Nov 17 15:30:57 1994 Jason Merrill <jason@phydeaux.cygnus.com> - - * bastring.hI: Add iterator, const_iterator, begin() and end() to - basic_string. - -Mon Nov 7 16:50:33 1994 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in, configure.in, config/*.ml, tests/Makefile.in, - tests/configure.in: Various changes to handle --enable-shared. - -Fri Nov 4 19:13:33 1994 Mike Stump (mrs@cygnus.com) - - * exception{,.cc}: Added to support catching bad_cast's. - -Thu Nov 3 17:42:13 1994 Mike Stump (mrs@cygnus.com) - - * typeinfo.h (type_info::{name, before}): Add to match draft. - -Thu Nov 3 00:56:34 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * Makefile.in (LIBIBERTY_OBJS): Add strerror.o. - -Mon Oct 31 15:33:06 1994 Kung Hsu (kung@mexican.cygnus.com) - - * typeinfo.cc: Fix a bug in the final return. - * typeinfo.cc: Fix the ANSI header version number. - * typeinfo.h: ditto. - -Fri Oct 28 14:23:12 1994 Mike Stump <mrs@cygnus.com> - - * type_info.{cc,h}: Rename to typeinfo to better match current draft. - -Wed Oct 26 11:13:53 1994 Kung Hsu (kung@mexican.cygnus.com) - - * type_info.h: new header file for rtti. - * type_info.cc: new code file for rtti. - * Makefile.in: change to include type_info.o in libstdc++ for rtti. - -Sat Oct 15 16:09:51 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * libg++ 2.6.1 released. - - * cinst.hI: Also declare instantiations of out-of-line functions. - -Fri Oct 14 15:00:09 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * configure.in (CXXINCLUDES): Use {} to wrap variable name. - * tests/configure.in (CXXINCLUDES): Ditto. - - * cinst.hI: Declare instantiations of two-argument functions so - overload resolution will work. - * complext.hI: Always include cinst.hI. - - * bastring.ccI (operator>>): Tweak. - -Tue Oct 11 17:07:49 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * stddef*: Do the #pragma i/i thang. - - * bastring.hI (basic_string::put_at): Use operator[]. - (basic_string::terminate): Don't necessarily copy the rep. - - * bastring.ccI (operator>>): Avoid shrinking and then re-expanding - the string. - - * bastring.*I, sinst.cc: Only allow allocation policy control if - _G_ALLOC_CONTROL is defined. - - * Makefile.in (libstdc++.a): Depend on iostream.list and libiberty.a. - (../libio/iostream.list): New rule. - (../libiberty/libiberty.a): New rule. - (OBJS): Add stddef.o. - -Sat Oct 8 23:59:45 1994 Jason Merrill (jason@phydeaux.cygnus.com) - - * *: First checkin. diff --git a/contrib/libg++/libstdc++/Makefile.in b/contrib/libg++/libstdc++/Makefile.in deleted file mode 100644 index a4bdc4fc216f..000000000000 --- a/contrib/libg++/libstdc++/Makefile.in +++ /dev/null @@ -1,310 +0,0 @@ -# Copyright (C) 1994, 1995 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.7.2 - -OBJS = newi.o cstringi.o stddefi.o typeinfoi.o exceptioni.o stdexcepti.o \ - cstdlibi.o cmathi.o -SUBLIBS = $(STAMP)-string $(STAMP)-complex - -# 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 new stddef string exception stdexcept typeinfo \ - algorithm deque list map queue set stack vector utility functional \ - iterator memory numeric - -ARLIB = libstdc++.a -SHLIB = libstdc++.so.$(VERSION) -SHARLIB = libstdc++-sh.a -SHLINK = libstdc++.so -MSHLINK = foo -SHFLAGS = -SHDEPS = - -STAMP = bigstmp - -LIBS = $(ARLIB) - -#### 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) -INSTALLDIR = $(libdir) - -MOSTLYCLEAN_JUNK = *stmp-* tlib*.a *.s *.ii stdlist piclist -CLEAN_JUNK = $(LIBS) - -# Remove these for public releases. -CXXFLAGS = -g -O3 -Wall -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Winline -CFLAGS = -g -O3 -Wpointer-arith -Wnested-externs - -.PHONY: libs -libs: $(LIBS) - -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 stl/stl.list - -rm -f tlist - cp stdlist tlist - sed 's,\([A-Za-z_]*\.o\),stl/\1,g' stl/stl.list >> tlist - if [ -n "$(PICFLAG)" ]; then \ - sed 's,\([A-Za-z_]*\.o\),pic/\1,g' tlist > tlist2 ; \ - mv tlist2 tlist ; \ - else true ; fi - mv tlist piclist - -$(ARLIB): stdlist stl/stl.list - -rm -f t$(ARLIB) - $(AR) $(AR_FLAGS) t$(ARLIB) `cat stdlist` - cd stl; $(AR) $(AR_FLAGS) ../t$(ARLIB) `cat stl.list` - mv t$(ARLIB) $(ARLIB) - $(RANLIB) $(ARLIB) - -$(SHLIB): piclist - $(CXX) $(SHFLAGS) -shared -o $(SHLIB) `cat piclist` $(SHDEPS) - -$(SHARLIB): $(SHLIB) - -rm -f t$(SHARLIB) - $(AR) $(AR_FLAGS) t$(SHARLIB) $(SHLIB) - mv t$(SHARLIB) $(SHARLIB) - $(RANLIB) $(SHARLIB) - -$(SHLINK): - ln -s -f $(SHLIB) $(SHLINK) - -$(MSHLINK): - ln -s -f $(SHLIB) $(MSHLINK) - -$(IO_DIR)/iostream.list: force - cd $(IO_DIR) ; $(MAKE) $(FLAGS_TO_PASS) iostream.list - -stl/stl.list: force - @rootme=`pwd`/ ; export rootme; cd stl ; \ - $(MAKE) $(FLAGS_TO_PASS) stl.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 - -typeinfoi.o: ${srcdir}/typeinfoi.cc ${srcdir}/std/typeinfo.h - if [ -n "$(PICFLAG)" ]; then \ - $(COMPILE.cc) $(PICFLAG) ${srcdir}/typeinfoi.cc -frtti -o pic/typeinfoi.o; \ - else true ; fi - $(COMPILE.cc) ${srcdir}/typeinfoi.cc -frtti - -stdexcepti.o: ${srcdir}/stdexcepti.cc ${srcdir}/std/stdexcept.h - if [ -n "$(PICFLAG)" ]; then \ - $(COMPILE.cc) $(PICFLAG) ${srcdir}/stdexcepti.cc -frtti -o pic/stdexcepti.o; \ - else true ; fi - $(COMPILE.cc) ${srcdir}/stdexcepti.cc -frtti - -exceptioni.o: ${srcdir}/exceptioni.cc - if [ -n "$(PICFLAG)" ]; then \ - $(COMPILE.cc) $(PICFLAG) ${srcdir}/exceptioni.cc -O0 -fhandle-exceptions -frtti -o pic/exceptioni.o; \ - else true ; fi - $(COMPILE.cc) ${srcdir}/exceptioni.cc -O0 -fhandle-exceptions -frtti - -# These are here for SunOS VPATH. -newi.o: newi.cc -cstringi.o: cstringi.cc -stddefi.o: stddefi.cc -cstdlibi.o: cstdlibi.cc -cmathi.o: cmathi.cc -typeinfoi.o: typeinfoi.cc -stdexcepti.o: stdexcepti.cc - -# 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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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-complex: ${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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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-complex - -bigstmp-complex: ${srcdir}/cinst.cc ${srcdir}/std/complext.h \ - ${srcdir}/std/complext.cc ${srcdir}/std/dcomplex.h \ - ${srcdir}/std/ldcomplex.h - echo fcomplex - if [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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 [ -n "$(PICFLAG)" ]; 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-complex - -.PHONY: install -install: - rootme=`pwd`/ ; export rootme ; \ - if [ -z "$(MULTISUBDIR)" ]; then \ - cd $(srcdir); \ - for FILE in $(HEADERS) *.h std/*.*; do \ - rm -f $(gxx_includedir)/$$FILE ; \ - $(INSTALL_DATA) $$FILE $(gxx_includedir)/$$FILE ; \ - chmod a-x $(gxx_includedir)/$$FILE ; \ - done ; \ - cd stl; \ - for FILE in *.h; do \ - rm -f $(gxx_includedir)/$$FILE ; \ - $(INSTALL_DATA) $$FILE $(gxx_includedir)/$$FILE ; \ - chmod a-x $(gxx_includedir)/$$FILE ; \ - done ; \ - else true ; \ - fi - rootme=`pwd`/ ; export rootme ; \ - for FILE in $(LIBS) ; do \ - rm -f $(INSTALLDIR)$(MULTISUBDIR)/$$FILE ; \ - if [ $$FILE = $(SHLINK) ] || [ $$FILE = $(MSHLINK) ]; then \ - ln -s -f $(SHLIB) $(INSTALLDIR)$(MULTISUBDIR)/$$FILE ; \ - 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: diff --git a/contrib/libg++/libstdc++/algorithm b/contrib/libg++/libstdc++/algorithm deleted file mode 100644 index 472d24166401..000000000000 --- a/contrib/libg++/libstdc++/algorithm +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __ALGORITHM__ -#define __ALGORITHM__ -#include <algo.h> -#endif diff --git a/contrib/libg++/libstdc++/cassert b/contrib/libg++/libstdc++/cassert deleted file mode 100644 index 848087f1783c..000000000000 --- a/contrib/libg++/libstdc++/cassert +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CASSERT__ -#include <std/cassert.h> -#endif diff --git a/contrib/libg++/libstdc++/cctype b/contrib/libg++/libstdc++/cctype deleted file mode 100644 index 12d96d75917b..000000000000 --- a/contrib/libg++/libstdc++/cctype +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CCTYPE__ -#include <std/cctype.h> -#endif diff --git a/contrib/libg++/libstdc++/cerrno b/contrib/libg++/libstdc++/cerrno deleted file mode 100644 index bbd93f750673..000000000000 --- a/contrib/libg++/libstdc++/cerrno +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CERRNO__ -#include <std/cerrno.h> -#endif diff --git a/contrib/libg++/libstdc++/cfloat b/contrib/libg++/libstdc++/cfloat deleted file mode 100644 index bd7497a9ebd6..000000000000 --- a/contrib/libg++/libstdc++/cfloat +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CFLOAT__ -#include <std/cfloat.h> -#endif diff --git a/contrib/libg++/libstdc++/cinst.cc b/contrib/libg++/libstdc++/cinst.cc deleted file mode 100644 index 92236c4f8c0c..000000000000 --- a/contrib/libg++/libstdc++/cinst.cc +++ /dev/null @@ -1,151 +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 class complex<f>; -#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&, complex<f>); -#endif diff --git a/contrib/libg++/libstdc++/ciso646 b/contrib/libg++/libstdc++/ciso646 deleted file mode 100644 index 512090866954..000000000000 --- a/contrib/libg++/libstdc++/ciso646 +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CISO646__ -#include <std/ciso646.h> -#endif diff --git a/contrib/libg++/libstdc++/climits b/contrib/libg++/libstdc++/climits deleted file mode 100644 index 4b7b81d82e35..000000000000 --- a/contrib/libg++/libstdc++/climits +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CLIMITS__ -#include <std/climits.h> -#endif diff --git a/contrib/libg++/libstdc++/clocale b/contrib/libg++/libstdc++/clocale deleted file mode 100644 index 9e20a88bfa42..000000000000 --- a/contrib/libg++/libstdc++/clocale +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CLOCALE__ -#include <std/clocale.h> -#endif diff --git a/contrib/libg++/libstdc++/cmath b/contrib/libg++/libstdc++/cmath deleted file mode 100644 index da5bce9cad31..000000000000 --- a/contrib/libg++/libstdc++/cmath +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CMATH__ -#include <std/cmath.h> -#endif diff --git a/contrib/libg++/libstdc++/cmathi.cc b/contrib/libg++/libstdc++/cmathi.cc deleted file mode 100644 index e9fa0604eb92..000000000000 --- a/contrib/libg++/libstdc++/cmathi.cc +++ /dev/null @@ -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 "std/cmath.h" -#endif -#include <std/cmath.h> diff --git a/contrib/libg++/libstdc++/complex b/contrib/libg++/libstdc++/complex deleted file mode 100644 index 17e2fe439bf7..000000000000 --- a/contrib/libg++/libstdc++/complex +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __COMPLEX__ -#include <std/complex.h> -#endif diff --git a/contrib/libg++/libstdc++/complex.h b/contrib/libg++/libstdc++/complex.h deleted file mode 100644 index 554210dcffd6..000000000000 --- a/contrib/libg++/libstdc++/complex.h +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- backward compatiblity header. -// Copyright (C) 1994 Free Software Foundation - -#ifndef __COMPLEX_H__ -#include <std/complex.h> -#endif diff --git a/contrib/libg++/libstdc++/csetjmp b/contrib/libg++/libstdc++/csetjmp deleted file mode 100644 index b635d738a4fb..000000000000 --- a/contrib/libg++/libstdc++/csetjmp +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSETJMP__ -#include <std/csetjmp.h> -#endif diff --git a/contrib/libg++/libstdc++/csignal b/contrib/libg++/libstdc++/csignal deleted file mode 100644 index 21ed90cda088..000000000000 --- a/contrib/libg++/libstdc++/csignal +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSIGNAL__ -#include <std/csignal.h> -#endif diff --git a/contrib/libg++/libstdc++/cstdarg b/contrib/libg++/libstdc++/cstdarg deleted file mode 100644 index c8ca3eabf13d..000000000000 --- a/contrib/libg++/libstdc++/cstdarg +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDARG__ -#include <std/cstdarg.h> -#endif diff --git a/contrib/libg++/libstdc++/cstddef b/contrib/libg++/libstdc++/cstddef deleted file mode 100644 index 18134383bb23..000000000000 --- a/contrib/libg++/libstdc++/cstddef +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDDEF__ -#include <std/cstddef.h> -#endif diff --git a/contrib/libg++/libstdc++/cstdio b/contrib/libg++/libstdc++/cstdio deleted file mode 100644 index ac851787b307..000000000000 --- a/contrib/libg++/libstdc++/cstdio +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDIO__ -#include <std/cstdio.h> -#endif diff --git a/contrib/libg++/libstdc++/cstdlib b/contrib/libg++/libstdc++/cstdlib deleted file mode 100644 index fa4dac415f56..000000000000 --- a/contrib/libg++/libstdc++/cstdlib +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDLIB__ -#include <std/cstdlib.h> -#endif diff --git a/contrib/libg++/libstdc++/cstdlibi.cc b/contrib/libg++/libstdc++/cstdlibi.cc deleted file mode 100644 index bd94aa5dfa38..000000000000 --- a/contrib/libg++/libstdc++/cstdlibi.cc +++ /dev/null @@ -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 "std/cstdlib.h" -#endif -#include <std/cstdlib.h> diff --git a/contrib/libg++/libstdc++/cstring b/contrib/libg++/libstdc++/cstring deleted file mode 100644 index e0d18cfaa5ec..000000000000 --- a/contrib/libg++/libstdc++/cstring +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTRING__ -#include <std/cstring.h> -#endif diff --git a/contrib/libg++/libstdc++/cstringi.cc b/contrib/libg++/libstdc++/cstringi.cc deleted file mode 100644 index e981ab73c984..000000000000 --- a/contrib/libg++/libstdc++/cstringi.cc +++ /dev/null @@ -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 "std/cstring.h" -#endif -#include <std/cstring.h> diff --git a/contrib/libg++/libstdc++/ctime b/contrib/libg++/libstdc++/ctime deleted file mode 100644 index 8b68715ac44a..000000000000 --- a/contrib/libg++/libstdc++/ctime +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CTIME__ -#include <std/ctime.h> -#endif diff --git a/contrib/libg++/libstdc++/cwchar b/contrib/libg++/libstdc++/cwchar deleted file mode 100644 index be96cc81d5b4..000000000000 --- a/contrib/libg++/libstdc++/cwchar +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CWCHAR__ -#include <std/cwchar.h> -#endif diff --git a/contrib/libg++/libstdc++/cwctype b/contrib/libg++/libstdc++/cwctype deleted file mode 100644 index 1eaa0ca8e031..000000000000 --- a/contrib/libg++/libstdc++/cwctype +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CWCTYPE__ -#include <std/cwctype.h> -#endif diff --git a/contrib/libg++/libstdc++/deque b/contrib/libg++/libstdc++/deque deleted file mode 100644 index bdc14299a045..000000000000 --- a/contrib/libg++/libstdc++/deque +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __DEQUE__ -#define __DEQUE__ -#include <deque.h> -#endif diff --git a/contrib/libg++/libstdc++/exception b/contrib/libg++/libstdc++/exception deleted file mode 100644 index a843d4bbc9c0..000000000000 --- a/contrib/libg++/libstdc++/exception +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __EXCEPTION__ -#include <std/exception.h> -#endif diff --git a/contrib/libg++/libstdc++/exceptioni.cc b/contrib/libg++/libstdc++/exceptioni.cc deleted file mode 100644 index 115c6d6b7a41..000000000000 --- a/contrib/libg++/libstdc++/exceptioni.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Functions for Exception Support for -*- C++ -*- -// Copyright (C) 1994, 1995 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. - -#include <exception> -#include <stdlib.h> - -/* terminate (), unexpected (), set_terminate (), set_unexpected () as - well as the default terminate func and default unexpected func */ - -#if 0 -extern "C" int printf(const char *, ...); -#endif - -void -__default_terminate () -{ - abort (); -} - -void -__default_unexpected () -{ - __default_terminate (); -} - -static terminate_handler __terminate_func = __default_terminate; -static unexpected_handler __unexpected_func = __default_unexpected; - -terminate_handler -set_terminate (terminate_handler func) -{ - terminate_handler old = __terminate_func; - - __terminate_func = func; - return old; -} - -unexpected_handler -set_unexpected (unexpected_handler func) -{ - unexpected_handler old = __unexpected_func; - - __unexpected_func = func; - return old; -} - -void -terminate () -{ - __terminate_func (); -} - -void -unexpected () -{ - __unexpected_func (); -} diff --git a/contrib/libg++/libstdc++/functional b/contrib/libg++/libstdc++/functional deleted file mode 100644 index ee8b7f20202e..000000000000 --- a/contrib/libg++/libstdc++/functional +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __FUNCTIONAL__ -#define __FUNCTIONAL__ -#include <function.h> -#endif diff --git a/contrib/libg++/libstdc++/iterator b/contrib/libg++/libstdc++/iterator deleted file mode 100644 index a0fa054c5ec6..000000000000 --- a/contrib/libg++/libstdc++/iterator +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __ITERATOR__ -#define __ITERATOR__ -#include <iterator.h> -#endif diff --git a/contrib/libg++/libstdc++/list b/contrib/libg++/libstdc++/list deleted file mode 100644 index 475d8443d167..000000000000 --- a/contrib/libg++/libstdc++/list +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __LIST__ -#define __LIST__ -#include <list.h> -#endif diff --git a/contrib/libg++/libstdc++/map b/contrib/libg++/libstdc++/map deleted file mode 100644 index 0127b9db250f..000000000000 --- a/contrib/libg++/libstdc++/map +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __MAP__ -#define __MAP__ -#include <map.h> -#endif diff --git a/contrib/libg++/libstdc++/memory b/contrib/libg++/libstdc++/memory deleted file mode 100644 index 8328720db6d5..000000000000 --- a/contrib/libg++/libstdc++/memory +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __MEMORY__ -#define __MEMORY__ -#include <defalloc.h> -#endif diff --git a/contrib/libg++/libstdc++/new b/contrib/libg++/libstdc++/new deleted file mode 100644 index 47944fcff98d..000000000000 --- a/contrib/libg++/libstdc++/new +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __NEW__ -#include <std/new.h> -#endif diff --git a/contrib/libg++/libstdc++/new.h b/contrib/libg++/libstdc++/new.h deleted file mode 100644 index 02bba4509b0f..000000000000 --- a/contrib/libg++/libstdc++/new.h +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- backward compatiblity header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __NEW_H__ -#define __NEW_H__ -#include <std/new.h> -#endif diff --git a/contrib/libg++/libstdc++/newi.cc b/contrib/libg++/libstdc++/newi.cc deleted file mode 100644 index b4a5b6aeb7e3..000000000000 --- a/contrib/libg++/libstdc++/newi.cc +++ /dev/null @@ -1,7 +0,0 @@ -// Implementation file for the -*- C++ -*- dynamic memory management header. -// This file is part of the GNU ANSI C++ Library. - -#ifdef __GNUG__ -#pragma implementation "std/new.h" -#endif -#include <std/new.h> diff --git a/contrib/libg++/libstdc++/numeric b/contrib/libg++/libstdc++/numeric deleted file mode 100644 index dcb88737f171..000000000000 --- a/contrib/libg++/libstdc++/numeric +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __NUMERIC__ -#define __NUMERIC__ -#include <algo.h> -#endif diff --git a/contrib/libg++/libstdc++/queue b/contrib/libg++/libstdc++/queue deleted file mode 100644 index e71ce343067c..000000000000 --- a/contrib/libg++/libstdc++/queue +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __QUEUE__ -#define __QUEUE__ -#include <stack.h> -#endif diff --git a/contrib/libg++/libstdc++/set b/contrib/libg++/libstdc++/set deleted file mode 100644 index 0353285fe502..000000000000 --- a/contrib/libg++/libstdc++/set +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __SET__ -#define __SET__ -#include <set.h> -#endif diff --git a/contrib/libg++/libstdc++/sinst.cc b/contrib/libg++/libstdc++/sinst.cc deleted file mode 100644 index 136a05e532bb..000000000000 --- a/contrib/libg++/libstdc++/sinst.cc +++ /dev/null @@ -1,147 +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 - -#if 0 -#define _G_NO_EXTERN_TEMPLATES -#endif -#include <std/bastring.cc> - -#ifdef C -typedef char c; -#endif -#ifdef W -typedef wchar_t c; -#endif - -#ifdef TRAITS -template class string_char_traits <c>; -#endif - -#define STRING basic_string <c, string_char_traits <c> > -typedef class STRING s; -#define BSREP __bsrep <c, string_char_traits <c> > -typedef class BSREP r; - -#ifdef REP -template class BSREP; -r s::nilRep = { 0, 0, 1 }; -#ifdef _G_ALLOC_CONTROL -bool (*r::excess_slop) (size_t, size_t) = r::default_excess; -size_t (*r::frob_size) (size_t) = r::default_frob; -#endif -#endif - -#ifdef MAIN -template class STRING; -#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&); -#endif diff --git a/contrib/libg++/libstdc++/stack b/contrib/libg++/libstdc++/stack deleted file mode 100644 index dfe0c51e1813..000000000000 --- a/contrib/libg++/libstdc++/stack +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __STACK__ -#define __STACK__ -#include <stack.h> -#endif diff --git a/contrib/libg++/libstdc++/std/bastring.cc b/contrib/libg++/libstdc++/std/bastring.cc deleted file mode 100644 index 92c69d845b22..000000000000 --- a/contrib/libg++/libstdc++/std/bastring.cc +++ /dev/null @@ -1,489 +0,0 @@ -// Member templates 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. - -#include <std/stddef.h> -#include <std/bastring.h> - -extern "C++" { -template <class charT, class traits> -inline void * __bsrep <charT, traits>:: -operator new (size_t s, size_t extra) -{ - return ::operator new (s + extra * sizeof (charT)); -} - -template <class charT, class traits> -inline size_t __bsrep <charT, traits>:: -#if _G_ALLOC_CONTROL -default_frob (size_t s) -#else -frob_size (size_t s) -#endif -{ - size_t i = 16; - while (i < s) i *= 2; - return i; -} - -template <class charT, class traits> -inline __bsrep <charT, traits> * __bsrep <charT, traits>:: -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> -charT * __bsrep <charT, traits>:: -clone () -{ - Rep *p = Rep::create (len); - p->copy (0, data (), len); - p->len = len; - return p->data (); -} - -template <class charT, class traits> -inline bool __bsrep <charT, traits>:: -#ifdef _G_ALLOC_CONTROL -default_excess (size_t s, size_t r) -#else -excess_slop (size_t s, size_t r) -#endif -{ - return 2 * (s <= 16 ? 16 : s) < r; -} - -template <class charT, class traits> -inline bool basic_string <charT, traits>:: -check_realloc (size_t s) const -{ - s += sizeof (charT); - return (rep ()->ref > 1 - || s > capacity () - || Rep::excess_slop (s, capacity ())); -} - -template <class charT, class traits> -void basic_string <charT, traits>:: -alloc (size_t 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> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos1, size_t n1, - const basic_string& str, size_t pos2, size_t 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> -inline void __bsrep <charT, traits>:: -copy (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::copy (data () + pos, s, n); -} - -template <class charT, class traits> -inline void __bsrep <charT, traits>:: -move (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::move (data () + pos, s, n); -} - -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos, size_t n1, const charT* s, size_t n2) -{ - 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->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> -inline void __bsrep <charT, traits>:: -set (size_t pos, const charT c, size_t n) -{ - traits::set (data () + pos, c, n); -} - -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos, size_t n1, size_t 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> -void basic_string <charT, traits>:: -resize (size_t n, charT c) -{ - LENGTHERROR (n > max_size ()); - - if (n > length ()) - append (n - length (), c); - else - remove (n); -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -copy (charT* s, size_t n, size_t pos) -{ - OUTOFRANGE (pos > length ()); - - if (n > length () - pos) - n = length () - pos; - - traits::copy (s, data () + pos, n); - return n; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find (const charT* s, size_t pos, size_t 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> -inline size_t basic_string <charT, traits>:: -_find (const charT* ptr, charT c, size_t xpos, size_t len) -{ - for (; xpos < len; ++xpos) - if (traits::eq (ptr [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find (charT c, size_t pos) const -{ - return _find (data (), c, pos, length ()); -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -rfind (const charT* s, size_t pos, size_t 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> -size_t basic_string <charT, traits>:: -rfind (charT c, size_t 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> -size_t basic_string <charT, traits>:: -find_first_of (const charT* s, size_t pos, size_t 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> -size_t basic_string <charT, traits>:: -find_last_of (const charT* s, size_t pos, size_t n) const -{ - size_t xpos = length (); - for (; xpos-- > pos; ) - if (_find (s, data () [xpos], 0, n) != npos) - return xpos; - return npos; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_first_not_of (const charT* s, size_t pos, size_t 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> -size_t basic_string <charT, traits>:: -find_first_not_of (charT c, size_t 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> -size_t basic_string <charT, traits>:: -find_last_not_of (const charT* s, size_t pos, size_t n) const -{ - size_t xpos = length (); - for (; xpos-- > pos; ) - if (_find (s, data () [xpos], 0, n) == npos) - return xpos; - return npos; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_last_not_of (charT c, size_t pos) const -{ - size_t xpos = length (); - for (; xpos-- > pos; ) - if (traits::ne (data () [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits> -int basic_string <charT, traits>:: -compare (const basic_string& str, size_t pos, size_t 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> -int basic_string <charT, traits>:: -compare (const charT* s, size_t pos, size_t 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; - return (length () - pos) - n; -} - -#include <iostream.h> - -template <class charT, class traits> -istream & -operator>> (istream &is, basic_string <charT, traits> &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 += ch; - if (--w == 1) - break; - } - } - - is.isfx (); - if (s.length () == 0) - is.setstate (ios::failbit); - - return is; -} - -template <class charT, class traits> -ostream & -operator<< (ostream &o, const basic_string <charT, traits>& s) -{ - return o.write (s.data (), s.length ()); -} - -template <class charT, class traits> -istream& -getline (istream &is, basic_string <charT, traits>& 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 += 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; -} -} // extern "C++" diff --git a/contrib/libg++/libstdc++/std/bastring.h b/contrib/libg++/libstdc++/std/bastring.h deleted file mode 100644 index d6174a21f92d..000000000000 --- a/contrib/libg++/libstdc++/std/bastring.h +++ /dev/null @@ -1,574 +0,0 @@ -// Main templates for the -*- C++ -*- string classes. -// Copyright (C) 1994, 1995 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 <std/stddef.h> -#include <std/straits.h> - -#if _G_USE_EXCEPTIONS - -#include <stdexcept> -#define OUTOFRANGE(cond) \ - do { if (!(cond)) throw out_of_range (#cond); } while (0) -#define LENGTHERROR(cond) \ - do { if (!(cond)) throw length_error (#cond); } while (0) - -#else - -#include <cassert> -#define OUTOFRANGE(cond) assert (!(cond)) -#define LENGTHERROR(cond) assert (!(cond)) - -#endif - -extern "C++" { -class istream; class ostream; - -// Should be a nested class basic_string<charT, traits>::Rep, but nested -// classes don't work well with templates in g++. -template <class charT, class traits = string_char_traits<charT> > -struct __bsrep { - typedef __bsrep Rep; - - size_t len, res, ref; - bool selfish; - - charT* data () { return reinterpret_cast<charT *>(this + 1); } - charT& operator[] (size_t s) { return data () [s]; } - charT* grab () { if (selfish) return clone (); ++ref; return data (); } - void release () { if (--ref == 0) delete this; } - - inline static void * operator new (size_t, size_t); - 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); - -#if _G_ALLOC_CONTROL - // These function pointers allow you to modify the allocation policy used - // by the string classes. By default they expand by powers of two, but - // this may be excessive for space-critical applications. - - // Returns true if ALLOCATED is too much larger than LENGTH - static bool (*excess_slop) (size_t length, size_t allocated); - inline static bool default_excess (size_t, size_t); - - // Returns a good amount of space to allocate for a string of length LENGTH - static size_t (*frob_size) (size_t length); - inline static size_t default_frob (size_t); -#else - inline static bool excess_slop (size_t, size_t); - inline static size_t frob_size (size_t); -#endif - -private: - Rep &operator= (const Rep &); -}; - -// #include <iterator.h> - -template <class charT, class traits = string_char_traits<charT> > -class basic_string -{ -private: - typedef __bsrep<charT, traits> Rep; - -public: -// types: - typedef traits traits_type; - typedef charT value_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; -#if 0 - typedef reverse_iterator<iterator, value_type, - reference, difference_type> reverse_iterator; - typedef reverse_iterator<const_iterator, value_type, const_reference, - difference_type> const_reverse_iterator; -#endif - 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); } -#if 0 - template<class InputIterator> - basic_string(InputIterator begin, InputIterator end, - Allocator& = Allocator()); -#endif - - ~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); } -#if 0 - template<class InputIterator> - basic_string& append(InputIterator first, InputIterator last); -#endif - - 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); } -#if 0 - template<class InputIterator> - basic_string& assign(InputIterator first, InputIterator last); -#endif - - 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 pos = p - begin (); insert (pos, 1, c); return pos +begin (); } - iterator insert(iterator p, size_type n, charT c) - { size_type pos = p - begin (); insert (pos, n, c); return pos +begin (); } -#if 0 - template<class InputIterator> - void insert(iterator p, InputIterator first, InputIterator last); -#endif - - basic_string& remove (size_type pos = 0, size_type n = npos) - { return replace (pos, n, (size_type)0, (charT)0); } - basic_string& remove (iterator pos) - { return replace (pos - begin (), 1, (size_type)0, (charT)0); } - basic_string& remove (iterator first, iterator last) - { return replace (first - begin (), last - first, (size_type)0, (charT)0);} - - 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 - begin (), i2 - i1, str); } - basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n) - { return replace (i1 - begin (), i2 - i1, s, n); } - basic_string& replace (iterator i1, iterator i2, const charT* s) - { return replace (i1 - begin (), i2 - i1, s); } - basic_string& replace (iterator i1, iterator i2, size_type n, charT c) - { return replace (i1 - begin (), i2 - i1, n, c); } -#if 0 - template<class InputIterator> - basic_string& replace(iterator i1, iterator i2, - InputIterator j1, InputIterator j2); -#endif - -private: - static charT eos () { return traits::eos (); } - void unique () { if (rep ()->ref > 1) alloc (capacity (), 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) - { unique (); 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 - { terminate (); return data (); } - void resize (size_type n, charT c); - void resize (size_type n) - { resize (n, eos ()); } - void reserve (size_type) { } - - size_type copy (charT* s, size_type n, size_type pos = 0); - - 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 ()]; } - const_iterator begin () const { return &(*rep ())[0]; } - const_iterator end () const { return &(*rep ())[length ()]; } - -#if 0 - 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 ()); } -#endif - -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; -}; - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (charT lhs, const basic_string <charT, traits>& rhs) -{ - basic_string <charT, traits> str (1, lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, charT rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (1, rhs); - return str; -} - -template <class charT, class traits> -inline bool -operator== (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template <class charT, class traits> -inline bool -operator== (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) == 0); -} - -template <class charT, class traits> -inline bool -operator== (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template <class charT, class traits> -inline bool -operator!= (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) != 0); -} - -template <class charT, class traits> -inline bool -operator!= (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template <class charT, class traits> -inline bool -operator< (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template <class charT, class traits> -inline bool -operator< (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) > 0); -} - -template <class charT, class traits> -inline bool -operator< (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template <class charT, class traits> -inline bool -operator> (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) < 0); -} - -template <class charT, class traits> -inline bool -operator> (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template <class charT, class traits> -inline bool -operator<= (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) >= 0); -} - -template <class charT, class traits> -inline bool -operator<= (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template <class charT, class traits> -inline bool -operator>= (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) <= 0); -} - -template <class charT, class traits> -inline bool -operator>= (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) >= 0); -} - -// Kludge this until g++ supports the new template overloading semantics. -#if !defined(FUNCTION_H) -template <class charT, class traits> -inline bool -operator!= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template <class charT, class traits> -inline bool -operator> (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template <class charT, class traits> -inline bool -operator<= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template <class charT, class traits> -inline bool -operator>= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) >= 0); -} -#endif - -class istream; class ostream; -template <class charT, class traits> istream& -operator>> (istream&, basic_string <charT, traits>&); -template <class charT, class traits> ostream& -operator<< (ostream&, const basic_string <charT, traits>&); -template <class charT, class traits> istream& -getline (istream&, basic_string <charT, traits>&, charT delim = '\n'); - -} // extern "C++" - -#if !defined (_G_NO_EXTERN_TEMPLATES) -#include <std/sinst.h> -#endif - -#endif diff --git a/contrib/libg++/libstdc++/std/cassert.h b/contrib/libg++/libstdc++/std/cassert.h deleted file mode 100644 index 83f9f4042f3b..000000000000 --- a/contrib/libg++/libstdc++/std/cassert.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- assertions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __ASSERT__ -#define __ASSERT__ -#include <assert.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cctype.h b/contrib/libg++/libstdc++/std/cctype.h deleted file mode 100644 index e2765aed50a6..000000000000 --- a/contrib/libg++/libstdc++/std/cctype.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/cerrno.h b/contrib/libg++/libstdc++/std/cerrno.h deleted file mode 100644 index ce493469597e..000000000000 --- a/contrib/libg++/libstdc++/std/cerrno.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/cfloat.h b/contrib/libg++/libstdc++/std/cfloat.h deleted file mode 100644 index 05a6338740e7..000000000000 --- a/contrib/libg++/libstdc++/std/cfloat.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- floating point header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CFLOAT__ -#define __CFLOAT__ -#include <float.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cinst.h b/contrib/libg++/libstdc++/std/cinst.h deleted file mode 100644 index e41a2bad1460..000000000000 --- a/contrib/libg++/libstdc++/std/cinst.h +++ /dev/null @@ -1,112 +0,0 @@ -// Forward declarations of -*- C++ -*- complex number instantiations. -// 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 __CINST__ -#define __CINST__ - -#ifndef _G_NO_EXTERN_TEMPLATES -extern "C++" { -extern template class complex<float>; -extern template class complex<double>; -extern template class complex<long double>; - -#define __B(type) bool -#define __C(type) complex<type> -#define __F(type) type -#define __I(type) int -#define __IS(type) istream& -#define __OS(type) ostream& -#define __CR(type) complex<type>& -#define __CCR(type) const complex<type>& - -#define __D2(name,type,ret,arg1,arg2) ret(type) name (arg1(type), arg2(type)); - -#define __S1(name,type,ret,arg1) \ - extern template ret(type) name (arg1(type)); -#define __S2(name,type,ret,arg1,arg2) \ - extern template __D2 (name,type,ret,arg1,arg2) - -#define __DO1(name,ret,arg1) \ - __S1(name,float,ret,arg1) \ - __S1(name,double,ret,arg1) \ - __S1(name,long double,ret,arg1) -#define __DO2(name,ret,arg1,arg2) \ - __S2(name,float,ret,arg1,arg2) \ - __S2(name,double,ret,arg1,arg2) \ - __S2(name,long double,ret,arg1,arg2) - -#define __DOCCC(name) __DO2(name,__C,__CCR,__CCR) -#define __DOCCF(name) __DO2(name,__C,__CCR,__F) -#define __DOCFC(name) __DO2(name,__C,__F,__CCR) -#define __DOCFF(name) __DO2(name,__C,__F,__F) -#define __DOBCC(name) __DO2(name,__B,__CCR,__CCR) -#define __DOBCF(name) __DO2(name,__B,__CCR,__F) -#define __DOBFC(name) __DO2(name,__B,__F,__CCR) -#define __DOFC(name) __DO1(name,__F,__CCR) -#define __DOCC(name) __DO1(name,__C,__CCR) - -__DO2(operator+,__C,__CCR,__CCR) -__DO2(operator+,__C,__CCR,__F) -__DO2(operator+,__C,__F,__CCR) -__DO2(operator-,__C,__CCR,__CCR) -__DO2(operator-,__C,__CCR,__F) -__DO2(operator-,__C,__F,__CCR) -__DO2(operator*,__C,__CCR,__CCR) -__DO2(operator*,__C,__CCR,__F) -__DO2(operator*,__C,__F,__CCR) -__DO2(operator/,__C,__CCR,__F) -__DO1(operator+,__C,__CCR) -__DO1(operator-,__C,__CCR) -__DO2(operator==,__B,__CCR,__CCR) -__DO2(operator==,__B,__CCR,__F) -__DO2(operator==,__B,__F,__CCR) -__DO2(operator!=,__B,__CCR,__CCR) -__DO2(operator!=,__B,__CCR,__F) -__DO2(operator!=,__B,__F,__CCR) -__DO1(abs,__F,__CCR) -__DO1(arg,__F,__CCR) -__DO2(polar,__C,__F,__F) -__DO1(conj,__C,__CCR) -__DO1(norm,__F,__CCR) - -#undef __DO1 -#undef __DO2 -#undef __S1 -#undef __S2 -#undef __D2 -#undef __B -#undef __C -#undef __F -#undef __I -#undef __IS -#undef __OS -#undef __CR -#undef __CCR -} // extern "C++" -#endif - -#endif diff --git a/contrib/libg++/libstdc++/std/ciso646.h b/contrib/libg++/libstdc++/std/ciso646.h deleted file mode 100644 index 974d15b57420..000000000000 --- a/contrib/libg++/libstdc++/std/ciso646.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- ISO 646 header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CISO646__ -#define __CISO646__ -#include <iso646.h> -#endif diff --git a/contrib/libg++/libstdc++/std/climits.h b/contrib/libg++/libstdc++/std/climits.h deleted file mode 100644 index 45e3d62b492f..000000000000 --- a/contrib/libg++/libstdc++/std/climits.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- integral type limits header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CLIMITS__ -#define __CLIMITS__ -#include <limits.h> -#endif diff --git a/contrib/libg++/libstdc++/std/clocale.h b/contrib/libg++/libstdc++/std/clocale.h deleted file mode 100644 index b67cf31c9d2e..000000000000 --- a/contrib/libg++/libstdc++/std/clocale.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/cmath.h b/contrib/libg++/libstdc++/std/cmath.h deleted file mode 100644 index 8c6628ed83c9..000000000000 --- a/contrib/libg++/libstdc++/std/cmath.h +++ /dev/null @@ -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 "std/cmath.h" -#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 diff --git a/contrib/libg++/libstdc++/std/complex.h b/contrib/libg++/libstdc++/std/complex.h deleted file mode 100644 index bfdd352b4623..000000000000 --- a/contrib/libg++/libstdc++/std/complex.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/complext.cc b/contrib/libg++/libstdc++/std/complext.cc deleted file mode 100644 index 0b63125b2d20..000000000000 --- a/contrib/libg++/libstdc++/std/complext.cc +++ /dev/null @@ -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 <std/complex.h> - -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>& complex<FLOAT>:: -operator /= (const complex& 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 = (re * t + im) / d; - ni = (im * t - re) / d; - } - else - { - t = y.im / y.re; - d = y.re * (1 + t*t); - nr = (re + im * t) / d; - ni = (im - re * t) / d; - } - re = nr; - im = ni; - return *this; -} - -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 = 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++" diff --git a/contrib/libg++/libstdc++/std/complext.h b/contrib/libg++/libstdc++/std/complext.h deleted file mode 100644 index db87dd0988fe..000000000000 --- a/contrib/libg++/libstdc++/std/complext.h +++ /dev/null @@ -1,317 +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 <std/cmath.h> - -#if ! defined (__GNUG__) && ! defined (__attribute__) -#define __attribute__ (foo) /* Ignore. */ -#endif - -extern "C++" { -template <class FLOAT> -class complex -{ -public: - complex (FLOAT r = 0, FLOAT i = 0): re (r), im (i) { } - complex& operator += (const complex&); - complex& operator -= (const complex&); - complex& operator *= (const complex&); - complex& operator /= (const complex&); - FLOAT real () const { return re; } - FLOAT imag () const { return im; } -private: - FLOAT re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend FLOAT real (const complex&) __attribute__ ((const)); - friend FLOAT imag (const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator + (FLOAT, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator - (FLOAT, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator * (FLOAT, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator / (FLOAT, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, FLOAT) __attribute__ ((const)); - friend bool operator == (FLOAT, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, FLOAT) __attribute__ ((const)); - friend bool operator != (FLOAT, const complex&) __attribute__ ((const)); - friend complex polar (FLOAT, FLOAT) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, FLOAT) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (FLOAT, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; - -// Declare specializations. -class complex<float>; -class complex<double>; -class complex<long double>; - -template <class FLOAT> -inline complex<FLOAT>& -complex<FLOAT>::operator += (const complex<FLOAT>& r) -{ - re += r.re; - im += r.im; - return *this; -} - -template <class FLOAT> -inline complex<FLOAT>& -complex<FLOAT>::operator -= (const complex<FLOAT>& r) -{ - re -= r.re; - im -= r.im; - return *this; -} - -template <class FLOAT> -inline complex<FLOAT>& -complex<FLOAT>::operator *= (const complex<FLOAT>& r) -{ - FLOAT f = re * r.re - im * r.im; - im = re * r.im + im * r.re; - re = f; - return *this; -} - -template <class FLOAT> inline FLOAT -imag (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return x.imag (); -} - -template <class FLOAT> inline FLOAT -real (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return x.real (); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) + real (y), imag (x) + imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) + y, imag (x)); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (x + real (y), imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator - (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) - real (y), imag (x) - imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator - (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) - y, imag (x)); -} - -template <class FLOAT> inline complex<FLOAT> -operator - (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (x - real (y), - imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator * (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) * real (y) - imag (x) * imag (y), - real (x) * imag (y) + imag (x) * real (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator * (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) * y, imag (x) * y); -} - -template <class FLOAT> inline complex<FLOAT> -operator * (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (x * real (y), x * imag (y)); -} - -template <class FLOAT> complex<FLOAT> -operator / (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) / y, imag (x) / y); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return x; -} - -template <class FLOAT> inline complex<FLOAT> -operator - (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return complex<FLOAT> (-real (x), -imag (x)); -} - -template <class FLOAT> inline bool -operator == (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return real (x) == real (y) && imag (x) == imag (y); -} - -template <class FLOAT> inline bool -operator == (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return real (x) == y && imag (x) == 0; -} - -template <class FLOAT> inline bool -operator == (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return x == real (y) && imag (y) == 0; -} - -template <class FLOAT> inline bool -operator != (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return real (x) != real (y) || imag (x) != imag (y); -} - -template <class FLOAT> inline bool -operator != (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return real (x) != y || imag (x) != 0; -} - -template <class FLOAT> inline bool -operator != (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - 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 FLOAT> inline FLOAT -abs (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return hypot (real (x), imag (x)); -} - -template <class FLOAT> inline FLOAT -arg (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return atan2 (imag (x), real (x)); -} - -template <class FLOAT> inline complex<FLOAT> -polar (FLOAT r, FLOAT t) __attribute__ ((const)) -{ - return complex<FLOAT> (r * cos (t), r * sin (t)); -} - -template <class FLOAT> inline complex<FLOAT> -conj (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x), -imag (x)); -} - -template <class FLOAT> inline FLOAT -norm (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return real (x) * real (x) + imag (x) * imag (x); -} - -// Declarations of templates in complext.ccI - -template <class FLOAT> complex<FLOAT> - operator / (const complex<FLOAT>&, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - operator / (FLOAT, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - cos (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - cosh (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - exp (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - log (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (const complex<FLOAT>&, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (const complex<FLOAT>&, FLOAT) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (const complex<FLOAT>&, int) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (FLOAT, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - sin (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - sinh (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - sqrt (const complex<FLOAT>&) __attribute__ ((const)); - -class istream; -class ostream; -template <class FLOAT> istream& operator >> (istream&, complex<FLOAT>&); -template <class FLOAT> ostream& operator << (ostream&, const complex<FLOAT>&); -} // extern "C++" - -// Specializations and such - -#include <std/fcomplex.h> -#include <std/dcomplex.h> -#include <std/ldcomplex.h> - -// Declare the instantiations. -#include <std/cinst.h> - -#endif diff --git a/contrib/libg++/libstdc++/std/csetjmp.h b/contrib/libg++/libstdc++/std/csetjmp.h deleted file mode 100644 index 4bba048dcb5e..000000000000 --- a/contrib/libg++/libstdc++/std/csetjmp.h +++ /dev/null @@ -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 - diff --git a/contrib/libg++/libstdc++/std/csignal.h b/contrib/libg++/libstdc++/std/csignal.h deleted file mode 100644 index 6febfb7b2ed5..000000000000 --- a/contrib/libg++/libstdc++/std/csignal.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/cstdarg.h b/contrib/libg++/libstdc++/std/cstdarg.h deleted file mode 100644 index 24c57f062997..000000000000 --- a/contrib/libg++/libstdc++/std/cstdarg.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- variable argument handling header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDARG__ -#define __CSTDARG__ -#include <stdarg.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cstddef.h b/contrib/libg++/libstdc++/std/cstddef.h deleted file mode 100644 index 0e025e3d163c..000000000000 --- a/contrib/libg++/libstdc++/std/cstddef.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- wrapper for the C standard definitions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDDEF__ -#define __CSTDDEF__ -#include <stddef.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cstdio.h b/contrib/libg++/libstdc++/std/cstdio.h deleted file mode 100644 index 1fe1456b5bdf..000000000000 --- a/contrib/libg++/libstdc++/std/cstdio.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/cstdlib.h b/contrib/libg++/libstdc++/std/cstdlib.h deleted file mode 100644 index 51dc00a5af09..000000000000 --- a/contrib/libg++/libstdc++/std/cstdlib.h +++ /dev/null @@ -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 "std/cstdlib.h" -#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 diff --git a/contrib/libg++/libstdc++/std/cstring.h b/contrib/libg++/libstdc++/std/cstring.h deleted file mode 100644 index f0e914b96810..000000000000 --- a/contrib/libg++/libstdc++/std/cstring.h +++ /dev/null @@ -1,71 +0,0 @@ -// The -*- C++ -*- null-terminated string header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTRING__ -#define __CSTRING__ - -#if 0 // Let's not bother with this just yet. -// The ANSI C prototypes for these functions have a const argument type and -// non-const return type, so we can't use them. - -#define strchr __hide_strchr -#define strpbrk __hide_strpbrk -#define strrchr __hide_strrchr -#define strstr __hide_strstr -#define memchr __hide_memchr -#endif // 0 - -#include <string.h> - -#if 0 // Let's not bother with this just yet. -#undef strchr -#undef strpbrk -#undef strrchr -#undef strstr -#undef memchr - -#include <std/cstddef.h> - -#ifdef __GNUG__ -#pragma interface "std/cstring.h" -#endif - -extern "C++" { -extern "C" const char *strchr (const char *, int); -inline char * -strchr (char *s, int c) -{ - return const_cast<char *> (strchr (static_cast<const char *> (s), c)); -} - -extern "C" const char *strpbrk (const char *, const char *); -inline char * -strpbrk (char *s1, const char *s2) -{ - return const_cast<char *> (strpbrk (static_cast<const char *> (s1), s2)); -} - -extern "C" const char *strrchr (const char *, int); -inline char * -strrchr (char *s, int c) -{ - return const_cast<char *> (strrchr (static_cast<const char *> (s), c)); -} - -extern "C" const char *strstr (const char *, const char *); -inline char * -strstr (char *s1, const char *s2) -{ - return const_cast<char *> (strstr (static_cast<const char *> (s1), s2)); -} - -extern "C" const void *memchr (const void *, int, size_t); -inline void * -memchr (void *s, int c, size_t n) -{ - return const_cast<void *> (memchr (static_cast<const void *> (s), c, n)); -} -} // extern "C++" - -#endif // 0 -#endif // !defined (__CSTRING__) diff --git a/contrib/libg++/libstdc++/std/ctime.h b/contrib/libg++/libstdc++/std/ctime.h deleted file mode 100644 index 0184da5929f3..000000000000 --- a/contrib/libg++/libstdc++/std/ctime.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/cwchar.h b/contrib/libg++/libstdc++/std/cwchar.h deleted file mode 100644 index 1674c12b61f0..000000000000 --- a/contrib/libg++/libstdc++/std/cwchar.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/cwctype.h b/contrib/libg++/libstdc++/std/cwctype.h deleted file mode 100644 index 81122012bd04..000000000000 --- a/contrib/libg++/libstdc++/std/cwctype.h +++ /dev/null @@ -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 diff --git a/contrib/libg++/libstdc++/std/dcomplex.h b/contrib/libg++/libstdc++/std/dcomplex.h deleted file mode 100644 index d3e5d311c634..000000000000 --- a/contrib/libg++/libstdc++/std/dcomplex.h +++ /dev/null @@ -1,89 +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&); - complex& operator-= (const complex&); - complex& operator*= (const complex&); - complex& operator/= (const complex&); - - double real () const { return re; } - double imag () const { return im; } -private: - double re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend double real (const complex& x) { return x.real (); } - friend double imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, double) __attribute__ ((const)); - friend complex operator + (double, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, double) __attribute__ ((const)); - friend complex operator - (double, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, double) __attribute__ ((const)); - friend complex operator * (double, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, double) __attribute__ ((const)); - friend complex operator / (double, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, double) __attribute__ ((const)); - friend bool operator == (double, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, double) __attribute__ ((const)); - friend bool operator != (double, const complex&) __attribute__ ((const)); - friend complex polar (double, double) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, double) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (double, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; - -inline complex<float>::complex (const complex<double>& r) -: re (r.real ()), im (r.imag ()) -{ } -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/exception.h b/contrib/libg++/libstdc++/std/exception.h deleted file mode 100644 index 6de65d8fc108..000000000000 --- a/contrib/libg++/libstdc++/std/exception.h +++ /dev/null @@ -1,39 +0,0 @@ -// Exception Handling header for -*- C++ -*- -// Copyright (C) 1995 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. - -#ifndef __EXCEPTION__ -#define __EXCEPTION__ - -extern "C++" { -// class XUNEXPECTED { to be specified }; -typedef void (*terminate_handler) (); -typedef void (*unexpected_handler) (); - -terminate_handler set_terminate (terminate_handler); -void terminate (void); -unexpected_handler set_unexpected (unexpected_handler); -void unexpected (void); -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/fcomplex.h b/contrib/libg++/libstdc++/std/fcomplex.h deleted file mode 100644 index 27f3be7a4809..000000000000 --- a/contrib/libg++/libstdc++/std/fcomplex.h +++ /dev/null @@ -1,85 +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&); - complex& operator-= (const complex&); - complex& operator*= (const complex&); - complex& operator/= (const complex&); - - float real () const { return re; } - float imag () const { return im; } -private: - float re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend float real (const complex& x) { return x.real (); } - friend float imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, float) __attribute__ ((const)); - friend complex operator + (float, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, float) __attribute__ ((const)); - friend complex operator - (float, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, float) __attribute__ ((const)); - friend complex operator * (float, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, float) __attribute__ ((const)); - friend complex operator / (float, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, float) __attribute__ ((const)); - friend bool operator == (float, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, float) __attribute__ ((const)); - friend bool operator != (float, const complex&) __attribute__ ((const)); - friend complex polar (float, float) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, float) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (float, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/ldcomplex.h b/contrib/libg++/libstdc++/std/ldcomplex.h deleted file mode 100644 index 95f90ae7f0ef..000000000000 --- a/contrib/libg++/libstdc++/std/ldcomplex.h +++ /dev/null @@ -1,93 +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&); - complex& operator-= (const complex&); - complex& operator*= (const complex&); - complex& operator/= (const complex&); - - long double real () const { return re; } - long double imag () const { return im; } -private: - long double re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend long double real (const complex& x) { return x.real (); } - friend long double imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, long double) __attribute__ ((const)); - friend complex operator + (long double, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, long double) __attribute__ ((const)); - friend complex operator - (long double, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, long double) __attribute__ ((const)); - friend complex operator * (long double, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, long double) __attribute__ ((const)); - friend complex operator / (long double, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, long double) __attribute__ ((const)); - friend bool operator == (long double, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, long double) __attribute__ ((const)); - friend bool operator != (long double, const complex&) __attribute__ ((const)); - friend complex polar (long double, long double) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, long double) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (long double, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; - -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 diff --git a/contrib/libg++/libstdc++/std/new.h b/contrib/libg++/libstdc++/std/new.h deleted file mode 100644 index cfdfbebdd63d..000000000000 --- a/contrib/libg++/libstdc++/std/new.h +++ /dev/null @@ -1,34 +0,0 @@ -// The -*- C++ -*- dynamic memory management header. -// Copyright (C) 1994 Free Software Foundation - -#ifndef __NEW__ -#define __NEW__ - -#ifdef __GNUG__ -#pragma interface "std/new.h" -#endif - -#include <std/cstddef.h> - -extern "C++" { -typedef void (*new_handler)(); -extern "C" new_handler set_new_handler (new_handler); - -#if defined(__GNUG__) && !defined (__STRICT_ANSI__) -// G++ implementation internals -extern new_handler __new_handler; -extern "C" void __default_new_handler (void); -#endif - -// replaceable signatures -void *operator new (size_t); -void *operator new[] (size_t); -void operator delete (void *); -void operator delete[] (void *); - -// default placement versions of operator new -inline void *operator new(size_t, void *place) { return place; } -inline void *operator new[](size_t, void *place) { return place; } -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/sinst.h b/contrib/libg++/libstdc++/std/sinst.h deleted file mode 100644 index 6bd9bfc6d19d..000000000000 --- a/contrib/libg++/libstdc++/std/sinst.h +++ /dev/null @@ -1,73 +0,0 @@ -// Forward declarations of -*- C++ -*- string instantiations. -// 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. - -#ifndef __SINST__ -#define __SINST__ - -extern "C++" { -#define __S basic_string<char,string_char_traits<char> > -//#define __W basic_string<wchar_t,string_char_traits<wchar_t> > - -extern template class __bsrep<char, string_char_traits<char> >; -extern template class __S; -// extern template class __W; -// extern template class __bsrep<wchar_t, string_char_traits<wchar_t> >; - -#define __DOPR(op, ret, c, s) \ - extern template ret operator op (const s&, const s&); \ - extern template ret operator op (const c*, const s&); \ - extern template ret operator op (const s&, const c*); \ - -#define __DO(op, ret, c, s) \ - extern template ret operator op (const s&, const s&); \ - extern template ret operator op (const c*, const s&); \ - extern template ret operator op (const s&, const c*); \ - extern template ret operator op (c, const s&); \ - extern template ret operator op (const s&, c); - -__DO (+, __S, char, __S) -// __DO (+, __W, wchar_t, __W) */ - -#define __DOB(op) \ - __DOPR (op, bool, char, __S) -// __DOPR (op, bool, wchar_t, __W) - -__DOB (==) -__DOB (!=) -__DOB (<) -__DOB (>) -__DOB (<=) -__DOB (>=) - -#undef __S -//#undef __W -#undef __DO -#undef __DOB -#undef __DOPR -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/stddef.h b/contrib/libg++/libstdc++/std/stddef.h deleted file mode 100644 index 00cf47e7a027..000000000000 --- a/contrib/libg++/libstdc++/std/stddef.h +++ /dev/null @@ -1,25 +0,0 @@ -// The -*- C++ -*- standard definitions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __STDDEF__ -#define __STDDEF__ - -#ifdef __GNUG__ -#pragma interface "std/stddef.h" -#endif - -#include <_G_config.h> -#include <std/cstddef.h> - -extern "C++" { -const size_t NPOS = (size_t)(-1); -typedef void fvoid_t(); - -#ifndef _WINT_T -#define _WINT_T -typedef _G_wint_t wint_t; -#endif - -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/stdexcept.h b/contrib/libg++/libstdc++/std/stdexcept.h deleted file mode 100644 index 785bb6a4223f..000000000000 --- a/contrib/libg++/libstdc++/std/stdexcept.h +++ /dev/null @@ -1,126 +0,0 @@ -// Methods for Exception Support for -*- C++ -*- -// Copyright (C) 1994, 1995 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 "std/stdexcept.h" -#endif - -#include <typeinfo> - -extern "C++" { -#if 0 -#include <string> -typedef string __string; -#else -typedef const char * __string; -#endif - -class exception { -public: - typedef void (*raise_handler)(exception&); - static raise_handler set_raise_handler(raise_handler handler_arg); - exception (const __string& what_arg): desc (what_arg) { } - virtual ~exception() { } - void raise(); - virtual __string what() const { return desc; } -protected: - exception() { } - virtual void do_raise() { } -private: - __string desc; -}; - -class logic_error : public exception { -public: - logic_error(const __string& what_arg): exception (what_arg) { } - virtual ~logic_error() { } -}; - -class domain_error : public logic_error { -public: - domain_error (const __string& what_arg): logic_error (what_arg) { } - virtual ~domain_error () { } -}; - -class invalid_argument : public logic_error { -public: - invalid_argument (const __string& what_arg): logic_error (what_arg) { } - virtual ~invalid_argument () { } -}; - -class length_error : public logic_error { -public: - length_error (const __string& what_arg): logic_error (what_arg) { } - virtual ~length_error () { } -}; - -class out_of_range : public logic_error { -public: - out_of_range (const __string& what_arg): logic_error (what_arg) { } - virtual ~out_of_range () { } -}; - -class runtime_error : public exception { -public: - runtime_error(const __string& what_arg): exception (what_arg) { } - virtual ~runtime_error() { } -protected: - runtime_error(): exception () { } -}; - -class range_error : public runtime_error { -public: - range_error (const __string& what_arg): runtime_error (what_arg) { } - virtual ~range_error () { } -}; - -class overflow_error : public runtime_error { -public: - overflow_error (const __string& what_arg): runtime_error (what_arg) { } - virtual ~overflow_error () { } -}; - -// These are moved here from typeinfo so that we can compile with -frtti -class bad_cast : public logic_error { -public: - bad_cast(const __string& what_arg): logic_error (what_arg) { } - virtual ~bad_cast() { } -}; - -extern bad_cast __bad_cast_object; - -class bad_typeid : public logic_error { - public: - bad_typeid (): logic_error ("bad_typeid") { } - virtual ~bad_typeid () { } -}; -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/straits.h b/contrib/libg++/libstdc++/std/straits.h deleted file mode 100644 index 42fbad37fe94..000000000000 --- a/contrib/libg++/libstdc++/std/straits.h +++ /dev/null @@ -1,161 +0,0 @@ -// Character traits template 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. - -#ifndef __STRING_CHAR_TRAITS__ -#define __STRING_CHAR_TRAITS__ - -#ifdef __GNUG__ -// For string_char_traits <char> -#pragma interface "std/straits.h" -#endif - -#include <std/stddef.h> - -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 <std/cctype.h> -#include <std/cstring.h> - -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 <std/cwctype.h> -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 diff --git a/contrib/libg++/libstdc++/std/string.h b/contrib/libg++/libstdc++/std/string.h deleted file mode 100644 index 77cc801be16f..000000000000 --- a/contrib/libg++/libstdc++/std/string.h +++ /dev/null @@ -1,13 +0,0 @@ -// Main header for the -*- C++ -*- string classes. - -#ifndef __STRING__ -#define __STRING__ - -#include <std/bastring.h> - -extern "C++" { -typedef basic_string <char, string_char_traits <char> > string; -// typedef basic_string <wchar_t, string_char_traits <wchar_t> > wstring; -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/typeinfo.h b/contrib/libg++/libstdc++/std/typeinfo.h deleted file mode 100644 index 44f833cd6858..000000000000 --- a/contrib/libg++/libstdc++/std/typeinfo.h +++ /dev/null @@ -1,245 +0,0 @@ -// RTTI support for -*- C++ -*- -// Copyright (C) 1994, 1995 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 Kung Hsu based upon the specification in the 20 September 1994 -// C++ working paper, ANSI document X3J16/94-0158. - -#ifndef __TYPEINFO__ -#define __TYPEINFO__ - -#ifdef __GNUG__ -#pragma interface "std/typeinfo.h" -#endif - -extern "C" void* __throw_type_match_rtti (void *, void *, void *); - -extern "C++" { -class type_info { -private: - // assigning type_info is not supported. made private. - type_info& operator=(const type_info&); - type_info(const type_info&); - -public: - enum node_type { - _RTTI_BUILTIN_TYPE, // builtin type - _RTTI_USER_TYPE, // user defined type - _RTTI_CLASS_TYPE, // class type - _RTTI_POINTER_TYPE, // pointer type - _RTTI_ATTR_TYPE, // attribute type for const and volatile - _RTTI_FUNC_TYPE, // function type - _RTTI_PTMF_TYPE, // pointer to member function type - _RTTI_PTMD_TYPE // pointer to member data type - }; - - // return node type of the object - virtual node_type __rtti_get_node_type() const { return _RTTI_BUILTIN_TYPE; } - - // get_name will return the name of the type, NULL if no name (like builtin) - virtual const char * __rtti_get_name() const { return 0; } - - // compare if type represented by the type_info are the same type - virtual int __rtti_compare(const type_info&) const { return 0; } - - // argument passed is the desired type, - // for class type, if the type can be converted to the desired type, - // it will be, and returned, else 0 is returned. If the match - // succeeds, the return value will be adjusted to point to the sub-object. - virtual void* __rtti_match(const type_info&, int, void *) const { - // This should never be called. - return 0; - }; - - // destructor - virtual ~type_info() {} - type_info() {} - - bool before(const type_info& arg); - const char* name() const - { return __rtti_get_name(); } - bool operator==(const type_info& arg) const - { return __rtti_compare(arg) == 0; } - bool operator!=(const type_info& arg) const - { return __rtti_compare(arg) != 0; } -}; - -// type_info for builtin type - -class __builtin_type_info : public type_info { -public: - enum builtin_type_val { - _RTTI_BI_BOOL = 1, _RTTI_BI_CHAR, _RTTI_BI_SHORT, _RTTI_BI_INT, - _RTTI_BI_LONG, _RTTI_BI_LONGLONG, _RTTI_BI_FLOAT, - _RTTI_BI_DOUBLE, _RTTI_BI_LDOUBLE, _RTTI_BI_UCHAR, - _RTTI_BI_USHORT, _RTTI_BI_UINT, _RTTI_BI_ULONG, - _RTTI_BI_ULONGLONG, _RTTI_BI_SCHAR, _RTTI_BI_WCHAR, _RTTI_BI_VOID - }; - - builtin_type_val b_type; - - __builtin_type_info (builtin_type_val bt) : b_type (bt) {} - node_type __rtti_get_node_type () const - { return _RTTI_BUILTIN_TYPE; } - const char *__rtti_get_name () const - { return (const char *)0; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == _RTTI_BUILTIN_TYPE && - ((__builtin_type_info&)arg).b_type == b_type) ? 0 : -1; } -}; - -// serice function for comparing types by name. - -inline int __fast_compare (const char *n1, const char *n2) { - int c; - if (n1 == n2) return 0; - if (n1 == 0) return *n2; - else if (n2 == 0) return *n1; - - c = (int)*n1++ - (int)*n2++; - return c == 0 ? strcmp (n1, n2) : c; -}; - -// type_info for user type. - -class __user_type_info : public type_info { - private: - const char *_name; - -public: - __user_type_info (const char *nm) : _name (nm) {} - node_type __rtti_get_node_type () const - { return _RTTI_USER_TYPE; } - const char *__rtti_get_name () const - { return _name; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == __rtti_get_node_type() && - __fast_compare (_name, arg.__rtti_get_name ()) == 0) ? 0 : -1; } -}; - -// type_info for a class. - -class __class_type_info : public __user_type_info { -private: - enum access_mode { - _RTTI_ACCESS_PUBLIC, _RTTI_ACCESS_PROTECTED, _RTTI_ACCESS_PRIVATE - }; - type_info **base_list; - int *offset_list; - int *is_virtual_list; - access_mode *access_list; - int n_bases; - -public: - __class_type_info (const char *name, type_info **bl, int *off, - int *is_vir, access_mode *acc, int bn) - : __user_type_info (name), base_list (bl), offset_list(off), - is_virtual_list(is_vir), access_list(acc), n_bases (bn) {} - node_type __rtti_get_node_type () const - { return _RTTI_CLASS_TYPE; } - - // inherit __rtti_compare from __user_type_info - - // This is a little complex defined in typeinfo.cc - void* __rtti_match(const type_info&, int, void *) const; -}; - -// type info for pointer type. - -class __pointer_type_info : public type_info { -private: - type_info& type; - -public: - __pointer_type_info (type_info& ti) : type (ti) {} - node_type __rtti_get_node_type () const - { return _RTTI_POINTER_TYPE; } - const char *__rtti_get_name () const - { return (const char *)0; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == __rtti_get_node_type() && - type.__rtti_compare ( ((__pointer_type_info&)arg).type) == 0) ? 0 : -1; } - void* __rtti_match(const type_info& catch_type, int, void *objptr) const; -}; - -// type info for attributes - -class __attr_type_info : public type_info { -public: - enum attr_val { - _RTTI_ATTR_CONST = 1, _RTTI_ATTR_VOLATILE, _RTTI_ATTR_CONSTVOL - }; - - attr_val attr; - type_info& type; - - __attr_type_info (attr_val a, type_info& t) : attr (a), type(t) {} - node_type __rtti_get_node_type () const - { return _RTTI_ATTR_TYPE; } - const char *__rtti_get_name () const - { return (const char *)0; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == _RTTI_ATTR_TYPE && - attr == ((__attr_type_info&)arg).attr && - type.__rtti_compare ( ((__attr_type_info&)arg).type ) == 0) - ? 0 : -1; } -}; - -// type info for function. - -class __func_type_info : public __user_type_info { -public: - __func_type_info (const char *name) : __user_type_info (name) {} - node_type __rtti_get_node_type () const - { return _RTTI_FUNC_TYPE; } -}; - -// type info for pointer to member function. - -class __ptmf_type_info : public __user_type_info { -public: - __ptmf_type_info (const char *name) : __user_type_info (name) {} - node_type __rtti_get_node_type () const - { return _RTTI_PTMF_TYPE; } -}; - -// type info for pointer to data member. - -class __ptmd_type_info : public type_info { - type_info& classtype; - type_info& type; -public: - __ptmd_type_info (type_info& tc, type_info& t) : classtype (tc), type (t) {} - node_type __rtti_get_node_type () const - { return _RTTI_PTMD_TYPE; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == _RTTI_PTMD_TYPE && - classtype.__rtti_compare ( ((__ptmd_type_info&)arg).classtype ) == 0 && - type.__rtti_compare ( ((__ptmd_type_info&)arg).type ) == 0) - ? 0 : -1; } -}; -} // extern "C++" - -#include <stdexcept> - -#endif diff --git a/contrib/libg++/libstdc++/stddef b/contrib/libg++/libstdc++/stddef deleted file mode 100644 index 9bfd4a91782d..000000000000 --- a/contrib/libg++/libstdc++/stddef +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __STDDEF__ -#include <std/stddef.h> -#endif diff --git a/contrib/libg++/libstdc++/stddefi.cc b/contrib/libg++/libstdc++/stddefi.cc deleted file mode 100644 index b49c42c945c7..000000000000 --- a/contrib/libg++/libstdc++/stddefi.cc +++ /dev/null @@ -1,7 +0,0 @@ -// Implementation file for the -*- C++ -*- standard definitions header. -// This file is part of the GNU ANSI C++ Library. - -#ifdef __GNUG__ -#pragma implementation "std/stddef.h" -#endif -#include <std/stddef.h> diff --git a/contrib/libg++/libstdc++/stdexcept b/contrib/libg++/libstdc++/stdexcept deleted file mode 100644 index 560c53dd8888..000000000000 --- a/contrib/libg++/libstdc++/stdexcept +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __STDEXCEPT__ -#include <std/stdexcept.h> -#endif diff --git a/contrib/libg++/libstdc++/stdexcepti.cc b/contrib/libg++/libstdc++/stdexcepti.cc deleted file mode 100644 index 4025f5ba187f..000000000000 --- a/contrib/libg++/libstdc++/stdexcepti.cc +++ /dev/null @@ -1,8 +0,0 @@ -// Implementation file for Exception Support for -*- C++ -*- -// This file is part of the GNU ANSI C++ Library. - -#ifdef __GNUG__ -#pragma implementation "std/stdexcept.h" -#endif - -#include <stdexcept> diff --git a/contrib/libg++/libstdc++/stl.h b/contrib/libg++/libstdc++/stl.h deleted file mode 100644 index 4b270742c9cf..000000000000 --- a/contrib/libg++/libstdc++/stl.h +++ /dev/null @@ -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> diff --git a/contrib/libg++/libstdc++/stl/ChangeLog b/contrib/libg++/libstdc++/stl/ChangeLog deleted file mode 100644 index 786989d76693..000000000000 --- a/contrib/libg++/libstdc++/stl/ChangeLog +++ /dev/null @@ -1,86 +0,0 @@ -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. - -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 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. - - diff --git a/contrib/libg++/libstdc++/stl/Makefile.in b/contrib/libg++/libstdc++/stl/Makefile.in deleted file mode 100644 index 438d81df2d77..000000000000 --- a/contrib/libg++/libstdc++/stl/Makefile.in +++ /dev/null @@ -1,12 +0,0 @@ -#### package, host, target, and site dependent Makefile fragments come in here. -## - -STL_OBJECTS = tempbuf.o tree.o random.o - -stl.list: stamp-picdir $(STL_OBJECTS) - @echo "$(STL_OBJECTS)" >stl.list - -# These are here for SunOS VPATH. -tempbuf.o: tempbuf.cc -random.o: random.cc -tree.o: tree.cc diff --git a/contrib/libg++/libstdc++/stl/README b/contrib/libg++/libstdc++/stl/README deleted file mode 100644 index fad26dec0c0d..000000000000 --- a/contrib/libg++/libstdc++/stl/README +++ /dev/null @@ -1,86 +0,0 @@ -This directory contains Hewlett-Packard's implementation of -the C++ Standard Template Library. -It is the October 31, 1995 version. -It has been extensively modified so it can be compiled by g++. -(Version 2.6.1 or newer is recommended.) -Some of these hacks are pretty ugly, but are needed to work around -bugs in g++ (which we are working on). -Thanks to Carsten Bormann <cabo@informatik.uni-bremen.de> for -coming up with many of these work-arounds. However, I have -come up with alternate (possibly inferior!) work-arounds in some cases. - -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. -CYGNUS MAKES NO COMMITTMENT (yet) TO SUPPORT BACKWARD COMPATIBILITY FOR STL. - -For examples if things that should work, look in the ../tests directory. - -DOCUMENTATION: -See http://www.cs.rpi.edu/~musser/stl.html on the World-Wide Web, -or anonymous ftp to butler.hpl.hp.com, directory stl, file sharfile.Z. - - --Per Bothner -Cygnus Support bothner@cygnus.com - ------------ -Here is Carsten Bormann's notes on his changes: - -This is a set of seriously bletcherous hacks to HP's wonderful STL -library. The objective is to hammer STL through GCC 2.6.1 (2.6.0 -seems to work, too, until you run into one of its bugs) so that us -academic types can play with STL, not to make STL better in any way. - -Many of these changes make the library much less efficient. All -changes (except vector<bool> -- see below) are due to bugs (or -non-features) in GCC, not due to any problems in STL. Do not judge -the performance of STL (code space, data space, compile time -complexity, run time complexity) from these hacks -- they will be much -better when GCC implements more of Standard C++. May the authors of -STL forgive me. - -The class templates generally have been hacked in the following ways: - -1) Static data members have been eliminated, generally by making them -non-static members or member functions (both of which generally -seriously impairs performance -- e.g., each rb_tree iterator now -carries a copy of NIL since there is no other place to put it). The -template list<> has suffered most. - -Allocators are still static members, since I changed defalloc.h to -have static members only. (This makes allocators less useful, but -still useable.) (Note that a static member without data need not be -initialized.) - -2) For member functions defined outside the class template, parameters -of type tmpl<T>::something have been changed. In some cases, a class -derived from the type has been used; in some cases the function simply -has been made inline (again causing code bloat). - -3) A number of function templates in iterator.h have been declared -again for derived classes defined by templates, usually by making them -friend functions and using the name injection feature of GCC. I don't -understand the relevant sections of the WP, so I don't know if this -hack will cease to work in more conforming versions of GCC or become -unneccessary or simply STL won't work with standard C++. Some of -the necessary friends may still be missing... - -defalloc.h has lost much of its functionality: see above. - -bool.h has been made ineffective, since GCC supports bool. - -Finally, bit_vector has been changed into a proper specialization of -vector<bool>. -[Not in this libstdc++ release. -PB] - -demo.cc and Makefile build a small demo program for a number of -features of STL. This is not a test suite, so I certainly have not -found all my mistakes (could anyone in possession of such a test suite -please run it over these hacks?). Send bug reports (that follow GNU -bug reporting conventions) to - - cabo@informatik.uni-bremen.de - -Note that I generally do not have time to answer questions about STL. - -Carsten Bormann diff --git a/contrib/libg++/libstdc++/stl/algo.h b/contrib/libg++/libstdc++/stl/algo.h deleted file mode 100644 index e038d715a250..000000000000 --- a/contrib/libg++/libstdc++/stl/algo.h +++ /dev/null @@ -1,2386 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef ALGO_H -#define ALGO_H - -#include <stdlib.h> -#ifndef __GNUG__ -#include <bool.h> -#endif -#include <pair.h> -#include <iterator.h> -#include <algobase.h> -#include <heap.h> -#include <tempbuf.h> - -template <class T> -inline const T& __median(const T& a, const T& b, const T& c) { - if (a < b) - if (b < c) - return b; - else if (a < c) - return c; - else - return a; - else if (a < c) - return a; - else if (b < c) - return c; - else - return b; -} - -template <class T, class Compare> -inline const T& __median(const T& a, const T& b, const T& c, Compare comp) { - if (comp(a, b)) - if (comp(b, c)) - return b; - else if (comp(a, c)) - return c; - else - return a; - else if (comp(a, c)) - return a; - else if (comp(b, c)) - return c; - else - return b; -} - -template <class InputIterator, class Function> -Function for_each(InputIterator first, InputIterator last, Function f) { - while (first != last) f(*first++); - return f; -} - -template <class InputIterator, class T> -InputIterator find(InputIterator first, InputIterator last, const T& value) { - while (first != last && *first != value) ++first; - return first; -} - -template <class InputIterator, class Predicate> -InputIterator find_if(InputIterator first, InputIterator last, - Predicate pred) { - while (first != last && !pred(*first)) ++first; - return first; -} - -template <class ForwardIterator> -ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last) { - if (first == last) return last; - ForwardIterator next = first; - while(++next != last) { - if (*first == *next) return first; - first = next; - } - return last; -} - -template <class ForwardIterator, class BinaryPredicate> -ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last, - BinaryPredicate binary_pred) { - if (first == last) return last; - ForwardIterator next = first; - while(++next != last) { - if (binary_pred(*first, *next)) return first; - first = next; - } - return last; -} - -template <class InputIterator, class T, class Size> -void count(InputIterator first, InputIterator last, const T& value, - Size& n) { - while (first != last) - if (*first++ == value) ++n; -} - -template <class InputIterator, class Predicate, class Size> -void count_if(InputIterator first, InputIterator last, Predicate pred, - Size& n) { - while (first != last) - if (pred(*first++)) ++n; -} - -template <class ForwardIterator1, class ForwardIterator2, class Distance1, - class Distance2> -ForwardIterator1 __search(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Distance1*, Distance2*) { - Distance1 d1 = 0; - distance(first1, last1, d1); - Distance2 d2 = 0; - distance(first2, last2, d2); - - if (d1 < d2) return last1; - - ForwardIterator1 current1 = first1; - ForwardIterator2 current2 = first2; - - while (current2 != last2) - if (*current1++ != *current2++) - if (d1-- == d2) - return last1; - else { - current1 = ++first1; - current2 = first2; - } - return (current2 == last2) ? first1 : last1; -} - -template <class ForwardIterator1, class ForwardIterator2> -inline ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2) -{ - return __search(first1, last1, first2, last2, distance_type(first1), - distance_type(first2)); -} - -template <class ForwardIterator1, class ForwardIterator2, - class BinaryPredicate, class Distance1, class Distance2> -ForwardIterator1 __search(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - BinaryPredicate binary_pred, Distance1*, Distance2*) { - Distance1 d1 = 0; - distance(first1, last1, d1); - Distance2 d2 = 0; - distance(first2, last2, d2); - - if (d1 < d2) return last1; - - ForwardIterator1 current1 = first1; - ForwardIterator2 current2 = first2; - - while (current2 != last2) - if (!binary_pred(*current1++, *current2++)) - if (d1-- == d2) - return last1; - else { - current1 = ++first1; - current2 = first2; - } - return (current2 == last2) ? first1 : last1; -} - -template <class ForwardIterator1, class ForwardIterator2, - class BinaryPredicate> -inline ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - BinaryPredicate binary_pred) { - return __search(first1, last1, first2, last2, binary_pred, - distance_type(first1), distance_type(first2)); -} - -template <class ForwardIterator1, class ForwardIterator2> -ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2) { - while (first1 != last1) iter_swap(first1++, first2++); - return first2; -} - -template <class InputIterator, class OutputIterator, class UnaryOperation> -OutputIterator transform(InputIterator first, InputIterator last, - OutputIterator result, UnaryOperation op) { - while (first != last) *result++ = op(*first++); - return result; -} - -template <class InputIterator1, class InputIterator2, class OutputIterator, - class BinaryOperation> -OutputIterator transform(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, OutputIterator result, - BinaryOperation binary_op) { - while (first1 != last1) *result++ = binary_op(*first1++, *first2++); - return result; -} - -template <class ForwardIterator, class T> -void replace(ForwardIterator first, ForwardIterator last, const T& old_value, - const T& new_value) { - while (first != last) { - if (*first == old_value) *first = new_value; - ++first; - } -} - -template <class ForwardIterator, class Predicate, class T> -void replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, - const T& new_value) { - while (first != last) { - if (pred(*first)) *first = new_value; - ++first; - } -} - -template <class InputIterator, class OutputIterator, class T> -OutputIterator replace_copy(InputIterator first, InputIterator last, - OutputIterator result, const T& old_value, - const T& new_value) { - while (first != last) { - *result++ = *first == old_value ? new_value : *first; - ++first; - } - return result; -} - -template <class Iterator, class OutputIterator, class Predicate, class T> -OutputIterator replace_copy_if(Iterator first, Iterator last, - OutputIterator result, Predicate pred, - const T& new_value) { - while (first != last) { - *result++ = pred(*first) ? new_value : *first; - ++first; - } - return result; -} - -template <class ForwardIterator, class Generator> -void generate(ForwardIterator first, ForwardIterator last, Generator gen) { - while (first != last) *first++ = gen(); -} - -template <class OutputIterator, class Size, class Generator> -OutputIterator generate_n(OutputIterator first, Size n, Generator gen) { - while (n-- > 0) *first++ = gen(); - return first; -} - -template <class InputIterator, class OutputIterator, class T> -OutputIterator remove_copy(InputIterator first, InputIterator last, - OutputIterator result, const T& value) { - while (first != last) { - if (*first != value) *result++ = *first; - ++first; - } - return result; -} - -template <class InputIterator, class OutputIterator, class Predicate> -OutputIterator remove_copy_if(InputIterator first, InputIterator last, - OutputIterator result, Predicate pred) { - while (first != last) { - if (!pred(*first)) *result++ = *first; - ++first; - } - return result; -} - -template <class ForwardIterator, class T> -ForwardIterator remove(ForwardIterator first, ForwardIterator last, - const T& value) { - first = find(first, last, value); - ForwardIterator next = first; - return first == last ? first : remove_copy(++next, last, first, value); -} - -template <class ForwardIterator, class Predicate> -ForwardIterator remove_if(ForwardIterator first, ForwardIterator last, - Predicate pred) { - first = find_if(first, last, pred); - ForwardIterator next = first; - return first == last ? first : remove_copy_if(++next, last, first, pred); -} - -template <class InputIterator, class ForwardIterator> -ForwardIterator __unique_copy(InputIterator first, InputIterator last, - ForwardIterator result, forward_iterator_tag) { - *result = *first; - while (++first != last) - if (*result != *first) *++result = *first; - return ++result; -} - -template <class InputIterator, class BidirectionalIterator> -inline BidirectionalIterator __unique_copy(InputIterator first, - InputIterator last, - BidirectionalIterator result, - bidirectional_iterator_tag) { - return __unique_copy(first, last, result, forward_iterator_tag()); -} - -template <class InputIterator, class RandomAccessIterator> -inline RandomAccessIterator __unique_copy(InputIterator first, - InputIterator last, - RandomAccessIterator result, - random_access_iterator_tag) { - return __unique_copy(first, last, result, forward_iterator_tag()); -} - -template <class InputIterator, class OutputIterator, class T> -OutputIterator __unique_copy(InputIterator first, InputIterator last, - OutputIterator result, T*) { - T value = *first; - *result = value; - while (++first != last) - if (value != *first) { - value = *first; - *++result = value; - } - return ++result; -} - -template <class InputIterator, class OutputIterator> -inline OutputIterator __unique_copy(InputIterator first, InputIterator last, - OutputIterator result, - output_iterator_tag) { - return __unique_copy(first, last, result, value_type(first)); -} - -template <class InputIterator, class OutputIterator> -inline OutputIterator unique_copy(InputIterator first, InputIterator last, - OutputIterator result) { - if (first == last) return result; - return __unique_copy(first, last, result, iterator_category(result)); -} -template <class InputIterator, class ForwardIterator, class BinaryPredicate> -ForwardIterator __unique_copy(InputIterator first, InputIterator last, - ForwardIterator result, - BinaryPredicate binary_pred, - forward_iterator_tag) { - *result = *first; - while (++first != last) - if (!binary_pred(*result, *first)) *++result = *first; - return ++result; -} - -template <class InputIterator, class BidirectionalIterator, - class BinaryPredicate> -inline BidirectionalIterator __unique_copy(InputIterator first, - InputIterator last, - BidirectionalIterator result, - BinaryPredicate binary_pred, - bidirectional_iterator_tag) { - return __unique_copy(first, last, result, binary_pred, - forward_iterator_tag()); -} - -template <class InputIterator, class RandomAccessIterator, - class BinaryPredicate> -inline RandomAccessIterator __unique_copy(InputIterator first, - InputIterator last, - RandomAccessIterator result, - BinaryPredicate binary_pred, - random_access_iterator_tag) { - return __unique_copy(first, last, result, binary_pred, - forward_iterator_tag()); -} - -template <class InputIterator, class OutputIterator, class BinaryPredicate, - class T> -OutputIterator __unique_copy(InputIterator first, InputIterator last, - OutputIterator result, - BinaryPredicate binary_pred, T*) { - T value = *first; - *result = value; - while (++first != last) - if (!binary_pred(value, *first)) { - value = *first; - *++result = value; - } - return ++result; -} - -template <class InputIterator, class OutputIterator, class BinaryPredicate> -inline OutputIterator __unique_copy(InputIterator first, InputIterator last, - OutputIterator result, - BinaryPredicate binary_pred, - output_iterator_tag) { - return __unique_copy(first, last, result, binary_pred, value_type(first)); -} - -template <class InputIterator, class OutputIterator, class BinaryPredicate> -inline OutputIterator unique_copy(InputIterator first, InputIterator last, - OutputIterator result, - BinaryPredicate binary_pred) { - if (first == last) return result; - return __unique_copy(first, last, result, binary_pred, - iterator_category(result)); -} - -template <class ForwardIterator> -ForwardIterator unique(ForwardIterator first, ForwardIterator last) { - first = adjacent_find(first, last); - return unique_copy(first, last, first); -} - -template <class ForwardIterator, class BinaryPredicate> -ForwardIterator unique(ForwardIterator first, ForwardIterator last, - BinaryPredicate binary_pred) { - first = adjacent_find(first, last, binary_pred); - return unique_copy(first, last, first, binary_pred); -} - -template <class BidirectionalIterator> -void __reverse(BidirectionalIterator first, BidirectionalIterator last, - bidirectional_iterator_tag) { - while (true) - if (first == last || first == --last) - return; - else - iter_swap(first++, last); -} - -template <class RandomAccessIterator> -void __reverse(RandomAccessIterator first, RandomAccessIterator last, - random_access_iterator_tag) { - while (first < last) iter_swap(first++, --last); -} - -template <class BidirectionalIterator> -inline void reverse(BidirectionalIterator first, BidirectionalIterator last) { - __reverse(first, last, iterator_category(first)); -} - -template <class BidirectionalIterator, class OutputIterator> -OutputIterator reverse_copy(BidirectionalIterator first, - BidirectionalIterator last, - OutputIterator result) { - while (first != last) *result++ = *--last; - return result; -} - -template <class ForwardIterator, class Distance> -void __rotate(ForwardIterator first, ForwardIterator middle, - ForwardIterator last, Distance*, forward_iterator_tag) { - for (ForwardIterator i = middle; ;) { - iter_swap(first++, i++); - if (first == middle) { - if (i == last) return; - middle = i; - } else if (i == last) - i = middle; - } -} - -template <class BidirectionalIterator, class Distance> -void __rotate(BidirectionalIterator first, BidirectionalIterator middle, - BidirectionalIterator last, Distance*, - bidirectional_iterator_tag) { - reverse(first, middle); - reverse(middle, last); - reverse(first, last); -} - -template <class EuclideanRingElement> -EuclideanRingElement __gcd(EuclideanRingElement m, EuclideanRingElement n) -{ - while (n != 0) { - EuclideanRingElement t = m % n; - m = n; - n = t; - } - return m; -} - -template <class RandomAccessIterator, class Distance, class T> -void __rotate_cycle(RandomAccessIterator first, RandomAccessIterator last, - RandomAccessIterator initial, Distance shift, T*) { - T value = *initial; - RandomAccessIterator ptr1 = initial; - RandomAccessIterator ptr2 = ptr1 + shift; - while (ptr2 != initial) { - *ptr1 = *ptr2; - ptr1 = ptr2; - if (last - ptr2 > shift) - ptr2 += shift; - else - ptr2 = first + (shift - (last - ptr2)); - } - *ptr1 = value; -} - -template <class RandomAccessIterator, class Distance> -void __rotate(RandomAccessIterator first, RandomAccessIterator middle, - RandomAccessIterator last, Distance*, - random_access_iterator_tag) { - Distance n = __gcd(last - first, middle - first); - while (n--) - __rotate_cycle(first, last, first + n, middle - first, - value_type(first)); -} - -template <class ForwardIterator> -inline void rotate(ForwardIterator first, ForwardIterator middle, - ForwardIterator last) { - if (first == middle || middle == last) return; - __rotate(first, middle, last, distance_type(first), - iterator_category(first)); -} - -template <class ForwardIterator, class OutputIterator> -OutputIterator rotate_copy(ForwardIterator first, ForwardIterator middle, - ForwardIterator last, OutputIterator result) { - return copy(first, middle, copy(middle, last, result)); -} - -unsigned long __long_random(unsigned long); - -template <class RandomAccessIterator, class Distance> -void __random_shuffle(RandomAccessIterator first, RandomAccessIterator last, - Distance*) { - if (first == last) return; - for (RandomAccessIterator i = first + 1; i != last; ++i) - iter_swap(i, first + Distance(__long_random((i - first) + 1))); -} - -template <class RandomAccessIterator> -inline void random_shuffle(RandomAccessIterator first, - RandomAccessIterator last) { - __random_shuffle(first, last, distance_type(first)); -} - -template <class RandomAccessIterator, class RandomNumberGenerator> -void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, - RandomNumberGenerator& __rand) { - if (first == last) return; - for (RandomAccessIterator i = first + 1; i != last; ++i) - iter_swap(i, first + __rand((i - first) + 1)); -} - -template <class BidirectionalIterator, class Predicate> -BidirectionalIterator partition(BidirectionalIterator first, - BidirectionalIterator last, Predicate pred) { - while (true) { - while (true) - if (first == last) - return first; - else if (pred(*first)) - ++first; - else - break; - --last; - while (true) - if (first == last) - return first; - else if (!pred(*last)) - --last; - else - break; - iter_swap(first, last); - ++first; - } -} - -template <class ForwardIterator, class Predicate, class Distance> -ForwardIterator __inplace_stable_partition(ForwardIterator first, - ForwardIterator last, - Predicate pred, Distance len) { - if (len == 1) return pred(*first) ? last : first; - ForwardIterator middle = first; - advance(middle, len / 2); - ForwardIterator - first_cut = __inplace_stable_partition(first, middle, pred, len / 2); - ForwardIterator - second_cut = __inplace_stable_partition(middle, last, pred, - len - len / 2); - rotate(first_cut, middle, second_cut); - len = 0; - distance(middle, second_cut, len); - advance(first_cut, len); - return first_cut; -} - -template <class ForwardIterator, class Pointer, class Predicate, - class Distance, class T> -ForwardIterator __stable_partition_adaptive(ForwardIterator first, - ForwardIterator last, - Predicate pred, Distance len, - Pointer buffer, - Distance buffer_size, - Distance& fill_pointer, T*) { - if (len <= buffer_size) { - len = 0; - ForwardIterator result1 = first; - Pointer result2 = buffer; - while (first != last && len < fill_pointer) - if (pred(*first)) - *result1++ = *first++; - else { - *result2++ = *first++; - ++len; - } - if (first != last) { - raw_storage_iterator<Pointer, T> result3 = result2; - while (first != last) - if (pred(*first)) - *result1++ = *first++; - else { - *result3++ = *first++; - ++len; - } - fill_pointer = len; - } - copy(buffer, buffer + len, result1); - return result1; - } - ForwardIterator middle = first; - advance(middle, len / 2); - ForwardIterator first_cut = __stable_partition_adaptive - (first, middle, pred, len / 2, buffer, buffer_size, fill_pointer, - (T*)0); - ForwardIterator second_cut = __stable_partition_adaptive - (middle, last, pred, len - len / 2, buffer, buffer_size, - fill_pointer, (T*)0); - rotate(first_cut, middle, second_cut); - len = 0; - distance(middle, second_cut, len); - advance(first_cut, len); - return first_cut; -} - -template <class ForwardIterator, class Predicate, class Pointer, - class Distance> -ForwardIterator __stable_partition(ForwardIterator first, ForwardIterator last, - Predicate pred, Distance len, - pair<Pointer, Distance> p) { - if (p.first == 0) - return __inplace_stable_partition(first, last, pred, len); - Distance fill_pointer = 0; - ForwardIterator result = - __stable_partition_adaptive(first, last, pred, len, p.first, p.second, - fill_pointer, value_type(first)); - destroy(p.first, p.first + fill_pointer); - return_temporary_buffer(p.first); - return result; -} - -template <class ForwardIterator, class Predicate, class Distance> -inline ForwardIterator __stable_partition_aux(ForwardIterator first, - ForwardIterator last, - Predicate pred, Distance*) { - Distance len = 0; - distance(first, last, len); - return __stable_partition(first, last, pred, len, - get_temporary_buffer(len, value_type(first))); -} - -template <class ForwardIterator, class Predicate> -inline ForwardIterator stable_partition(ForwardIterator first, - ForwardIterator last, - Predicate pred) { - return __stable_partition_aux(first, last, pred, distance_type(first)); -} - -template <class RandomAccessIterator, class T> -RandomAccessIterator __unguarded_partition(RandomAccessIterator first, - RandomAccessIterator last, - T pivot) { - while (1) { - while (*first < pivot) ++first; - --last; - while (pivot < *last) --last; - if (!(first < last)) return first; - iter_swap(first, last); - ++first; - } -} - -template <class RandomAccessIterator, class T, class Compare> -RandomAccessIterator __unguarded_partition(RandomAccessIterator first, - RandomAccessIterator last, - T pivot, Compare comp) { - while (1) { - while (comp(*first, pivot)) ++first; - --last; - while (comp(pivot, *last)) --last; - if (!(first < last)) return first; - iter_swap(first, last); - ++first; - } -} - -const int __stl_threshold = 16; - -template <class RandomAccessIterator, class T> -void __quick_sort_loop_aux(RandomAccessIterator first, - RandomAccessIterator last, T*) { - while (last - first > __stl_threshold) { - RandomAccessIterator cut = __unguarded_partition - (first, last, T(__median(*first, *(first + (last - first)/2), - *(last - 1)))); - if (cut - first >= last - cut) { - __quick_sort_loop(cut, last); - last = cut; - } else { - __quick_sort_loop(first, cut); - first = cut; - } - } -} - -template <class RandomAccessIterator> -inline void __quick_sort_loop(RandomAccessIterator first, - RandomAccessIterator last) { - __quick_sort_loop_aux(first, last, value_type(first)); -} - -template <class RandomAccessIterator, class T, class Compare> -void __quick_sort_loop_aux(RandomAccessIterator first, - RandomAccessIterator last, T*, Compare comp) { - while (last - first > __stl_threshold) { - RandomAccessIterator cut = __unguarded_partition - (first, last, T(__median(*first, *(first + (last - first)/2), - *(last - 1), comp)), comp); - if (cut - first >= last - cut) { - __quick_sort_loop(cut, last, comp); - last = cut; - } else { - __quick_sort_loop(first, cut, comp); - first = cut; - } - } -} - -template <class RandomAccessIterator, class Compare> -inline void __quick_sort_loop(RandomAccessIterator first, - RandomAccessIterator last, Compare comp) { - __quick_sort_loop_aux(first, last, value_type(first), comp); -} - -template <class RandomAccessIterator, class T> -void __unguarded_linear_insert(RandomAccessIterator last, T value) { - RandomAccessIterator next = last; - --next; - while (value < *next) { - *last = *next; - last = next--; - } - *last = value; -} - -template <class RandomAccessIterator, class T, class Compare> -void __unguarded_linear_insert(RandomAccessIterator last, T value, - Compare comp) { - RandomAccessIterator next = last; - --next; - while (comp(value , *next)) { - *last = *next; - last = next--; - } - *last = value; -} - -template <class RandomAccessIterator, class T> -inline void __linear_insert(RandomAccessIterator first, - RandomAccessIterator last, T*) { - T value = *last; - if (value < *first) { - copy_backward(first, last, last + 1); - *first = value; - } else - __unguarded_linear_insert(last, value); -} - -template <class RandomAccessIterator, class T, class Compare> -inline void __linear_insert(RandomAccessIterator first, - RandomAccessIterator last, T*, Compare comp) { - T value = *last; - if (comp(value, *first)) { - copy_backward(first, last, last + 1); - *first = value; - } else - __unguarded_linear_insert(last, value, comp); -} - -template <class RandomAccessIterator> -void __insertion_sort(RandomAccessIterator first, RandomAccessIterator last) { - if (first == last) return; - for (RandomAccessIterator i = first + 1; i != last; ++i) - __linear_insert(first, i, value_type(first)); -} - -template <class RandomAccessIterator, class Compare> -void __insertion_sort(RandomAccessIterator first, - RandomAccessIterator last, Compare comp) { - if (first == last) return; - for (RandomAccessIterator i = first + 1; i != last; ++i) - __linear_insert(first, i, value_type(first), comp); -} - -template <class RandomAccessIterator, class T> -void __unguarded_insertion_sort_aux(RandomAccessIterator first, - RandomAccessIterator last, T*) { - for (RandomAccessIterator i = first; i != last; ++i) - __unguarded_linear_insert(i, T(*i)); -} - -template <class RandomAccessIterator> -inline void __unguarded_insertion_sort(RandomAccessIterator first, - RandomAccessIterator last) { - __unguarded_insertion_sort_aux(first, last, value_type(first)); -} - -template <class RandomAccessIterator, class T, class Compare> -void __unguarded_insertion_sort_aux(RandomAccessIterator first, - RandomAccessIterator last, - T*, Compare comp) { - for (RandomAccessIterator i = first; i != last; ++i) - __unguarded_linear_insert(i, T(*i), comp); -} - -template <class RandomAccessIterator, class Compare> -inline void __unguarded_insertion_sort(RandomAccessIterator first, - RandomAccessIterator last, - Compare comp) { - __unguarded_insertion_sort_aux(first, last, value_type(first), comp); -} - -template <class RandomAccessIterator> -void __final_insertion_sort(RandomAccessIterator first, - RandomAccessIterator last) { - if (last - first > __stl_threshold) { - __insertion_sort(first, first + __stl_threshold); - __unguarded_insertion_sort(first + __stl_threshold, last); - } else - __insertion_sort(first, last); -} - -template <class RandomAccessIterator, class Compare> -void __final_insertion_sort(RandomAccessIterator first, - RandomAccessIterator last, Compare comp) { - if (last - first > __stl_threshold) { - __insertion_sort(first, first + __stl_threshold, comp); - __unguarded_insertion_sort(first + __stl_threshold, last, comp); - } else - __insertion_sort(first, last, comp); -} - -template <class RandomAccessIterator> -void sort(RandomAccessIterator first, RandomAccessIterator last) { - __quick_sort_loop(first, last); - __final_insertion_sort(first, last); -} - -template <class RandomAccessIterator, class Compare> -void sort(RandomAccessIterator first, RandomAccessIterator last, - Compare comp) { - __quick_sort_loop(first, last, comp); - __final_insertion_sort(first, last, comp); -} - -template <class RandomAccessIterator> -void __inplace_stable_sort(RandomAccessIterator first, - RandomAccessIterator last) { - if (last - first < 15) { - __insertion_sort(first, last); - return; - } - RandomAccessIterator middle = first + (last - first) / 2; - __inplace_stable_sort(first, middle); - __inplace_stable_sort(middle, last); - __merge_without_buffer(first, middle, last, middle - first, last - middle); -} - -template <class RandomAccessIterator, class Compare> -void __inplace_stable_sort(RandomAccessIterator first, - RandomAccessIterator last, Compare comp) { - if (last - first < 15) { - __insertion_sort(first, last, comp); - return; - } - RandomAccessIterator middle = first + (last - first) / 2; - __inplace_stable_sort(first, middle, comp); - __inplace_stable_sort(middle, last, comp); - __merge_without_buffer(first, middle, last, middle - first, - last - middle, comp); -} - -template <class RandomAccessIterator1, class RandomAccessIterator2, - class Distance> -void __merge_sort_loop(RandomAccessIterator1 first, - RandomAccessIterator1 last, - RandomAccessIterator2 result, Distance step_size) { - Distance two_step = 2 * step_size; - - while (last - first >= two_step) { - result = merge(first, first + step_size, - first + step_size, first + two_step, result); - first += two_step; - } - step_size = min(Distance(last - first), step_size); - - merge(first, first + step_size, first + step_size, last, result); -} - -template <class RandomAccessIterator1, class RandomAccessIterator2, - class Distance, class Compare> -void __merge_sort_loop(RandomAccessIterator1 first, - RandomAccessIterator1 last, - RandomAccessIterator2 result, Distance step_size, - Compare comp) { - Distance two_step = 2 * step_size; - - while (last - first >= two_step) { - result = merge(first, first + step_size, - first + step_size, first + two_step, result, comp); - first += two_step; - } - step_size = min(Distance(last - first), step_size); - - merge(first, first + step_size, first + step_size, last, result, comp); -} - -const int __stl_chunk_size = 7; - -template <class RandomAccessIterator, class Distance> -void __chunk_insertion_sort(RandomAccessIterator first, - RandomAccessIterator last, Distance chunk_size) { - while (last - first >= chunk_size) { - __insertion_sort(first, first + chunk_size); - first += chunk_size; - } - __insertion_sort(first, last); -} - -template <class RandomAccessIterator, class Distance, class Compare> -void __chunk_insertion_sort(RandomAccessIterator first, - RandomAccessIterator last, - Distance chunk_size, Compare comp) { - while (last - first >= chunk_size) { - __insertion_sort(first, first + chunk_size, comp); - first += chunk_size; - } - __insertion_sort(first, last, comp); -} - -template <class RandomAccessIterator, class Pointer, class Distance, class T> -void __merge_sort_with_buffer(RandomAccessIterator first, - RandomAccessIterator last, - Pointer buffer, Distance*, T*) { - Distance len = last - first; - Pointer buffer_last = buffer + len; - - Distance step_size = __stl_chunk_size; - __chunk_insertion_sort(first, last, step_size); - - while (step_size < len) { - __merge_sort_loop(first, last, buffer, step_size); - step_size *= 2; - __merge_sort_loop(buffer, buffer_last, first, step_size); - step_size *= 2; - } -} - -template <class RandomAccessIterator, class Pointer, class Distance, class T, - class Compare> -void __merge_sort_with_buffer(RandomAccessIterator first, - RandomAccessIterator last, Pointer buffer, - Distance*, T*, Compare comp) { - Distance len = last - first; - Pointer buffer_last = buffer + len; - - Distance step_size = __stl_chunk_size; - __chunk_insertion_sort(first, last, step_size, comp); - - while (step_size < len) { - __merge_sort_loop(first, last, buffer, step_size, comp); - step_size *= 2; - __merge_sort_loop(buffer, buffer_last, first, step_size, comp); - step_size *= 2; - } -} - -template <class RandomAccessIterator, class Pointer, class Distance, class T> -void __stable_sort_adaptive(RandomAccessIterator first, - RandomAccessIterator last, Pointer buffer, - Distance buffer_size, T*) { - Distance len = (last - first + 1) / 2; - RandomAccessIterator middle = first + len; - if (len > buffer_size) { - __stable_sort_adaptive(first, middle, buffer, buffer_size, (T*)0); - __stable_sort_adaptive(middle, last, buffer, buffer_size, (T*)0); - } else { - __merge_sort_with_buffer(first, middle, buffer, (Distance*)0, (T*)0); - __merge_sort_with_buffer(middle, last, buffer, (Distance*)0, (T*)0); - } - __merge_adaptive(first, middle, last, Distance(middle - first), - Distance(last - middle), buffer, buffer_size, (T*)0); -} - -template <class RandomAccessIterator, class Pointer, class Distance, class T, - class Compare> -void __stable_sort_adaptive(RandomAccessIterator first, - RandomAccessIterator last, Pointer buffer, - Distance buffer_size, T*, Compare comp) { - Distance len = (last - first + 1) / 2; - RandomAccessIterator middle = first + len; - if (len > buffer_size) { - __stable_sort_adaptive(first, middle, buffer, buffer_size, (T*)0, comp); - __stable_sort_adaptive(middle, last, buffer, buffer_size, (T*)0, comp); - } else { - __merge_sort_with_buffer(first, middle, buffer, (Distance*)0, (T*)0, - comp); - __merge_sort_with_buffer(middle, last, buffer, (Distance*)0, (T*)0, - comp); - } - __merge_adaptive(first, middle, last, Distance(middle - first), - Distance(last - middle), buffer, buffer_size, (T*)0, comp); -} - -template <class RandomAccessIterator, class Pointer, class Distance, class T> -inline void __stable_sort(RandomAccessIterator first, - RandomAccessIterator last, - pair<Pointer, Distance> p, T*) { - if (p.first == 0) { - __inplace_stable_sort(first, last); - return; - } - Distance len = min(p.second, last - first); - copy(first, first + len, raw_storage_iterator<Pointer, T>(p.first)); - __stable_sort_adaptive(first, last, p.first, p.second, (T*)0); - destroy(p.first, p.first + len); - return_temporary_buffer(p.first); -} - -template <class RandomAccessIterator, class Pointer, class Distance, class T, - class Compare> -inline void __stable_sort(RandomAccessIterator first, - RandomAccessIterator last, - pair<Pointer, Distance> p, T*, Compare comp) { - if (p.first == 0) { - __inplace_stable_sort(first, last, comp); - return; - } - Distance len = min(p.second, last - first); - copy(first, first + len, raw_storage_iterator<Pointer, T>(p.first)); - __stable_sort_adaptive(first, last, p.first, p.second, (T*)0, comp); - destroy(p.first, p.first + len); - return_temporary_buffer(p.first); -} - -template <class RandomAccessIterator, class T, class Distance> -inline void __stable_sort_aux(RandomAccessIterator first, - RandomAccessIterator last, T*, Distance*) { - __stable_sort(first, last, get_temporary_buffer(Distance(last - first), - (T*)0), (T*)0); -} - -template <class RandomAccessIterator, class T, class Distance, class Compare> -inline void __stable_sort_aux(RandomAccessIterator first, - RandomAccessIterator last, T*, Distance*, - Compare comp) { - __stable_sort(first, last, get_temporary_buffer(Distance(last - first), - (T*)0), (T*)0, comp); -} - -template <class RandomAccessIterator> -inline void stable_sort(RandomAccessIterator first, - RandomAccessIterator last) { - __stable_sort_aux(first, last, value_type(first), distance_type(first)); -} - -template <class RandomAccessIterator, class Compare> -inline void stable_sort(RandomAccessIterator first, - RandomAccessIterator last, Compare comp) { - __stable_sort_aux(first, last, value_type(first), distance_type(first), - comp); -} - -template <class RandomAccessIterator, class T> -void __partial_sort(RandomAccessIterator first, RandomAccessIterator middle, - RandomAccessIterator last, T*) { - make_heap(first, middle); - for (RandomAccessIterator i = middle; i < last; ++i) - if (*i < *first) - __pop_heap(first, middle, i, T(*i), distance_type(first)); - sort_heap(first, middle); -} - -template <class RandomAccessIterator> -inline void partial_sort(RandomAccessIterator first, - RandomAccessIterator middle, - RandomAccessIterator last) { - __partial_sort(first, middle, last, value_type(first)); -} - -template <class RandomAccessIterator, class T, class Compare> -void __partial_sort(RandomAccessIterator first, RandomAccessIterator middle, - RandomAccessIterator last, T*, Compare comp) { - make_heap(first, middle, comp); - for (RandomAccessIterator i = middle; i < last; ++i) - if (comp(*i, *first)) - __pop_heap(first, middle, i, T(*i), comp, distance_type(first)); - sort_heap(first, middle, comp); -} - -template <class RandomAccessIterator, class Compare> -inline void partial_sort(RandomAccessIterator first, - RandomAccessIterator middle, - RandomAccessIterator last, Compare comp) { - __partial_sort(first, middle, last, value_type(first), comp); -} - -template <class InputIterator, class RandomAccessIterator, class Distance, - class T> -RandomAccessIterator __partial_sort_copy(InputIterator first, - InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last, - Distance*, T*) { - if (result_first == result_last) return result_last; - RandomAccessIterator result_real_last = result_first; - while(first != last && result_real_last != result_last) - *result_real_last++ = *first++; - make_heap(result_first, result_real_last); - while (first != last) { - if (*first < *result_first) - __adjust_heap(result_first, Distance(0), - Distance(result_real_last - result_first), T(*first)); - ++first; - } - sort_heap(result_first, result_real_last); - return result_real_last; -} - -template <class InputIterator, class RandomAccessIterator> -inline RandomAccessIterator -partial_sort_copy(InputIterator first, InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last) { - return __partial_sort_copy(first, last, result_first, result_last, - distance_type(result_first), value_type(first)); -} - -template <class InputIterator, class RandomAccessIterator, class Compare, - class Distance, class T> -RandomAccessIterator __partial_sort_copy(InputIterator first, - InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last, - Compare comp, Distance*, T*) { - if (result_first == result_last) return result_last; - RandomAccessIterator result_real_last = result_first; - while(first != last && result_real_last != result_last) - *result_real_last++ = *first++; - make_heap(result_first, result_real_last, comp); - while (first != last) { - if (comp(*first, *result_first)) - __adjust_heap(result_first, Distance(0), - Distance(result_real_last - result_first), T(*first), - comp); - ++first; - } - sort_heap(result_first, result_real_last, comp); - return result_real_last; -} - -template <class InputIterator, class RandomAccessIterator, class Compare> -inline RandomAccessIterator -partial_sort_copy(InputIterator first, InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last, Compare comp) { - return __partial_sort_copy(first, last, result_first, result_last, comp, - distance_type(result_first), value_type(first)); -} - -template <class RandomAccessIterator, class T> -void __nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last, T*) { - while (last - first > 3) { - RandomAccessIterator cut = __unguarded_partition - (first, last, T(__median(*first, *(first + (last - first)/2), - *(last - 1)))); - if (cut <= nth) - first = cut; - else - last = cut; - } - __insertion_sort(first, last); -} - -template <class RandomAccessIterator> -inline void nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last) { - __nth_element(first, nth, last, value_type(first)); -} - -template <class RandomAccessIterator, class T, class Compare> -void __nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last, T*, Compare comp) { - while (last - first > 3) { - RandomAccessIterator cut = __unguarded_partition - (first, last, T(__median(*first, *(first + (last - first)/2), - *(last - 1), comp)), comp); - if (cut <= nth) - first = cut; - else - last = cut; - } - __insertion_sort(first, last, comp); -} - -template <class RandomAccessIterator, class Compare> -inline void nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last, Compare comp) { - __nth_element(first, nth, last, value_type(first), comp); -} - -template <class ForwardIterator, class T, class Distance> -ForwardIterator __lower_bound(ForwardIterator first, ForwardIterator last, - const T& value, Distance*, - forward_iterator_tag) { - Distance len = 0; - distance(first, last, len); - Distance half; - ForwardIterator middle; - - while (len > 0) { - half = len / 2; - middle = first; - advance(middle, half); - if (*middle < value) { - first = middle; - ++first; - len = len - half - 1; - } else - len = half; - } - return first; -} - -template <class ForwardIterator, class T, class Distance> -inline ForwardIterator __lower_bound(ForwardIterator first, - ForwardIterator last, - const T& value, Distance*, - bidirectional_iterator_tag) { - return __lower_bound(first, last, value, (Distance*)0, - forward_iterator_tag()); -} - -template <class RandomAccessIterator, class T, class Distance> -RandomAccessIterator __lower_bound(RandomAccessIterator first, - RandomAccessIterator last, const T& value, - Distance*, random_access_iterator_tag) { - Distance len = last - first; - Distance half; - RandomAccessIterator middle; - - while (len > 0) { - half = len / 2; - middle = first + half; - if (*middle < value) { - first = middle + 1; - len = len - half - 1; - } else - len = half; - } - return first; -} - -template <class ForwardIterator, class T> -inline ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, - const T& value) { - return __lower_bound(first, last, value, distance_type(first), - iterator_category(first)); -} - -template <class ForwardIterator, class T, class Compare, class Distance> -ForwardIterator __lower_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp, Distance*, - forward_iterator_tag) { - Distance len = 0; - distance(first, last, len); - Distance half; - ForwardIterator middle; - - while (len > 0) { - half = len / 2; - middle = first; - advance(middle, half); - if (comp(*middle, value)) { - first = middle; - ++first; - len = len - half - 1; - } else - len = half; - } - return first; -} - -template <class ForwardIterator, class T, class Compare, class Distance> -inline ForwardIterator __lower_bound(ForwardIterator first, - ForwardIterator last, - const T& value, Compare comp, Distance*, - bidirectional_iterator_tag) { - return __lower_bound(first, last, value, comp, (Distance*)0, - forward_iterator_tag()); -} - -template <class RandomAccessIterator, class T, class Compare, class Distance> -RandomAccessIterator __lower_bound(RandomAccessIterator first, - RandomAccessIterator last, - const T& value, Compare comp, Distance*, - random_access_iterator_tag) { - Distance len = last - first; - Distance half; - RandomAccessIterator middle; - - while (len > 0) { - half = len / 2; - middle = first + half; - if (comp(*middle, value)) { - first = middle + 1; - len = len - half - 1; - } else - len = half; - } - return first; -} - -template <class ForwardIterator, class T, class Compare> -inline ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp) { - return __lower_bound(first, last, value, comp, distance_type(first), - iterator_category(first)); -} - -template <class ForwardIterator, class T, class Distance> -ForwardIterator __upper_bound(ForwardIterator first, ForwardIterator last, - const T& value, Distance*, - forward_iterator_tag) { - Distance len = 0; - distance(first, last, len); - Distance half; - ForwardIterator middle; - - while (len > 0) { - half = len / 2; - middle = first; - advance(middle, half); - if (value < *middle) - len = half; - else { - first = middle; - ++first; - len = len - half - 1; - } - } - return first; -} - -template <class ForwardIterator, class T, class Distance> -inline ForwardIterator __upper_bound(ForwardIterator first, - ForwardIterator last, - const T& value, Distance*, - bidirectional_iterator_tag) { - return __upper_bound(first, last, value, (Distance*)0, - forward_iterator_tag()); -} - -template <class RandomAccessIterator, class T, class Distance> -RandomAccessIterator __upper_bound(RandomAccessIterator first, - RandomAccessIterator last, const T& value, - Distance*, random_access_iterator_tag) { - Distance len = last - first; - Distance half; - RandomAccessIterator middle; - - while (len > 0) { - half = len / 2; - middle = first + half; - if (value < *middle) - len = half; - else { - first = middle + 1; - len = len - half - 1; - } - } - return first; -} - -template <class ForwardIterator, class T> -inline ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, - const T& value) { - return __upper_bound(first, last, value, distance_type(first), - iterator_category(first)); -} - -template <class ForwardIterator, class T, class Compare, class Distance> -ForwardIterator __upper_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp, Distance*, - forward_iterator_tag) { - Distance len = 0; - distance(first, last, len); - Distance half; - ForwardIterator middle; - - while (len > 0) { - half = len / 2; - middle = first; - advance(middle, half); - if (comp(value, *middle)) - len = half; - else { - first = middle; - ++first; - len = len - half - 1; - } - } - return first; -} - -template <class ForwardIterator, class T, class Compare, class Distance> -inline ForwardIterator __upper_bound(ForwardIterator first, - ForwardIterator last, - const T& value, Compare comp, Distance*, - bidirectional_iterator_tag) { - return __upper_bound(first, last, value, comp, (Distance*)0, - forward_iterator_tag()); -} - -template <class RandomAccessIterator, class T, class Compare, class Distance> -RandomAccessIterator __upper_bound(RandomAccessIterator first, - RandomAccessIterator last, - const T& value, Compare comp, Distance*, - random_access_iterator_tag) { - Distance len = last - first; - Distance half; - RandomAccessIterator middle; - - while (len > 0) { - half = len / 2; - middle = first + half; - if (comp(value, *middle)) - len = half; - else { - first = middle + 1; - len = len - half - 1; - } - } - return first; -} - -template <class ForwardIterator, class T, class Compare> -inline ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp) { - return __upper_bound(first, last, value, comp, distance_type(first), - iterator_category(first)); -} - -template <class ForwardIterator, class T, class Distance> -pair<ForwardIterator, ForwardIterator> -__equal_range(ForwardIterator first, ForwardIterator last, const T& value, - Distance*, forward_iterator_tag) { - Distance len = 0; - distance(first, last, len); - Distance half; - ForwardIterator middle, left, right; - - while (len > 0) { - half = len / 2; - middle = first; - advance(middle, half); - if (*middle < value) { - first = middle; - ++first; - len = len - half - 1; - } else if (value < *middle) - len = half; - else { - left = lower_bound(first, middle, value); - advance(first, len); - right = upper_bound(++middle, first, value); - return pair<ForwardIterator, ForwardIterator>(left, right); - } - } - return pair<ForwardIterator, ForwardIterator>(first, first); -} - -template <class ForwardIterator, class T, class Distance> -inline pair<ForwardIterator, ForwardIterator> -__equal_range(ForwardIterator first, ForwardIterator last, const T& value, - Distance*, bidirectional_iterator_tag) { - return __equal_range(first, last, value, (Distance*)0, - forward_iterator_tag()); -} - -template <class RandomAccessIterator, class T, class Distance> -pair<RandomAccessIterator, RandomAccessIterator> -__equal_range(RandomAccessIterator first, RandomAccessIterator last, - const T& value, Distance*, random_access_iterator_tag) { - Distance len = last - first; - Distance half; - RandomAccessIterator middle, left, right; - - while (len > 0) { - half = len / 2; - middle = first + half; - if (*middle < value) { - first = middle + 1; - len = len - half - 1; - } else if (value < *middle) - len = half; - else { - left = lower_bound(first, middle, value); - right = upper_bound(++middle, first + len, value); - return pair<RandomAccessIterator, RandomAccessIterator>(left, - right); - } - } - return pair<RandomAccessIterator, RandomAccessIterator>(first, first); -} - -template <class ForwardIterator, class T> -inline pair<ForwardIterator, ForwardIterator> -equal_range(ForwardIterator first, ForwardIterator last, const T& value) { - return __equal_range(first, last, value, distance_type(first), - iterator_category(first)); -} - -template <class ForwardIterator, class T, class Compare, class Distance> -pair<ForwardIterator, ForwardIterator> -__equal_range(ForwardIterator first, ForwardIterator last, const T& value, - Compare comp, Distance*, forward_iterator_tag) { - Distance len = 0; - distance(first, last, len); - Distance half; - ForwardIterator middle, left, right; - - while (len > 0) { - half = len / 2; - middle = first; - advance(middle, half); - if (comp(*middle, value)) { - first = middle; - ++first; - len = len - half - 1; - } else if (comp(value, *middle)) - len = half; - else { - left = lower_bound(first, middle, value, comp); - advance(first, len); - right = upper_bound(++middle, first, value, comp); - return pair<ForwardIterator, ForwardIterator>(left, right); - } - } - return pair<ForwardIterator, ForwardIterator>(first, first); -} - -template <class ForwardIterator, class T, class Compare, class Distance> -inline pair<ForwardIterator, ForwardIterator> -__equal_range(ForwardIterator first, ForwardIterator last, const T& value, - Compare comp, Distance*, bidirectional_iterator_tag) { - return __equal_range(first, last, value, comp, (Distance*)0, - forward_iterator_tag()); -} - -template <class RandomAccessIterator, class T, class Compare, class Distance> -pair<RandomAccessIterator, RandomAccessIterator> -__equal_range(RandomAccessIterator first, RandomAccessIterator last, - const T& value, Compare comp, Distance*, - random_access_iterator_tag) { - Distance len = last - first; - Distance half; - RandomAccessIterator middle, left, right; - - while (len > 0) { - half = len / 2; - middle = first + half; - if (comp(*middle, value)) { - first = middle + 1; - len = len - half - 1; - } else if (comp(value, *middle)) - len = half; - else { - left = lower_bound(first, middle, value, comp); - right = upper_bound(++middle, first + len, value, comp); - return pair<RandomAccessIterator, RandomAccessIterator>(left, - right); - } - } - return pair<RandomAccessIterator, RandomAccessIterator>(first, first); -} - -template <class ForwardIterator, class T, class Compare> -inline pair<ForwardIterator, ForwardIterator> -equal_range(ForwardIterator first, ForwardIterator last, const T& value, - Compare comp) { - return __equal_range(first, last, value, comp, distance_type(first), - iterator_category(first)); -} - -template <class ForwardIterator, class T> -bool binary_search(ForwardIterator first, ForwardIterator last, - const T& value) { - ForwardIterator i = lower_bound(first, last, value); - return i != last && !(value < *i); -} - -template <class ForwardIterator, class T, class Compare> -bool binary_search(ForwardIterator first, ForwardIterator last, const T& value, - Compare comp) { - ForwardIterator i = lower_bound(first, last, value, comp); - return i != last && !comp(value, *i); -} - -template <class InputIterator1, class InputIterator2, class OutputIterator> -OutputIterator merge(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { - while (first1 != last1 && first2 != last2) - if (*first2 < *first1) - *result++ = *first2++; - else - *result++ = *first1++; - return copy(first2, last2, copy(first1, last1, result)); -} - -template <class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> -OutputIterator merge(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp) { - while (first1 != last1 && first2 != last2) - if (comp(*first2, *first1)) - *result++ = *first2++; - else - *result++ = *first1++; - return copy(first2, last2, copy(first1, last1, result)); -} - -template <class BidirectionalIterator, class Distance> -void __merge_without_buffer(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, - Distance len1, Distance len2) { - if (len1 == 0 || len2 == 0) return; - if (len1 + len2 == 2) { - if (*middle < *first) iter_swap(first, middle); - return; - } - BidirectionalIterator first_cut = first; - BidirectionalIterator second_cut = middle; - Distance len11 = 0; - Distance len22 = 0; - if (len1 > len2) { - len11 = len1 / 2; - advance(first_cut, len11); - second_cut = lower_bound(middle, last, *first_cut); - distance(middle, second_cut, len22); - } else { - len22 = len2 / 2; - advance(second_cut, len22); - first_cut = upper_bound(first, middle, *second_cut); - distance(first, first_cut, len11); - } - rotate(first_cut, middle, second_cut); - BidirectionalIterator new_middle = first_cut; - advance(new_middle, len22); - __merge_without_buffer(first, first_cut, new_middle, len11, len22); - __merge_without_buffer(new_middle, second_cut, last, len1 - len11, - len2 - len22); -} - -template <class BidirectionalIterator, class Distance, class Compare> -void __merge_without_buffer(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, - Distance len1, Distance len2, Compare comp) { - if (len1 == 0 || len2 == 0) return; - if (len1 + len2 == 2) { - if (comp(*middle, *first)) iter_swap(first, middle); - return; - } - BidirectionalIterator first_cut = first; - BidirectionalIterator second_cut = middle; - Distance len11 = 0; - Distance len22 = 0; - if (len1 > len2) { - len11 = len1 / 2; - advance(first_cut, len11); - second_cut = lower_bound(middle, last, *first_cut, comp); - distance(middle, second_cut, len22); - } else { - len22 = len2 / 2; - advance(second_cut, len22); - first_cut = upper_bound(first, middle, *second_cut, comp); - distance(first, first_cut, len11); - } - rotate(first_cut, middle, second_cut); - BidirectionalIterator new_middle = first_cut; - advance(new_middle, len22); - __merge_without_buffer(first, first_cut, new_middle, len11, len22, comp); - __merge_without_buffer(new_middle, second_cut, last, len1 - len11, - len2 - len22, comp); -} - - -template <class InputIterator, class OutputIterator> -OutputIterator __borland_bugfix_copy(InputIterator first, InputIterator last, - OutputIterator result) { -// this is used in __rotate_adaptive to work around some obscure Borland -// bug. It is the same as copy, but with a different (and appropriate) name. - while (first != last) *result++ = *first++; - return result; -} - -template <class BidirectionalIterator1, class BidirectionalIterator2, - class Distance> -BidirectionalIterator1 __rotate_adaptive(BidirectionalIterator1 first, - BidirectionalIterator1 middle, - BidirectionalIterator1 last, - Distance len1, Distance len2, - BidirectionalIterator2 buffer, - Distance buffer_size) { - BidirectionalIterator2 buffer_end; - if (len1 > len2 && len2 <= buffer_size) { - buffer_end = __borland_bugfix_copy(middle, last, buffer); - copy_backward(first, middle, last); - return copy(buffer, buffer_end, first); - } else if (len1 <= buffer_size) { - buffer_end = __borland_bugfix_copy(first, middle, buffer); - copy(middle, last, first); - return copy_backward(buffer, buffer_end, last); - } else { - rotate(first, middle, last); - advance(first, len2); - return first; - } -} - -template <class BidirectionalIterator1, class BidirectionalIterator2, - class BidirectionalIterator3> -BidirectionalIterator3 __merge_backward(BidirectionalIterator1 first1, - BidirectionalIterator1 last1, - BidirectionalIterator2 first2, - BidirectionalIterator2 last2, - BidirectionalIterator3 result) { - if (first1 == last1) return copy_backward(first2, last2, result); - if (first2 == last2) return copy_backward(first1, last1, result); - --last1; - --last2; - while (true) { - if (*last2 < *last1) { - *--result = *last1; - if (first1 == last1) return copy_backward(first2, ++last2, result); - --last1; - } else { - *--result = *last2; - if (first2 == last2) return copy_backward(first1, ++last1, result); - --last2; - } - } -} - -template <class BidirectionalIterator1, class BidirectionalIterator2, - class BidirectionalIterator3, class Compare> -BidirectionalIterator3 __merge_backward(BidirectionalIterator1 first1, - BidirectionalIterator1 last1, - BidirectionalIterator2 first2, - BidirectionalIterator2 last2, - BidirectionalIterator3 result, - Compare comp) { - if (first1 == last1) return copy_backward(first2, last2, result); - if (first2 == last2) return copy_backward(first1, last1, result); - --last1; - --last2; - while (true) { - if (comp(*last2, *last1)) { - *--result = *last1; - if (first1 == last1) return copy_backward(first2, ++last2, result); - --last1; - } else { - *--result = *last2; - if (first2 == last2) return copy_backward(first1, ++last1, result); - --last2; - } - } -} - -template <class BidirectionalIterator, class Distance, class Pointer, class T> -void __merge_adaptive(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Distance len1, Distance len2, - Pointer buffer, Distance buffer_size, T*) { - if (len1 <= len2 && len1 <= buffer_size) { - Pointer end_buffer = copy(first, middle, buffer); - merge(buffer, end_buffer, middle, last, first); - } else if (len2 <= buffer_size) { - Pointer end_buffer = copy(middle, last, buffer); - __merge_backward(first, middle, buffer, end_buffer, last); - } else { - BidirectionalIterator first_cut = first; - BidirectionalIterator second_cut = middle; - Distance len11 = 0; - Distance len22 = 0; - if (len1 > len2) { - len11 = len1 / 2; - advance(first_cut, len11); - second_cut = lower_bound(middle, last, *first_cut); - distance(middle, second_cut, len22); - } else { - len22 = len2 / 2; - advance(second_cut, len22); - first_cut = upper_bound(first, middle, *second_cut); - distance(first, first_cut, len11); - } - BidirectionalIterator new_middle = - __rotate_adaptive(first_cut, middle, second_cut, len1 - len11, - len22, buffer, buffer_size); - __merge_adaptive(first, first_cut, new_middle, len11, len22, buffer, - buffer_size, (T*)0); - __merge_adaptive(new_middle, second_cut, last, len1 - len11, - len2 - len22, buffer, buffer_size, (T*)0); - } -} - -template <class BidirectionalIterator, class Distance, class Pointer, class T, - class Compare> -void __merge_adaptive(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Distance len1, Distance len2, - Pointer buffer, Distance buffer_size, T*, Compare comp) { - if (len1 <= len2 && len1 <= buffer_size) { - Pointer end_buffer = copy(first, middle, buffer); - merge(buffer, end_buffer, middle, last, first, comp); - } else if (len2 <= buffer_size) { - Pointer end_buffer = copy(middle, last, buffer); - __merge_backward(first, middle, buffer, end_buffer, last, comp); - } else { - BidirectionalIterator first_cut = first; - BidirectionalIterator second_cut = middle; - Distance len11 = 0; - Distance len22 = 0; - if (len1 > len2) { - len11 = len1 / 2; - advance(first_cut, len11); - second_cut = lower_bound(middle, last, *first_cut, comp); - distance(middle, second_cut, len22); - } else { - len22 = len2 / 2; - advance(second_cut, len22); - first_cut = upper_bound(first, middle, *second_cut, comp); - distance(first, first_cut, len11); - } - BidirectionalIterator new_middle = - __rotate_adaptive(first_cut, middle, second_cut, len1 - len11, - len22, buffer, buffer_size); - __merge_adaptive(first, first_cut, new_middle, len11, len22, buffer, - buffer_size, (T*)0, comp); - __merge_adaptive(new_middle, second_cut, last, len1 - len11, - len2 - len22, buffer, buffer_size, (T*)0, comp); - } -} - -template <class BidirectionalIterator, class Distance, class Pointer, class T> -void __inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Distance len1, Distance len2, - pair<Pointer, Distance> p, T*) { - if (p.first == 0) { - __merge_without_buffer(first, middle, last, len1, len2); - return; - } - Distance len = min(p.second, len1 + len2); - fill_n(raw_storage_iterator<Pointer, T>(p.first), len, *first); - __merge_adaptive(first, middle, last, len1, len2, p.first, p.second, (T*)0); - destroy(p.first, p.first + len); - return_temporary_buffer(p.first); -} - -template <class BidirectionalIterator, class Distance, class Pointer, class T, - class Compare> -void __inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Distance len1, Distance len2, - pair<Pointer, Distance> p, T*, Compare comp) { - if (p.first == 0) { - __merge_without_buffer(first, middle, last, len1, len2, comp); - return; - } - Distance len = min(p.second, len1 + len2); - fill_n(raw_storage_iterator<Pointer, T>(p.first), len, *first); - __merge_adaptive(first, middle, last, len1, len2, p.first, p.second, (T*)0, - comp); - destroy(p.first, p.first + len); - return_temporary_buffer(p.first); -} - -template <class BidirectionalIterator, class T, class Distance> -inline void __inplace_merge_aux(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, T*, Distance*) { - Distance len1 = 0; - distance(first, middle, len1); - Distance len2 = 0; - distance(middle, last, len2); - __inplace_merge(first, middle, last, len1, len2, - get_temporary_buffer(len1 + len2, (T*)0), (T*)0); -} - -template <class BidirectionalIterator, class T, class Distance, class Compare> -inline void __inplace_merge_aux(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, T*, Distance*, - Compare comp) { - Distance len1 = 0; - distance(first, middle, len1); - Distance len2 = 0; - distance(middle, last, len2); - __inplace_merge(first, middle, last, len1, len2, - get_temporary_buffer(len1 + len2, (T*)0), (T*)0, - comp); -} - -template <class BidirectionalIterator> -inline void inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last) { - if (first == middle || middle == last) return; - __inplace_merge_aux(first, middle, last, value_type(first), - distance_type(first)); -} - -template <class BidirectionalIterator, class Compare> -inline void inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Compare comp) { - if (first == middle || middle == last) return; - __inplace_merge_aux(first, middle, last, value_type(first), - distance_type(first), comp); -} - -template <class InputIterator1, class InputIterator2> -bool includes(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { - while (first1 != last1 && first2 != last2) - if (*first2 < *first1) - return false; - else if(*first1 < *first2) - ++first1; - else - ++first1, ++first2; - - return first2 == last2; -} - -template <class InputIterator1, class InputIterator2, class Compare> -bool includes(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, Compare comp) { - while (first1 != last1 && first2 != last2) - if (comp(*first2, *first1)) - return false; - else if(comp(*first1, *first2)) - ++first1; - else - ++first1, ++first2; - - return first2 == last2; -} - -template <class InputIterator1, class InputIterator2, class OutputIterator> -OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { - while (first1 != last1 && first2 != last2) - if (*first1 < *first2) - *result++ = *first1++; - else if (*first2 < *first1) - *result++ = *first2++; - else { - *result++ = *first1++; - first2++; - } - return copy(first2, last2, copy(first1, last1, result)); -} - -template <class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> -OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp) { - while (first1 != last1 && first2 != last2) - if (comp(*first1, *first2)) - *result++ = *first1++; - else if (comp(*first2, *first1)) - *result++ = *first2++; - else { - *result++ = *first1++; - ++first2; - } - return copy(first2, last2, copy(first1, last1, result)); -} - -template <class InputIterator1, class InputIterator2, class OutputIterator> -OutputIterator set_intersection(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { - while (first1 != last1 && first2 != last2) - if (*first1 < *first2) - ++first1; - else if (*first2 < *first1) - ++first2; - else { - *result++ = *first1++; - ++first2; - } - return result; -} - -template <class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> -OutputIterator set_intersection(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp) { - while (first1 != last1 && first2 != last2) - if (comp(*first1, *first2)) - ++first1; - else if (comp(*first2, *first1)) - ++first2; - else { - *result++ = *first1++; - ++first2; - } - return result; -} - -template <class InputIterator1, class InputIterator2, class OutputIterator> -OutputIterator set_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { - while (first1 != last1 && first2 != last2) - if (*first1 < *first2) - *result++ = *first1++; - else if (*first2 < *first1) - ++first2; - else { - ++first1; - ++first2; - } - return copy(first1, last1, result); -} - -template <class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> -OutputIterator set_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp) { - while (first1 != last1 && first2 != last2) - if (comp(*first1, *first2)) - *result++ = *first1++; - else if (comp(*first2, *first1)) - ++first2; - else { - ++first1; - ++first2; - } - return copy(first1, last1, result); -} - -template <class InputIterator1, class InputIterator2, class OutputIterator> -OutputIterator set_symmetric_difference(InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2, - InputIterator2 last2, - OutputIterator result) { - while (first1 != last1 && first2 != last2) - if (*first1 < *first2) - *result++ = *first1++; - else if (*first2 < *first1) - *result++ = *first2++; - else { - ++first1; - ++first2; - } - return copy(first2, last2, copy(first1, last1, result)); -} - -template <class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> -OutputIterator set_symmetric_difference(InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2, - InputIterator2 last2, - OutputIterator result, Compare comp) { - while (first1 != last1 && first2 != last2) - if (comp(*first1, *first2)) - *result++ = *first1++; - else if (comp(*first2, *first1)) - *result++ = *first2++; - else { - ++first1; - ++first2; - } - return copy(first2, last2, copy(first1, last1, result)); -} - -template <class ForwardIterator> -ForwardIterator max_element(ForwardIterator first, ForwardIterator last) { - if (first == last) return first; - ForwardIterator result = first; - while (++first != last) - if (*result < *first) result = first; - return result; -} - -template <class ForwardIterator, class Compare> -ForwardIterator max_element(ForwardIterator first, ForwardIterator last, - Compare comp) { - if (first == last) return first; - ForwardIterator result = first; - while (++first != last) - if (comp(*result, *first)) result = first; - return result; -} - -template <class ForwardIterator> -ForwardIterator min_element(ForwardIterator first, ForwardIterator last) { - if (first == last) return first; - ForwardIterator result = first; - while (++first != last) - if (*first < *result) result = first; - return result; -} - -template <class ForwardIterator, class Compare> -ForwardIterator min_element(ForwardIterator first, ForwardIterator last, - Compare comp) { - if (first == last) return first; - ForwardIterator result = first; - while (++first != last) - if (comp(*first, *result)) result = first; - return result; -} - -template <class BidirectionalIterator> -bool next_permutation(BidirectionalIterator first, - BidirectionalIterator last) { - if (first == last) return false; - BidirectionalIterator i = first; - ++i; - if (i == last) return false; - i = last; - --i; - - for(;;) { - BidirectionalIterator ii = i--; - if (*i < *ii) { - BidirectionalIterator j = last; - while (!(*i < *--j)); - iter_swap(i, j); - reverse(ii, last); - return true; - } - if (i == first) { - reverse(first, last); - return false; - } - } -} - -template <class BidirectionalIterator, class Compare> -bool next_permutation(BidirectionalIterator first, BidirectionalIterator last, - Compare comp) { - if (first == last) return false; - BidirectionalIterator i = first; - ++i; - if (i == last) return false; - i = last; - --i; - - for(;;) { - BidirectionalIterator ii = i--; - if (comp(*i, *ii)) { - BidirectionalIterator j = last; - while (!comp(*i, *--j)); - iter_swap(i, j); - reverse(ii, last); - return true; - } - if (i == first) { - reverse(first, last); - return false; - } - } -} - -template <class BidirectionalIterator> -bool prev_permutation(BidirectionalIterator first, - BidirectionalIterator last) { - if (first == last) return false; - BidirectionalIterator i = first; - ++i; - if (i == last) return false; - i = last; - --i; - - for(;;) { - BidirectionalIterator ii = i--; - if (*ii < *i) { - BidirectionalIterator j = last; - while (!(*--j < *i)); - iter_swap(i, j); - reverse(ii, last); - return true; - } - if (i == first) { - reverse(first, last); - return false; - } - } -} - -template <class BidirectionalIterator, class Compare> -bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last, - Compare comp) { - if (first == last) return false; - BidirectionalIterator i = first; - ++i; - if (i == last) return false; - i = last; - --i; - - for(;;) { - BidirectionalIterator ii = i--; - if (comp(*ii, *i)) { - BidirectionalIterator j = last; - while (!comp(*--j, *i)); - iter_swap(i, j); - reverse(ii, last); - return true; - } - if (i == first) { - reverse(first, last); - return false; - } - } -} - -template <class InputIterator, class T> -T accumulate(InputIterator first, InputIterator last, T init) { - while (first != last) - init = init + *first++; - return init; -} - -template <class InputIterator, class T, class BinaryOperation> -T accumulate(InputIterator first, InputIterator last, T init, - BinaryOperation binary_op) { - while (first != last) - init = binary_op(init, *first++); - return init; -} - -template <class InputIterator1, class InputIterator2, class T> -T inner_product(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, T init) { - while (first1 != last1) - init = init + (*first1++ * *first2++); - return init; -} - -template <class InputIterator1, class InputIterator2, class T, - class BinaryOperation1, class BinaryOperation2> -T inner_product(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, T init, BinaryOperation1 binary_op1, - BinaryOperation2 binary_op2) { - while (first1 != last1) - init = binary_op1(init, binary_op2(*first1++, *first2++)); - return init; -} - -template <class InputIterator, class OutputIterator, class T> -OutputIterator __partial_sum(InputIterator first, InputIterator last, - OutputIterator result, T*) { - T value = *first; - while (++first != last) { - value = value + *first; - *++result = value; - } - return ++result; -} - -template <class InputIterator, class OutputIterator> -OutputIterator partial_sum(InputIterator first, InputIterator last, - OutputIterator result) { - if (first == last) return result; - *result = *first; - return __partial_sum(first, last, result, value_type(first)); -} - -template <class InputIterator, class OutputIterator, class T, - class BinaryOperation> -OutputIterator __partial_sum(InputIterator first, InputIterator last, - OutputIterator result, T*, - BinaryOperation binary_op) { - T value = *first; - while (++first != last) { - value = binary_op(value, *first); - *++result = value; - } - return ++result; -} - -template <class InputIterator, class OutputIterator, class BinaryOperation> -OutputIterator partial_sum(InputIterator first, InputIterator last, - OutputIterator result, BinaryOperation binary_op) { - if (first == last) return result; - *result = *first; - return __partial_sum(first, last, result, value_type(first), binary_op); -} - -template <class InputIterator, class OutputIterator, class T> -OutputIterator __adjacent_difference(InputIterator first, InputIterator last, - OutputIterator result, T*) { - T value = *first; - while (++first != last) { - T tmp = *first; - *++result = tmp - value; - value = tmp; - } - return ++result; -} - -template <class InputIterator, class OutputIterator> -OutputIterator adjacent_difference(InputIterator first, InputIterator last, - OutputIterator result) { - if (first == last) return result; - *result = *first; - return __adjacent_difference(first, last, result, value_type(first)); -} - -template <class InputIterator, class OutputIterator, class T, - class BinaryOperation> -OutputIterator __adjacent_difference(InputIterator first, InputIterator last, - OutputIterator result, T*, - BinaryOperation binary_op) { - T value = *first; - while (++first != last) { - T tmp = *first; - *++result = binary_op(tmp, value); - value = tmp; - } - return ++result; -} - -template <class InputIterator, class OutputIterator, class BinaryOperation> -OutputIterator adjacent_difference(InputIterator first, InputIterator last, - OutputIterator result, - BinaryOperation binary_op) { - if (first == last) return result; - *result = *first; - return __adjacent_difference(first, last, result, value_type(first), - binary_op); -} - -template <class ForwardIterator, class T> -void iota(ForwardIterator first, ForwardIterator last, T value) { - while (first != last) *first++ = value++; -} - -#endif - diff --git a/contrib/libg++/libstdc++/stl/algobase.h b/contrib/libg++/libstdc++/stl/algobase.h deleted file mode 100644 index 21cea93b5f88..000000000000 --- a/contrib/libg++/libstdc++/stl/algobase.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef ALGOBASE_H -#define ALGOBASE_H - -#include <pair.h> -#include <iterator.h> - -template <class ForwardIterator1, class ForwardIterator2, class T> -inline void __iter_swap(ForwardIterator1 a, ForwardIterator2 b, T*) { - T tmp = *a; - *a = *b; - *b = tmp; -} - -template <class ForwardIterator1, class ForwardIterator2> -inline void iter_swap(ForwardIterator1 a, ForwardIterator2 b) { - __iter_swap(a, b, value_type(a)); -} - -template <class T> -inline void swap(T& a, T& b) { - T tmp = a; - a = b; - b = tmp; -} - -template <class T> -inline const T& min(const T& a, const T& b) { - return b < a ? b : a; -} - -template <class T, class Compare> -inline const T& min(const T& a, const T& b, Compare comp) { - return comp(b, a) ? b : a; -} - -template <class T> -inline const T& max(const T& a, const T& b) { - return a < b ? b : a; -} - -template <class T, class Compare> -inline const T& max(const T& a, const T& b, Compare comp) { - return comp(a, b) ? b : a; -} - -template <class InputIterator, class Distance> -void __distance(InputIterator first, InputIterator last, Distance& n, - input_iterator_tag) { - while (first != last) { ++first; ++n; } -} - -template <class ForwardIterator, class Distance> -void __distance(ForwardIterator first, ForwardIterator last, Distance& n, - forward_iterator_tag) { - while (first != last) { ++first; ++n; } -} - -template <class BidirectionalIterator, class Distance> -void __distance(BidirectionalIterator first, BidirectionalIterator last, - Distance& n, bidirectional_iterator_tag) { - while (first != last) { ++first; ++n; } -} - -template <class RandomAccessIterator, class Distance> -inline void __distance(RandomAccessIterator first, RandomAccessIterator last, - Distance& n, random_access_iterator_tag) { - n += last - first; -} - -template <class InputIterator, class Distance> -inline void distance(InputIterator first, InputIterator last, Distance& n) { - __distance(first, last, n, iterator_category(first)); -} - -template <class InputIterator, class Distance> -void __advance(InputIterator& i, Distance n, input_iterator_tag) { - while (n--) ++i; -} - -template <class ForwardIterator, class Distance> -void __advance(ForwardIterator& i, Distance n, forward_iterator_tag) { - while (n--) ++i; -} - -template <class BidirectionalIterator, class Distance> -void __advance(BidirectionalIterator& i, Distance n, - bidirectional_iterator_tag) { - if (n >= 0) - while (n--) ++i; - else - while (n++) --i; -} - -template <class RandomAccessIterator, class Distance> -inline void __advance(RandomAccessIterator& i, Distance n, - random_access_iterator_tag) { - i += n; -} - -template <class InputIterator, class Distance> -inline void advance(InputIterator& i, Distance n) { - __advance(i, n, iterator_category(i)); -} - -template <class ForwardIterator> -void destroy(ForwardIterator first, ForwardIterator last) { - while (first != last) { - /* Borland bug */ - destroy(&*first); - ++first; - //destroy(&*first++); - } -} - -template <class InputIterator, class ForwardIterator> -ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, - ForwardIterator result) { - while (first != last) construct(&*result++, *first++); - return result; -} - -template <class ForwardIterator, class T> -void uninitialized_fill(ForwardIterator first, ForwardIterator last, - const T& x) { - while (first != last) construct(&*first++, x); -} - -template <class ForwardIterator, class Size, class T> -ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, - const T& x) { - while (n--) construct(&*first++, x); - return first; -} - -template <class InputIterator, class OutputIterator> -OutputIterator copy(InputIterator first, InputIterator last, - OutputIterator result) { - while (first != last) *result++ = *first++; - return result; -} - -template <class BidirectionalIterator1, class BidirectionalIterator2> -BidirectionalIterator2 copy_backward(BidirectionalIterator1 first, - BidirectionalIterator1 last, - BidirectionalIterator2 result) { - while (first != last) *--result = *--last; - return result; -} - -template <class ForwardIterator, class T> -void fill(ForwardIterator first, ForwardIterator last, const T& value) { - while (first != last) *first++ = value; -} - -template <class OutputIterator, class Size, class T> -OutputIterator fill_n(OutputIterator first, Size n, const T& value) { - while (n-- > 0) *first++ = value; - return first; -} - -template <class InputIterator1, class InputIterator2> -pair<InputIterator1, InputIterator2> mismatch(InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2) { - while (first1 != last1 && *first1 == *first2) { - ++first1; - ++first2; - } - return pair<InputIterator1, InputIterator2>(first1, first2); -} - -template <class InputIterator1, class InputIterator2, class BinaryPredicate> -pair<InputIterator1, InputIterator2> mismatch(InputIterator1 first1, - InputIterator1 last1, - InputIterator2 first2, - BinaryPredicate binary_pred) { - while (first1 != last1 && binary_pred(*first1, *first2)) { - ++first1; - ++first2; - } - return pair<InputIterator1, InputIterator2>(first1, first2); -} - -template <class InputIterator1, class InputIterator2> -inline bool equal(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2) { - return mismatch(first1, last1, first2).first == last1; -} - -template <class InputIterator1, class InputIterator2, class BinaryPredicate> -inline bool equal(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, BinaryPredicate binary_pred) { - return mismatch(first1, last1, first2, binary_pred).first == last1; -} - -template <class InputIterator1, class InputIterator2> -bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { - while (first1 != last1 && first2 != last2) { - if (*first1 < *first2) return true; - if (*first2++ < *first1++) return false; - } - return first1 == last1 && first2 != last2; -} - -template <class InputIterator1, class InputIterator2, class Compare> -bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - Compare comp) { - while (first1 != last1 && first2 != last2) { - if (comp(*first1, *first2)) return true; - if (comp(*first2++, *first1++)) return false; - } - return first1 == last1 && first2 != last2; -} - -#endif diff --git a/contrib/libg++/libstdc++/stl/bool.h b/contrib/libg++/libstdc++/stl/bool.h deleted file mode 100644 index 9d86aac99c68..000000000000 --- a/contrib/libg++/libstdc++/stl/bool.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __GNUC__ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#define bool int -#define true 1 -#define false 0 -#endif diff --git a/contrib/libg++/libstdc++/stl/bvector.h b/contrib/libg++/libstdc++/stl/bvector.h deleted file mode 100644 index f9fe10655cbc..000000000000 --- a/contrib/libg++/libstdc++/stl/bvector.h +++ /dev/null @@ -1,421 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -// vector<bool> is replaced by bit_vector at present because bool is not -// implemented. - -#ifndef BVECTOR_H -#define BVECTOR_H - -#include <function.h> -#include <algobase.h> -#include <iterator.h> -#ifndef __GNUG__ -#include <bool.h> -#endif - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#define __WORD_BIT (int(CHAR_BIT*sizeof(unsigned int))) - -class bit_vector { -public: - typedef Allocator<unsigned int> vector_allocator; - typedef bool value_type; - typedef vector_allocator::size_type size_type; - typedef vector_allocator::difference_type difference_type; - - class iterator; - class const_iterator; - - class reference { - friend class iterator; - friend class const_iterator; - protected: - unsigned int* p; - unsigned int mask; - reference(unsigned int* x, unsigned int y) : p(x), mask(y) {} - public: - reference() : p(0), mask(0) {} - operator bool() const { return !(!(*p & mask)); } - reference& operator=(bool x) { - if (x) - *p |= mask; - else - *p &= ~mask; - return *this; - } - reference& operator=(const reference& x) { return *this = bool(x); } - bool operator==(const reference& x) const { - return bool(*this) == bool(x); - } - bool operator<(const reference& x) const { - return bool(*this) < bool(x); - } - void flip() { *p ^= mask; } - }; - typedef bool const_reference; - class iterator : public random_access_iterator<bool, difference_type> { - friend class bit_vector; - friend class const_iterator; - protected: - unsigned int* p; - unsigned int offset; - void bump_up() { - if (offset++ == __WORD_BIT - 1) { - offset = 0; - ++p; - } - } - void bump_down() { - if (offset-- == 0) { - offset = __WORD_BIT - 1; - --p; - } - } - public: - iterator() : p(0), offset(0) {} - iterator(unsigned int* x, unsigned int y) : p(x), offset(y) {} - reference operator*() const { return reference(p, 1U << offset); } - iterator& operator++() { - bump_up(); - return *this; - } - iterator operator++(int) { - iterator tmp = *this; - bump_up(); - return tmp; - } - iterator& operator--() { - bump_down(); - return *this; - } - iterator operator--(int) { - iterator tmp = *this; - bump_down(); - return tmp; - } - iterator& operator+=(difference_type i) { - difference_type n = i + offset; - p += n / __WORD_BIT; - n = n % __WORD_BIT; - if (n < 0) { - offset = n + __WORD_BIT; - --p; - } else - offset = n; - return *this; - } - iterator& operator-=(difference_type i) { - *this += -i; - return *this; - } - iterator operator+(difference_type i) const { - iterator tmp = *this; - return tmp += i; - } - iterator operator-(difference_type i) const { - iterator tmp = *this; - return tmp -= i; - } - difference_type operator-(iterator x) const { - return __WORD_BIT * (p - x.p) + offset - x.offset; - } - reference operator[](difference_type i) { return *(*this + i); } - bool operator==(const iterator& x) const { - return p == x.p && offset == x.offset; - } - bool operator<(iterator x) const { - return p < x.p || (p == x.p && offset < x.offset); - } - }; - - class const_iterator - : public random_access_iterator<bool, difference_type> { - friend class bit_vector; - protected: - unsigned int* p; - unsigned int offset; - void bump_up() { - if (offset++ == __WORD_BIT - 1) { - offset = 0; - ++p; - } - } - void bump_down() { - if (offset-- == 0) { - offset = __WORD_BIT - 1; - --p; - } - } - public: - const_iterator() : p(0), offset(0) {} - const_iterator(unsigned int* x, unsigned int y) : p(x), offset(y) {} - const_iterator(const iterator& x) : p(x.p), offset(x.offset) {} - const_reference operator*() const { - return reference(p, 1U << offset); - } - const_iterator& operator++() { - bump_up(); - return *this; - } - const_iterator operator++(int) { - const_iterator tmp = *this; - bump_up(); - return tmp; - } - const_iterator& operator--() { - bump_down(); - return *this; - } - const_iterator operator--(int) { - const_iterator tmp = *this; - bump_down(); - return tmp; - } - const_iterator& operator+=(difference_type i) { - difference_type n = i + offset; - p += n / __WORD_BIT; - n = n % __WORD_BIT; - if (n < 0) { - offset = n + __WORD_BIT; - --p; - } else - offset = n; - return *this; - } - const_iterator& operator-=(difference_type i) { - *this += -i; - return *this; - } - const_iterator operator+(difference_type i) const { - const_iterator tmp = *this; - return tmp += i; - } - const_iterator operator-(difference_type i) const { - const_iterator tmp = *this; - return tmp -= i; - } - difference_type operator-(const_iterator x) const { - return __WORD_BIT * (p - x.p) + offset - x.offset; - } - const_reference operator[](difference_type i) { - return *(*this + i); - } - bool operator==(const const_iterator& x) const { - return p == x.p && offset == x.offset; - } - bool operator<(const_iterator x) const { - return p < x.p || (p == x.p && offset < x.offset); - } - }; - - typedef reverse_iterator<const_iterator, value_type, const_reference, - difference_type> const_reverse_iterator; - typedef reverse_iterator<iterator, value_type, reference, difference_type> - reverse_iterator; - -protected: - static Allocator<unsigned int> static_allocator; - iterator start; - iterator finish; - unsigned int* end_of_storage; - unsigned int* bit_alloc(size_type n) { - return static_allocator.allocate((n + __WORD_BIT - 1)/__WORD_BIT); - } - void initialize(size_type n) { - unsigned int* q = bit_alloc(n); - end_of_storage = q + (n + __WORD_BIT - 1)/__WORD_BIT; - start = iterator(q, 0); - finish = start + n; - } - void insert_aux(iterator position, bool x); - typedef bit_vector self; -public: - iterator begin() { return start; } - const_iterator begin() const { return start; } - iterator end() { return finish; } - const_iterator end() const { return finish; } - - 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()); - } - - size_type size() const { return size_type(end() - begin()); } - size_type max_size() const { return static_allocator.max_size(); } - size_type capacity() const { - return size_type(const_iterator(end_of_storage, 0) - begin()); - } - bool empty() const { return begin() == end(); } - reference operator[](size_type n) { return *(begin() + n); } - const_reference operator[](size_type n) const { return *(begin() + n); } - bit_vector() : start(iterator()), finish(iterator()), end_of_storage(0) {} - bit_vector(size_type n, bool value = bool()) { - initialize(n); - fill(start.p, end_of_storage, value ? ~0 : 0); - } - bit_vector(const self& x) { - initialize(x.size()); - copy(x.begin(), x.end(), start); - } - bit_vector(const_iterator first, const_iterator last) { - size_type n = 0; - distance(first, last, n); - initialize(n); - copy(first, last, start); - } - ~bit_vector() { static_allocator.deallocate(start.p); } - self& operator=(const self& x) { - if (&x == this) return *this; - if (x.size() > capacity()) { - static_allocator.deallocate(start.p); - initialize(x.size()); - } - copy(x.begin(), x.end(), begin()); - finish = begin() + x.size(); - return *this; - } - void reserve(size_type n) { - if (capacity() < n) { - unsigned int* q = bit_alloc(n); - finish = copy(begin(), end(), iterator(q, 0)); - static_allocator.deallocate(start.p); - start = iterator(q, 0); - end_of_storage = q + (n + __WORD_BIT - 1)/__WORD_BIT; - } - } - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - void push_back(bool x) { - if (finish.p != end_of_storage) - *finish++ = x; - else - insert_aux(end(), x); - } - void swap(bit_vector& x) { - ::swap(start, x.start); - ::swap(finish, x.finish); - ::swap(end_of_storage, x.end_of_storage); - } - iterator insert(iterator position, bool x) { - size_type n = position - begin(); - if (finish.p != end_of_storage && position == end()) - *finish++ = x; - else - insert_aux(position, x); - return begin() + n; - } - void insert(iterator position, const_iterator first, - const_iterator last); - void insert(iterator position, size_type n, bool x); - void pop_back() { --finish; } - void erase(iterator position) { - if (position + 1 != end()) - copy(position + 1, end(), position); - --finish; - } - void erase(iterator first, iterator last) { - finish = copy(last, end(), first); - } -}; - -Allocator<unsigned int> bit_vector::static_allocator; - -inline bool operator==(const bit_vector& x, const bit_vector& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -inline bool operator<(const bit_vector& x, const bit_vector& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -void swap(bit_vector::reference x, bit_vector::reference y) { - bool tmp = x; - x = y; - y = tmp; -} - -void bit_vector::insert_aux(iterator position, bool x) { - if (finish.p != end_of_storage) { - copy_backward(position, finish - 1, finish); - *position = x; - ++finish; - } else { - size_type len = size() ? 2 * size() : __WORD_BIT; - unsigned int* q = bit_alloc(len); - iterator i = copy(begin(), position, iterator(q, 0)); - *i++ = x; - finish = copy(position, end(), i); - static_allocator.deallocate(start.p); - end_of_storage = q + (len + __WORD_BIT - 1)/__WORD_BIT; - start = iterator(q, 0); - } -} - -void bit_vector::insert(iterator position, size_type n, bool x) { - if (n == 0) return; - if (capacity() - size() >= n) { - copy_backward(position, end(), finish + n); - fill(position, position + n, x); - finish += n; - } else { - size_type len = size() + max(size(), n); - unsigned int* q = bit_alloc(len); - iterator i = copy(begin(), position, iterator(q, 0)); - fill_n(i, n, x); - finish = copy(position, end(), i + n); - static_allocator.deallocate(start.p); - end_of_storage = q + (n + __WORD_BIT - 1)/__WORD_BIT; - start = iterator(q, 0); - } -} - -void bit_vector::insert(iterator position, const_iterator first, - const_iterator last) { - if (first == last) return; - size_type n = 0; - distance(first, last, n); - if (capacity() - size() >= n) { - copy_backward(position, end(), finish + n); - copy(first, last, position); - finish += n; - } else { - size_type len = size() + max(size(), n); - unsigned int* q = bit_alloc(len); - iterator i = copy(begin(), position, iterator(q, 0)); - i = copy(first, last, i); - finish = copy(position, end(), i); - static_allocator.deallocate(start.p); - end_of_storage = q + (len + __WORD_BIT - 1)/__WORD_BIT; - start = iterator(q, 0); - } -} - -#undef Allocator -#undef __WORD_BIT - -#endif - - diff --git a/contrib/libg++/libstdc++/stl/configure.in b/contrib/libg++/libstdc++/stl/configure.in deleted file mode 100644 index d452935df77f..000000000000 --- a/contrib/libg++/libstdc++/stl/configure.in +++ /dev/null @@ -1,37 +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. - -configdirs= -srctrigger=iterator.h -srcname="Standard Template Library" -package_makefile_frag=Make.pack - -# per-host: - -# per-target: - -target_makefile_frag=../target-mkfrag - -LIBDIR=yes -TO_TOPDIR=../../ -ALL='stl.list' -EXTRA_MOSTLYCLEAN=stl.list -XCXXINCLUDES="-I${srcdir} -I${srcdir}/.. -I${TO_TOPDIR}libio -I${srcdir}/${TO_TOPDIR}libio" -(. ${srcdir}/${TO_TOPDIR}libio/config.shared) >${package_makefile_frag} - -# post-target: - -# We need multilib support. -case ${srcdir} in -.) - if [ "${with_target_subdir}" != "." ] ; then - . ${srcdir}/${with_multisrctop}../../../config-ml.in - else - . ${srcdir}/${with_multisrctop}../../config-ml.in - fi - ;; -*) - . ${srcdir}/../../config-ml.in - ;; -esac diff --git a/contrib/libg++/libstdc++/stl/defalloc.h b/contrib/libg++/libstdc++/stl/defalloc.h deleted file mode 100644 index 388e58fd7444..000000000000 --- a/contrib/libg++/libstdc++/stl/defalloc.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef DEFALLOC_H -#define DEFALLOC_H - -#include <new.h> -#include <stddef.h> -#include <stdlib.h> -#include <limits.h> -#include <iostream.h> -#include <algobase.h> - -#ifndef __GNUG__ -inline void* operator new(size_t, void* p) {return p;} -#endif - -/* - * the following template function is replaced by the following two functions - * due to the fact that the Borland compiler doesn't change prediff_t type - * to type long when compile with -ml or -mh. - -template <class T> -inline T* allocate(ptrdiff_t size, T*) { - set_new_handler(0); - T* tmp = (T*)(::operator new((size_t)(size * sizeof(T)))); - if (tmp == 0) { - cerr << "out of memory" << endl; - exit(1); - } - return tmp; -} -*/ - -template <class T> -inline T* allocate(int size, T*) { - set_new_handler(0); - T* tmp = (T*)(::operator new((unsigned int)(size * sizeof(T)))); - if (tmp == 0) { - cerr << "out of memory" << endl; - exit(1); - } - return tmp; -} - -template <class T> -inline T* allocate(long size, T*) { - set_new_handler(0); - T* tmp = (T*)(::operator new((unsigned long)(size * sizeof(T)))); - if (tmp == 0) { - cerr << "out of memory" << endl; - exit(1); - } - return tmp; -} - -template <class T> -inline void deallocate(T* buffer) { - ::operator delete(buffer); -} - -template <class T> -inline void destroy(T* pointer) { - pointer->~T(); -} - -inline void destroy(char*) {} -inline void destroy(unsigned char*) {} -inline void destroy(short*) {} -inline void destroy(unsigned short*) {} -inline void destroy(int*) {} -inline void destroy(unsigned int*) {} -inline void destroy(long*) {} -inline void destroy(unsigned long*) {} -inline void destroy(float*) {} -inline void destroy(double*) {} -inline void destroy(char**) {} -inline void destroy(unsigned char**) {} -inline void destroy(short**) {} -inline void destroy(unsigned short**) {} -inline void destroy(int**) {} -inline void destroy(unsigned int**) {} -inline void destroy(long**) {} -inline void destroy(unsigned long**) {} -inline void destroy(float**) {} -inline void destroy(double**) {} - -inline void destroy(char*, char*) {} -inline void destroy(unsigned char*, unsigned char*) {} -inline void destroy(short*, short*) {} -inline void destroy(unsigned short*, unsigned short*) {} -inline void destroy(int*, int*) {} -inline void destroy(unsigned int*, unsigned int*) {} -inline void destroy(long*, long*) {} -inline void destroy(unsigned long*, unsigned long*) {} -inline void destroy(float*, float*) {} -inline void destroy(double*, double*) {} -inline void destroy(char**, char**) {} -inline void destroy(unsigned char**, unsigned char**) {} -inline void destroy(short**, short**) {} -inline void destroy(unsigned short**, unsigned short**) {} -inline void destroy(int**, int**) {} -inline void destroy(unsigned int**, unsigned int**) {} -inline void destroy(long**, long**) {} -inline void destroy(unsigned long**, unsigned long**) {} -inline void destroy(float**, float**) {} -inline void destroy(double**, double**) {} - -template <class T1, class T2> -inline void construct(T1* p, const T2& value) { - new (p) T1(value); -} - -template <class T> -class allocator { -public: - typedef T value_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; -#ifdef __GNUG__ - static pointer allocate(size_type n) { - return ::allocate((difference_type)n, (pointer)0); - } - static void deallocate(pointer p) { ::deallocate(p); } - static pointer address(reference x) { return (pointer)&x; } - static const_pointer const_address(const_reference x) { - return (const_pointer)&x; - } - static size_type init_page_size() { - return max(size_type(1), size_type(4096/sizeof(T))); - } - static size_type max_size() { - return max(size_type(1), size_type(UINT_MAX/sizeof(T))); - } -#else - pointer allocate(size_type n) { - return ::allocate((difference_type)n, (pointer)0); - } - void deallocate(pointer p) { ::deallocate(p); } - pointer address(reference x) { return (pointer)&x; } - const_pointer const_address(const_reference x) { - return (const_pointer)&x; - } - size_type init_page_size() { - return max(size_type(1), size_type(4096/sizeof(T))); - } - size_type max_size() const { - return max(size_type(1), size_type(UINT_MAX/sizeof(T))); - } -#endif -}; - -class allocator<void> { -public: - typedef void* pointer; -}; - - - -#endif diff --git a/contrib/libg++/libstdc++/stl/deque.h b/contrib/libg++/libstdc++/stl/deque.h deleted file mode 100644 index 1dc622e0d980..000000000000 --- a/contrib/libg++/libstdc++/stl/deque.h +++ /dev/null @@ -1,684 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef DEQUE_H -#define DEQUE_H - -#include <function.h> -#include <algobase.h> -#include <iterator.h> -#ifndef __GNUG__ -#include <bool.h> -#endif - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#ifndef deque -#define deque deque -#endif - -template <class T> -class deque { -public: - class iterator; - class const_iterator; - friend class iterator; - friend class const_iterator; -public: - typedef T value_type; - typedef Allocator<T> data_allocator_type; - typedef Allocator<T>::pointer pointer; - typedef Allocator<T>::reference reference; - typedef Allocator<T>::const_reference const_reference; - typedef Allocator<T>::size_type size_type; - typedef Allocator<T>::difference_type difference_type; - typedef Allocator<pointer> map_allocator_type; -protected: - static data_allocator_type data_allocator; -#ifdef __GNUG__ - // static // Too bad -- I don't like this hack very much... - static size_type buffer_size() { - return data_allocator.init_page_size(); - } -#define __dq_buffer_size buffer_size() -#else - static size_type buffer_size; -#define __dq_buffer_size buffer_size -#endif - static map_allocator_type map_allocator; - typedef Allocator<pointer>::pointer map_pointer; -public: - class iterator : public random_access_iterator<T, difference_type> { - friend class deque<T>; - friend class const_iterator; - protected: - pointer current; - pointer first; - pointer last; - map_pointer node; - iterator(pointer x, map_pointer y) - : current(x), first(*y), last(*y + __dq_buffer_size), node(y) {} - public: - iterator() : current(0), first(0), last(0), node(0) {} - reference operator*() const { return *current; } - difference_type operator-(const iterator& x) const { - return node == x.node - ? current - x.current - : difference_type(__dq_buffer_size * (node - x.node - 1) + - (current - first) + (x.last - x.current)); - } - iterator& operator++() { - if (++current == last) { - first = *(++node); - current = first; - last = first + __dq_buffer_size; - } - return *this; - } - iterator operator++(int) { - iterator tmp = *this; - ++*this; - return tmp; - } - iterator& operator--() { - if (current == first) { - first = *(--node); - last = first + __dq_buffer_size; - current = last; - } - --current; - return *this; - } - iterator operator--(int) { - iterator tmp = *this; - --*this; - return tmp; - } - iterator& operator+=(difference_type n) { - difference_type offset = n + (current - first); - difference_type num_node_to_jump = offset >= 0 - ? offset / __dq_buffer_size - : -((-offset + __dq_buffer_size - 1) / __dq_buffer_size); - if (num_node_to_jump == 0) - current += n; - else { - node = node + num_node_to_jump; - first = *node; - last = first + __dq_buffer_size; - current = first + (offset - num_node_to_jump * __dq_buffer_size); - } - return *this; - } - iterator& operator-=(difference_type n) { return *this += -n; } - iterator operator+(difference_type n) const { - iterator tmp = *this; - return tmp += n; - } - iterator operator-(difference_type n) const { - iterator tmp = *this; - return tmp -= n; - } - reference operator[](difference_type n) { return *(*this + n); } - bool operator==(const iterator& x) const { - return current == x.current || - ((current == first || x.current == x.first) && - *this - x == 0); - } - bool operator<(const iterator& x) const { - return (node == x.node) ? (current < x.current) : (node < x.node); - } - }; - class const_iterator : public random_access_iterator<T, difference_type> { - friend class deque<T>; - protected: - pointer current; - pointer first; - pointer last; - map_pointer node; - const_iterator(pointer x, map_pointer y) - : current(x), first(*y), last(*y + __dq_buffer_size), node(y) {} - public: - const_iterator() : current(0), first(0), last(0), node(0) {} - const_iterator(const iterator& x) - : current(x.current), first(x.first), last(x.last), node(x.node) {} - const_reference operator*() const { return *current; } - difference_type operator-(const const_iterator& x) const { - return node == x.node - ? current - x.current - : difference_type(__dq_buffer_size * (node - x.node - 1) + - (current - first) + (x.last - x.current)); - } - const_iterator& operator++() { - if (++current == last) { - first = *(++node); - current = first; - last = first + __dq_buffer_size; - } - return *this; - } - const_iterator operator++(int) { - const_iterator tmp = *this; - ++*this; - return tmp; - } - const_iterator& operator--() { - if (current == first) { - first = *(--node); - last = first + __dq_buffer_size; - current = last; - } - --current; - return *this; - } - const_iterator operator--(int) { - const_iterator tmp = *this; - --*this; - return tmp; - } - const_iterator& operator+=(difference_type n) { - difference_type offset = n + (current - first); - difference_type num_node_to_jump = offset >= 0 - ? offset / __dq_buffer_size - : -((-offset + __dq_buffer_size - 1) / __dq_buffer_size); - if (num_node_to_jump == 0) - current += n; - else { - node = node + num_node_to_jump; - first = *node; - last = first + __dq_buffer_size; - current = first + (offset - num_node_to_jump * __dq_buffer_size); - } - return *this; - } - const_iterator& operator-=(difference_type n) { return *this += -n; } - const_iterator operator+(difference_type n) const { - const_iterator tmp = *this; - return tmp += n; - } - const_iterator operator-(difference_type n) const { - const_iterator tmp = *this; - return tmp -= n; - } - const_reference operator[](difference_type n) { - return *(*this + n); - } - bool operator==(const const_iterator& x) const { - return current == x.current || - ((current == first || x.current == x.first) && - *this - x == 0); - } - bool operator<(const const_iterator& x) const { - return (node == x.node) ? (current < x.current) : (node < x.node); - } - }; - typedef reverse_iterator<const_iterator, value_type, const_reference, - difference_type> const_reverse_iterator; - typedef reverse_iterator<iterator, value_type, reference, difference_type> - reverse_iterator; -protected: - iterator start; - iterator finish; - size_type length; - map_pointer map; - size_type map_size; - - void allocate_at_begin(); - void allocate_at_end(); - void deallocate_at_begin(); - void deallocate_at_end(); - -public: - deque() : start(), finish(), length(0), map(0), map_size(0) { -#ifndef __GNUG__ - __dq_buffer_size = data_allocator.init_page_size(); -#endif - } - iterator begin() { return start; } - const_iterator begin() const { return start; } - iterator end() { return finish; } - const_iterator end() const { return finish; } - 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()); - } - bool empty() const { return length == 0; } - size_type size() const { return length; } - size_type max_size() const { return data_allocator.max_size(); } - reference operator[](size_type n) { return *(begin() + n); } - const_reference operator[](size_type n) const { return *(begin() + n); } - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - void push_front(const T& x) { - if (empty() || begin().current == begin().first) - allocate_at_begin(); - --start.current; - construct(start.current, x); - ++length; - if (end().current == end().last) allocate_at_end(); - } - void push_back(const T& x) { - if (empty()) allocate_at_end(); - construct(finish.current, x); - ++finish.current; - ++length; - if (end().current == end().last) allocate_at_end(); - } - void pop_front() { - destroy(start.current); - ++start.current; - --length; - if (empty() || begin().current == begin().last) - deallocate_at_begin(); - } - void pop_back() { - if (end().current == end().first) deallocate_at_end(); - --finish.current; - destroy(finish.current); - --length; - if (empty()) deallocate_at_end(); - } - void swap(deque<T>& x) { - ::swap(start, x.start); - ::swap(finish, x.finish); - ::swap(length, x.length); - ::swap(map, x.map); - ::swap(map_size, x.map_size); - } -#ifdef __GNUG__ - iterator insert(iterator position, const T& x) { - return insert(deque_iterator<T>(position), x); - } - deque_iterator<T> insert(deque_iterator<T> position, const T& x); - void insert(iterator position, size_type n, const T& x) { - insert(deque_iterator<T>(position), n, x); - } - void insert(deque_iterator<T>(position), size_type n, const T& x); -// template <class Iterator> void insert(iterator position, -// Iterator first, Iterator last); - void insert(iterator position, const T* first, const T* last) { - insert(deque_iterator<T>(position), first, last); - } - void insert(deque_iterator<T> position, const T* first, const T* last); - void erase(iterator position) { - erase(deque_iterator<T>(position)); - } - void erase(deque_iterator<T> position); - void erase(iterator first, iterator last) { - erase(deque_iterator<T>(first), deque_iterator<T>(last)); - } - void erase(deque_iterator<T> first, deque_iterator<T> last); -#else - iterator insert(iterator position, const T& x); - void insert(iterator position, size_type n, const T& x); -// template <class Iterator> void insert(iterator position, -// Iterator first, Iterator last); - void insert(iterator position, const T* first, const T* last); - void erase(iterator position); - void erase(iterator first, iterator last); -#endif - deque(size_type n, const T& value = T()) - : start(), finish(), length(0), map(0), map_size(0) { -#ifndef __GNUG__ - __dq_buffer_size = data_allocator.init_page_size(); -#endif - insert(begin(), n, value); - } -// template <class Iterator> deque(Iterator first, Iterator last); - deque(const T* first, const T* last) - : start(), finish(), length(0), map(0), map_size(0) { -#ifndef __GNUG__ - __dq_buffer_size = data_allocator.init_page_size(); -#endif - copy(first, last, back_inserter(*this)); - } - deque(const deque<T>& x) - : start(), finish(), length(0), map(0), map_size(0) { -#ifndef __GNUG__ - __dq_buffer_size = data_allocator.init_page_size(); -#endif - copy(x.begin(), x.end(), back_inserter(*this)); - } - deque<T>& operator=(const deque<T>& x) { - if (this != &x) - if (size() >= x.size()) - erase(copy(x.begin(), x.end(), begin()), end()); - else - copy(x.begin() + size(), x.end(), - inserter(*this, copy(x.begin(), x.begin() + size(), - begin()))); - return *this; - } - ~deque(); -#ifdef __GNUG__ - friend T* value_type(const iterator&) { - return (T*)(0); - } - friend inline difference_type* distance_type(const iterator&) { - return (difference_type*)(0); - } -#endif -}; - -#ifdef __GNUG__ -template <class T> -struct deque_iterator: deque<T>::iterator { - deque_iterator(deque<T>::iterator i) : deque<T>::iterator(i) {} -}; - -template <class T> -inline T* value_type(const deque_iterator<T>&) { - return (T*)(0); -} -#else -template <class T> -deque<T>::data_allocator_type deque<T>::data_allocator; - -template <class T> -deque<T>::map_allocator_type deque<T>::map_allocator; - -template <class T> -deque<T>::size_type deque<T>::__dq_buffer_size = 0; -// should be data_allocator.init_page_size(); // Borland bug -#endif - -template <class T> -bool operator==(const deque<T>& x, const deque<T>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class T> -bool operator<(const deque<T>& x, const deque<T>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -template <class T> -deque<T>::~deque() { while (!empty()) pop_front(); } - -template <class T> -void deque<T>::allocate_at_begin() { - pointer p = data_allocator.allocate(__dq_buffer_size); - if (!empty()) { - if (start.node == map) { - difference_type i = finish.node - start.node; - map_size = (i + 1) * 2; -#ifdef __GNUG__ - map_pointer tmp = map_allocator_type::allocate(map_size); - copy(start.node, finish.node + 1, tmp + map_size / 4 + 1); - map_allocator_type::deallocate(map); -#else - map_pointer tmp = map_allocator.allocate(map_size); - copy(start.node, finish.node + 1, tmp + map_size / 4 + 1); - map_allocator.deallocate(map); -#endif - map = tmp; - map[map_size / 4] = p; - start = iterator(p + __dq_buffer_size, map + map_size / 4); - finish = iterator(finish.current, map + map_size / 4 + i + 1); - } else { -#ifdef __GNU_G__typo /* source depends on this being broken */ - map_size = map_allocator_type::init_page_size(); - map = map_allocator_type::allocate(map_size); -#else - *--start.node = p; - start = iterator(p + __dq_buffer_size, start.node); -#endif - } - } else { -#ifdef __GNUG__ - map_size = map_allocator_type::init_page_size(); - map = map_allocator_type::allocate(map_size); -#else - map_size = map_allocator.init_page_size(); - map = map_allocator.allocate(map_size); -#endif - map[map_size / 2] = p; - start = iterator(p + __dq_buffer_size / 2 + 1, map + map_size / 2); - finish = start; - } -} - -template <class T> -void deque<T>::allocate_at_end() { - pointer p = data_allocator.allocate(__dq_buffer_size); - if (!empty()) { - if (finish.node == map + map_size - 1) { - difference_type i = finish.node - start.node; - map_size = (i + 1) * 2; -#ifdef __GNUG__ - map_pointer tmp = map_allocator_type::allocate(map_size); - copy(start.node, finish.node + 1, tmp + map_size / 4); - map_allocator_type::deallocate(map); -#else - map_pointer tmp = map_allocator.allocate(map_size); - copy(start.node, finish.node + 1, tmp + map_size / 4); - map_allocator.deallocate(map); -#endif - map = tmp; - map[map_size / 4 + i + 1] = p; - start = iterator(start.current, map + map_size / 4); - finish = iterator(p, map + map_size / 4 + i + 1); - } else { - *++finish.node = p; - finish = iterator(p, finish.node); - } - } else { -#ifdef __GNUG__ - map_size = map_allocator_type::init_page_size(); - map = map_allocator_type::allocate(map_size); -#else - map_size = map_allocator.init_page_size(); - map = map_allocator.allocate(map_size); -#endif - map[map_size / 2] = p; - start = iterator(p + __dq_buffer_size / 2, map + map_size / 2); - finish = start; - } -} - -template <class T> -void deque<T>::deallocate_at_begin() { - data_allocator.deallocate(*start.node++); - if (empty()) { - if (finish.current == finish.first) - data_allocator.deallocate(*start.node); - start = iterator(); - finish = start; -#ifdef __GNUG__ - map_allocator.deallocate(map); -#else - map_allocator.deallocate(map); -#endif - } else - start = iterator(*start.node, start.node); -} - -template <class T> -void deque<T>::deallocate_at_end() { - data_allocator.deallocate(*finish.node--); - if (empty()) { - start = iterator(); - finish = start; -#ifdef __GNUG__ - map_allocator.deallocate(map); -#else - map_allocator.deallocate(map); -#endif - } else - finish = iterator(*finish.node + __dq_buffer_size, finish.node); -} - -template <class T> -#ifdef __GNUG__ -deque_iterator<T> -deque<T>::insert(deque_iterator<T> posn, const T& x) { - iterator position = posn; -#else -deque<T>::iterator deque<T>::insert(iterator position, const T& x) { -#endif - if (position == begin()) { - push_front(x); - return begin(); - } else if (position == end()) { - push_back(x); - return end() - 1; - } else { - difference_type index = position - begin(); - if (index < length) { - push_front(*begin()); - copy(begin() + 2, begin() + index + 1, begin() + 1); - } else { - push_back(*(end() - 1)); - copy_backward(begin() + index, end() - 2, end() - 1); - } - *(begin() + index) = x; - return begin() + index; - } -} - -template <class T> -#ifdef __GNUG__ -void deque<T>::insert(deque_iterator<T> posn, - size_t n, // BAD HACK - const T& x) { - iterator position = posn; -#else -void deque<T>::insert(iterator position, size_type n, const T& x) { -#endif - difference_type index = position - begin(); - difference_type remainder = length - index; - if (remainder > index) { - if (n > index) { - difference_type m = n - index; - while (m-- > 0) push_front(x); - difference_type i = index; - while (i--) push_front(*(begin() + n - 1)); - fill(begin() + n, begin() + n + index, x); - } else { - difference_type i = n; - while (i--) push_front(*(begin() + n - 1)); - copy(begin() + n + n, begin() + n + index, begin() + n); - fill(begin() + index, begin() + n + index, x); - } - } else { - difference_type orig_len = index + remainder; - if (n > remainder) { - difference_type m = n - remainder; - while (m-- > 0) push_back(x); - difference_type i = 0; - while (i < remainder) push_back(*(begin() + index + i++)); - fill(begin() + index, begin() + orig_len, x); - } else { - difference_type i = 0; - while (i < n) push_back(*(begin() + orig_len - n + i++)); - copy_backward(begin() + index, begin() + orig_len - n, - begin() + orig_len); - fill(begin() + index, begin() + index + n, x); - } - } -} - -template <class T> -void deque<T>::insert -#ifdef __GNUG__ -(deque_iterator<T> posn, const T* first, const T* last) -{ - iterator position = posn; -#else -(iterator position, const T* first, const T* last) -{ -#endif - difference_type index = position - begin(); - difference_type remainder = length - index; - size_type n = 0; - distance(first, last, n); - if (remainder > index) { - if (n > index) { - const T* m = last - index; - while (m != first) push_front(*--m); - difference_type i = index; - while (i--) push_front(*(begin() + n - 1)); - copy(last - index, last, begin() + n); - } else { - difference_type i = n; - while (i--) push_front(*(begin() + n - 1)); - copy(begin() + n + n, begin() + n + index, begin() + n); - copy(first, last, begin() + index); - } - } else { - difference_type orig_len = index + remainder; - if (n > remainder) { - const T* m = first + remainder; - while (m != last) push_back(*m++); - difference_type i = 0; - while (i < remainder) push_back(*(begin() + index + i++)); - copy(first, first + remainder, begin() + index); - } else { - difference_type i = 0; - while (i < n) push_back(*(begin() + orig_len - n + i++)); - copy_backward(begin() + index, begin() + orig_len - n, - begin() + orig_len); - copy(first, last, begin() + index); - } - } -} - -template <class T> -#ifdef __GNUG__ -void deque<T>::erase(deque_iterator<T> posn) { - iterator position = posn; -#else -void deque<T>::erase(iterator position) { -#endif - if (end() - position > position - begin()) { - copy_backward(begin(), position, position + 1); - pop_front(); - } else { - copy(position + 1, end(), position); - pop_back(); - } -} - -template <class T> -#ifdef __GNUG__ -void deque<T>::erase(deque_iterator<T> fi, deque_iterator<T> la) { - iterator first = fi; - iterator last = la; - difference_type n = last - first; -#else -void deque<T>::erase(iterator first, iterator last) { - difference_type n = last - first; -#endif - if (end() - last > first - begin()) { - copy_backward(begin(), first, last); - while(n-- > 0) pop_front(); - } else { - copy(last, end(), first); - while(n-- > 0) pop_back(); - } -} - -#undef Allocator -#undef deque - -#endif diff --git a/contrib/libg++/libstdc++/stl/faralloc.h b/contrib/libg++/libstdc++/stl/faralloc.h deleted file mode 100644 index b29602cc6327..000000000000 --- a/contrib/libg++/libstdc++/stl/faralloc.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FARALLOC_H -#define FARALLOC_H - -#include <new.h> -#include <stddef.h> -#include <stdlib.h> -#include <limits.h> -#include <iostream.h> -#include <algobase.h> - -template <class T> -inline random_access_iterator_tag iterator_category(const T __far *) { - return random_access_iterator_tag(); -} - -template <class T> -inline T* value_type(const T __far *) { return (T*)(0); } - -template <class T> -inline long* distance_type(const T __far*) { return (long*)(0); } - -inline void destroy(char __far *) {} -inline void destroy(unsigned char __far *) {} -inline void destroy(short __far *) {} -inline void destroy(unsigned short __far *) {} -inline void destroy(int __far *) {} -inline void destroy(unsigned int __far *) {} -inline void destroy(long __far *) {} -inline void destroy(unsigned long __far *) {} -inline void destroy(float __far *) {} -inline void destroy(double __far *) {} - -inline void destroy(char __far *, char __far *) {} -inline void destroy(unsigned char __far *, unsigned char __far *) {} -inline void destroy(short __far *, short __far *) {} -inline void destroy(unsigned short __far *, unsigned short __far *) {} -inline void destroy(int __far *, int __far *) {} -inline void destroy(unsigned int __far *, unsigned int __far *) {} -inline void destroy(long __far *, long __far *) {} -inline void destroy(unsigned long __far *, unsigned long __far *) {} -inline void destroy(float __far *, float __far *) {} -inline void destroy(double __far *, double __far *) {} - -inline void __far * operator new(size_t, void __far *p) { return p; } - -template <class T> -inline T __far * allocate(long size, T __far * p) { - set_new_handler(0); - T __far * tmp = - (T __far *)(::operator new((unsigned long)(size * sizeof(T)))); - if (tmp == 0) { - cerr << "out of memory" << endl; - exit(1); - } - return tmp; -} - -template <class T> -inline void deallocate(T __far * buffer) { - ::operator delete(buffer); -} - -template <class T1, class T2> -inline void construct( T1 __far *p, const T2& value ) -{ - new(p)T1(value); -} - -template <class T> -inline void destroy( T __far * pointer ) { - pointer->~T(); -} - -template <class T> -class far_allocator { -public: - typedef T value_type; - typedef T __far * pointer; - typedef const T __far * const_pointer; - typedef T __far & reference; - typedef const T __far & const_reference; - typedef unsigned long size_type; - typedef long difference_type; - pointer allocate(size_type n) { - return ::allocate((difference_type)n, (pointer)0); - } - void deallocate(pointer p) { ::deallocate(p); } - pointer address(reference x) { return (pointer)&x; } - const_pointer const_address(const_reference x) { - return (const_pointer)&x; - } - size_type init_page_size() { - return max(size_type(1), size_type(4096/sizeof(T))); - } - size_type max_size() const { - return max(size_type(1), size_type(ULONG_MAX/sizeof(T))); - } -}; - -class far_allocator<void> { -public: - typedef void __far * pointer; -}; - -#endif diff --git a/contrib/libg++/libstdc++/stl/fdeque.h b/contrib/libg++/libstdc++/stl/fdeque.h deleted file mode 100644 index 7b512b62dc2a..000000000000 --- a/contrib/libg++/libstdc++/stl/fdeque.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FDEQUE_H -#define FDEQUE_H - -#ifdef DEQUE_H -#undef DEQUE_H -#define __DEQUE_WAS_DEFINED -#endif - -#define Allocator far_allocator -#define deque far_deque -#include <faralloc.h> -#include <deque.h> - -#undef DEQUE_H - -#ifdef __DEQUE_WAS_DEFINED -#define DEQUE_H -#undef __DEQUE_WAS_DEFINED -#endif - -#undef Allocator -#undef deque - -#endif diff --git a/contrib/libg++/libstdc++/stl/flist.h b/contrib/libg++/libstdc++/stl/flist.h deleted file mode 100644 index 35fe9bf6288f..000000000000 --- a/contrib/libg++/libstdc++/stl/flist.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FLIST_H -#define FLIST_H - -#ifdef LIST_H -#undef LIST_H -#define __LIST_WAS_DEFINED -#endif - -#define Allocator far_allocator -#define list far_list -#include <faralloc.h> -#include <list.h> - -#undef LIST_H - -#ifdef __LIST_WAS_DEFINED -#define LIST_H -#undef __LIST_WAS_DEFINED -#endif - -#undef Allocator -#undef list - -#endif diff --git a/contrib/libg++/libstdc++/stl/fmap.h b/contrib/libg++/libstdc++/stl/fmap.h deleted file mode 100644 index 65aa2091fc20..000000000000 --- a/contrib/libg++/libstdc++/stl/fmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FMAP_H -#define FMAP_H - -#ifdef MAP_H -#undef MAP_H -#undef TREE_H -#define __MAP_WAS_DEFINED -#endif - -#define Allocator far_allocator -#define map far_map -#define rb_tree far_rb_tree -#include <faralloc.h> -#include <map.h> - -#undef MAP_H -#undef TREE_H - -#ifdef __MAP_WAS_DEFINED -#define MAP_H -#define TREE_H -#undef __MAP_WAS_DEFINED -#endif - -#undef Allocator -#undef map -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/fmultmap.h b/contrib/libg++/libstdc++/stl/fmultmap.h deleted file mode 100644 index ecb5cd4fdeff..000000000000 --- a/contrib/libg++/libstdc++/stl/fmultmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FMULTIMAP_H -#define FMULTIMAP_H - -#ifdef MULTIMAP_H -#undef MULTIMAP_H -#undef TREE_H -#define __MULTIMAP_WAS_DEFINED -#endif - -#define Allocator far_allocator -#define multimap far_multimap -#define rb_tree far_rb_tree -#include <faralloc.h> -#include <multimap.h> - -#undef MULTIMAP_H -#undef TREE_H - -#ifdef __MULTIMAP_WAS_DEFINED -#define MULTIMAP_H -#define TREE_H -#undef __MULTIMAP_WAS_DEFINED -#endif - -#undef Allocator -#undef multimap -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/fmultset.h b/contrib/libg++/libstdc++/stl/fmultset.h deleted file mode 100644 index ca9887646ce7..000000000000 --- a/contrib/libg++/libstdc++/stl/fmultset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FMULTISET_H -#define FMULTISET_H - -#ifdef MULTISET_H -#undef MULTISET_H -#undef TREE_H -#define __MULTISET_WAS_DEFINED -#endif - -#define Allocator far_allocator -#define multiset far_multiset -#define rb_tree far_rb_tree -#include <faralloc.h> -#include <multiset.h> - -#undef MULTISET_H -#undef TREE_H - -#ifdef __MULTISET_WAS_DEFINED -#define MULTISET_H -#define TREE_H -#undef __MULTISET_WAS_DEFINED -#endif - -#undef Allocator -#undef multiset -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/fset.h b/contrib/libg++/libstdc++/stl/fset.h deleted file mode 100644 index b374bc435a6c..000000000000 --- a/contrib/libg++/libstdc++/stl/fset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FSET_H -#define FSET_H - -#ifdef SET_H -#undef SET_H -#undef TREE_H -#define __SET_WAS_DEFINED -#endif - -#define Allocator far_allocator -#define set far_set -#define rb_tree far_rb_tree -#include <faralloc.h> -#include <set.h> - -#undef SET_H -#undef TREE_H - -#ifdef __SET_WAS_DEFINED -#define SET_H -#define TREE_H -#undef __SET_WAS_DEFINED -#endif - -#undef Allocator -#undef set -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/function.h b/contrib/libg++/libstdc++/stl/function.h deleted file mode 100644 index 46fe55569bbd..000000000000 --- a/contrib/libg++/libstdc++/stl/function.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef FUNCTION_H -#define FUNCTION_H - -#ifndef __GNUG__ -#include <bool.h> -#endif - -template <class T1, class T2> -inline bool operator!=(const T1& x, const T2& y) { - return !(x == y); -} - -template <class T1, class T2> -inline bool operator>(const T1& x, const T2& y) { - return y < x; -} - -template <class T1, class T2> -inline bool operator<=(const T1& x, const T2& y) { - return !(y < x); -} - -template <class T1, class T2> -inline bool operator>=(const T1& x, const T2& y) { - return !(x < y); -} - -template <class Arg, class Result> -struct unary_function { - typedef Arg argument_type; - typedef Result result_type; -}; - -template <class Arg1, class Arg2, class Result> -struct binary_function { - typedef Arg1 first_argument_type; - typedef Arg2 second_argument_type; - typedef Result result_type; -}; - -template <class T> -struct plus : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x + y; } -}; - -template <class T> -struct minus : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x - y; } -}; - -template <class T> -struct times : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x * y; } -}; - -template <class T> -struct divides : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x / y; } -}; - -template <class T> -#ifdef __GNU__ -struct modulus { - typedef T first_argument_type; - typedef T second_argument_type; - typedef T result_type; - T operator()(const T& x, const T& y) const { return x % y; } -}; -#else -struct modulus : binary_function<T, T, T> { - T operator()(const T& x, const T& y) const { return x % y; } -}; -#endif - -template <class T> -struct negate : unary_function<T, T> { - T operator()(const T& x) const { return -x; } -}; - -template <class T> -struct equal_to : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x == y; } -}; - -template <class T> -struct not_equal_to : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x != y; } -}; - -template <class T> -struct greater : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x > y; } -}; - -template <class T> -struct less : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x < y; } -}; - -template <class T> -struct greater_equal : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x >= y; } -}; - -template <class T> -struct less_equal : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x <= y; } -}; - -template <class T> -struct logical_and : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x && y; } -}; - -template <class T> -struct logical_or : binary_function<T, T, bool> { - bool operator()(const T& x, const T& y) const { return x || y; } -}; - -template <class T> -struct logical_not : unary_function<T, bool> { - bool operator()(const T& x) const { return !x; } -}; - -template <class Predicate> -class unary_negate : public unary_function<Predicate::argument_type, bool> { -protected: - Predicate pred; -public: - unary_negate(const Predicate& x) : pred(x) {} - bool operator()(const argument_type& x) const { return !pred(x); } -}; - -template <class Predicate> -unary_negate<Predicate> not1(const Predicate& pred) { - return unary_negate<Predicate>(pred); -} - -template <class Predicate> -class binary_negate - : public binary_function<Predicate::first_argument_type, - Predicate::second_argument_type, bool> { -protected: - Predicate pred; -public: - binary_negate(const Predicate& x) : pred(x) {} - bool operator()(const first_argument_type& x, - const second_argument_type& y) const { - return !pred(x, y); - } -}; - -template <class Predicate> -binary_negate<Predicate> not2(const Predicate& pred) { - return binary_negate<Predicate>(pred); -} - -template <class Operation> -class binder1st : public unary_function<Operation::second_argument_type, - Operation::result_type> { -protected: - Operation op; - Operation::first_argument_type value; -public: - binder1st(const Operation& x, const Operation::first_argument_type& y) - : op(x), value(y) {} - result_type operator()(const argument_type& x) const { - return op(value, x); - } -}; - -template <class Operation, class T> -binder1st<Operation> bind1st(const Operation& op, const T& x) { - return binder1st<Operation>(op, Operation::first_argument_type(x)); -} - -template <class Operation> -class binder2nd : public unary_function<Operation::first_argument_type, - Operation::result_type> { -protected: - Operation op; - Operation::second_argument_type value; -public: - binder2nd(const Operation& x, const Operation::second_argument_type& y) - : op(x), value(y) {} - result_type operator()(const argument_type& x) const { - return op(x, value); - } -}; - -template <class Operation, class T> -binder2nd<Operation> bind2nd(const Operation& op, const T& x) { - return binder2nd<Operation>(op, Operation::second_argument_type(x)); -} - -template <class Operation1, class Operation2> -class unary_compose : public unary_function<Operation2::argument_type, - Operation1::result_type> { -protected: - Operation1 op1; - Operation2 op2; -public: - unary_compose(const Operation1& x, const Operation2& y) : op1(x), op2(y) {} - result_type operator()(const argument_type& x) const { - return op1(op2(x)); - } -}; - -template <class Operation1, class Operation2> -unary_compose<Operation1, Operation2> compose1(const Operation1& op1, - const Operation2& op2) { - return unary_compose<Operation1, Operation2>(op1, op2); -} - -template <class Operation1, class Operation2, class Operation3> -class binary_compose : public unary_function<Operation2::argument_type, - Operation1::result_type> { -protected: - Operation1 op1; - Operation2 op2; - Operation3 op3; -public: - binary_compose(const Operation1& x, const Operation2& y, - const Operation3& z) : op1(x), op2(y), op3(z) { } - result_type operator()(const argument_type& x) const { - return op1(op2(x), op3(x)); - } -}; - -template <class Operation1, class Operation2, class Operation3> -binary_compose<Operation1, Operation2, Operation3> -compose2(const Operation1& op1, const Operation2& op2, const Operation3& op3) { - return binary_compose<Operation1, Operation2, Operation3>(op1, op2, op3); -} - -template <class Arg, class Result> -class pointer_to_unary_function : public unary_function<Arg, Result> { -protected: - Result (*ptr)(Arg); -public: - pointer_to_unary_function() {} - pointer_to_unary_function(Result (*x)(Arg)) : ptr(x) {} - Result operator()(Arg x) const { return ptr(x); } -}; - -template <class Arg, class Result> -pointer_to_unary_function<Arg, Result> ptr_fun(Result (*x)(Arg)) { - return pointer_to_unary_function<Arg, Result>(x); -} - -template <class Arg1, class Arg2, class Result> -class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result> { -protected: - Result (*ptr)(Arg1, Arg2); -public: - pointer_to_binary_function() {} - pointer_to_binary_function(Result (*x)(Arg1, Arg2)) : ptr(x) {} - Result operator()(Arg1 x, Arg2 y) const { return ptr(x, y); } -}; - -template <class Arg1, class Arg2, class Result> -pointer_to_binary_function<Arg1, Arg2, Result> -ptr_fun(Result (*x)(Arg1, Arg2)) { - return pointer_to_binary_function<Arg1, Arg2, Result>(x); -} - -#endif diff --git a/contrib/libg++/libstdc++/stl/hdeque.h b/contrib/libg++/libstdc++/stl/hdeque.h deleted file mode 100644 index 0d47098a06c4..000000000000 --- a/contrib/libg++/libstdc++/stl/hdeque.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HDEQUE_H -#define HDEQUE_H - -#ifdef DEQUE_H -#undef DEQUE_H -#define __DEQUE_WAS_DEFINED -#endif - -#define Allocator huge_allocator -#define deque huge_deque -#include <hugalloc.h> -#include <deque.h> - -#undef DEQUE_H - -#ifdef __DEQUE_WAS_DEFINED -#define DEQUE_H -#undef __DEQUE_WAS_DEFINED -#endif - -#undef Allocator -#undef deque - -#endif diff --git a/contrib/libg++/libstdc++/stl/heap.h b/contrib/libg++/libstdc++/stl/heap.h deleted file mode 100644 index 7f2747fc5b91..000000000000 --- a/contrib/libg++/libstdc++/stl/heap.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HEAP_H -#define HEAP_H - -template <class RandomAccessIterator, class Distance, class T> -void __push_heap(RandomAccessIterator first, Distance holeIndex, - Distance topIndex, T value) { - Distance parent = (holeIndex - 1) / 2; - while (holeIndex > topIndex && *(first + parent) < value) { - *(first + holeIndex) = *(first + parent); - holeIndex = parent; - parent = (holeIndex - 1) / 2; - } - *(first + holeIndex) = value; -} - -template <class RandomAccessIterator, class T> -inline void __push_heap_aux(RandomAccessIterator first, - RandomAccessIterator last, T*) { - __push_heap(first, (last - first) - 1, 0, T(*(last - 1))); -} - -template <class RandomAccessIterator> -inline void push_heap(RandomAccessIterator first, RandomAccessIterator last) { - __push_heap_aux(first, last, value_type(first)); -} - -template <class RandomAccessIterator, class Distance, class T, class Compare> -void __push_heap(RandomAccessIterator first, Distance holeIndex, - Distance topIndex, T value, Compare comp) { - Distance parent = (holeIndex - 1) / 2; - while (holeIndex > topIndex && comp(*(first + parent), value)) { - *(first + holeIndex) = *(first + parent); - holeIndex = parent; - parent = (holeIndex - 1) / 2; - } - *(first + holeIndex) = value; -} - -template <class RandomAccessIterator, class Compare, class T> -inline void __push_heap_aux(RandomAccessIterator first, - RandomAccessIterator last, Compare comp, T*) { - __push_heap(first, (last - first) - 1, 0, T(*(last - 1)), comp); -} - -template <class RandomAccessIterator, class Compare> -inline void push_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp) { - __push_heap_aux(first, last, comp, value_type(first)); -} - -template <class RandomAccessIterator, class Distance, class T> -void __adjust_heap(RandomAccessIterator first, Distance holeIndex, - Distance len, T value) { - Distance topIndex = holeIndex; - Distance secondChild = 2 * holeIndex + 2; - while (secondChild < len) { - if (*(first + secondChild) < *(first + (secondChild - 1))) - secondChild--; - *(first + holeIndex) = *(first + secondChild); - holeIndex = secondChild; - secondChild = 2 * (secondChild + 1); - } - if (secondChild == len) { - *(first + holeIndex) = *(first + (secondChild - 1)); - holeIndex = secondChild - 1; - } - __push_heap(first, holeIndex, topIndex, value); -} - -template <class RandomAccessIterator, class T, class Distance> -inline void __pop_heap(RandomAccessIterator first, RandomAccessIterator last, - RandomAccessIterator result, T value, Distance*) { - *result = *first; - __adjust_heap(first, Distance(0), Distance(last - first), value); -} - -template <class RandomAccessIterator, class T> -inline void __pop_heap_aux(RandomAccessIterator first, - RandomAccessIterator last, T*) { - __pop_heap(first, last - 1, last - 1, T(*(last - 1)), distance_type(first)); -} - -template <class RandomAccessIterator> -inline void pop_heap(RandomAccessIterator first, RandomAccessIterator last) { - __pop_heap_aux(first, last, value_type(first)); -} - -template <class RandomAccessIterator, class Distance, class T, class Compare> -void __adjust_heap(RandomAccessIterator first, Distance holeIndex, - Distance len, T value, Compare comp) { - Distance topIndex = holeIndex; - Distance secondChild = 2 * holeIndex + 2; - while (secondChild < len) { - if (comp(*(first + secondChild), *(first + (secondChild - 1)))) - secondChild--; - *(first + holeIndex) = *(first + secondChild); - holeIndex = secondChild; - secondChild = 2 * (secondChild + 1); - } - if (secondChild == len) { - *(first + holeIndex) = *(first + (secondChild - 1)); - holeIndex = secondChild - 1; - } - __push_heap(first, holeIndex, topIndex, value, comp); -} - -template <class RandomAccessIterator, class T, class Compare, class Distance> -inline void __pop_heap(RandomAccessIterator first, RandomAccessIterator last, - RandomAccessIterator result, T value, Compare comp, - Distance*) { - *result = *first; - __adjust_heap(first, Distance(0), Distance(last - first), value, comp); -} - -template <class RandomAccessIterator, class T, class Compare> -inline void __pop_heap_aux(RandomAccessIterator first, - RandomAccessIterator last, T*, Compare comp) { - __pop_heap(first, last - 1, last - 1, T(*(last - 1)), comp, - distance_type(first)); -} - -template <class RandomAccessIterator, class Compare> -inline void pop_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp) { - __pop_heap_aux(first, last, value_type(first), comp); -} - -template <class RandomAccessIterator, class T, class Distance> -void __make_heap(RandomAccessIterator first, RandomAccessIterator last, T*, - Distance*) { - if (last - first < 2) return; - Distance len = last - first; - Distance parent = (len - 2)/2; - - while (true) { - __adjust_heap(first, parent, len, T(*(first + parent))); - if (parent == 0) return; - parent--; - } -} - -template <class RandomAccessIterator> -inline void make_heap(RandomAccessIterator first, RandomAccessIterator last) { - __make_heap(first, last, value_type(first), distance_type(first)); -} - -template <class RandomAccessIterator, class Compare, class T, class Distance> -void __make_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp, T*, Distance*) { - if (last - first < 2) return; - Distance len = last - first; - Distance parent = (len - 2)/2; - - while (true) { - __adjust_heap(first, parent, len, T(*(first + parent)), comp); - if (parent == 0) return; - parent--; - } -} - -template <class RandomAccessIterator, class Compare> -inline void make_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp) { - __make_heap(first, last, comp, value_type(first), distance_type(first)); -} - -template <class RandomAccessIterator> -void sort_heap(RandomAccessIterator first, RandomAccessIterator last) { - while (last - first > 1) pop_heap(first, last--); -} - -template <class RandomAccessIterator, class Compare> -void sort_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp) { - while (last - first > 1) pop_heap(first, last--, comp); -} - -#endif diff --git a/contrib/libg++/libstdc++/stl/hlist.h b/contrib/libg++/libstdc++/stl/hlist.h deleted file mode 100644 index 543ffa7a77ee..000000000000 --- a/contrib/libg++/libstdc++/stl/hlist.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HLIST_H -#define HLIST_H - -#ifdef LIST_H -#undef LIST_H -#define __LIST_WAS_DEFINED -#endif - -#define Allocator huge_allocator -#define list huge_list -#include <hugalloc.h> -#include <list.h> - -#undef LIST_H - -#ifdef __LIST_WAS_DEFINED -#define LIST_H -#undef __LIST_WAS_DEFINED -#endif - -#undef Allocator -#undef list - -#endif diff --git a/contrib/libg++/libstdc++/stl/hmap.h b/contrib/libg++/libstdc++/stl/hmap.h deleted file mode 100644 index f40abc042ada..000000000000 --- a/contrib/libg++/libstdc++/stl/hmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HMAP_H -#define HMAP_H - -#ifdef MAP_H -#undef MAP_H -#undef TREE_H -#define __MAP_WAS_DEFINED -#endif - -#define Allocator huge_allocator -#define map huge_map -#define rb_tree huge_rb_tree -#include <hugalloc.h> -#include <map.h> - -#undef MAP_H -#undef TREE_H - -#ifdef __MAP_WAS_DEFINED -#define MAP_H -#define TREE_H -#undef __MAP_WAS_DEFINED -#endif - -#undef Allocator -#undef map -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/hmultmap.h b/contrib/libg++/libstdc++/stl/hmultmap.h deleted file mode 100644 index 0a8551e9ec53..000000000000 --- a/contrib/libg++/libstdc++/stl/hmultmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HMULTIMAP_H -#define HMULTIMAP_H - -#ifdef MULTIMAP_H -#undef MULTIMAP_H -#undef TREE_H -#define __MULTIMAP_WAS_DEFINED -#endif - -#define Allocator huge_allocator -#define multimap huge_multimap -#define rb_tree huge_rb_tree -#include <hugalloc.h> -#include <multimap.h> - -#undef MULTIMAP_H -#undef TREE_H - -#ifdef __MULTIMAP_WAS_DEFINED -#define MULTIMAP_H -#define TREE_H -#undef __MULTIMAP_WAS_DEFINED -#endif - -#undef Allocator -#undef multimap -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/hmultset.h b/contrib/libg++/libstdc++/stl/hmultset.h deleted file mode 100644 index e207299603fb..000000000000 --- a/contrib/libg++/libstdc++/stl/hmultset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HMULTISET_H -#define HMULTISET_H - -#ifdef MULTISET_H -#undef MULTISET_H -#undef TREE_H -#define __MULTISET_WAS_DEFINED -#endif - -#define Allocator huge_allocator -#define multiset huge_multiset -#define rb_tree huge_rb_tree -#include <hugalloc.h> -#include <multiset.h> - -#undef MULTISET_H -#undef TREE_H - -#ifdef __MULTISET_WAS_DEFINED -#define MULTISET_H -#define TREE_H -#undef __MULTISET_WAS_DEFINED -#endif - -#undef Allocator -#undef multiset -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/hset.h b/contrib/libg++/libstdc++/stl/hset.h deleted file mode 100644 index 11a157632168..000000000000 --- a/contrib/libg++/libstdc++/stl/hset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HSET_H -#define HSET_H - -#ifdef SET_H -#undef SET_H -#undef TREE_H -#define __SET_WAS_DEFINED -#endif - -#define Allocator huge_allocator -#define set huge_set -#define rb_tree huge_rb_tree -#include <hugalloc.h> -#include <set.h> - -#undef SET_H -#undef TREE_H - -#ifdef __SET_WAS_DEFINED -#define SET_H -#define TREE_H -#undef __SET_WAS_DEFINED -#endif - -#undef Allocator -#undef set -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/hugalloc.h b/contrib/libg++/libstdc++/stl/hugalloc.h deleted file mode 100644 index a793ab27fd7c..000000000000 --- a/contrib/libg++/libstdc++/stl/hugalloc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HUGALLOC_H -#define HUGALLOC_H - -#ifdef FARALLOC_H -#undef FARALLOC_H -#define __FARALLOC_WAS_DEFINED -#endif - -#define __far __huge -#define far_allocator huge_allocator -#include <faralloc.h> -#undef __far -#undef far_allocator - -#undef FARALLOC_H - -#ifdef __FARALLOC_WAS_DEFINED -#define FARALLOC_H -#undef __FARALLOC_WAS_DEFINED -#endif - -#endif - diff --git a/contrib/libg++/libstdc++/stl/hvector.h b/contrib/libg++/libstdc++/stl/hvector.h deleted file mode 100644 index e7fb41530db8..000000000000 --- a/contrib/libg++/libstdc++/stl/hvector.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef HVECTOR_H -#define HVECTOR_H - -#ifdef VECTOR_H -#undef VECTOR_H -#define __VECTOR_WAS_DEFINED -#endif - -#define Allocator huge_allocator -#define vector huge_vector -#include <hugalloc.h> -#include <vector.h> - -#undef VECTOR_H - -#ifdef __VECTOR_WAS_DEFINED -#define VECTOR_H -#undef __VECTOR_WAS_DEFINED -#endif - -#undef Allocator -#undef vector - -#endif diff --git a/contrib/libg++/libstdc++/stl/iterator.h b/contrib/libg++/libstdc++/stl/iterator.h deleted file mode 100644 index 5e51598f200f..000000000000 --- a/contrib/libg++/libstdc++/stl/iterator.h +++ /dev/null @@ -1,395 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef ITERATOR_H -#define ITERATOR_H - -#include <stddef.h> -#include <iostream.h> -#ifndef __GNUG__ -#include <bool.h> -#endif -#include <function.h> - -struct input_iterator_tag {}; -struct output_iterator_tag {}; -struct forward_iterator_tag {}; -struct bidirectional_iterator_tag {}; -struct random_access_iterator_tag {}; - -template <class T, class Distance> struct input_iterator {}; -struct output_iterator {}; -template <class T, class Distance> struct forward_iterator {}; -template <class T, class Distance> struct bidirectional_iterator {}; -template <class T, class Distance> struct random_access_iterator {}; - -template <class T, class Distance> -inline input_iterator_tag -iterator_category(const input_iterator<T, Distance>&) { - return input_iterator_tag(); -} - -inline output_iterator_tag iterator_category(const output_iterator&) { - return output_iterator_tag(); -} - -template <class T, class Distance> -inline forward_iterator_tag -iterator_category(const forward_iterator<T, Distance>&) { - return forward_iterator_tag(); -} - -template <class T, class Distance> -inline bidirectional_iterator_tag -iterator_category(const bidirectional_iterator<T, Distance>&) { - return bidirectional_iterator_tag(); -} - -template <class T, class Distance> -inline random_access_iterator_tag -iterator_category(const random_access_iterator<T, Distance>&) { - return random_access_iterator_tag(); -} - -template <class T> -inline random_access_iterator_tag iterator_category(const T*) { - return random_access_iterator_tag(); -} - -template <class T, class Distance> -inline T* value_type(const input_iterator<T, Distance>&) { - return (T*)(0); -} - -template <class T, class Distance> -inline T* value_type(const forward_iterator<T, Distance>&) { - return (T*)(0); -} - -template <class T, class Distance> -inline T* value_type(const bidirectional_iterator<T, Distance>&) { - return (T*)(0); -} - -template <class T, class Distance> -inline T* value_type(const random_access_iterator<T, Distance>&) { - return (T*)(0); -} - -template <class T> -inline T* value_type(const T*) { return (T*)(0); } - -template <class T, class Distance> -inline Distance* distance_type(const input_iterator<T, Distance>&) { - return (Distance*)(0); -} - -template <class T, class Distance> -inline Distance* distance_type(const forward_iterator<T, Distance>&) { - return (Distance*)(0); -} - -template <class T, class Distance> -inline Distance* -distance_type(const bidirectional_iterator<T, Distance>&) { - return (Distance*)(0); -} - -template <class T, class Distance> -inline Distance* -distance_type(const random_access_iterator<T, Distance>&) { - return (Distance*)(0); -} - -template <class T> -inline ptrdiff_t* distance_type(const T*) { return (ptrdiff_t*)(0); } - -template <class Container> -class back_insert_iterator : public output_iterator { -protected: - Container& container; -public: - back_insert_iterator(Container& x) : container(x) {} - back_insert_iterator<Container>& - operator=(const Container::value_type& value) { - container.push_back(value); - return *this; - } - back_insert_iterator<Container>& operator*() { return *this; } - back_insert_iterator<Container>& operator++() { return *this; } - back_insert_iterator<Container>& operator++(int) { return *this; } -}; - -template <class Container> -back_insert_iterator<Container> back_inserter(Container& x) { - return back_insert_iterator<Container>(x); -} - -template <class Container> -class front_insert_iterator : public output_iterator { -protected: - Container& container; -public: - front_insert_iterator(Container& x) : container(x) {} - front_insert_iterator<Container>& - operator=(const Container::value_type& value) { - container.push_front(value); - return *this; - } - front_insert_iterator<Container>& operator*() { return *this; } - front_insert_iterator<Container>& operator++() { return *this; } - front_insert_iterator<Container>& operator++(int) { return *this; } -}; - -template <class Container> -front_insert_iterator<Container> front_inserter(Container& x) { - return front_insert_iterator<Container>(x); -} - -template <class Container> -class insert_iterator : public output_iterator { -protected: - Container& container; - Container::iterator iter; -public: - insert_iterator(Container& x, Container::iterator i) - : container(x), iter(i) {} - insert_iterator<Container>& - operator=(const Container::value_type& value) { - iter = container.insert(iter, value); - ++iter; - return *this; - } - insert_iterator<Container>& operator*() { return *this; } - insert_iterator<Container>& operator++() { return *this; } - insert_iterator<Container>& operator++(int) { return *this; } -}; - -template <class Container, class Iterator> -insert_iterator<Container> inserter(Container& x, Iterator i) { - return insert_iterator<Container>(x, Container::iterator(i)); -} - -template <class BidirectionalIterator, class T, class Reference, - class Distance = ptrdiff_t> -// Reference = T& -class reverse_bidirectional_iterator - : public bidirectional_iterator<T, Distance> { - typedef reverse_bidirectional_iterator<BidirectionalIterator, T, Reference, - Distance> self; - friend bool operator==(const self& x, const self& y); -protected: - BidirectionalIterator current; -public: - reverse_bidirectional_iterator() {} - reverse_bidirectional_iterator(BidirectionalIterator x) : current(x) {} - BidirectionalIterator base() { return current; } - Reference operator*() const { - BidirectionalIterator tmp = current; - return *--tmp; - } - self& operator++() { - --current; - return *this; - } - self operator++(int) { - self tmp = *this; - --current; - return tmp; - } - self& operator--() { - ++current; - return *this; - } - self operator--(int) { - self tmp = *this; - ++current; - return tmp; - } -}; - -template <class BidirectionalIterator, class T, class Reference, - class Distance> -inline bool operator==( - const reverse_bidirectional_iterator<BidirectionalIterator, T, Reference, - Distance>& x, - const reverse_bidirectional_iterator<BidirectionalIterator, T, Reference, - Distance>& y) { - return x.current == y.current; -} - -template <class RandomAccessIterator, class T, class Reference, - class Distance = ptrdiff_t> -// Reference = T& -class reverse_iterator : public random_access_iterator<T, Distance> { - typedef reverse_iterator<RandomAccessIterator, T, Reference, Distance> - self; - friend bool operator==(const self& x, const self& y); - friend bool operator<(const self& x, const self& y); - friend Distance operator-(const self& x, const self& y); - friend self operator+(Distance n, const self& x); -protected: - RandomAccessIterator current; -public: - reverse_iterator() {} - reverse_iterator(RandomAccessIterator x) : current(x) {} - RandomAccessIterator base() { return current; } - Reference operator*() const { return *(current - 1); } - self& operator++() { - --current; - return *this; - } - self operator++(int) { - self tmp = *this; - --current; - return tmp; - } - self& operator--() { - ++current; - return *this; - } - self operator--(int) { - self tmp = *this; - ++current; - return tmp; - } - self operator+(Distance n) const { - return self(current - n); - } - self& operator+=(Distance n) { - current -= n; - return *this; - } - self operator-(Distance n) const { - return self(current + n); - } - self& operator-=(Distance n) { - current += n; - return *this; - } - Reference operator[](Distance n) { return *(*this + n); } -}; - -template <class RandomAccessIterator, class T, class Reference, class Distance> -inline bool operator==(const reverse_iterator<RandomAccessIterator, T, - Reference, Distance>& x, - const reverse_iterator<RandomAccessIterator, T, - Reference, Distance>& y) { - return x.current == y.current; -} - -template <class RandomAccessIterator, class T, class Reference, class Distance> -inline bool operator<(const reverse_iterator<RandomAccessIterator, T, - Reference, Distance>& x, - const reverse_iterator<RandomAccessIterator, T, - Reference, Distance>& y) { - return y.current < x.current; -} - -template <class RandomAccessIterator, class T, class Reference, class Distance> -inline Distance operator-(const reverse_iterator<RandomAccessIterator, T, - Reference, Distance>& x, - const reverse_iterator<RandomAccessIterator, T, - Reference, Distance>& y) { - return y.current - x.current; -} - -template <class RandomAccessIterator, class T, class Reference, class Distance> -inline reverse_iterator<RandomAccessIterator, T, Reference, Distance> -operator+(Distance n, - const reverse_iterator<RandomAccessIterator, T, Reference, - Distance>& x) { - return reverse_iterator<RandomAccessIterator, T, Reference, Distance> - (x.current - n); -} - - -template <class OutputIterator, class T> -class raw_storage_iterator : public output_iterator { -protected: - OutputIterator iter; -public: - raw_storage_iterator(OutputIterator x) : iter(x) {} - raw_storage_iterator<OutputIterator, T>& operator*() { return *this; } - raw_storage_iterator<OutputIterator, T>& operator=(const T& element) { - construct(iter, element); - return *this; - } - raw_storage_iterator<OutputIterator, T>& operator++() { - ++iter; - return *this; - } - raw_storage_iterator<OutputIterator, T> operator++(int) { - raw_storage_iterator<OutputIterator, T> tmp = *this; - ++iter; - return tmp; - } -}; - - -template <class T, class Distance = ptrdiff_t> -class istream_iterator : public input_iterator<T, Distance> { -friend bool operator==(const istream_iterator<T, Distance>& x, - const istream_iterator<T, Distance>& y); -protected: - istream* stream; - T value; - bool end_marker; - void read() { - end_marker = (*stream) ? true : false; - if (end_marker) *stream >> value; - end_marker = (*stream) ? true : false; - } -public: - istream_iterator() : stream(&cin), end_marker(false) {} - istream_iterator(istream& s) : stream(&s) { read(); } - const T& operator*() const { return value; } - istream_iterator<T, Distance>& operator++() { - read(); - return *this; - } - istream_iterator<T, Distance> operator++(int) { - istream_iterator<T, Distance> tmp = *this; - read(); - return tmp; - } -}; - -template <class T, class Distance> -bool operator==(const istream_iterator<T, Distance>& x, - const istream_iterator<T, Distance>& y) { - return x.stream == y.stream && x.end_marker == y.end_marker || - x.end_marker == false && y.end_marker == false; -} - -template <class T> -class ostream_iterator : public output_iterator { -protected: - ostream* stream; - char* string; -public: - ostream_iterator(ostream& s) : stream(&s), string(0) {} - ostream_iterator(ostream& s, char* c) : stream(&s), string(c) {} - ostream_iterator<T>& operator=(const T& value) { - *stream << value; - if (string) *stream << string; - return *this; - } - ostream_iterator<T>& operator*() { return *this; } - ostream_iterator<T>& operator++() { return *this; } - ostream_iterator<T>& operator++(int) { return *this; } -}; - -#endif diff --git a/contrib/libg++/libstdc++/stl/lbvector.h b/contrib/libg++/libstdc++/stl/lbvector.h deleted file mode 100644 index 763666c3d39b..000000000000 --- a/contrib/libg++/libstdc++/stl/lbvector.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LBVECTOR_H -#define LBVECTOR_H - -#ifdef BVECTOR_H -#undef BVECTOR_H -#define __BVECTOR_WAS_DEFINED -#endif - -#define Allocator long_allocator -#define bit_vector long_bit_vector -#include <lngalloc.h> -#include <bvector.h> - -#undef BVECTOR_H - -#ifdef __BVECTOR_WAS_DEFINED -#define BVECTOR_H -#undef __BVECTOR_WAS_DEFINED -#endif - -#undef Allocator -#undef bit_vector - -#endif diff --git a/contrib/libg++/libstdc++/stl/ldeque.h b/contrib/libg++/libstdc++/stl/ldeque.h deleted file mode 100644 index 4c8761c9f8be..000000000000 --- a/contrib/libg++/libstdc++/stl/ldeque.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LDEQUE_H -#define LDEQUE_H - -#ifdef DEQUE_H -#undef DEQUE_H -#define __DEQUE_WAS_DEFINED -#endif - -#define Allocator long_allocator -#define deque long_deque -#include <lngalloc.h> -#include <deque.h> - -#undef DEQUE_H - -#ifdef __DEQUE_WAS_DEFINED -#define DEQUE_H -#undef __DEQUE_WAS_DEFINED -#endif - -#undef Allocator -#undef deque - -#endif diff --git a/contrib/libg++/libstdc++/stl/list.h b/contrib/libg++/libstdc++/stl/list.h deleted file mode 100644 index 42b5d0f5f673..000000000000 --- a/contrib/libg++/libstdc++/stl/list.h +++ /dev/null @@ -1,531 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LIST_H -#define LIST_H - -#include <function.h> -#include <algobase.h> -#include <iterator.h> -#ifndef __GNUG__ -#include <bool.h> -#endif - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#ifndef list -#define list list -#endif - -template <class T> -class list { -protected: - typedef Allocator<void>::pointer void_pointer; - struct list_node; - friend list_node; - struct list_node { - void_pointer next; - void_pointer prev; - T data; - }; -#ifndef __GNUG__ - static Allocator<list_node> list_node_allocator; - static Allocator<T> value_allocator; -#endif -public: - typedef T value_type; - typedef Allocator<T> value_allocator_type; - typedef Allocator<T>::pointer pointer; - typedef Allocator<T>::reference reference; - typedef Allocator<T>::const_reference const_reference; - typedef Allocator<list_node> list_node_allocator_type; - typedef Allocator<list_node>::pointer link_type; - typedef Allocator<list_node>::size_type size_type; - typedef Allocator<list_node>::difference_type difference_type; -protected: -#ifdef __GNUG__ - link_type get_node() { return (link_type)(::operator new(sizeof(list_node))); } - void put_node(link_type p) { ::operator delete(p); } -#else - size_type buffer_size() { - return list_node_allocator.init_page_size(); - } - struct list_node_buffer; - friend list_node_buffer; - struct list_node_buffer { - void_pointer next_buffer; - link_type buffer; - }; -public: - typedef Allocator<list_node_buffer> buffer_allocator_type; - typedef Allocator<list_node_buffer>::pointer buffer_pointer; -protected: - static Allocator<list_node_buffer> buffer_allocator; - static buffer_pointer buffer_list; - static link_type free_list; - static link_type next_avail; - static link_type last; - void add_new_buffer() { - buffer_pointer tmp = buffer_allocator.allocate((size_type)1); - tmp->buffer = list_node_allocator.allocate(buffer_size()); - tmp->next_buffer = buffer_list; - buffer_list = tmp; - next_avail = buffer_list->buffer; - last = next_avail + buffer_size(); - } - static size_type number_of_lists; - void deallocate_buffers(); - link_type get_node() { - link_type tmp = free_list; - return free_list ? (free_list = (link_type)(free_list->next), tmp) - : (next_avail == last ? (add_new_buffer(), next_avail++) - : next_avail++); - // ugly code for inlining - avoids multiple returns - } - void put_node(link_type p) { - p->next = free_list; - free_list = p; - } -#endif - - link_type node; - size_type length; -public: - class iterator; - class const_iterator; - class iterator : public bidirectional_iterator<T, difference_type> { - friend class list<T>; - friend class const_iterator; -// friend bool operator==(const iterator& x, const iterator& y); - protected: - link_type node; - iterator(link_type x) : node(x) {} - public: - iterator() {} - bool operator==(const iterator& x) const { return node == x.node; } - reference operator*() const { return (*node).data; } - iterator& operator++() { - node = (link_type)((*node).next); - return *this; - } - iterator operator++(int) { - iterator tmp = *this; - ++*this; - return tmp; - } - iterator& operator--() { - node = (link_type)((*node).prev); - return *this; - } - iterator operator--(int) { - iterator tmp = *this; - --*this; - return tmp; - } - }; - class const_iterator : public bidirectional_iterator<T, difference_type> { - friend class list<T>; - protected: - link_type node; - const_iterator(link_type x) : node(x) {} - public: - const_iterator() {} - const_iterator(const iterator& x) : node(x.node) {} - bool operator==(const const_iterator& x) const { return node == x.node; } - const_reference operator*() const { return (*node).data; } - const_iterator& operator++() { - node = (link_type)((*node).next); - return *this; - } - const_iterator operator++(int) { - const_iterator tmp = *this; - ++*this; - return tmp; - } - const_iterator& operator--() { - node = (link_type)((*node).prev); - return *this; - } - const_iterator operator--(int) { - const_iterator tmp = *this; - --*this; - return tmp; - } - }; - typedef reverse_bidirectional_iterator<const_iterator, value_type, - const_reference, difference_type> - const_reverse_iterator; - typedef reverse_bidirectional_iterator<iterator, value_type, reference, - difference_type> - reverse_iterator; - list() : length(0) { -#ifndef __GNUG__ - ++number_of_lists; -#endif - node = get_node(); - (*node).next = node; - (*node).prev = node; - } - iterator begin() { return (link_type)((*node).next); } - const_iterator begin() const { return (link_type)((*node).next); } - iterator end() { return node; } - const_iterator end() const { return node; } - 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()); - } - bool empty() const { return length == 0; } - size_type size() const { return length; } -#ifndef __GNUG__ - size_type max_size() const { return list_node_allocator.max_size(); } -#endif - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(--end()); } - const_reference back() const { return *(--end()); } - void swap(list<T>& x) { - ::swap(node, x.node); - ::swap(length, x.length); - } - iterator insert(iterator position, const T& x) { - link_type tmp = get_node(); -#ifdef __GNUG__ - construct(&(*tmp).data, x); -#else - construct(value_allocator.address((*tmp).data), x); -#endif - (*tmp).next = position.node; - (*tmp).prev = (*position.node).prev; - (*(link_type((*position.node).prev))).next = tmp; - (*position.node).prev = tmp; - ++length; - return tmp; - } -#ifdef __GNUG__ - void insert(iterator position, const T* first, const T* last) { - while (first != last) insert(position, *first++); - } - void insert(iterator position, const_iterator first, - const_iterator last) { - while (first != last) insert(position, *first++); - } - void insert(iterator position, size_type n, const T& x) { - while (n--) insert(position, x); - } -#else - void insert(iterator position, const T* first, const T* last); - void insert(iterator position, const_iterator first, - const_iterator last); - void insert(iterator position, size_type n, const T& x); -#endif - void push_front(const T& x) { insert(begin(), x); } - void push_back(const T& x) { insert(end(), x); } - void erase(iterator position) { - (*(link_type((*position.node).prev))).next = (*position.node).next; - (*(link_type((*position.node).next))).prev = (*position.node).prev; -#ifdef __GNUG__ - destroy(&(*position.node).data); -#else - destroy(value_allocator.address((*position.node).data)); -#endif - put_node(position.node); - --length; - } -#ifdef __GNUG__ - void erase(iterator first, iterator last) { - while (first != last) erase(first++); - } -#else - void erase(iterator first, iterator last); -#endif - void pop_front() { erase(begin()); } - void pop_back() { - iterator tmp = end(); - erase(--tmp); - } - list(size_type n, const T& value = T()) : length(0) { -#ifndef __GNUG__ - ++number_of_lists; -#endif - node = get_node(); - (*node).next = node; - (*node).prev = node; - insert(begin(), n, value); - } - list(const T* first, const T* last) : length(0) { -#ifndef __GNUG__ - ++number_of_lists; -#endif - node = get_node(); - (*node).next = node; - (*node).prev = node; - insert(begin(), first, last); - } - list(const list<T>& x) : length(0) { -#ifndef __GNUG__ - ++number_of_lists; -#endif - node = get_node(); - (*node).next = node; - (*node).prev = node; - insert(begin(), x.begin(), x.end()); - } - ~list() { - erase(begin(), end()); - put_node(node); -#ifndef __GNUG__ - if (--number_of_lists == 0) deallocate_buffers(); -#endif - } - list<T>& operator=(const list<T>& x); -protected: - void transfer(iterator position, iterator first, iterator last) { - (*(link_type((*last.node).prev))).next = position.node; - (*(link_type((*first.node).prev))).next = last.node; - (*(link_type((*position.node).prev))).next = first.node; - link_type tmp = link_type((*position.node).prev); - (*position.node).prev = (*last.node).prev; - (*last.node).prev = (*first.node).prev; - (*first.node).prev = tmp; - } -public: - void splice(iterator position, list<T>& x) { - if (!x.empty()) { - transfer(position, x.begin(), x.end()); - length += x.length; - x.length = 0; - } - } - void splice(iterator position, list<T>& x, iterator i) { - iterator j = i; - if (position == i || position == ++j) return; - transfer(position, i, j); - ++length; - --x.length; - } - void splice(iterator position, list<T>& x, iterator first, iterator last) { - if (first != last) { - if (&x != this) { - difference_type n = 0; - distance(first, last, n); - x.length -= n; - length += n; - } - transfer(position, first, last); - } - } - void remove(const T& value); - void unique(); - void merge(list<T>& x); - void reverse(); - void sort(); -#ifdef __GNUG__ - friend difference_type* distance_type(const iterator&) { - return (difference_type*)(0); - } - friend T* value_type(const iterator&) { - return (T*)(0); - } - friend bidirectional_iterator_tag iterator_category(iterator) { - return bidirectional_iterator_tag(); - } -#endif -}; - -#ifndef __GNUG__ -template <class T> -list<T>::buffer_pointer list<T>::buffer_list = 0; - -template <class T> -list<T>::link_type list<T>::free_list = 0; - -template <class T> -list<T>::link_type list<T>::next_avail = 0; - -template <class T> -list<T>::link_type list<T>::last = 0; - -template <class T> -list<T>::size_type list<T>::number_of_lists = 0; - -template <class T> -list<T>::list_node_allocator_type list<T>::list_node_allocator; - -template <class T> -list<T>::value_allocator_type list<T>::value_allocator; - -template <class T> -list<T>::buffer_allocator_type list<T>::buffer_allocator; -#endif - -/* - * currently the following does not work - made into a member function - -template <class T> -inline bool operator==(const list<T>::iterator& x, const list<T>::iterator& y) { - return x.node == y.node; -} -*/ - -template <class T> -inline bool operator==(const list<T>& x, const list<T>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class T> -inline bool operator<(const list<T>& x, const list<T>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -#ifndef __GNUG__ -template <class T> -void list<T>::deallocate_buffers() { - while (buffer_list) { - buffer_pointer tmp = buffer_list; - buffer_list = (buffer_pointer)(buffer_list->next_buffer); - list_node_allocator.deallocate(tmp->buffer); - buffer_allocator.deallocate(tmp); - } - free_list = 0; - next_avail = 0; - last = 0; -} -#endif - -#ifndef __GNUG__ -template <class T> -void list<T>::insert(iterator position, const T* first, const T* last) { - while (first != last) insert(position, *first++); -} - -template <class T> -void list<T>::insert(iterator position, const_iterator first, - const_iterator last) { - while (first != last) insert(position, *first++); -} - -template <class T> -void list<T>::insert(iterator position, size_type n, const T& x) { - while (n--) insert(position, x); -} - -template <class T> -void list<T>::erase(iterator first, iterator last) { - while (first != last) erase(first++); -} -#endif - -template <class T> -list<T>& list<T>::operator=(const list<T>& x) { - if (this != &x) { - iterator first1 = begin(); - iterator last1 = end(); - const_iterator first2 = x.begin(); - const_iterator last2 = x.end(); - while (first1 != last1 && first2 != last2) *first1++ = *first2++; - if (first2 == last2) - erase(first1, last1); - else - insert(last1, first2, last2); - } - return *this; -} - -template <class T> -void list<T>::remove(const T& value) { - iterator first = begin(); - iterator last = end(); - while (first != last) { - iterator next = first; - ++next; - if (*first == value) erase(first); - first = next; - } -} - -template <class T> -void list<T>::unique() { - iterator first = begin(); - iterator last = end(); - if (first == last) return; - iterator next = first; - while (++next != last) { - if (*first == *next) - erase(next); - else - first = next; - next = first; - } -} - -template <class T> -void list<T>::merge(list<T>& x) { - iterator first1 = begin(); - iterator last1 = end(); - iterator first2 = x.begin(); - iterator last2 = x.end(); - while (first1 != last1 && first2 != last2) - if (*first2 < *first1) { - iterator next = first2; - transfer(first1, first2, ++next); - first2 = next; - } else - ++first1; - if (first2 != last2) transfer(last1, first2, last2); - length += x.length; - x.length= 0; -} - -template <class T> -void list<T>::reverse() { - if (size() < 2) return; - for (iterator first = ++begin(); first != end();) { - iterator old = first++; - transfer(begin(), old, first); - } -} - -template <class T> -void list<T>::sort() { - if (size() < 2) return; - list<T> carry; - list<T> counter[64]; - int fill = 0; - while (!empty()) { - carry.splice(carry.begin(), *this, begin()); - int i = 0; - while(i < fill && !counter[i].empty()) { - counter[i].merge(carry); - carry.swap(counter[i++]); - } - carry.swap(counter[i]); - if (i == fill) ++fill; - } - - for (int i = 1; i < fill; ++i) counter[i].merge(counter[i-1]); - swap(counter[fill-1]); -} - -#undef Allocator -#undef list - -#endif diff --git a/contrib/libg++/libstdc++/stl/llist.h b/contrib/libg++/libstdc++/stl/llist.h deleted file mode 100644 index 07ee6113a096..000000000000 --- a/contrib/libg++/libstdc++/stl/llist.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LLIST_H -#define LLIST_H - -#ifdef LIST_H -#undef LIST_H -#define __LIST_WAS_DEFINED -#endif - -#define Allocator long_allocator -#define list long_list -#include <lngalloc.h> -#include <list.h> - -#undef LIST_H - -#ifdef __LIST_WAS_DEFINED -#define LIST_H -#undef __LIST_WAS_DEFINED -#endif - -#undef Allocator -#undef list - -#endif diff --git a/contrib/libg++/libstdc++/stl/lmap.h b/contrib/libg++/libstdc++/stl/lmap.h deleted file mode 100644 index da1eeba6c8cc..000000000000 --- a/contrib/libg++/libstdc++/stl/lmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LMAP_H -#define LMAP_H - -#ifdef MAP_H -#undef MAP_H -#undef TREE_H -#define __MAP_WAS_DEFINED -#endif - -#define Allocator long_allocator -#define map long_map -#define rb_tree long_rb_tree -#include <lngalloc.h> -#include <map.h> - -#undef MAP_H -#undef TREE_H - -#ifdef __MAP_WAS_DEFINED -#define MAP_H -#define TREE_H -#undef __MAP_WAS_DEFINED -#endif - -#undef Allocator -#undef map -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/lmultmap.h b/contrib/libg++/libstdc++/stl/lmultmap.h deleted file mode 100644 index 1a87e3372d8d..000000000000 --- a/contrib/libg++/libstdc++/stl/lmultmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LMULTIMAP_H -#define LMULTIMAP_H - -#ifdef MULTIMAP_H -#undef MULTIMAP_H -#undef TREE_H -#define __MULTIMAP_WAS_DEFINED -#endif - -#define Allocator long_allocator -#define multimap long_multimap -#define rb_tree long_rb_tree -#include <lngalloc.h> -#include <multimap.h> - -#undef MULTIMAP_H -#undef TREE_H - -#ifdef __MULTIMAP_WAS_DEFINED -#define MULTIMAP_H -#define TREE_H -#undef __MULTIMAP_WAS_DEFINED -#endif - -#undef Allocator -#undef multimap -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/lmultset.h b/contrib/libg++/libstdc++/stl/lmultset.h deleted file mode 100644 index bb1571f6c906..000000000000 --- a/contrib/libg++/libstdc++/stl/lmultset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LMULTISET_H -#define LMULTISET_H - -#ifdef MULTISET_H -#undef MULTISET_H -#undef TREE_H -#define __MULTISET_WAS_DEFINED -#endif - -#define Allocator long_allocator -#define multiset long_multiset -#define rb_tree long_rb_tree -#include <lngalloc.h> -#include <multiset.h> - -#undef MULTISET_H -#undef TREE_H - -#ifdef __MULTISET_WAS_DEFINED -#define MULTISET_H -#define TREE_H -#undef __MULTISET_WAS_DEFINED -#endif - -#undef Allocator -#undef multiset -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/lngalloc.h b/contrib/libg++/libstdc++/stl/lngalloc.h deleted file mode 100644 index 6685ea54511c..000000000000 --- a/contrib/libg++/libstdc++/stl/lngalloc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LNGALLOC_H -#define LNGALLOC_H - -#include <limits.h> -#include <algobase.h> -#include <defalloc.h> - -template <class T> -class long_allocator { -public: - typedef T value_type; - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef unsigned long size_type; - typedef long difference_type; - pointer allocate(size_type n) { - return ::allocate((difference_type)n, (pointer)0); - } - void deallocate(pointer p) { ::deallocate(p); } - pointer address(reference x) { return (pointer)&x; } - const_pointer const_address(const_reference x) { - return (const_pointer)&x; - } - size_type init_page_size() { - return max(size_type(1), size_type(4096/sizeof(T))); - } - size_type max_size() const { - return max(size_type(1), size_type(ULONG_MAX/sizeof(T))); - } -}; - -class long_allocator<void> { -public: - typedef void* pointer; -}; - -#endif diff --git a/contrib/libg++/libstdc++/stl/lset.h b/contrib/libg++/libstdc++/stl/lset.h deleted file mode 100644 index e4d52f7c39e1..000000000000 --- a/contrib/libg++/libstdc++/stl/lset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef LSET_H -#define LSET_H - -#ifdef SET_H -#undef SET_H -#undef TREE_H -#define __SET_WAS_DEFINED -#endif - -#define Allocator long_allocator -#define set long_set -#define rb_tree long_rb_tree -#include <lngalloc.h> -#include <set.h> - -#undef SET_H -#undef TREE_H - -#ifdef __SET_WAS_DEFINED -#define SET_H -#define TREE_H -#undef __SET_WAS_DEFINED -#endif - -#undef Allocator -#undef set -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/map.h b/contrib/libg++/libstdc++/stl/map.h deleted file mode 100644 index 5c1c30d49e67..000000000000 --- a/contrib/libg++/libstdc++/stl/map.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef MAP_H -#define MAP_H - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#include <tree.h> - -template <class Key, class T, class Compare> -class map { -public: - -// typedefs: - - typedef Key key_type; - typedef pair<const Key, T> value_type; - typedef Compare key_compare; - - class value_compare - : public binary_function<value_type, value_type, bool> { - friend class map<Key, T, Compare>; - protected : - Compare comp; - value_compare(Compare c) : comp(c) {} - public: - bool operator()(const value_type& x, const value_type& y) const { - return comp(x.first, y.first); - } - }; - -private: - typedef rb_tree<key_type, value_type, - select1st<value_type, key_type>, key_compare> rep_type; - rep_type t; // red-black tree representing map -public: - typedef rep_type::pointer pointer; - typedef rep_type::reference reference; - typedef rep_type::const_reference const_reference; - typedef rep_type::iterator iterator; - typedef rep_type::const_iterator const_iterator; - typedef rep_type::reverse_iterator reverse_iterator; - typedef rep_type::const_reverse_iterator const_reverse_iterator; - typedef rep_type::size_type size_type; - typedef rep_type::difference_type difference_type; - -// allocation/deallocation - - map(const Compare& comp = Compare()) : t(comp, false) {} - map(const value_type* first, const value_type* last, - const Compare& comp = Compare()) : t(first, last, comp, false) {} - map(const map<Key, T, Compare>& x) : t(x.t, false) {} - map<Key, T, Compare>& operator=(const map<Key, T, Compare>& x) { - t = x.t; - return *this; - } - -// accessors: - - key_compare key_comp() const { return t.key_comp(); } - value_compare value_comp() const { return value_compare(t.key_comp()); } - iterator begin() { return t.begin(); } - const_iterator begin() const { return t.begin(); } - iterator end() { return t.end(); } - const_iterator end() const { return t.end(); } - reverse_iterator rbegin() { return t.rbegin(); } - const_reverse_iterator rbegin() const { return t.rbegin(); } - reverse_iterator rend() { return t.rend(); } - const_reverse_iterator rend() const { return t.rend(); } - bool empty() const { return t.empty(); } - size_type size() const { return t.size(); } -#ifndef __GNUG__ - size_type max_size() const { return t.max_size(); } -#endif - Allocator<T>::reference operator[](const key_type& k) { - return (*((insert(value_type(k, T()))).first)).second; - } - void swap(map<Key, T, Compare>& x) { t.swap(x.t); } - -// insert/erase - - typedef pair<iterator, bool> pair_iterator_bool; - // typedef done to get around compiler bug - pair_iterator_bool insert(const value_type& x) { return t.insert(x); } - iterator insert(iterator position, const value_type& x) { - return t.insert(position, x); - } - void insert(const value_type* first, const value_type* last) { - t.insert(first, last); - } - void erase(iterator position) { t.erase(position); } - size_type erase(const key_type& x) { return t.erase(x); } - void erase(iterator first, iterator last) { t.erase(first, last); } - -// map operations: - - iterator find(const key_type& x) { return t.find(x); } - const_iterator find(const key_type& x) const { return t.find(x); } - size_type count(const key_type& x) const { return t.count(x); } - iterator lower_bound(const key_type& x) {return t.lower_bound(x); } - const_iterator lower_bound(const key_type& x) const { - return t.lower_bound(x); - } - iterator upper_bound(const key_type& x) {return t.upper_bound(x); } - const_iterator upper_bound(const key_type& x) const { - return t.upper_bound(x); - } - typedef pair<iterator, iterator> pair_iterator_iterator; - // typedef done to get around compiler bug - pair_iterator_iterator equal_range(const key_type& x) { - return t.equal_range(x); - } - typedef pair<const_iterator, const_iterator> pair_citerator_citerator; - // typedef done to get around compiler bug - pair_citerator_citerator equal_range(const key_type& x) const { - return t.equal_range(x); - } -}; - -template <class Key, class T, class Compare> -inline bool operator==(const map<Key, T, Compare>& x, - const map<Key, T, Compare>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class Key, class T, class Compare> -inline bool operator<(const map<Key, T, Compare>& x, - const map<Key, T, Compare>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -#undef Allocator - -#endif diff --git a/contrib/libg++/libstdc++/stl/multimap.h b/contrib/libg++/libstdc++/stl/multimap.h deleted file mode 100644 index 2478e2419fa6..000000000000 --- a/contrib/libg++/libstdc++/stl/multimap.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef MULTIMAP_H -#define MULTIMAP_H - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#include <tree.h> - -template <class Key, class T, class Compare> -class multimap { -public: - -// typedefs: - - typedef Key key_type; - typedef pair<const Key, T> value_type; - typedef Compare key_compare; - - class value_compare - : public binary_function<value_type, value_type, bool> { - friend class multimap<Key, T, Compare>; - protected: - Compare comp; - value_compare(Compare c) : comp(c) {} - public: - bool operator()(const value_type& x, const value_type& y) const { - return comp(x.first, y.first); - } - }; - -private: - typedef rb_tree<key_type, value_type, - select1st<value_type, key_type>, key_compare> rep_type; - rep_type t; // red-black tree representing multimap -public: - typedef rep_type::reference reference; - typedef rep_type::const_reference const_reference; - typedef rep_type::iterator iterator; - typedef rep_type::const_iterator const_iterator; - typedef rep_type::reverse_iterator reverse_iterator; - typedef rep_type::const_reverse_iterator const_reverse_iterator; - typedef rep_type::size_type size_type; - typedef rep_type::difference_type difference_type; - -// allocation/deallocation - - multimap(const Compare& comp = Compare()) : t(comp, true) { } - multimap(const value_type* first, const value_type* last, - const Compare& comp = Compare()) : t(first, last, comp, true) { } - multimap(const multimap<Key, T, Compare>& x) : t(x.t, true) { } - multimap<Key, T, Compare>& operator=(const multimap<Key, T, Compare>& x) { - t = x.t; - return *this; - } - -// accessors: - - key_compare key_comp() const { return t.key_comp(); } - value_compare value_comp() const { return value_compare(t.key_comp()); } - iterator begin() { return t.begin(); } - const_iterator begin() const { return t.begin(); } - iterator end() { return t.end(); } - const_iterator end() const { return t.end(); } - reverse_iterator rbegin() { return t.rbegin(); } - const_reverse_iterator rbegin() const { return t.rbegin(); } - reverse_iterator rend() { return t.rend(); } - const_reverse_iterator rend() const { return t.rend(); } - bool empty() const { return t.empty(); } - size_type size() const { return t.size(); } - size_type max_size() const { return t.max_size(); } - void swap(multimap<Key, T, Compare>& x) { t.swap(x.t); } - -// insert/erase - - iterator insert(const value_type& x) { return t.insert(x).first; } - iterator insert(iterator position, const value_type& x) { - return t.insert(position, x); - } - void insert(const value_type* first, const value_type* last) { - t.insert(first, last); - } - void erase(iterator position) { t.erase(position); } - size_type erase(const key_type& x) { return t.erase(x); } - void erase(iterator first, iterator last) { t.erase(first, last); } - -// multimap operations: - - iterator find(const key_type& x) { return t.find(x); } - const_iterator find(const key_type& x) const { return t.find(x); } - size_type count(const key_type& x) const { return t.count(x); } - iterator lower_bound(const key_type& x) {return t.lower_bound(x); } - const_iterator lower_bound(const key_type& x) const { - return t.lower_bound(x); - } - iterator upper_bound(const key_type& x) {return t.upper_bound(x); } - const_iterator upper_bound(const key_type& x) const { - return t.upper_bound(x); - } - typedef pair<iterator, iterator> pair_iterator_iterator; - // typedef done to get around compiler bug - pair_iterator_iterator equal_range(const key_type& x) { - return t.equal_range(x); - } - typedef pair<const_iterator, const_iterator> pair_citerator_citerator; - // typedef done to get around compiler bug - pair_citerator_citerator equal_range(const key_type& x) const { - return t.equal_range(x); - } -}; - -template <class Key, class T, class Compare> -inline bool operator==(const multimap<Key, T, Compare>& x, - const multimap<Key, T, Compare>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class Key, class T, class Compare> -inline bool operator<(const multimap<Key, T, Compare>& x, - const multimap<Key, T, Compare>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -#undef Allocator - -#endif diff --git a/contrib/libg++/libstdc++/stl/multiset.h b/contrib/libg++/libstdc++/stl/multiset.h deleted file mode 100644 index 1ee6d93e352d..000000000000 --- a/contrib/libg++/libstdc++/stl/multiset.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef MULTISET_H -#define MULTISET_H - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#include <tree.h> - -template <class Key, class Compare> -class multiset { -public: -// typedefs: - - typedef Key key_type; - typedef Key value_type; - typedef Compare key_compare; - typedef Compare value_compare; -private: - typedef rb_tree<key_type, value_type, - ident<value_type, key_type>, key_compare> rep_type; - rep_type t; // red-black tree representing multiset -public: - typedef rep_type::const_reference reference; - typedef rep_type::const_reference const_reference; - typedef rep_type::const_iterator iterator; - typedef rep_type::const_iterator const_iterator; - typedef rep_type::const_reverse_iterator reverse_iterator; - typedef rep_type::const_reverse_iterator const_reverse_iterator; - typedef rep_type::size_type size_type; - typedef rep_type::difference_type difference_type; - -// allocation/deallocation - - multiset(const Compare& comp = Compare()) : t(comp, true) {} - multiset(const value_type* first, const value_type* last, - const Compare& comp = Compare()) : t(comp, true) { - for (const value_type* i = first; i != last; ++i) - t.insert(*i); - } - multiset(const multiset<Key, Compare>& x) : t(x.t, true) {} - multiset<Key, Compare>& operator=(const multiset<Key, Compare>& x) { - t = x.t; - return *this; - } - -// accessors: - - key_compare key_comp() const { return t.key_comp(); } - value_compare value_comp() const { return t.key_comp(); } - iterator begin() const { return t.begin(); } - iterator end() const { return t.end(); } - reverse_iterator rbegin() const { return t.rbegin(); } - reverse_iterator rend() const { return t.rend(); } - bool empty() const { return t.empty(); } - size_type size() const { return t.size(); } - size_type max_size() const { return t.max_size(); } - void swap(multiset<Key, Compare>& x) { t.swap(x.t); } - -// insert/erase - iterator insert(const value_type& x) { - return t.insert(x).first; - } - iterator insert(iterator position, const value_type& x) { - return t.insert((rep_type::iterator&)position, x); - } - void insert(const value_type* first, const value_type* last) { - for (const value_type* i = first; i != last; ++i) - t.insert(*i); - } - void erase(iterator position) { - t.erase((rep_type::iterator&)position); - } - size_type erase(const key_type& x) { - return t.erase(x); - } - void erase(iterator first, iterator last) { - t.erase((rep_type::iterator&)first, - (rep_type::iterator&)last); - } - -// multiset operations: - - iterator find(const key_type& x) const { return t.find(x); } - size_type count(const key_type& x) const { return t.count(x); } - iterator lower_bound(const key_type& x) const { - return t.lower_bound(x); - } - iterator upper_bound(const key_type& x) const { - return t.upper_bound(x); - } - typedef pair<iterator, iterator> pair_iterator_iterator; - // typedef done to get around compiler bug - pair_iterator_iterator equal_range(const key_type& x) const { - return t.equal_range(x); - } -}; - -template <class Key, class Compare> -inline bool operator==(const multiset<Key, Compare>& x, - const multiset<Key, Compare>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class Key, class Compare> -inline bool operator<(const multiset<Key, Compare>& x, - const multiset<Key, Compare>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -#undef Allocator - -#endif diff --git a/contrib/libg++/libstdc++/stl/neralloc.h b/contrib/libg++/libstdc++/stl/neralloc.h deleted file mode 100644 index c66e9b366a02..000000000000 --- a/contrib/libg++/libstdc++/stl/neralloc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef NEARALLOC_H -#define NEARALLOC_H - -#ifdef FARALLOC_H -#undef FARALLOC_H -#define __FARALLOC_WAS_DEFINED -#endif - -#define __far __near -#define far_allocator near_allocator -#include <faralloc.h> -#undef __far -#undef far_allocator - -#undef FARALLOC_H - -#ifdef __FARALLOC_WAS_DEFINED -#define FARALLOC_H -#undef __FARALLOC_WAS_DEFINED -#endif - -#endif - diff --git a/contrib/libg++/libstdc++/stl/nmap.h b/contrib/libg++/libstdc++/stl/nmap.h deleted file mode 100644 index 99754c781692..000000000000 --- a/contrib/libg++/libstdc++/stl/nmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef NMAP_H -#define NMAP_H - -#ifdef MAP_H -#undef MAP_H -#undef TREE_H -#define __MAP_WAS_DEFINED -#endif - -#define Allocator near_allocator -#define map near_map -#define rb_tree near_rb_tree -#include <neralloc.h> -#include <map.h> - -#undef MAP_H -#undef TREE_H - -#ifdef __MAP_WAS_DEFINED -#define MAP_H -#define TREE_H -#undef __MAP_WAS_DEFINED -#endif - -#undef Allocator -#undef map -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/nmultmap.h b/contrib/libg++/libstdc++/stl/nmultmap.h deleted file mode 100644 index a6ad67c4fbb2..000000000000 --- a/contrib/libg++/libstdc++/stl/nmultmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef NMULTIMAP_H -#define NMULTIMAP_H - -#ifdef MULTIMAP_H -#undef MULTIMAP_H -#undef TREE_H -#define __MULTIMAP_WAS_DEFINED -#endif - -#define Allocator near_allocator -#define multimap near_multimap -#define rb_tree near_rb_tree -#include <neralloc.h> -#include <multimap.h> - -#undef MULTIMAP_H -#undef TREE_H - -#ifdef __MULTIMAP_WAS_DEFINED -#define MULTIMAP_H -#define TREE_H -#undef __MULTIMAP_WAS_DEFINED -#endif - -#undef Allocator -#undef multimap -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/nmultset.h b/contrib/libg++/libstdc++/stl/nmultset.h deleted file mode 100644 index 3a0ad30db0d6..000000000000 --- a/contrib/libg++/libstdc++/stl/nmultset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef NMULTISET_H -#define NMULTISET_H - -#ifdef MULTISET_H -#undef MULTISET_H -#undef TREE_H -#define __MULTISET_WAS_DEFINED -#endif - -#define Allocator near_allocator -#define multiset near_multiset -#define rb_tree near_rb_tree -#include <neralloc.h> -#include <multiset.h> - -#undef MULTISET_H -#undef TREE_H - -#ifdef __MULTISET_WAS_DEFINED -#define MULTISET_H -#define TREE_H -#undef __MULTISET_WAS_DEFINED -#endif - -#undef Allocator -#undef multiset -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/nset.h b/contrib/libg++/libstdc++/stl/nset.h deleted file mode 100644 index 325d6b94aacf..000000000000 --- a/contrib/libg++/libstdc++/stl/nset.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef NSET_H -#define NSET_H - -#ifdef SET_H -#undef SET_H -#undef TREE_H -#define __SET_WAS_DEFINED -#endif - -#define Allocator near_allocator -#define set near_set -#define rb_tree near_rb_tree -#include <neralloc.h> -#include <set.h> - -#undef SET_H -#undef TREE_H - -#ifdef __SET_WAS_DEFINED -#define SET_H -#define TREE_H -#undef __SET_WAS_DEFINED -#endif - -#undef Allocator -#undef set -#undef rb_tree - -#endif diff --git a/contrib/libg++/libstdc++/stl/pair.h b/contrib/libg++/libstdc++/stl/pair.h deleted file mode 100644 index 817d9a439695..000000000000 --- a/contrib/libg++/libstdc++/stl/pair.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef PAIR_H -#define PAIR_H - -#ifndef __GNUG__ -#include <bool.h> -#endif - -template <class T1, class T2> -struct pair { - T1 first; - T2 second; - pair() {} - pair(const T1& a, const T2& b) : first(a), second(b) {} -}; - -template <class T1, class T2> -inline bool operator==(const pair<T1, T2>& x, const pair<T1, T2>& y) { - return x.first == y.first && x.second == y.second; -} - -template <class T1, class T2> -inline bool operator<(const pair<T1, T2>& x, const pair<T1, T2>& y) { - return x.first < y.first || (!(y.first < x.first) && x.second < y.second); -} - -template <class T1, class T2> -inline pair<T1, T2> make_pair(const T1& x, const T2& y) { - return pair<T1, T2>(x, y); -} - -#endif diff --git a/contrib/libg++/libstdc++/stl/projectn.h b/contrib/libg++/libstdc++/stl/projectn.h deleted file mode 100644 index 766796e9f218..000000000000 --- a/contrib/libg++/libstdc++/stl/projectn.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef PROJECTN_H -#define PROJECTN_H - -#include <function.h> - -template <class T, class U> -struct select1st : public unary_function<T, U> { - const U& operator()(const T& x) const { return x.first; } -}; - -template <class T, class U> -struct ident : public unary_function<T, U> { - const U& operator()(const T& x) const { return x; } -}; - -#endif - - diff --git a/contrib/libg++/libstdc++/stl/random.cc b/contrib/libg++/libstdc++/stl/random.cc deleted file mode 100644 index e79872ca49b1..000000000000 --- a/contrib/libg++/libstdc++/stl/random.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include <stddef.h> - -#define __SEED 161803398 - -class __random_generator { -protected: - unsigned long table[55]; - size_t index1; - size_t index2; -public: - unsigned long operator()(unsigned long limit) { - index1 = (index1 + 1) % 55; - index2 = (index2 + 1) % 55; - table[index1] = table[index1] - table[index2]; - return table[index1] % limit; - } - void seed(unsigned long j); - __random_generator(unsigned long j) { seed(j); } -}; - -void __random_generator::seed(unsigned long j) { - unsigned long k = 1; - table[54] = j; - for (size_t i = 0; i < 54; i++) { - size_t ii = 21 * i % 55; - table[ii] = k; - k = j - k; - j = table[ii]; - } - for (int loop = 0; loop < 4; loop++) { - for (size_t i = 0; i < 55; i++) - table[i] = table[i] - table[(1 + i + 30) % 55]; - } - index1 = 0; - index2 = 31; -} - -static __random_generator rd(__SEED); - -unsigned long __long_random(unsigned long limit) { - return rd(limit); -} - - - diff --git a/contrib/libg++/libstdc++/stl/set.h b/contrib/libg++/libstdc++/stl/set.h deleted file mode 100644 index d108e42371a0..000000000000 --- a/contrib/libg++/libstdc++/stl/set.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef SET_H -#define SET_H - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#include <tree.h> - -template <class Key, class Compare> -class set { -public: -// typedefs: - - typedef Key key_type; - typedef Key value_type; - typedef Compare key_compare; - typedef Compare value_compare; -private: - typedef rb_tree<key_type, value_type, - ident<value_type, key_type>, key_compare> rep_type; - rep_type t; // red-black tree representing set -public: - typedef rep_type::const_reference reference; - typedef rep_type::const_reference const_reference; - typedef rep_type::const_iterator iterator; - typedef rep_type::const_iterator const_iterator; - typedef rep_type::const_reverse_iterator reverse_iterator; - typedef rep_type::const_reverse_iterator const_reverse_iterator; - typedef rep_type::size_type size_type; - typedef rep_type::difference_type difference_type; - -// allocation/deallocation - - set(const Compare& comp = Compare()) : t(comp, false) {} - set(const value_type* first, const value_type* last, - const Compare& comp = Compare()) : t(comp, false) { - for (const value_type* i = first; i != last; ++i) - t.insert(*i); - } - set(const set<Key, Compare>& x) : t(x.t, false) {} - set<Key, Compare>& operator=(const set<Key, Compare>& x) { - t = x.t; - return *this; - } - -// accessors: - - key_compare key_comp() const { return t.key_comp(); } - value_compare value_comp() const { return t.key_comp(); } - iterator begin() const { return t.begin(); } - iterator end() const { return t.end(); } - reverse_iterator rbegin() const { return t.rbegin(); } - reverse_iterator rend() const { return t.rend(); } - bool empty() const { return t.empty(); } - size_type size() const { return t.size(); } - size_type max_size() const { return t.max_size(); } - void swap(set<Key, Compare>& x) { t.swap(x.t); } - -// insert/erase - typedef pair<iterator, bool> pair_iterator_bool; - // typedef done to get around compiler bug - pair_iterator_bool insert(const value_type& x) { - pair<rep_type::iterator, bool> p = t.insert(x); - return pair<iterator, bool>(p.first, p.second); - } - iterator insert(iterator position, const value_type& x) { - return t.insert((rep_type::iterator&)position, x); - } - void insert(const value_type* first, const value_type* last) { - for (const value_type* i = first; i != last; ++i) - t.insert(*i); - } - void erase(iterator position) { - t.erase((rep_type::iterator&)position); - } - size_type erase(const key_type& x) { - return t.erase(x); - } - void erase(iterator first, iterator last) { - t.erase((rep_type::iterator&)first, - (rep_type::iterator&)last); - } - -// set operations: - - iterator find(const key_type& x) const { return t.find(x); } - size_type count(const key_type& x) const { return t.count(x); } - iterator lower_bound(const key_type& x) const { - return t.lower_bound(x); - } - iterator upper_bound(const key_type& x) const { - return t.upper_bound(x); - } - typedef pair<iterator, iterator> pair_iterator_iterator; - // typedef done to get around compiler bug - pair_iterator_iterator equal_range(const key_type& x) const { - return t.equal_range(x); - } -}; - -template <class Key, class Compare> -inline bool operator==(const set<Key, Compare>& x, - const set<Key, Compare>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class Key, class Compare> -inline bool operator<(const set<Key, Compare>& x, - const set<Key, Compare>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -#undef Allocator - -#endif diff --git a/contrib/libg++/libstdc++/stl/stack.h b/contrib/libg++/libstdc++/stl/stack.h deleted file mode 100644 index 83a59a4c2afc..000000000000 --- a/contrib/libg++/libstdc++/stl/stack.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef STACK_H -#define STACK_H - -#ifndef __GNUG__ -#include <bool.h> -#endif -#include <heap.h> - -template <class Container> -class stack { -friend bool operator==(const stack<Container>& x, const stack<Container>& y); -friend bool operator<(const stack<Container>& x, const stack<Container>& y); -public: - typedef Container::value_type value_type; - typedef Container::size_type size_type; -protected: - Container c; -public: - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - value_type& top() { return c.back(); } - const value_type& top() const { return c.back(); } - void push(const value_type& x) { c.push_back(x); } - void pop() { c.pop_back(); } -}; - -template <class Container> -bool operator==(const stack<Container>& x, const stack<Container>& y) { - return x.c == y.c; -} - -template <class Container> -bool operator<(const stack<Container>& x, const stack<Container>& y) { - return x.c < y.c; -} - -template <class Container> -class queue { -friend bool operator==(const queue<Container>& x, const queue<Container>& y); -friend bool operator<(const queue<Container>& x, const queue<Container>& y); -public: - typedef Container::value_type value_type; - typedef Container::size_type size_type; -protected: - Container c; -public: - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - value_type& front() { return c.front(); } - const value_type& front() const { return c.front(); } - value_type& back() { return c.back(); } - const value_type& back() const { return c.back(); } - void push(const value_type& x) { c.push_back(x); } - void pop() { c.pop_front(); } -}; - -template <class Container> -bool operator==(const queue<Container>& x, const queue<Container>& y) { - return x.c == y.c; -} - -template <class Container> -bool operator<(const queue<Container>& x, const queue<Container>& y) { - return x.c < y.c; -} - -template <class Container, class Compare> -// Compare = less<Container::value_type> > -class priority_queue { -public: - typedef Container::value_type value_type; - typedef Container::size_type size_type; -protected: - Container c; - Compare comp; -public: - priority_queue(const Compare& x = Compare()) : c(), comp(x) {} - priority_queue(const value_type* first, const value_type* last, - const Compare& x = Compare()) : c(first, last), comp(x) { - make_heap(c.begin(), c.end(), comp); - } -/* - template <class InputIterator> - priority_queue(InputIterator first, InputIterator last, - const Compare& x = Compare()) : c(first, last), comp(x) { - make_heap(c.begin(), c.end(), comp); - } -*/ - bool empty() const { return c.empty(); } - size_type size() const { return c.size(); } - value_type& top() { return c.front(); } - const value_type& top() const { return c.front(); } - void push(const value_type& x) { - c.push_back(x); - push_heap(c.begin(), c.end(), comp); - } - void pop() { - pop_heap(c.begin(), c.end(), comp); - c.pop_back(); - } -}; - -// no equality is provided - -#endif diff --git a/contrib/libg++/libstdc++/stl/tempbuf.cc b/contrib/libg++/libstdc++/stl/tempbuf.cc deleted file mode 100644 index 2e7408eadd30..000000000000 --- a/contrib/libg++/libstdc++/stl/tempbuf.cc +++ /dev/null @@ -1,18 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#include <tempbuf.h> - -char __stl_temp_buffer[__stl_buffer_size]; diff --git a/contrib/libg++/libstdc++/stl/tempbuf.h b/contrib/libg++/libstdc++/stl/tempbuf.h deleted file mode 100644 index 238b6acc31bb..000000000000 --- a/contrib/libg++/libstdc++/stl/tempbuf.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef TEMPBUF_H -#define TEMPBUF_H - -#include <limits.h> -#include <pair.h> - -#ifndef __stl_buffer_size -#define __stl_buffer_size 16384 // 16k -#endif - -extern char __stl_temp_buffer[__stl_buffer_size]; - -//not reentrant code - -template <class T> -pair<T*, int> get_temporary_buffer(int len, T*) { - while (len > __stl_buffer_size / sizeof(T)) { - set_new_handler(0); - T* tmp = (T*)(::operator new((unsigned int)len * sizeof(T))); - if (tmp) return pair<T*, int>(tmp, len); - len = len / 2; - } - return pair<T*, int>((T*)__stl_temp_buffer, - (int)(__stl_buffer_size / sizeof(T))); -} - -template <class T> -void return_temporary_buffer(T* p) { - if ((char*)(p) != __stl_temp_buffer) deallocate(p); -} - -template <class T> -pair<T*, long> get_temporary_buffer(long len, T* p) { - if (len > INT_MAX/sizeof(T)) - len = INT_MAX/sizeof(T); - pair<T*, int> tmp = get_temporary_buffer((int)len, p); - return pair<T*, long>(tmp.first, (long)(tmp.second)); -} - -#endif diff --git a/contrib/libg++/libstdc++/stl/tree.cc b/contrib/libg++/libstdc++/stl/tree.cc deleted file mode 100644 index e4a9cfe10fa7..000000000000 --- a/contrib/libg++/libstdc++/stl/tree.cc +++ /dev/null @@ -1,3 +0,0 @@ -#include "tree.h" - -__rb_tree_node_base __rb_NIL = { black, 0, 0, 0 }; diff --git a/contrib/libg++/libstdc++/stl/tree.h b/contrib/libg++/libstdc++/stl/tree.h deleted file mode 100644 index 3ae5da02b08c..000000000000 --- a/contrib/libg++/libstdc++/stl/tree.h +++ /dev/null @@ -1,1246 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef TREE_H -#define TREE_H - -/* - -Red-black tree class, designed for use in implementing STL -associative containers (set, multiset, map, and multimap). The -insertion and deletion algorithms are based on those in Cormen, -Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990), -except that - -(1) the header cell is maintained with links not only to the root -but also to the leftmost node of the tree, to enable constant time -begin(), and to the rightmost node of the tree, to enable linear time -performance when used with the generic set algorithms (set_union, -etc.); - -(2) when a node being deleted has two children its successor node is -relinked into its place, rather than copied, so that the only -iterators invalidated are those referring to the deleted node. - -*/ - -#include <algobase.h> -#include <iterator.h> -#include <function.h> -#ifndef __GNUG__ -#include <bool.h> -#endif -#include <projectn.h> - -#ifndef rb_tree -#define rb_tree rb_tree -#endif - -enum __rb_color_type {red, black}; - -struct __rb_tree_node_base { - enum __rb_color_type color_field; - void* parent_link; - void* left_link; - void* right_link; -}; - -extern __rb_tree_node_base __rb_NIL; - -template <class Key, class Value, class KeyOfValue, class Compare> -class rb_tree { -protected: - typedef enum __rb_color_type color_type; - typedef Allocator<void>::pointer void_pointer; - struct rb_tree_node; - friend rb_tree_node; - struct rb_tree_node : public __rb_tree_node_base { - Value value_field; - }; -#ifndef __GNUG__ - static Allocator<rb_tree_node> rb_tree_node_allocator; - static Allocator<Value> value_allocator; -#endif -public: - typedef Key key_type; - typedef Value value_type; - typedef Allocator<Value>::pointer pointer; - typedef Allocator<Value>::reference reference; - typedef Allocator<Value>::const_reference const_reference; - typedef Allocator<rb_tree_node> rb_tree_node_allocator_type; - typedef Allocator<rb_tree_node>::pointer link_type; - typedef Allocator<rb_tree_node>::size_type size_type; - typedef Allocator<rb_tree_node>::difference_type difference_type; -protected: -#ifndef __GNUG__ - size_type buffer_size() { - return rb_tree_node_allocator.init_page_size(); - } -#endif - struct rb_tree_node_buffer; - friend rb_tree_node_buffer; - struct rb_tree_node_buffer { - void_pointer next_buffer; - link_type buffer; - }; -public: - typedef Allocator<rb_tree_node_buffer> buffer_allocator_type; - typedef Allocator<rb_tree_node_buffer>::pointer buffer_pointer; -protected: -#ifdef __GNUG__ - static Allocator<rb_tree_node_buffer> buffer_allocator; - static buffer_pointer buffer_list; - static link_type free_list; - static link_type next_avail; - static link_type last; - link_type get_node() { return (link_type) operator new (sizeof (rb_tree_node)); } - void put_node(link_type p) { operator delete (p); } -#else - void add_new_buffer() { - buffer_pointer tmp = buffer_allocator.allocate((size_type)1); - tmp->buffer = rb_tree_node_allocator.allocate(buffer_size()); - tmp->next_buffer = buffer_list; - buffer_list = tmp; - next_avail = buffer_list->buffer; - last = next_avail + buffer_size(); - } - static size_type number_of_trees; - void deallocate_buffers(); - link_type get_node() { - link_type tmp = free_list; - return free_list ? - (free_list = (link_type)(free_list->right_link), tmp) - : (next_avail == last ? (add_new_buffer(), next_avail++) - : next_avail++); - // ugly code for inlining - avoids multiple returns - } - void put_node(link_type p) { - p->right_link = free_list; - free_list = p; - } -#endif -protected: - link_type header; - link_type& root() { return parent(header); } - link_type& root() const { return parent(header); } - link_type& leftmost() { return left(header); } - link_type& leftmost() const { return left(header); } - link_type& rightmost() { return right(header); } - link_type& rightmost() const { return right(header); } - size_type node_count; // keeps track of size of tree - bool insert_always; // controls whether an element already in the - // tree is inserted again -//public: - Compare key_compare; - static link_type& left(link_type x) { - return (link_type&)((*x).left_link); - } - static link_type& right(link_type x) { - return (link_type&)((*x).right_link); - } - static link_type& parent(link_type x) { - return (link_type&)((*x).parent_link); - } - static reference value(link_type x) { return (*x).value_field; } - static Allocator<Key>::const_reference key(link_type x) { - return KeyOfValue()(value(x)); - } - static color_type& color(link_type x) { - return (color_type&)(*x).color_field; } - static link_type minimum(link_type x) { - while (left(x) != &__rb_NIL) - x = left(x); - return x; - } - static link_type maximum(link_type x) { - while (right(x) != &__rb_NIL) - x = right(x); - return x; - } -public: - class iterator; - friend iterator; - class const_iterator; - friend const_iterator; - class iterator : public bidirectional_iterator<Value, difference_type> { - friend class rb_tree<Key, Value, KeyOfValue, Compare>; - friend class const_iterator; -/* - friend bool operator==(const iterator& x, const iterator& y) { - return x.node == y.node; - } -*/ - protected: - link_type node; - iterator(link_type x) : node(x) {} - public: - iterator() {} - bool operator==(const iterator& y) const { return node == y.node; } - reference operator*() const { return value(node); } - iterator& operator++() { - if (right(node) != &__rb_NIL) { - node = right(node); - while (left(node) != &__rb_NIL) - node = left(node); - } else { - link_type y = parent(node); - while (node == right(y)) { - node = y; - y = parent(y); - } - if (right(node) != y) // necessary because of rightmost - node = y; - } - return *this; - } - iterator operator++(int) { - iterator tmp = *this; - ++*this; - return tmp; - } - iterator& operator--() { - if (color(node) == red && parent(parent(node)) == node) - // check for header - node = right(node); // return rightmost - else if (left(node) != &__rb_NIL) { - link_type y = left(node); - while (right(y) != &__rb_NIL) - y = right(y); - node = y; - } else { - link_type y = parent(node); - while (node == left(y)) { - node = y; - y = parent(y); - } - node = y; - } - return *this; - } - iterator operator--(int) { - iterator tmp = *this; - --*this; - return tmp; - } - }; - class const_iterator - : public bidirectional_iterator<Value,difference_type> { - friend class rb_tree<Key, Value, KeyOfValue, Compare>; - friend class iterator; -/* - friend bool operator==(const const_iterator& x, const const_iterator& y) { - return x.node == y.node; - } -*/ - protected: - link_type node; - const_iterator(link_type x) : node(x) {} - public: - const_iterator() {} - const_iterator(const iterator& x) : node(x.node) {} - bool operator==(const const_iterator& y) const { - return node == y.node; - } - bool operator!=(const const_iterator& y) const { - return node != y.node; - } - const_reference operator*() const { return value(node); } - const_iterator& operator++() { - if (right(node) != &__rb_NIL) { - node = right(node); - while (left(node) != &__rb_NIL) - node = left(node); - } else { - link_type y = parent(node); - while (node == right(y)) { - node = y; - y = parent(y); - } - if (right(node) != y) // necessary because of rightmost - node = y; - } - return *this; - } - const_iterator operator++(int) { - const_iterator tmp = *this; - ++*this; - return tmp; - } - const_iterator& operator--() { - if (color(node) == red && parent(parent(node)) == node) - // check for header - node = right(node); // return rightmost - else if (left(node) != &__rb_NIL) { - link_type y = left(node); - while (right(y) != &__rb_NIL) - y = right(y); - node = y; - } else { - link_type y = parent(node); - while (node == left(y)) { - node = y; - y = parent(y); - } - node = y; - } - return *this; - } - const_iterator operator--(int) { - const_iterator tmp = *this; - --*this; - return tmp; - } - }; - typedef reverse_bidirectional_iterator<iterator, value_type, reference, - difference_type> - reverse_iterator; - typedef reverse_bidirectional_iterator<const_iterator, value_type, - const_reference, difference_type> - const_reverse_iterator; -private: -#ifdef __GNUC__ - rb_tree_iterator<Key, Value, KeyOfValue, Compare> __insert(void* x, void* y, const value_type& v); - link_type __copy(link_type x, link_type p) { - return (link_type) __copy_hack (x, p); - } -private: - void * __copy_hack (void *, void *); -public: - void __erase(void* x); -#else - iterator __insert(link_type x, link_type y, const value_type& v); - link_type __copy(link_type x, link_type p); - void __erase(link_type x); -#endif - void init() { -#ifndef __GNUG__ - ++number_of_trees; -#endif - header = get_node(); - color(header) = red; // used to distinguish header from root, - // in iterator.operator++ - header->parent_link = &__rb_NIL; - leftmost() = header; - rightmost() = header; - } -public: - -// allocation/deallocation - - rb_tree(const Compare& comp = Compare(), bool always = true) - : node_count(0), insert_always(always), key_compare(comp) { - init(); - } - rb_tree(const value_type* first, const value_type* last, - const Compare& comp = Compare(), bool always = true) - : node_count(0), insert_always(always), key_compare(comp) { - init(); - insert(first, last); - } - rb_tree(const rb_tree<Key, Value, KeyOfValue, Compare>& x, - bool always = true) : node_count(x.node_count), - insert_always(always), key_compare(x.key_compare) { -#ifndef __GNUG__ - ++number_of_trees; -#endif - header = get_node(); - color(header) = red; - root() = __copy(x.root(), header); - if (root() == &__rb_NIL) { - leftmost() = header; - rightmost() = header; - } else { - leftmost() = minimum(root()); - rightmost() = maximum(root()); - } - } - ~rb_tree() { - erase(begin(), end()); - put_node(header); -#ifndef __GNUG__ - if (--number_of_trees == 0) { - deallocate_buffers(); - free_list = 0; - next_avail = 0; - last = 0; - } -#endif - } - rb_tree<Key, Value, KeyOfValue, Compare>& - operator=(const rb_tree<Key, Value, KeyOfValue, Compare>& x); - -// accessors: - - Compare key_comp() const { return key_compare; } - iterator begin() { return leftmost(); } - const_iterator begin() const { return leftmost(); } - iterator end() { return header; } - const_iterator end() const { return header; } - 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()); - } - bool empty() const { return node_count == 0; } - size_type size() const { return node_count; } -#ifndef __GNUG__ - size_type max_size() const { - return rb_tree_node_allocator.max_size(); - } -#else - size_type max_size() const { - return rb_tree_node_allocator_type::max_size(); - } -#endif - void swap(rb_tree<Key, Value, KeyOfValue, Compare>& t) { - ::swap(header, t.header); - ::swap(node_count, t.node_count); - ::swap(insert_always, t.insert_always); - ::swap(key_compare, t.key_compare); - } - -// insert/erase - - typedef pair<iterator, bool> pair_iterator_bool; - // typedef done to get around compiler bug -#ifdef __GNUG__ - pair_iterator_bool insert(const value_type& x) { - return insert_hack(x); - } -private: - rb_tree_pair_iterator_bool<Key, Value, KeyOfValue, Compare> - insert_hack(const Value& v); -public: - iterator insert(iterator position, const value_type& x) { - return insert_hack(position, x); - } -private: - rb_tree_iterator<Key, Value, KeyOfValue, Compare> - insert_hack(rb_tree_iterator<Key, Value, KeyOfValue, Compare> posn, - const Value& v); -public: - void insert(iterator first, iterator last) { - while (first != last) insert(*first++); - } - void insert(const value_type* first, const value_type* last){ - while (first != last) insert(*first++); - } - void erase(iterator position) { - erase_hack(position); - } -private: - void erase_hack(rb_tree_iterator<Key, Value, KeyOfValue, Compare> position); -public: - size_type erase(const key_type& x); - void erase(iterator first, iterator last) { - while (first != last) erase(first++); - } -#else - pair_iterator_bool insert(const value_type& x); - iterator insert(iterator position, const value_type& x); - void insert(iterator first, iterator last); - void insert(const value_type* first, const value_type* last); - void erase(iterator position); - size_type erase(const key_type& x); - void erase(iterator first, iterator last); -#endif - void erase(const key_type* first, const key_type* last); - -// set operations: - -#ifdef __GNUG__ - iterator find(const key_type& x) { - return find_hack(x); - } - const_iterator find(const key_type& x) const { - return find_hack(x); - } -private: - rb_tree_iterator<Key, Value, KeyOfValue, Compare> - find_hack(const key_type& x); - rb_tree_const_iterator<Key, Value, KeyOfValue, Compare> - find_hack(const Key& k) const; -public: - - size_type count(const key_type& x) const; - iterator lower_bound(const key_type& x) { - return lower_bound_hack(x); - } - const_iterator lower_bound(const key_type& x) const { - return lower_bound_hack(x); - } - iterator upper_bound(const key_type& x) { - return upper_bound_hack(x); - } - const_iterator upper_bound(const key_type& x) const { - return upper_bound_hack(x); - } -private: - rb_tree_iterator<Key, Value, KeyOfValue, Compare> - lower_bound_hack(const key_type& x); - rb_tree_const_iterator<Key, Value, KeyOfValue, Compare> - lower_bound_hack(const Key& k) const; - rb_tree_iterator<Key, Value, KeyOfValue, Compare> - upper_bound_hack(const key_type& x); - rb_tree_const_iterator<Key, Value, KeyOfValue, Compare> - upper_bound_hack(const Key& k) const; -public: - typedef pair<iterator, iterator> pair_iterator_iterator; - // typedef done to get around compiler bug - pair_iterator_iterator equal_range(const key_type& x) { - return pair_iterator_iterator(lower_bound(x), upper_bound(x)); - } - typedef pair<const_iterator, const_iterator> pair_citerator_citerator; - - // typedef done to get around compiler bug - pair_citerator_citerator equal_range(const key_type& x) const { - return pair_citerator_citerator(lower_bound(x), upper_bound(x)); - } - inline void rotate_left(link_type x) { - link_type y = right(x); - right(x) = left(y); - if (left(y) != &__rb_NIL) - parent(left(y)) = x; - parent(y) = parent(x); - if (x == root()) - root() = y; - else if (x == left(parent(x))) - left(parent(x)) = y; - else - right(parent(x)) = y; - left(y) = x; - parent(x) = y; - } - - inline void rotate_right(link_type x) { - link_type y = left(x); - left(x) = right(y); - if (right(y) != &__rb_NIL) - parent(right(y)) = x; - parent(y) = parent(x); - if (x == root()) - root() = y; - else if (x == right(parent(x))) - right(parent(x)) = y; - else - left(parent(x)) = y; - right(y) = x; - parent(x) = y; - } - friend bidirectional_iterator_tag iterator_category(iterator) { - return bidirectional_iterator_tag(); - } - friend bidirectional_iterator_tag iterator_category(const_iterator) { - return bidirectional_iterator_tag(); - } -#else - iterator find(const key_type& x); - const_iterator find(const key_type& x) const; - size_type count(const key_type& x) const; - iterator lower_bound(const key_type& x); - const_iterator lower_bound(const key_type& x) const; - iterator upper_bound(const key_type& x); - const_iterator upper_bound(const key_type& x) const; - typedef pair<iterator, iterator> pair_iterator_iterator; - // typedef done to get around compiler bug - pair_iterator_iterator equal_range(const key_type& x); - typedef pair<const_iterator, const_iterator> pair_citerator_citerator; - // typedef done to get around compiler bug - pair_citerator_citerator equal_range(const key_type& x) const; - inline void rotate_left(link_type x); - inline void rotate_right(link_type x); -#endif -}; - -#ifndef __GNUG__ -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::buffer_pointer - rb_tree<Key, Value, KeyOfValue, Compare>::buffer_list = 0; - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::link_type - rb_tree<Key, Value, KeyOfValue, Compare>::free_list = 0; - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::link_type - rb_tree<Key, Value, KeyOfValue, Compare>::next_avail = 0; - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::link_type - rb_tree<Key, Value, KeyOfValue, Compare>::last = 0; - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::size_type - rb_tree<Key, Value, KeyOfValue, Compare>::number_of_trees = 0; - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::rb_tree_node_allocator_type - rb_tree<Key, Value, KeyOfValue, Compare>::rb_tree_node_allocator; - -template <class Key, class Value, class KeyOfValue, class Compare> -Allocator<Value> rb_tree<Key, Value, KeyOfValue, Compare>::value_allocator; - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::buffer_allocator_type - rb_tree<Key, Value, KeyOfValue, Compare>::buffer_allocator; - -template <class Key, class Value, class KeyOfValue, class Compare> -void rb_tree<Key, Value, KeyOfValue, Compare>::deallocate_buffers() { - while (buffer_list) { - buffer_pointer tmp = buffer_list; - buffer_list = (buffer_pointer)(buffer_list->next_buffer); - rb_tree_node_allocator.deallocate(tmp->buffer); - buffer_allocator.deallocate(tmp); - } -} -#endif - -#ifdef __GNUC__ -template <class Key, class Value, class KeyOfValue, class Compare> -struct rb_tree_iterator { - rb_tree<Key, Value, KeyOfValue, Compare>::iterator it; - rb_tree_iterator(rb_tree<Key, Value, KeyOfValue, Compare>::iterator i) : it(i) {} - operator rb_tree<Key, Value, KeyOfValue, Compare>::iterator() { - return it; - } -}; - -template <class Key, class Value, class KeyOfValue, class Compare> -inline Value* value_type(const rb_tree_iterator<Key, Value, KeyOfValue, Compare>&) { - return (Value*)(0); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -struct rb_tree_const_iterator { - rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator it; - rb_tree_const_iterator(rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator i) : it(i) {} - operator rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator() { - return it; - } -}; - -template <class Key, class Value, class KeyOfValue, class Compare> -inline Value* value_type(const rb_tree_const_iterator<Key, Value, KeyOfValue, Compare>&) { - return (Value*)(0); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -struct rb_tree_pair_iterator_bool { - rb_tree<Key, Value, KeyOfValue, Compare>::pair_iterator_bool it; - rb_tree_pair_iterator_bool(rb_tree<Key, Value, KeyOfValue, Compare>::pair_iterator_bool i) : it(i) {} - operator rb_tree<Key, Value, KeyOfValue, Compare>::pair_iterator_bool() { - return it; - } -}; - -template <class Key, class Value, class KeyOfValue, class Compare> -inline Value* value_type(rb_tree_pair_iterator_bool<Key, Value, KeyOfValue, Compare>&) { - return (Value*)(0); -} -#endif - -template <class Key, class Value, class KeyOfValue, class Compare> -inline bool operator==(const rb_tree<Key, Value, KeyOfValue, Compare>& x, - const rb_tree<Key, Value, KeyOfValue, Compare>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -inline bool operator<(const rb_tree<Key, Value, KeyOfValue, Compare>& x, - const rb_tree<Key, Value, KeyOfValue, Compare>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>& -rb_tree<Key, Value, KeyOfValue, Compare>:: -operator=(const rb_tree<Key, Value, KeyOfValue, Compare>& x) { - if (this != &x) { - // can't be done as in list because Key may be a constant type - erase(begin(), end()); - root() = __copy(x.root(), header); - if (root() == &__rb_NIL) { - leftmost() = header; - rightmost() = header; - } else { - leftmost() = minimum(root()); - rightmost() = maximum(root()); - } - node_count = x.node_count; - } - return *this; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::__insert -(void* xa, void* ya, const Value& v) { - link_type x = (link_type)xa; - link_type y = (link_type)ya; -#else -rb_tree<Key, Value, KeyOfValue, Compare>::iterator -rb_tree<Key, Value, KeyOfValue, Compare>:: -__insert(link_type x, link_type y, const Value& v) { -#endif - ++node_count; - link_type z = get_node(); -#ifdef __GNUG__ - construct(&(value(z)), v); -#else - construct(value_allocator.address(value(z)), v); -#endif - if (y == header || x != &__rb_NIL || key_compare(KeyOfValue()(v), key(y))) { - left(y) = z; // also makes leftmost() = z when y == header - if (y == header) { - root() = z; - rightmost() = z; - } else if (y == leftmost()) - leftmost() = z; // maintain leftmost() pointing to minimum node - } else { - right(y) = z; - if (y == rightmost()) - rightmost() = z; // maintain rightmost() pointing to maximum node - } - parent(z) = y; - z->left_link = &__rb_NIL; - z->right_link = &__rb_NIL; - x = z; // recolor and rebalance the tree - color(x) = red; - while (x != root() && color(parent(x)) == red) - if (parent(x) == left(parent(parent(x)))) { - y = right(parent(parent(x))); - if (color(y) == red) { - color(parent(x)) = black; - color(y) = black; - color(parent(parent(x))) = red; - x = parent(parent(x)); - } else { - if (x == right(parent(x))) { - x = parent(x); - rotate_left(x); - } - color(parent(x)) = black; - color(parent(parent(x))) = red; - rotate_right(parent(parent(x))); - } - } else { - y = left(parent(parent(x))); - if (color(y) == red) { - color(parent(x)) = black; - color(y) = black; - color(parent(parent(x))) = red; - x = parent(parent(x)); - } else { - if (x == left(parent(x))) { - x = parent(x); - rotate_right(x); - } - color(parent(x)) = black; - color(parent(parent(x))) = red; - rotate_left(parent(parent(x))); - } - } - color(root()) = black; - return iterator(z); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_pair_iterator_bool<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::insert_hack(const Value& v) { -#else -rb_tree<Key, Value, KeyOfValue, Compare>::pair_iterator_bool -rb_tree<Key, Value, KeyOfValue, Compare>::insert(const Value& v) { -#endif - link_type y = header; - link_type x = root(); - bool comp = true; - while (x != &__rb_NIL) { - y = x; - comp = key_compare(KeyOfValue()(v), key(x)); - x = comp ? left(x) : right(x); - } - if (insert_always) - return pair_iterator_bool(__insert(x, y, v), true); - iterator j = iterator(y); - if (comp) - if (j == begin()) - return pair_iterator_bool(__insert(x, y, v), true); - else - --j; - if (key_compare(key(j.node), KeyOfValue()(v))) - return pair_iterator_bool(__insert(x, y, v), true); - return pair_iterator_bool(j, false); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::insert_hack(rb_tree_iterator<Key, Value, KeyOfValue, Compare> posn, - const Value& v) { - iterator position = posn; -#else -rb_tree<Key, Value, KeyOfValue, Compare>::iterator -rb_tree<Key, Value, KeyOfValue, Compare>::insert(iterator position, - const Value& v) { -#endif - if (position == iterator(begin())) - if (size() > 0 && key_compare(KeyOfValue()(v), key(position.node))) - return __insert(position.node, position.node, v); - // first argument just needs to be non-&__rb_NIL - else - return insert(v).first; - else if (position == iterator(end())) - if (key_compare(key(rightmost()), KeyOfValue()(v))) - return __insert(&__rb_NIL, rightmost(), v); - else - return insert(v).first; - else { - iterator before = --position; - if (key_compare(key(before.node), KeyOfValue()(v)) - && key_compare(KeyOfValue()(v), key(position.node))) - if (right(before.node) == &__rb_NIL) - return __insert(&__rb_NIL, before.node, v); - else - return __insert(position.node, position.node, v); - // first argument just needs to be non-&__rb_NIL - else - return insert(v).first; - } -} - -#ifndef __GNUC__ -template <class Key, class Value, class KeyOfValue, class Compare> -void rb_tree<Key, Value, KeyOfValue, Compare>::insert(iterator first, - iterator last) { - while (first != last) insert(*first++); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -void rb_tree<Key, Value, KeyOfValue, Compare>::insert(const Value* first, - const Value* last) { - while (first != last) insert(*first++); -} -#endif - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -void rb_tree<Key, Value, KeyOfValue, Compare>::erase_hack( - rb_tree_iterator<Key, Value, KeyOfValue, Compare> posn) { - iterator position = posn; -#else -void rb_tree<Key, Value, KeyOfValue, Compare>::erase(iterator position) { -#endif - link_type z = position.node; - link_type y = z; - link_type x; - if (left(y) == &__rb_NIL) - x = right(y); - else - if (right(y) == &__rb_NIL) - x = left(y); - else { - y = right(y); - while (left(y) != &__rb_NIL) - y = left(y); - x = right(y); - } - if (y != z) { // relink y in place of z - parent(left(z)) = y; - left(y) = left(z); - if (y != right(z)) { - parent(x) = parent(y); // possibly x == &__rb_NIL - left(parent(y)) = x; // y must be a left child - right(y) = right(z); - parent(right(z)) = y; - } else - parent(x) = y; // needed in case x == &__rb_NIL - if (root() == z) - root() = y; - else if (left(parent(z)) == z) - left(parent(z)) = y; - else - right(parent(z)) = y; - parent(y) = parent(z); - ::swap(color(y), color(z)); - ::swap(y, z); - // y points to node to be actually deleted, - // z points to old z's former successor - } else { // y == z - parent(x) = parent(y); // possibly x == &__rb_NIL - if (root() == z) - root() = x; - else - if (left(parent(z)) == z) - left(parent(z)) = x; - else - right(parent(z)) = x; - if (leftmost() == z) - if (right(z) == &__rb_NIL) // left(z) must be &__rb_NIL also - leftmost() = parent(z); - // makes leftmost() == header if z == root() - else - leftmost() = minimum(x); - if (rightmost() == z) - if (left(z) == &__rb_NIL) // right(z) must be &__rb_NIL also - rightmost() = parent(z); - // makes rightmost() == header if z == root() - else // x == left(z) - rightmost() = maximum(x); - } - if (color(y) != red) { - while (x != root() && color(x) == black) - if (x == left(parent(x))) { - link_type w = right(parent(x)); - if (color(w) == red) { - color(w) = black; - color(parent(x)) = red; - rotate_left(parent(x)); - w = right(parent(x)); - } - if (color(left(w)) == black && color(right(w)) == black) { - color(w) = red; - x = parent(x); - } else { - if (color(right(w)) == black) { - color(left(w)) = black; - color(w) = red; - rotate_right(w); - w = right(parent(x)); - } - color(w) = color(parent(x)); - color(parent(x)) = black; - color(right(w)) = black; - rotate_left(parent(x)); - break; - } - } else { // same as then clause with "right" and "left" exchanged - link_type w = left(parent(x)); - if (color(w) == red) { - color(w) = black; - color(parent(x)) = red; - rotate_right(parent(x)); - w = left(parent(x)); - } - if (color(right(w)) == black && color(left(w)) == black) { - color(w) = red; - x = parent(x); - } else { - if (color(left(w)) == black) { - color(right(w)) = black; - color(w) = red; - rotate_left(w); - w = left(parent(x)); - } - color(w) = color(parent(x)); - color(parent(x)) = black; - color(left(w)) = black; - rotate_right(parent(x)); - break; - } - } - color(x) = black; - } -#ifdef __GNUG__ - delete y; -#else - destroy(value_allocator.address(value(y))); - put_node(y); -#endif - --node_count; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -#ifndef __SIZE_TYPE__ -#define __SIZE_TYPE__ long unsigned int -#endif -__SIZE_TYPE__ -#else -rb_tree<Key, Value, KeyOfValue, Compare>::size_type -#endif -rb_tree<Key, Value, KeyOfValue, Compare>::erase(const Key& x) { - pair_iterator_iterator p = equal_range(x); - size_type n = 0; - distance(p.first, p.second, n); - erase(p.first, p.second); - return n; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUG__ -void * -rb_tree<Key, Value, KeyOfValue, Compare>::__copy_hack(void* xa, void* pa) { - link_type x = (link_type)xa; - link_type p = (link_type)pa; -#else -rb_tree<Key, Value, KeyOfValue, Compare>::link_type -rb_tree<Key, Value, KeyOfValue, Compare>::__copy(link_type x, link_type p) { -#endif - // structural copy - link_type r = x; - while (x != &__rb_NIL) { - link_type y = get_node(); - if (r == x) r = y; // save for return value -#ifdef __GNUG__ - construct(&(value(y)), value(x)); -#else - construct(value_allocator.address(value(y)), value(x)); -#endif - left(p) = y; - parent(y) = p; - color(y) = color(x); - right(y) = __copy(right(x), y); - p = y; - x = left(x); - } - left(p) = (link_type)&__rb_NIL; - return r; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUG__ -void rb_tree<Key, Value, KeyOfValue, Compare>::__erase(void* xa) { - link_type x = (link_type)xa; -#else -void rb_tree<Key, Value, KeyOfValue, Compare>::__erase(link_type x) { -#endif - // erase without rebalancing - while (x != &__rb_NIL) { - __erase(right(x)); - link_type y = left(x); -#ifdef __GNUG__ - delete x; -#else - destroy(value_allocator.address(value(x))); - put_node(x); -#endif - x = y; - } -} - -#ifndef __GNUC__ -template <class Key, class Value, class KeyOfValue, class Compare> -void rb_tree<Key, Value, KeyOfValue, Compare>::erase(iterator first, - iterator last) { - if (first == begin() && last == end() && node_count != 0) { - __erase(root()); - leftmost() = header; - root() = NIL; - rightmost() = header; - node_count = 0; - } else - while (first != last) erase(first++); -} -#endif - -template <class Key, class Value, class KeyOfValue, class Compare> -void rb_tree<Key, Value, KeyOfValue, Compare>::erase(const Key* first, - const Key* last) { - while (first != last) erase(*first++); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::find_hack(const Key& k) { -#else -rb_tree<Key, Value, KeyOfValue, Compare>::iterator -rb_tree<Key, Value, KeyOfValue, Compare>::find(const Key& k) { -#endif - link_type y = header; - link_type x = root(); - bool comp = false; - while (x != &__rb_NIL) { - y = x; - comp = key_compare(key(x), k); - x = comp ? right(x) : left(x); - } - iterator j = iterator(y); - if (comp) ++j; - return (j == end() || key_compare(k, key(j.node))) ? end() : j; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_const_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::find_hack(const Key& k) const { -#else -rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator -rb_tree<Key, Value, KeyOfValue, Compare>::find(const Key& k) const { -#endif - link_type y = header; - link_type x = root(); - bool comp = false; - while (x != &__rb_NIL) { - y = x; - comp = key_compare(key(x), k); - x = comp ? right(x) : left(x); - } - const_iterator j = const_iterator(y); - if (comp) ++j; - return (j == end() || key_compare(k, key(j.node))) ? end() : j; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUG__ -__SIZE_TYPE__ -#else -rb_tree<Key, Value, KeyOfValue, Compare>::size_type -#endif -rb_tree<Key, Value, KeyOfValue, Compare>::count(const Key& k) const { - pair<const_iterator, const_iterator> p = equal_range(k); - size_type n = 0; - distance(p.first, p.second, n); - return n; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::lower_bound_hack(const Key& k) { -#else -rb_tree<Key, Value, KeyOfValue, Compare>::iterator -rb_tree<Key, Value, KeyOfValue, Compare>::lower_bound(const Key& k) { -#endif - link_type y = header; - link_type x = root(); - bool comp = false; - while (x != &__rb_NIL) { - y = x; - comp = key_compare(key(x), k); - x = comp ? right(x) : left(x); - } - iterator j = iterator(y); - return comp ? ++j : j; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_const_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::lower_bound_hack(const Key& k) const { -#else -rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator -rb_tree<Key, Value, KeyOfValue, Compare>::lower_bound(const Key& k) const { -#endif - link_type y = header; - link_type x = root(); - bool comp = false; - while (x != &__rb_NIL) { - y = x; - comp = key_compare(key(x), k); - x = comp ? right(x) : left(x); - } - const_iterator j = const_iterator(y); - return comp ? ++j : j; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::upper_bound_hack(const Key& k) { -#else -rb_tree<Key, Value, KeyOfValue, Compare>::iterator -rb_tree<Key, Value, KeyOfValue, Compare>::upper_bound(const Key& k) { -#endif - link_type y = header; - link_type x = root(); - bool comp = true; - while (x != &__rb_NIL) { - y = x; - comp = key_compare(k, key(x)); - x = comp ? left(x) : right(x); - } - iterator j = iterator(y); - return comp ? j : ++j; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -#ifdef __GNUC__ -rb_tree_const_iterator<Key, Value, KeyOfValue, Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::upper_bound_hack(const Key& k) const { -#else -rb_tree<Key, Value, KeyOfValue, Compare>::const_iterator -rb_tree<Key, Value, KeyOfValue, Compare>::upper_bound(const Key& k) const { -#endif - link_type y = header; - link_type x = root(); - bool comp = true; - while (x != &__rb_NIL) { - y = x; - comp = key_compare(k, key(x)); - x = comp ? left(x) : right(x); - } - const_iterator j = const_iterator(y); - return comp ? j : ++j; -} - - -#ifndef __GNUC__ -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::pair_iterator_iterator -rb_tree<Key, Value, KeyOfValue, Compare>::equal_range(const Key& k) { - return pair_iterator_iterator(lower_bound(k), upper_bound(k)); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -rb_tree<Key, Value, KeyOfValue, Compare>::pair_citerator_citerator -rb_tree<Key, Value, KeyOfValue, Compare>::equal_range(const Key& k) const { - return pair_citerator_citerator(lower_bound(k), upper_bound(k)); -} - -template <class Key, class Value, class KeyOfValue, class Compare> -inline void -rb_tree<Key, Value, KeyOfValue, Compare>::rotate_left(link_type x) { - link_type y = right(x); - right(x) = left(y); - if (left(y) != &__rb_NIL) - parent(left(y)) = x; - parent(y) = parent(x); - if (x == root()) - root() = y; - else if (x == left(parent(x))) - left(parent(x)) = y; - else - right(parent(x)) = y; - left(y) = x; - parent(x) = y; -} - -template <class Key, class Value, class KeyOfValue, class Compare> -inline void -rb_tree<Key, Value, KeyOfValue, Compare>::rotate_right(link_type x) { - link_type y = left(x); - left(x) = right(y); - if (right(y) != &__rb_NIL) - parent(right(y)) = x; - parent(y) = parent(x); - if (x == root()) - root() = y; - else if (x == right(parent(x))) - right(parent(x)) = y; - else - left(parent(x)) = y; - right(y) = x; - parent(x) = y; -} -#endif - -#endif - diff --git a/contrib/libg++/libstdc++/stl/vector.h b/contrib/libg++/libstdc++/stl/vector.h deleted file mode 100644 index e609aa109a0a..000000000000 --- a/contrib/libg++/libstdc++/stl/vector.h +++ /dev/null @@ -1,355 +0,0 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef VECTOR_H -#define VECTOR_H - -#include <function.h> -#include <algobase.h> -#ifndef __GNUG__ -#include <bool.h> -#endif - -#ifndef Allocator -#define Allocator allocator -#include <defalloc.h> -#endif - -#ifndef vector -#define vector vector -#endif - -template <class T> -class vector { -public: - - typedef Allocator<T> vector_allocator; - typedef T value_type; - typedef vector_allocator::pointer pointer; - typedef vector_allocator::pointer iterator; - typedef vector_allocator::const_pointer const_iterator; - typedef vector_allocator::reference reference; - typedef vector_allocator::const_reference const_reference; - typedef vector_allocator::size_type size_type; - typedef vector_allocator::difference_type difference_type; - typedef reverse_iterator<const_iterator, value_type, const_reference, - difference_type> const_reverse_iterator; - typedef reverse_iterator<iterator, value_type, reference, difference_type> - reverse_iterator; -protected: - static Allocator<T> static_allocator; - iterator start; - iterator finish; - iterator end_of_storage; -#ifdef __GNUG__ - void insert_aux(iterator position, const T& x) { - insert_aux(vector_iterator<T>(position), x); - } - void insert_aux(vector_iterator<T> position, const T& x); -#else - void insert_aux(iterator position, const T& x); -#endif -public: - iterator begin() { return start; } - const_iterator begin() const { return start; } - iterator end() { return finish; } - const_iterator end() const { return finish; } - 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()); - } - size_type size() const { return size_type(end() - begin()); } - size_type max_size() const { return static_allocator.max_size(); } - size_type capacity() const { return size_type(end_of_storage - begin()); } - bool empty() const { return begin() == end(); } - reference operator[](size_type n) { return *(begin() + n); } - const_reference operator[](size_type n) const { return *(begin() + n); } - vector() : start(0), finish(0), end_of_storage(0) {} - vector(size_type n, const T& value = T()) { - start = static_allocator.allocate(n); - uninitialized_fill_n(start, n, value); - finish = start + n; - end_of_storage = finish; - } - vector(const vector<T>& x) { - start = static_allocator.allocate(x.end() - x.begin()); - finish = uninitialized_copy(x.begin(), x.end(), start); - end_of_storage = finish; - } - vector(const_iterator first, const_iterator last) { - size_type n = 0; - distance(first, last, n); - start = static_allocator.allocate(n); - finish = uninitialized_copy(first, last, start); - end_of_storage = finish; - } - ~vector() { - destroy(start, finish); - static_allocator.deallocate(start); - } - vector<T>& operator=(const vector<T>& x); - void reserve(size_type n) { - if (capacity() < n) { - iterator tmp = static_allocator.allocate(n); - uninitialized_copy(begin(), end(), tmp); - destroy(start, finish); - static_allocator.deallocate(start); - finish = tmp + size(); - start = tmp; - end_of_storage = begin() + n; - } - } - reference front() { return *begin(); } - const_reference front() const { return *begin(); } - reference back() { return *(end() - 1); } - const_reference back() const { return *(end() - 1); } - void push_back(const T& x) { - if (finish != end_of_storage) { - /* Borland bug */ - construct(finish, x); - finish++; - } else - insert_aux(end(), x); - } - void swap(vector<T>& x) { - ::swap(start, x.start); - ::swap(finish, x.finish); - ::swap(end_of_storage, x.end_of_storage); - } - iterator insert(iterator position, const T& x) { - size_type n = position - begin(); - if (finish != end_of_storage && position == end()) { - /* Borland bug */ - construct(finish, x); - finish++; - } else - insert_aux(position, x); - return begin() + n; - } -#ifdef __GNUG__ - void insert (iterator position, const_iterator first, - const_iterator last) { - insert(vector_iterator<T>(position), - vector_const_iterator<T>(first), - vector_const_iterator<T>(last)); - } - void insert (vector_iterator<T> position, vector_const_iterator<T> first, - vector_const_iterator<T> last); - void insert (iterator position, size_type n, const T& x) { - insert(vector_iterator<T>(position), n, x); - } - void insert (vector_iterator<T> position, size_type n, const T& x); -#else - void insert (iterator position, const_iterator first, - const_iterator last); - void insert (iterator position, size_type n, const T& x); -#endif - void pop_back() { - /* Borland bug */ - --finish; - destroy(finish); - } - void erase(iterator position) { - if (position + 1 != end()) - copy(position + 1, end(), position); - /* Borland bug */ - --finish; - destroy(finish); - } - void erase(iterator first, iterator last) { - vector<T>::iterator i = copy(last, end(), first); - destroy(i, finish); - // work around for destroy(copy(last, end(), first), finish); - finish = finish - (last - first); - } -}; - -#ifdef __GNUG__ -template <class T> -struct vector_iterator { - vector<T>::iterator it; - vector_iterator(vector<T>::iterator i) : it(i) {} - operator vector<T>::iterator() { - return it; - } -}; - -template <class T> -inline T* value_type(const vector_iterator<T>&) { - return (T*)(0); -} - - -template <class T> -struct vector_const_iterator { - vector<T>::const_iterator it; - vector_const_iterator(vector<T>::const_iterator i) : it(i) {} - operator vector<T>::const_iterator() { - return it; - } -}; -#endif - -template <class T> -inline bool operator==(const vector<T>& x, const vector<T>& y) { - return x.size() == y.size() && equal(x.begin(), x.end(), y.begin()); -} - -template <class T> -inline bool operator<(const vector<T>& x, const vector<T>& y) { - return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); -} - -#ifndef __GNUG__ -template <class T> -vector<T>::vector_allocator vector<T>::static_allocator; -#endif - -template <class T> -vector<T>& vector<T>::operator=(const vector<T>& x) { - if (&x == this) return *this; - if (x.size() > capacity()) { - destroy(start, finish); - static_allocator.deallocate(start); - start = static_allocator.allocate(x.end() - x.begin()); - end_of_storage = uninitialized_copy(x.begin(), x.end(), start); - } else if (size() >= x.size()) { - vector<T>::iterator i = copy(x.begin(), x.end(), begin()); - destroy(i, finish); - // work around for destroy(copy(x.begin(), x.end(), begin()), finish); - } else { - copy(x.begin(), x.begin() + size(), begin()); - uninitialized_copy(x.begin() + size(), x.end(), begin() + size()); - } - finish = begin() + x.size(); - return *this; -} - -template <class T> -#ifdef __GNUG__ -void vector<T>::insert_aux(vector_iterator<T> posn, const T& x) { - iterator position = posn; -#else -void vector<T>::insert_aux(iterator position, const T& x) { -#endif - if (finish != end_of_storage) { - construct(finish, *(finish - 1)); - copy_backward(position, finish - 1, finish); - *position = x; - ++finish; - } else { - size_type len = size() ? 2 * size() - : static_allocator.init_page_size(); - iterator tmp = static_allocator.allocate(len); - uninitialized_copy(begin(), position, tmp); - construct(tmp + (position - begin()), x); - uninitialized_copy(position, end(), tmp + (position - begin()) + 1); - destroy(begin(), end()); - static_allocator.deallocate(begin()); - end_of_storage = tmp + len; - finish = tmp + size() + 1; - start = tmp; - } -} - -template <class T> -#ifdef __GNUG__ -void vector<T>::insert(vector_iterator<T> posn, - size_t n, - const T& x) { - iterator position = posn; -#else -void vector<T>::insert(iterator position, size_type n, const T& x) { -#endif - if (n == 0) return; - if ((size_type) (end_of_storage - finish) >= n) { - if ((size_type) (end() - position) > n) { - uninitialized_copy(end() - n, end(), end()); - copy_backward(position, end() - n, end()); - fill(position, position + n, x); - } else { - uninitialized_copy(position, end(), position + n); - fill(position, end(), x); - uninitialized_fill_n(end(), n - (end() - position), x); - } - finish += n; - } else { - size_type len = size() + max(size(), n); - iterator tmp = static_allocator.allocate(len); - uninitialized_copy(begin(), position, tmp); - uninitialized_fill_n(tmp + (position - begin()), n, x); - uninitialized_copy(position, end(), tmp + (position - begin() + n)); - destroy(begin(), end()); - static_allocator.deallocate(begin()); - end_of_storage = tmp + len; - finish = tmp + size() + n; - start = tmp; - } -} - -template <class T> -#ifdef __GNUG__ -void vector<T>::insert(vector_iterator<T> posn, - vector_const_iterator<T> fi, - vector_const_iterator<T> la) { - iterator position = posn; - const_iterator first = fi; - const_iterator last = la; -#else -void vector<T>::insert(iterator position, - const_iterator first, - const_iterator last) { -#endif - if (first == last) return; - size_type n = 0; - distance(first, last, n); - if ((size_type) (end_of_storage - finish) >= n) { - if ((size_type) (end() - position) > n) { - uninitialized_copy(end() - n, end(), end()); - copy_backward(position, end() - n, end()); - copy(first, last, position); - } else { - uninitialized_copy(position, end(), position + n); - copy(first, first + (end() - position), position); - uninitialized_copy(first + (end() - position), last, end()); - } - finish += n; - } else { - size_type len = size() + max(size(), n); - iterator tmp = static_allocator.allocate(len); - uninitialized_copy(begin(), position, tmp); - uninitialized_copy(first, last, tmp + (position - begin())); - uninitialized_copy(position, end(), tmp + (position - begin() + n)); - destroy(begin(), end()); - static_allocator.deallocate(begin()); - end_of_storage = tmp + len; - finish = tmp + size() + n; - start = tmp; - } -} - -#undef Allocator -#undef vector - -#endif - - - - - diff --git a/contrib/libg++/libstdc++/string b/contrib/libg++/libstdc++/string deleted file mode 100644 index 467a2fd0a690..000000000000 --- a/contrib/libg++/libstdc++/string +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __STRING__ -#include <std/string.h> -#endif diff --git a/contrib/libg++/libstdc++/tests/ChangeLog b/contrib/libg++/libstdc++/tests/ChangeLog deleted file mode 100644 index c089bfbda21d..000000000000 --- a/contrib/libg++/libstdc++/tests/ChangeLog +++ /dev/null @@ -1,52 +0,0 @@ -Mon Jun 17 14:05:50 1996 Per Bothner <bothner@deneb.cygnus.com> - - * tlist.cc (test_splice): New test. - -Sat Nov 18 19:52:26 1995 Mike Stump <mrs@cygnus.com> - - * Makefile.in: Update version to 2.7.1. - -Tue May 9 19:36:54 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * tstring.cc (decltest): Adjust single-character test. - -Fri May 5 14:35:19 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * tcomplex.*: Update to reflect that operator<< now - accepts more forms of input. - -Thu Apr 27 15:34:58 1995 Brendan Kehoe (brendan@lisa.cygnus.com) - - * configure.in: Update to stay in sync with config.shared. - -Thu Feb 16 00:08:28 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (VERSION, SHLIB): Define. - -Tue Jan 24 02:36:24 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in (CXXFLAGS): Don't set. - -Mon Jan 23 04:12:10 1995 Jason Merrill <jason@python.cygnus.com> - - * tlist.cc (plus): Remove. - -Thu Jan 19 19:41:07 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in: Don't set LD_LIBRARY_PATH. Users will have to set - it themselves. - -Mon Jan 16 13:57:34 1995 Jason Merrill <jason@phydeaux.cygnus.com> - - * Makefile.in: Update to reflect header movement. - -Wed Dec 14 19:55:45 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * configure.in: Fix quoting problem. Reported nu H.J.Lu. - -Tue Nov 29 16:46:56 1994 Per Bothner <bothner@kalessin.cygnus.com> - - * Makefile.in, configure.in: Re-write to avoid duplication. - * {tvector,tmap,tlist}.{cc,exp}, configure.in: New tests for STL. - - diff --git a/contrib/libg++/libstdc++/tests/Makefile.in b/contrib/libg++/libstdc++/tests/Makefile.in deleted file mode 100644 index a068ec160a7f..000000000000 --- a/contrib/libg++/libstdc++/tests/Makefile.in +++ /dev/null @@ -1,35 +0,0 @@ -# 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. - -VERSION = 2.7.2 -SHLIB = libstdc++.so.$(VERSION) - -DEPLIBS = ../libstdc++.a -LDLIBS = -L.. -lstdc++ -MDEPLIBS = $(DEPLIBS) -MLDLIBS = $(LDLIBS) -lm - -#### package, host, target, and site dependent Makefile fragments come in here. -## - -tcomplex.o: ${srcdir}/../std/complext.h ${srcdir}/../std/dcomplex.h -tcomplex: tcomplex.o $(MDEPLIBS) - $(CXX) -o tcomplex tcomplex.o $(MLDLIBS) - -tstring.o: ${srcdir}/../std/bastring.h - -# NOTE: Rules for following tests are generated by $(srcdir)/configure.in !!! - diff --git a/contrib/libg++/libstdc++/tests/configure.in b/contrib/libg++/libstdc++/tests/configure.in deleted file mode 100644 index a32d0495f45e..000000000000 --- a/contrib/libg++/libstdc++/tests/configure.in +++ /dev/null @@ -1,49 +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. - -configdirs= -srctrigger=tcomplex.cc -srcname="tests for ANSI C++ library" -package_makefile_frag=Make.pack - -# per-host: - -# per-target: - -target_makefile_frag=../target-mkfrag - -TO_TOPDIR=../../ -ALL=' ' -XCXXINCLUDES="-I${srcdir}/.. -I${srcdir}/../stl -I${TO_TOPDIR}libio -I${srcdir}/${TO_TOPDIR}libio" -SIMPLE_TESTS='tstring tlist tmap tvector' -TESTS="tcomplex ${SIMPLE_TESTS}" -MOSTLYCLEAN="*.o core ${TESTS} *.out" -(. ${srcdir}/${TO_TOPDIR}libio/config.shared) >${package_makefile_frag} - -# post-target: - -CHECK="" - -for TEST in ${SIMPLE_TESTS} ; do - echo "${TEST}: ${TEST}.o" '$(DEPLIBS) - $(CXX) -o' "${TEST} ${TEST}.o" '$(LDLIBS) -' >> Makefile -done - -for TEST in ${TESTS} ; do - echo ".PHONY: check-${TEST}" >>Makefile - if [ -f ${srcdir}/${TEST}.inp ] ; then - echo "check-${TEST}: ${TEST}" '$(srcdir)'"/${TEST}.inp - ./${TEST} < "'$(srcdir)'"/${TEST}.inp > ${TEST}.out 2>&1" >>Makefile - else - echo "check-${TEST}: ${TEST} - ./${TEST} > ${TEST}.out 2>&1" >>Makefile - fi - echo ' diff -c $(srcdir)/'"${TEST}.exp ${TEST}.out" >>Makefile - CHECK="${CHECK} check-${TEST}" -done -echo " -check: ${CHECK}" >>Makefile - - diff --git a/contrib/libg++/libstdc++/tests/tcomplex.cc b/contrib/libg++/libstdc++/tests/tcomplex.cc deleted file mode 100644 index c9d27360b1b8..000000000000 --- a/contrib/libg++/libstdc++/tests/tcomplex.cc +++ /dev/null @@ -1,143 +0,0 @@ -// Tests 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. - -#include <std/cassert.h> -#include <iostream.h> -#include <std/complex.h> - -// to test near-equality - -const double eps = 0.000001; - -static void close_enough(const double_complex& a, const double_complex& b) -{ - assert(fabs(real(a) - real(b)) < eps && - fabs(imag(a) - imag(b)) < eps); -} - - -void test3(double_complex& a, double_complex& b, double_complex& c) -{ - - close_enough(-(-a) , a); - close_enough((a + b) , (b + a)); - close_enough((a + (-b)) , (a - b)); - close_enough((a * b) , (b * a)); - close_enough((a * (-b)) , -(a * b)); - close_enough((a / (-b)) , -(a / b)); - close_enough((a - b) , -(b - a)); - close_enough((a + (b + c)) , ((a + b) + c)); - close_enough((a * (b * c)) , ((a * b) * c)); - close_enough((a * (b + c)) , ((a * b) + (a * c))); - close_enough(((a - b) + b) , a); - close_enough(((a + b) - b) , a); - close_enough(((a * b) / b) , a); - close_enough(((a / b) * b) , a); - - - double_complex x = a; - x *= b; - close_enough(x , (a * b)); - x += c; - close_enough(x , ((a * b) + c)); - x -= a; - close_enough(x , (((a * b) + c) - a)); - x /= b; - close_enough(x , ((((a * b) + c) - a) / b)); - -} - -main() -{ - double_complex one = 1.0; - double_complex i (0.0, 1.0); - double_complex neg_one = -1.0; - - cout << "double_complex one = " << one << "\n"; - cout << "i = " << i << "\n"; - cout << "neg_one = " << neg_one << "\n"; - cout << "sqrt(neg_one) = " << sqrt(neg_one) << "\n"; - - double_complex a (2.0, 3.0); - double_complex b (4.0, 5.0); - - cout << "a = " << a << "\n"; - cout << "b = " << b << "\n"; - - cout << "a + one = " << (a + one) << "\n"; - (close_enough((a+one), double_complex(3.0, 3.0))); - cout << "a - one = " << (a - one) << "\n"; - (close_enough((a-one), double_complex(1.0, 3.0))); - cout << "a * one = " << (a * one) << "\n"; - (close_enough((a*one), a)); - cout << "a / one = " << (a / one) << "\n"; - (close_enough((a/one), a)); - - cout << "a + b = " << (a + b) << "\n"; - (close_enough((a+b), double_complex(6.0, 8.0))); - cout << "a - b = " << (a - b) << "\n"; - (close_enough((a-b), double_complex(-2.0, -2.0))); - cout << "a * b = " << (a * b) << "\n"; - (close_enough((a*b), double_complex(-7.0, 22.0))); - cout << "a / b = " << (a / b) << "\n"; - (close_enough((a/b), double_complex(0.5609760976, 0.0487804878))); - - double_complex c; - - c = a; cout << "c = a; c += b = " << (c += b) << "\n"; - c = a; cout << "c = a; c -= b = " << (c -= b) << "\n"; - c = a; cout << "c = a; c *= b = " << (c *= b) << "\n"; - c = a; cout << "c = a; c /= b = " << (c /= b) << "\n"; - - cout << "-a = " << (-a) << "\n"; - cout << "real(a) = " << real(a) << "\n"; - assert(real(a) == 2.0); - cout << "imag(a) = " << imag(a) << "\n"; - assert(imag(a) == 3.0); - cout << "conj(a) = " << conj(a) << "\n"; - assert(conj(a) == double_complex(2.0, -3.0)); - cout << "norm(a) = " << norm(a) << "\n"; - assert(norm(a) == 13.0); - - cout << "abs(a) = " << abs(a) << "\n"; - cout << "arg(a) = " << arg(a) << "\n"; - cout << "cos(a) = " << cos(a) << "\n"; - cout << "sin(a) = " << sin(a) << "\n"; - cout << "cosh(a) = " << cosh(a) << "\n"; - cout << "sinh(a) = " << sinh(a) << "\n"; - cout << "log(a) = " << log(a) << "\n"; - cout << "exp(a) = " << exp(a) << "\n"; - cout << "sqrt(a) = " << sqrt(a) << "\n"; - cout << "pow(a, 2) = " << pow(a, 2) << "\n"; - cout << "pow(a, b) = " << pow(a, b) << "\n"; - - double_complex d (10, 20); - double_complex e = pow(a, 2); - - test3(one, one, one); - test3(a, a, a); - test3(a, b, d); - test3(e, i, b); - test3(d, d, i); - - cout << "enter a complex number in form a or (a) or (a, b): "; - cin >> c; - cout << "number = " << c << "\n"; - - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libstdc++/tests/tcomplex.exp b/contrib/libg++/libstdc++/tests/tcomplex.exp deleted file mode 100644 index 5bef15cd3769..000000000000 --- a/contrib/libg++/libstdc++/tests/tcomplex.exp +++ /dev/null @@ -1,37 +0,0 @@ -double_complex one = (1,0) -i = (0,1) -neg_one = (-1,0) -sqrt(neg_one) = (0,1) -a = (2,3) -b = (4,5) -a + one = (3,3) -a - one = (1,3) -a * one = (2,3) -a / one = (2,3) -a + b = (6,8) -a - b = (-2,-2) -a * b = (-7,22) -a / b = (0.560976,0.0487805) -c = a; c += b = (6,8) -c = a; c -= b = (-2,-2) -c = a; c *= b = (-7,22) -c = a; c /= b = (0.560976,0.0487805) --a = (-2,-3) -real(a) = 2 -imag(a) = 3 -conj(a) = (2,-3) -norm(a) = 13 -abs(a) = 3.60555 -arg(a) = 0.982794 -cos(a) = (-4.18963,-9.10923) -sin(a) = (9.1545,-4.16891) -cosh(a) = (-3.72455,0.511823) -sinh(a) = (-3.59056,0.530921) -log(a) = (1.28247,0.982794) -exp(a) = (-7.31511,1.04274) -sqrt(a) = (1.67415,0.895977) -pow(a, 2) = (-5,12) -pow(a, b) = (-0.753046,-0.986429) -enter a complex number in form a or (a) or (a, b): number = (1.2,-34) - -End of test diff --git a/contrib/libg++/libstdc++/tests/tcomplex.inp b/contrib/libg++/libstdc++/tests/tcomplex.inp deleted file mode 100644 index c4e1d84660f2..000000000000 --- a/contrib/libg++/libstdc++/tests/tcomplex.inp +++ /dev/null @@ -1 +0,0 @@ -(1.2, -34) diff --git a/contrib/libg++/libstdc++/tests/tlist.cc b/contrib/libg++/libstdc++/tests/tlist.cc deleted file mode 100644 index aaf56714a79c..000000000000 --- a/contrib/libg++/libstdc++/tests/tlist.cc +++ /dev/null @@ -1,162 +0,0 @@ -/* - test/demo of generic lists -*/ - -#include <assert.h> - -#define tassert(ex) {if ((ex)) cerr << #ex << "\n"; \ - else _assert(#ex, __FILE__,__LINE__); } - -#include <iostream.h> -#include "list.h" -#include "algo.h" - -bool int_compare(int a, int b) -{ - return a < b; -} - -int inc(int x) -{ - return x + 1; -} - -void print(list<int>& l) -{ - for (list<int>::iterator it = l.begin(); it != l.end(); it++) - cout << *it << " "; - cout << "\n"; -} - -int is_odd(int x) -{ - return x & 1; -} - -int is_even(int x) -{ - return (x & 1) == 0; -} - -void sequence(list<int>& a, int lo, int hi) -{ - back_insert_iterator<list<int> > it(a); - while (lo <= hi) - *it++ = lo++; -} - -int old_rand = 9999; - -int get_rand() -{ - old_rand = ((long)old_rand * (long)1243) % (long)971; - return old_rand; -} - -void randseq(list<int>& a, int n) -{ - back_insert_iterator<list<int> > it(a); - while (--n >= 0) - *it++ = get_rand() % 50; -} - -int array1 [] = { 9, 16, 36 }; -int array2 [] = { 1, 4 }; - -int test_splice () -{ - list<int> l1 (array1, array1 + 3); - list<int> l2 (array2, array2 + 2); - list<int>::iterator i1 = l1.begin (); - l1.splice (i1, l2); - list<int>::iterator i2 = l1.begin (); - while (i2 != l1.end ()) - cout << *i2++ << endl; - return 0; -} - -main() -{ - list<int> a; int i; - list<int>::iterator it, bit; - sequence(a, 1, 20); - cout << "\nlist<int> a = sequence(1, 20);\n"; print(a); - for (it = a.begin (), i = 0; it != a.end (); it++, i++) - assert (*it == i + 1); - list<int> b; - randseq(b, 20); - cout << "\nlist<int> b = randseq(20);\n"; print(b); - list<int> c; - c.insert (c.end(), a.begin(), a.end()); - c.insert (c.end(), b.begin(), b.end()); - cout << "\nlist<int> c = a and b;\n"; print(c); - - list<int> d; - for (it = a.begin(); it != a.end(); it++) - d.insert(d.end (), inc(*it)); - cout << "\nlist<int> d = map(inc, a);\n"; print(d); - - list<int> e; - back_insert_iterator<list<int> > e_insertor (e); - reverse_copy (a.begin(), a.end (), e_insertor); - cout << "\nlist<int> e = reverse(a);\n"; print(e); - - list<int> f; - for (it = a.begin(); it != a.end(); it++) - if (is_odd (*it)) - f.insert(f.end (), *it); - cout << "\nlist<int> f = select(is_odd, a);\n"; print(f); - list<int> ff; - for (it = f.begin(); it != f.end(); it++) - if (is_even (*it)) - ff.insert(ff.end (), *it); - assert(ff.empty()); - - int red = 0; - for (it = a.begin(); it != a.end(); it++) - red += *it; - cout << "\nint red = a.reduce(plus, 0);\n"; cout << red; - it = a.begin(); ++it; ++it; - int second = *it; - cout << "\nint second = a[2];\n"; cout << second; - list<int> g; - for (it = a.begin(), bit = b.begin(); it != a.end () && bit != b.end (); ) - g.insert (g.end (), *it++ + *bit++); - cout << "\nlist<int> g = combine(plus, a, b);\n"; print(g); -#if 1 - for (it = g.begin(); it != g.end(); ) - { - bit = it++; - if (is_odd (*bit)) - g.erase (bit); - } -#else - g.remove_if (is_odd); -#endif - cout << "\ng.del(is_odd);\n"; print(g); - - ff.erase (ff.begin (), ff.end()); - for (it = g.begin(); it != g.end(); it++) - if (is_odd (*it)) - ff.insert (ff.end (), *it); - assert(ff.empty()); - - b.sort(); - for (it = b.begin(); bit = it++, it != b.end (); ) assert (*it >= *bit); - cout << "\nb.sort(int_compare);\n"; print(b); - - list<int> h; - back_insert_iterator<list<int> > h_insertor (h); - merge (a.begin (), a.end (), b.begin (), b.end (), h_insertor, int_compare); - cout << "\nlist<int> h = merge(a, b, int_compare);\n"; print(h); - for (it = h.begin(); bit = it++, it != h.end (); ) assert (*it >= *bit); - - cout << "\nh via iterator:\n"; - for (it = h.begin(); it != h.end (); it++) - cout << *it << ", "; - cout << "\n"; - - test_splice (); - - cout << "\ndone\n"; -} diff --git a/contrib/libg++/libstdc++/tests/tlist.exp b/contrib/libg++/libstdc++/tests/tlist.exp deleted file mode 100644 index 65f7806826f6..000000000000 --- a/contrib/libg++/libstdc++/tests/tlist.exp +++ /dev/null @@ -1,44 +0,0 @@ - -list<int> a = sequence(1, 20); -1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - -list<int> b = randseq(20); -28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6 - -list<int> c = a and b; -1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 28 27 5 17 44 6 9 40 15 26 49 35 15 48 13 27 25 25 9 6 - -list<int> d = map(inc, a); -2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 - -list<int> e = reverse(a); -20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 - -list<int> f = select(is_odd, a); -1 3 5 7 9 11 13 15 17 19 - -int red = a.reduce(plus, 0); -210 -int second = a[2]; -3 -list<int> g = combine(plus, a, b); -29 29 8 21 49 12 16 48 24 36 60 47 28 62 28 43 42 43 28 26 - -g.del(is_odd); -8 12 16 48 24 36 60 28 62 28 42 28 26 - -b.sort(int_compare); -5 6 6 9 9 13 15 15 17 25 25 26 27 27 28 35 40 44 48 49 - -list<int> h = merge(a, b, int_compare); -1 2 3 4 5 5 6 6 6 7 8 9 9 9 10 11 12 13 13 14 15 15 15 16 17 17 18 19 20 25 25 26 27 27 28 35 40 44 48 49 - -h via iterator: -1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 13, 13, 14, 15, 15, 15, 16, 17, 17, 18, 19, 20, 25, 25, 26, 27, 27, 28, 35, 40, 44, 48, 49, -1 -4 -9 -16 -36 - -done diff --git a/contrib/libg++/libstdc++/tests/tmap.cc b/contrib/libg++/libstdc++/tests/tmap.cc deleted file mode 100644 index 7169f9d20d19..000000000000 --- a/contrib/libg++/libstdc++/tests/tmap.cc +++ /dev/null @@ -1,66 +0,0 @@ -#include <map.h> -#include <algo.h> -#include <iostream.h> -#include <function.h> - -int SIZE; - -#if 0 -/* Crashes compiler */ -#define int_less less<int> -#else -struct int_less { - bool operator() (int x, int y) const { return x < y; } -}; -struct str_less { - bool operator() (char* x, char* y) const { return strcmp(x,y) < 0; } -}; -#endif - -#if 0 -void add(int x[], int y[], map<int,int, int_less>& a) -{ - for (int i = 0; i < SIZE; ++i) a[x[i]] = y[i]; -} -#endif - -int -main(int argv, char** argc) -{ -#if 0 - if (argv > 1) - { - SIZE = abs(atoi(argc[1])); - SIZE &= ~1; - } - else - SIZE = 100; - nums = new int[SIZE]; - odds = new int[SIZE]; - perm = new int[SIZE]; -#endif - - map<int, int, int_less> my_map; - - map<char*, int, str_less> phones; - - my_map[4] = 40; - my_map[2] = 20; - - // The (char*) is needed because g++ doesn't - // convert char[] to char* in this context. - phones[(char*)"tom"] = 2345; - phones[(char*)"dick"] = 5678; - phones[(char*)"harry"] = 7654; - - cout << "2 -> " << my_map[2] << endl; - cout << "4 -> " << my_map[4] << endl; - - map<int, int, int_less>::iterator it = my_map.begin(); - for ( ; it != my_map.end(); it++) - cout << "my_map[" << (*it).first << "] = " << (*it).second << endl; - - map<char*, int, str_less>::iterator pit = phones.begin(); - for ( ; pit != phones.end(); pit++) - cout << "phones[" << (*pit).first << "] = " << (*pit).second << endl; -} diff --git a/contrib/libg++/libstdc++/tests/tmap.exp b/contrib/libg++/libstdc++/tests/tmap.exp deleted file mode 100644 index b7b5df249fb0..000000000000 --- a/contrib/libg++/libstdc++/tests/tmap.exp +++ /dev/null @@ -1,7 +0,0 @@ -2 -> 20 -4 -> 40 -my_map[2] = 20 -my_map[4] = 40 -phones[dick] = 5678 -phones[harry] = 7654 -phones[tom] = 2345 diff --git a/contrib/libg++/libstdc++/tests/tstring.cc b/contrib/libg++/libstdc++/tests/tstring.cc deleted file mode 100644 index 490f2c843e7a..000000000000 --- a/contrib/libg++/libstdc++/tests/tstring.cc +++ /dev/null @@ -1,189 +0,0 @@ -// Tests 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. - -#include <std/string.h> -#include <iostream.h> -#include <std/cstdlib.h> -#include <std/cassert.h> - -string X = "Hello"; -string Y = "world"; -string N = "123"; -string c; -char* s = ","; - -void decltest() -{ - string x; - cout << "an empty string:" << x << "\n"; - assert(x == ""); - - string y = "Hello"; - cout << "A string initialized to Hello:" << y << "\n"; - assert(y == "Hello"); - - if (y[y.length()-1] == 'o') - y = y + '\n'; - assert(y == "Hello\n"); - y = "Hello"; - - string a = y; - cout << "A string initialized to previous string:" << a << "\n"; - assert(a == "Hello"); - assert(a == y); - - string b (a, 1, 2); - cout << "A string initialized to (previous string, 1, 2):" << b << "\n"; - assert(b == "el"); - - char ch = '@'; - string z (1, ch); - cout << "A string initialized to @:" << z << "\n"; - assert (z == "@"); - - string n ("20"); - cout << "A string initialized to 20:" << n << "\n"; - assert(n == "20"); - - int i = atoi(n.c_str ()); - double f = atof(n.c_str ()); - cout << "n = " << n << " atoi(n) = " << i << " atof(n) = " << f << "\n"; - assert(i == 20); - assert(f == 20); - -} - -void cattest() -{ - string x = X; - string y = Y; - string z = x + y; - cout << "z = x + y = " << z << "\n"; - assert(z == "Helloworld"); - - x += y; - cout << "x += y; x = " << x << "\n"; - assert(x == "Helloworld"); - - y = Y; - x = X; - y.insert (0, x); - cout << "y.insert (0, x); y = " << y << "\n"; - assert(y == "Helloworld"); - - y = Y; - x = X; - x = x + y + x; - cout << "x = x + y + x; x = " << x << "\n"; - assert(x == "HelloworldHello"); - - y = Y; - x = X; - x = y + x + x; - cout << "x = y + x + x; x = " << x << "\n"; - assert(x == "worldHelloHello"); - - x = X; - y = Y; - z = x + s + ' ' + y.substr (y.find ('w'), 1) + y.substr (y.find ('w') + 1) + "."; - cout << "z = x + s + + y.substr (y.find (w), 1) + y.substr (y.find (w) + 1) + . = " << z << "\n"; - assert(z == "Hello, world."); -} - -void comparetest() -{ - string x = X; - string y = Y; - string n = N; - string z = x + y; - - assert(x != y); - assert(x == "Hello"); - assert(x != z.substr (0, 4)); - assert(x.compare (y) < 0); - assert(x.compare (z.substr (0, 6)) < 0); - - assert(x.find ("lo") == 3); - assert(x.find ("l", 2) == 2); - assert(x.rfind ("l") == 3); -} - -void substrtest() -{ - string x = X; - - char ch = x[0]; - cout << "ch = x[0] = " << ch << "\n"; - assert(ch == 'H'); - - string z = x.substr (2, 3); - cout << "z = x.substr (2, 3) = " << z << "\n"; - assert(z == "llo"); - - x.replace (2, 2, "r"); - cout << "x.replace (2, 2, r); x = " << x << "\n"; - assert(x == "Hero"); - - x = X; - x.replace (0, 1, 'j'); - cout << "x.replace (0, 1, 'j'); x = " << x << "\n"; - assert(x == "jello"); -} - -void iotest() -{ - string z; - cout << "enter a word:"; - cin >> z; - cout << "word =" << z << " "; - cout << "length = " << z.length() << "\n"; -} - -void identitytest(string a, string b) -{ - string x = a; - string y = b; - x += b; - y.insert (0, a); - assert((a + b) == x); - assert((a + b) == y); - assert(x == y); - - assert((a + b + a) == (a + (b + a))); - - x.remove (x.rfind (b)); - assert(x == a); - - y.replace (0, y.rfind (b), b); - assert(y == (b + b)); - y.replace (y.find (b), b.length (), a); - assert(y == (a + b)); -} - -int main() -{ - decltest(); - cattest(); - comparetest(); - substrtest(); - identitytest(X, X); - identitytest(X, Y); - identitytest(X+Y+N+X+Y+N, "A string that will be used in identitytest but is otherwise just another useless string."); - iotest(); - cout << "\nEnd of test\n"; - return 0; -} diff --git a/contrib/libg++/libstdc++/tests/tstring.exp b/contrib/libg++/libstdc++/tests/tstring.exp deleted file mode 100644 index 3333ab1231d3..000000000000 --- a/contrib/libg++/libstdc++/tests/tstring.exp +++ /dev/null @@ -1,20 +0,0 @@ -an empty string: -A string initialized to Hello:Hello -A string initialized to previous string:Hello -A string initialized to (previous string, 1, 2):el -A string initialized to @:@ -A string initialized to 20:20 -n = 20 atoi(n) = 20 atof(n) = 20 -z = x + y = Helloworld -x += y; x = Helloworld -y.insert (0, x); y = Helloworld -x = x + y + x; x = HelloworldHello -x = y + x + x; x = worldHelloHello -z = x + s + + y.substr (y.find (w), 1) + y.substr (y.find (w) + 1) + . = Hello, world. -ch = x[0] = H -z = x.substr (2, 3) = llo -x.replace (2, 2, r); x = Hero -x.replace (0, 1, 'j'); x = jello -enter a word:word =abcdefghijklmnopqrstuvwxyz length = 26 - -End of test diff --git a/contrib/libg++/libstdc++/tests/tstring.inp b/contrib/libg++/libstdc++/tests/tstring.inp deleted file mode 100644 index b0883f382e1a..000000000000 --- a/contrib/libg++/libstdc++/tests/tstring.inp +++ /dev/null @@ -1 +0,0 @@ -abcdefghijklmnopqrstuvwxyz diff --git a/contrib/libg++/libstdc++/tests/tvector.cc b/contrib/libg++/libstdc++/tests/tvector.cc deleted file mode 100644 index ef238ef52da5..000000000000 --- a/contrib/libg++/libstdc++/tests/tvector.cc +++ /dev/null @@ -1,20 +0,0 @@ -#include <vector.h> -#include <iostream.h> -#include <algo.h> - -main () -{ - cout << "Fill of C array:\n"; - char x[50]; - fill (x, x+50, '/'); - fill (x+1, x+49, '*'); - copy (x, x+50, ostream_iterator<char>(cout)); - - cout << "\nFill of vector<char>:\n"; - - vector<char> cvec; - cvec.insert (cvec.begin(), 50, '/'); - fill (cvec.begin()+1, cvec.end()-1, '-'); - copy (cvec.begin(), cvec.end(), ostream_iterator<char>(cout)); - cout << endl; -} diff --git a/contrib/libg++/libstdc++/tests/tvector.exp b/contrib/libg++/libstdc++/tests/tvector.exp deleted file mode 100644 index 84a9d1bf3a4d..000000000000 --- a/contrib/libg++/libstdc++/tests/tvector.exp +++ /dev/null @@ -1,4 +0,0 @@ -Fill of C array: -/************************************************/ -Fill of vector<char>: -/------------------------------------------------/ diff --git a/contrib/libg++/libstdc++/typeinfo b/contrib/libg++/libstdc++/typeinfo deleted file mode 100644 index 93524ed18626..000000000000 --- a/contrib/libg++/libstdc++/typeinfo +++ /dev/null @@ -1,6 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __TYPEINFO__ -#include <std/typeinfo.h> -#endif diff --git a/contrib/libg++/libstdc++/typeinfoi.cc b/contrib/libg++/libstdc++/typeinfoi.cc deleted file mode 100644 index 8daa17764f4a..000000000000 --- a/contrib/libg++/libstdc++/typeinfoi.cc +++ /dev/null @@ -1,131 +0,0 @@ -// Methods for type_info for the -*- C++ -*- Run Time Type Identification. -// 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 Kung Hsu based upon the specification in the 20 September 1994 -// C++ working paper, ANSI document X3J16/94-0158. - -#ifdef __GNUG__ -#pragma implementation "std/typeinfo.h" -#endif - -#include <std/cstdlib.h> -#include <std/typeinfo.h> - -// Offset functions for the class type. - -// 0 is returned if the cast is invalid, otherwise the converted -// object pointer that points to the sub-object that is matched is -// returned. - -void* -__class_type_info::__rtti_match (const type_info& desired, int is_public, - void *objptr) const -{ - if (__rtti_compare (desired) == 0) - return objptr; - - void *match_found = 0; - for (int i = 0; i < n_bases; i++) { - if (is_public && access_list[i] != _RTTI_ACCESS_PUBLIC) - continue; - void *p = (char *)objptr + offset_list[i]; - if (is_virtual_list[i]) - p = *(void **)p; - - if ((p=base_list[i]->__rtti_match (desired, is_public, p)) - != 0) - if (match_found == 0) - match_found = p; - else if (match_found != p) { - // base found at two different pointers, - // conversion is not unique - return 0; - } - } - - return match_found; -} - -void* -__pointer_type_info::__rtti_match (const type_info& catch_type, int, - void *objptr) const -{ - if (catch_type.__rtti_get_node_type () == __rtti_get_node_type()) - { - type_info &sub_catch_type = ((__pointer_type_info&)catch_type).type; - type_info &sub_throw_type = ((__pointer_type_info*)this)->type; - if (sub_catch_type.__rtti_get_node_type () == _RTTI_BUILTIN_TYPE - && ((__builtin_type_info&)sub_catch_type).b_type == __builtin_type_info::_RTTI_BI_VOID) - { - return objptr; - } - if (sub_catch_type.__rtti_get_node_type () == _RTTI_ATTR_TYPE - && ((__attr_type_info&)sub_catch_type).attr == __attr_type_info::_RTTI_ATTR_CONST) - { - /* We have to allow a catch of const int* on a int * throw. */ - type_info &sub_sub_catch_type = ((__attr_type_info&)sub_catch_type).type; - return __throw_type_match_rtti (&sub_sub_catch_type, &sub_throw_type, objptr); - } - return __throw_type_match_rtti (&sub_catch_type, &sub_throw_type, objptr); - } - return 0; -} - -/* Low level match routine used by compiler to match types of catch variables and thrown - objects. */ -extern "C" -void* -__throw_type_match_rtti (void *catch_type_r, void *throw_type_r, void *objptr) -{ - type_info &catch_type = *(type_info*)catch_type_r; - type_info &throw_type = *(type_info*)throw_type_r; - void *new_objptr; - - if (catch_type == throw_type) - return objptr; - - /* Ensure we can call __rtti_match. */ - if ((throw_type.__rtti_get_node_type () != type_info::_RTTI_CLASS_TYPE - && throw_type.__rtti_get_node_type () != type_info::_RTTI_USER_TYPE - && throw_type.__rtti_get_node_type () != type_info::_RTTI_POINTER_TYPE) - || ((catch_type.__rtti_get_node_type () != type_info::_RTTI_CLASS_TYPE - && catch_type.__rtti_get_node_type () != type_info::_RTTI_USER_TYPE - && catch_type.__rtti_get_node_type () != type_info::_RTTI_POINTER_TYPE))) - return 0; - -#if 0 - printf ("We want to match a %s against a %s!\n", - throw_type.name (), catch_type.name ()); -#endif - - /* The 1 skips conversions to private bases. */ - new_objptr = throw_type.__rtti_match (catch_type, 1, objptr); -#if 0 - if (new_objptr) - printf ("It converts, delta is %d\n", new_objptr-objptr); -#endif - return new_objptr; -} - -bad_cast __bad_cast_object ("bad_cast"); diff --git a/contrib/libg++/libstdc++/utility b/contrib/libg++/libstdc++/utility deleted file mode 100644 index fb79aa782746..000000000000 --- a/contrib/libg++/libstdc++/utility +++ /dev/null @@ -1,8 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __UTILITY__ -#define __UTILITY__ -#include <function.h> -#include <pair.h> -#endif diff --git a/contrib/libg++/libstdc++/vector b/contrib/libg++/libstdc++/vector deleted file mode 100644 index 79f735937517..000000000000 --- a/contrib/libg++/libstdc++/vector +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- forwarding header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __VECTOR__ -#define __VECTOR__ -#include <vector.h> -#endif |