summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2004-08-12 16:41:42 +0000
committerkan <kan@FreeBSD.org>2004-08-12 16:41:42 +0000
commitd42790ccc00a70f00d10a3b8f17967a5b396bd4d (patch)
tree05895ca3fdba11097afd624bf6f64962995c416e /contrib/libstdc++
parentd42b9316c71d1b89b1b05d36be366eadf7bd8cdf (diff)
downloadFreeBSD-src-d42790ccc00a70f00d10a3b8f17967a5b396bd4d.zip
FreeBSD-src-d42790ccc00a70f00d10a3b8f17967a5b396bd4d.tar.gz
Remove files that are not part of GCC 3.4.x from the vendor branch.
Diffstat (limited to 'contrib/libstdc++')
-rw-r--r--contrib/libstdc++/NEWS9
-rw-r--r--contrib/libstdc++/cassert7
-rw-r--r--contrib/libstdc++/cctype7
-rw-r--r--contrib/libstdc++/cerrno7
-rw-r--r--contrib/libstdc++/cfloat7
-rw-r--r--contrib/libstdc++/cinst.cc154
-rw-r--r--contrib/libstdc++/ciso6467
-rw-r--r--contrib/libstdc++/climits7
-rw-r--r--contrib/libstdc++/clocale7
-rw-r--r--contrib/libstdc++/cmath76
-rw-r--r--contrib/libstdc++/cmathi.cc7
-rw-r--r--contrib/libstdc++/complex18
-rw-r--r--contrib/libstdc++/complex.h6
-rwxr-xr-xcontrib/libstdc++/config/abi/extract_symvers64
-rw-r--r--contrib/libstdc++/config/aix.ml9
-rw-r--r--contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h88
-rw-r--r--contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h70
-rw-r--r--contrib/libstdc++/config/dec-osf.ml6
-rw-r--r--contrib/libstdc++/config/delta.mt2
-rw-r--r--contrib/libstdc++/config/elf.ml8
-rw-r--r--contrib/libstdc++/config/elfshlibm.ml6
-rw-r--r--contrib/libstdc++/config/freebsd.ml6
-rw-r--r--contrib/libstdc++/config/gnu.ml6
-rw-r--r--contrib/libstdc++/config/hpux.ml6
-rw-r--r--contrib/libstdc++/config/io/basic_file_libio.cc194
-rw-r--r--contrib/libstdc++/config/io/basic_file_libio.h498
-rw-r--r--contrib/libstdc++/config/io/c_io_libio.h113
-rw-r--r--contrib/libstdc++/config/io/c_io_libio_codecvt.c153
-rw-r--r--contrib/libstdc++/config/irix5.ml6
-rw-r--r--contrib/libstdc++/config/linux.ml11
-rw-r--r--contrib/libstdc++/config/linux.mt2
-rw-r--r--contrib/libstdc++/config/openbsd.ml7
-rw-r--r--contrib/libstdc++/config/openbsd.mt3
-rw-r--r--contrib/libstdc++/config/posix.mt1
-rw-r--r--contrib/libstdc++/config/sol2pth.mt1
-rw-r--r--contrib/libstdc++/config/sol2shm.ml6
-rw-r--r--contrib/libstdc++/config/sol2solth.mt1
-rw-r--r--contrib/libstdc++/config/sunos4.ml9
-rw-r--r--contrib/libstdc++/config/x86-interix.ml9
-rw-r--r--contrib/libstdc++/configure.in554
-rw-r--r--contrib/libstdc++/configure.target200
-rw-r--r--contrib/libstdc++/csetjmp8
-rw-r--r--contrib/libstdc++/csignal7
-rw-r--r--contrib/libstdc++/cstdarg7
-rw-r--r--contrib/libstdc++/cstddef7
-rw-r--r--contrib/libstdc++/cstdio7
-rw-r--r--contrib/libstdc++/cstdlib23
-rw-r--r--contrib/libstdc++/cstdlibi.cc7
-rw-r--r--contrib/libstdc++/cstring96
-rw-r--r--contrib/libstdc++/cstringi.cc7
-rw-r--r--contrib/libstdc++/ctime7
-rw-r--r--contrib/libstdc++/cwchar7
-rw-r--r--contrib/libstdc++/cwctype7
-rw-r--r--contrib/libstdc++/fstream7
-rw-r--r--contrib/libstdc++/include/bits/fpos.h127
-rw-r--r--contrib/libstdc++/include/bits/pthread_allocimpl.h525
-rw-r--r--contrib/libstdc++/include/bits/stl_alloc.h974
-rw-r--r--contrib/libstdc++/include/bits/stl_pthread_alloc.h60
-rw-r--r--contrib/libstdc++/include/bits/valarray_meta.h1147
-rw-r--r--contrib/libstdc++/include/ext/stl_hash_fun.h126
-rw-r--r--contrib/libstdc++/include/ext/stl_hashtable.h996
-rw-r--r--contrib/libstdc++/include/ext/stl_rope.h2503
-rw-r--r--contrib/libstdc++/iomanip7
-rw-r--r--contrib/libstdc++/iosfwd15
-rw-r--r--contrib/libstdc++/iostream7
-rw-r--r--contrib/libstdc++/libio/ChangeLog2802
-rw-r--r--contrib/libstdc++/libio/Makefile.am67
-rw-r--r--contrib/libstdc++/libio/Makefile.in406
-rw-r--r--contrib/libstdc++/libio/_G_config.h136
-rw-r--r--contrib/libstdc++/libio/filedoalloc.c101
-rw-r--r--contrib/libstdc++/libio/fileops.c1049
-rw-r--r--contrib/libstdc++/libio/genops.c1123
-rw-r--r--contrib/libstdc++/libio/iofclose.c97
-rw-r--r--contrib/libstdc++/libio/iofopen.c78
-rw-r--r--contrib/libstdc++/libio/iofwide.c476
-rw-r--r--contrib/libstdc++/libio/iolibio.h82
-rw-r--r--contrib/libstdc++/libio/libio.h511
-rw-r--r--contrib/libstdc++/libio/libioP.h821
-rw-r--r--contrib/libstdc++/libio/stdfiles.c71
-rw-r--r--contrib/libstdc++/libio/stdio.c43
-rw-r--r--contrib/libstdc++/libio/wfiledoalloc.c108
-rw-r--r--contrib/libstdc++/libio/wfileops.c754
-rw-r--r--contrib/libstdc++/libio/wgenops.c756
-rw-r--r--contrib/libstdc++/libmath/nan.c36
-rwxr-xr-xcontrib/libstdc++/mkcheck.in448
-rw-r--r--contrib/libstdc++/sinst.cc135
-rw-r--r--contrib/libstdc++/src/bitset.cc219
-rw-r--r--contrib/libstdc++/src/cmath.cc47
-rw-r--r--contrib/libstdc++/src/fstream.cc202
-rw-r--r--contrib/libstdc++/src/globals.cc317
-rw-r--r--contrib/libstdc++/src/stl-inst.cc43
-rw-r--r--contrib/libstdc++/src/vterminate.cc82
-rw-r--r--contrib/libstdc++/sstream343
-rw-r--r--contrib/libstdc++/std/bastring.cc524
-rw-r--r--contrib/libstdc++/std/bastring.h657
-rw-r--r--contrib/libstdc++/std/complext.cc273
-rw-r--r--contrib/libstdc++/std/complext.h400
-rw-r--r--contrib/libstdc++/std/dcomplex.h91
-rw-r--r--contrib/libstdc++/std/fcomplex.h87
-rw-r--r--contrib/libstdc++/std/gslice.h111
-rw-r--r--contrib/libstdc++/std/gslice_array.h170
-rw-r--r--contrib/libstdc++/std/indirect_array.h157
-rw-r--r--contrib/libstdc++/std/ldcomplex.h95
-rw-r--r--contrib/libstdc++/std/mask_array.h154
-rw-r--r--contrib/libstdc++/std/slice.h76
-rw-r--r--contrib/libstdc++/std/slice_array.h156
-rw-r--r--contrib/libstdc++/std/std_valarray.h728
-rw-r--r--contrib/libstdc++/std/straits.h161
-rw-r--r--contrib/libstdc++/std/valarray_array.h346
-rw-r--r--contrib/libstdc++/std/valarray_array.tcc130
-rw-r--r--contrib/libstdc++/std/valarray_meta.h1046
-rw-r--r--contrib/libstdc++/stdexcept97
-rw-r--r--contrib/libstdc++/stdexcepti.cc21
-rw-r--r--contrib/libstdc++/stl.h15
-rw-r--r--contrib/libstdc++/stl/ChangeLog381
-rw-r--r--contrib/libstdc++/stl/README13
-rw-r--r--contrib/libstdc++/stl/algo.h114
-rw-r--r--contrib/libstdc++/stl/algobase.h71
-rw-r--r--contrib/libstdc++/stl/algorithm40
-rw-r--r--contrib/libstdc++/stl/alloc.h46
-rw-r--r--contrib/libstdc++/stl/bitset1066
-rw-r--r--contrib/libstdc++/stl/bvector.h51
-rw-r--r--contrib/libstdc++/stl/defalloc.h87
-rw-r--r--contrib/libstdc++/stl/deque40
-rw-r--r--contrib/libstdc++/stl/deque.h42
-rw-r--r--contrib/libstdc++/stl/function.h118
-rw-r--r--contrib/libstdc++/stl/functional26
-rw-r--r--contrib/libstdc++/stl/hash_map40
-rw-r--r--contrib/libstdc++/stl/hash_map.h49
-rw-r--r--contrib/libstdc++/stl/hash_set40
-rw-r--r--contrib/libstdc++/stl/hash_set.h44
-rw-r--r--contrib/libstdc++/stl/hashtable.h48
-rw-r--r--contrib/libstdc++/stl/heap.h46
-rw-r--r--contrib/libstdc++/stl/iterator44
-rw-r--r--contrib/libstdc++/stl/iterator.h104
-rw-r--r--contrib/libstdc++/stl/list40
-rw-r--r--contrib/libstdc++/stl/list.h42
-rw-r--r--contrib/libstdc++/stl/map40
-rw-r--r--contrib/libstdc++/stl/map.h41
-rw-r--r--contrib/libstdc++/stl/memory108
-rw-r--r--contrib/libstdc++/stl/multimap.h41
-rw-r--r--contrib/libstdc++/stl/multiset.h41
-rw-r--r--contrib/libstdc++/stl/numeric42
-rw-r--r--contrib/libstdc++/stl/pair.h51
-rw-r--r--contrib/libstdc++/stl/pthread_alloc479
-rw-r--r--contrib/libstdc++/stl/pthread_alloc.h31
-rw-r--r--contrib/libstdc++/stl/queue45
-rw-r--r--contrib/libstdc++/stl/rope32
-rw-r--r--contrib/libstdc++/stl/rope.h34
-rw-r--r--contrib/libstdc++/stl/ropeimpl.h1550
-rw-r--r--contrib/libstdc++/stl/set40
-rw-r--r--contrib/libstdc++/stl/set.h41
-rw-r--r--contrib/libstdc++/stl/slist28
-rw-r--r--contrib/libstdc++/stl/slist.h30
-rw-r--r--contrib/libstdc++/stl/stack41
-rw-r--r--contrib/libstdc++/stl/stack.h46
-rw-r--r--contrib/libstdc++/stl/stl_algo.h2894
-rw-r--r--contrib/libstdc++/stl/stl_algobase.h526
-rw-r--r--contrib/libstdc++/stl/stl_alloc.h1057
-rw-r--r--contrib/libstdc++/stl/stl_bvector.h838
-rw-r--r--contrib/libstdc++/stl/stl_config.h356
-rw-r--r--contrib/libstdc++/stl/stl_construct.h90
-rw-r--r--contrib/libstdc++/stl/stl_deque.h1698
-rw-r--r--contrib/libstdc++/stl/stl_function.h700
-rw-r--r--contrib/libstdc++/stl/stl_hash_fun.h93
-rw-r--r--contrib/libstdc++/stl/stl_hash_map.h416
-rw-r--r--contrib/libstdc++/stl/stl_hash_set.h401
-rw-r--r--contrib/libstdc++/stl/stl_hashtable.h1039
-rw-r--r--contrib/libstdc++/stl/stl_heap.h281
-rw-r--r--contrib/libstdc++/stl/stl_iterator.h915
-rw-r--r--contrib/libstdc++/stl/stl_list.h840
-rw-r--r--contrib/libstdc++/stl/stl_map.h242
-rw-r--r--contrib/libstdc++/stl/stl_multimap.h232
-rw-r--r--contrib/libstdc++/stl/stl_multiset.h224
-rw-r--r--contrib/libstdc++/stl/stl_numeric.h239
-rw-r--r--contrib/libstdc++/stl/stl_pair.h77
-rw-r--r--contrib/libstdc++/stl/stl_queue.h202
-rw-r--r--contrib/libstdc++/stl/stl_raw_storage_iter.h81
-rw-r--r--contrib/libstdc++/stl/stl_relops.h62
-rw-r--r--contrib/libstdc++/stl/stl_rope.h2541
-rw-r--r--contrib/libstdc++/stl/stl_set.h216
-rw-r--r--contrib/libstdc++/stl/stl_slist.h945
-rw-r--r--contrib/libstdc++/stl/stl_stack.h111
-rw-r--r--contrib/libstdc++/stl/stl_tempbuf.h156
-rw-r--r--contrib/libstdc++/stl/stl_tree.h1333
-rw-r--r--contrib/libstdc++/stl/stl_uninitialized.h279
-rw-r--r--contrib/libstdc++/stl/stl_vector.h823
-rw-r--r--contrib/libstdc++/stl/tempbuf.h61
-rw-r--r--contrib/libstdc++/stl/tree.h46
-rw-r--r--contrib/libstdc++/stl/type_traits.h373
-rw-r--r--contrib/libstdc++/stl/utility38
-rw-r--r--contrib/libstdc++/stl/vector41
-rw-r--r--contrib/libstdc++/stl/vector.h42
-rw-r--r--contrib/libstdc++/stlinst.cc10
-rw-r--r--contrib/libstdc++/string13
-rw-r--r--contrib/libstdc++/strstream7
-rw-r--r--contrib/libstdc++/tests/ChangeLog132
-rw-r--r--contrib/libstdc++/tests/Makefile.in35
-rw-r--r--contrib/libstdc++/tests/configure.in65
-rw-r--r--contrib/libstdc++/tests/tcomplex.cc151
-rw-r--r--contrib/libstdc++/tests/tcomplex.exp37
-rw-r--r--contrib/libstdc++/tests/tcomplex.inp1
-rw-r--r--contrib/libstdc++/tests/tlist.cc151
-rw-r--r--contrib/libstdc++/tests/tlist.exp44
-rw-r--r--contrib/libstdc++/tests/tmap.cc59
-rw-r--r--contrib/libstdc++/tests/tmap.exp7
-rw-r--r--contrib/libstdc++/tests/tstring.cc249
-rw-r--r--contrib/libstdc++/tests/tstring.exp22
-rw-r--r--contrib/libstdc++/tests/tstring.inp1
-rw-r--r--contrib/libstdc++/tests/tvector.cc20
-rw-r--r--contrib/libstdc++/tests/tvector.exp4
-rw-r--r--contrib/libstdc++/testsuite/ChangeLog94
-rw-r--r--contrib/libstdc++/testsuite/Makefile.in428
-rw-r--r--contrib/libstdc++/testsuite/config/default.exp21
-rw-r--r--contrib/libstdc++/testsuite/configure.in24
-rw-r--r--contrib/libstdc++/testsuite/lib/libstdc++.exp179
-rw-r--r--contrib/libstdc++/testsuite/libstdc++.tests/test.exp34
-rwxr-xr-xcontrib/libstdc++/testsuite_flags.in61
-rw-r--r--contrib/libstdc++/valarray8
-rw-r--r--contrib/libstdc++/valarray.cc50
220 files changed, 0 insertions, 53658 deletions
diff --git a/contrib/libstdc++/NEWS b/contrib/libstdc++/NEWS
deleted file mode 100644
index 89e866e..0000000
--- a/contrib/libstdc++/NEWS
+++ /dev/null
@@ -1,9 +0,0 @@
-SUMMARY OF RECENT MAJOR CHANGES to LIBSTDC++.
-(Also check ../libio/NEWS.)
-
-*** Noteworthy changes in libstdc++ for EGCS
-
-* EGCS includes the SGI STL implementation without changes.
-
-* As a result of these and other changes, libstc++ for EGCS is not binary
- compatible with previous releases of libstdc++.
diff --git a/contrib/libstdc++/cassert b/contrib/libstdc++/cassert
deleted file mode 100644
index b4165bf..0000000
--- a/contrib/libstdc++/cassert
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __CASSERT__
-#define __CASSERT__
-#include <assert.h>
-#endif
diff --git a/contrib/libstdc++/cctype b/contrib/libstdc++/cctype
deleted file mode 100644
index e2765ae..0000000
--- a/contrib/libstdc++/cctype
+++ /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/libstdc++/cerrno b/contrib/libstdc++/cerrno
deleted file mode 100644
index ce49346..0000000
--- a/contrib/libstdc++/cerrno
+++ /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/libstdc++/cfloat b/contrib/libstdc++/cfloat
deleted file mode 100644
index cf59ead..0000000
--- a/contrib/libstdc++/cfloat
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __CFLOAT__
-#define __CFLOAT__
-#include <float.h>
-#endif
diff --git a/contrib/libstdc++/cinst.cc b/contrib/libstdc++/cinst.cc
deleted file mode 100644
index 983e8a9..0000000
--- a/contrib/libstdc++/cinst.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-// Instantiation file for the -*- C++ -*- complex number classes.
-// Copyright (C) 1994 Free Software Foundation
-
-#ifdef F
-typedef float f;
-#endif
-#ifdef D
-typedef double f;
-#endif
-#ifdef LD
-typedef long double f;
-#endif
-
-#if defined (MAIN) && defined (__GNUG__)
-#ifdef F
-#pragma implementation "fcomplex"
-#endif
-#ifdef D
-#pragma implementation "dcomplex"
-#endif
-#ifdef LD
-#pragma implementation "ldcomplex"
-#endif
-#endif
-
-#if 0
-#define _G_NO_EXTERN_TEMPLATES
-#endif
-#include <std/complext.cc>
-
-typedef complex<f> c;
-typedef const c& ccr;
-
-#ifdef MAIN
-template c& __doapl (c*, ccr);
-template c& __doaml (c*, ccr);
-template c& __doami (c*, ccr);
-template c& __doadv (c*, ccr);
-#endif
-
-#ifdef ADDCC
-template c operator+ (ccr, ccr);
-#endif
-#ifdef ADDCF
-template c operator+ (ccr, f);
-#endif
-#ifdef ADDFC
-template c operator+ (f, ccr);
-#endif
-#ifdef SUBCC
-template c operator- (ccr, ccr);
-#endif
-#ifdef SUBCF
-template c operator- (ccr, f);
-#endif
-#ifdef SUBFC
-template c operator- (f, ccr);
-#endif
-#ifdef MULCC
-template c operator* (ccr, ccr);
-#endif
-#ifdef MULCF
-template c operator* (ccr, f);
-#endif
-#ifdef MULFC
-template c operator* (f, ccr);
-#endif
-#ifdef DIVCC
-template c operator/ (ccr, ccr);
-#endif
-#ifdef DIVCF
-template c operator/ (ccr, f);
-#endif
-#ifdef DIVFC
-template c operator/ (f, ccr);
-#endif
-#ifdef PLUS
-template c operator+ (ccr);
-#endif
-#ifdef MINUS
-template c operator- (ccr);
-#endif
-#ifdef EQCC
-template bool operator== (ccr, ccr);
-#endif
-#ifdef EQCF
-template bool operator== (ccr, f);
-#endif
-#ifdef EQFC
-template bool operator== (f, ccr);
-#endif
-#ifdef NECC
-template bool operator!= (ccr, ccr);
-#endif
-#ifdef NECF
-template bool operator!= (ccr, f);
-#endif
-#ifdef NEFC
-template bool operator!= (f, ccr);
-#endif
-#ifdef ABS
-template f abs (ccr);
-#endif
-#ifdef ARG
-template f arg (ccr);
-#endif
-#ifdef POLAR
-template c polar (f, f);
-#endif
-#ifdef CONJ
-template c conj (ccr);
-#endif
-#ifdef NORM
-template f norm (ccr);
-#endif
-#ifdef COS
-template c cos (ccr);
-#endif
-#ifdef COSH
-template c cosh (ccr);
-#endif
-#ifdef EXP
-template c exp (ccr);
-#endif
-#ifdef LOG
-template c log (ccr);
-#endif
-#ifdef POWCC
-template c pow (ccr, ccr);
-#endif
-#ifdef POWCF
-template c pow (ccr, f);
-#endif
-#ifdef POWCI
-template c pow (ccr, int);
-#endif
-#ifdef POWFC
-template c pow (f, ccr);
-#endif
-#ifdef SIN
-template c sin (ccr);
-#endif
-#ifdef SINH
-template c sinh (ccr);
-#endif
-#ifdef SQRT
-template c sqrt (ccr);
-#endif
-#ifdef EXTRACT
-template istream& operator>> (istream&, complex<f>&);
-#endif
-#ifdef INSERT
-template ostream& operator<< (ostream&, const complex<f>&);
-#endif
diff --git a/contrib/libstdc++/ciso646 b/contrib/libstdc++/ciso646
deleted file mode 100644
index 4d8200d..0000000
--- a/contrib/libstdc++/ciso646
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __CISO646__
-#define __CISO646__
-#include <iso646.h>
-#endif
diff --git a/contrib/libstdc++/climits b/contrib/libstdc++/climits
deleted file mode 100644
index 1b29b3a..0000000
--- a/contrib/libstdc++/climits
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __CLIMITS__
-#define __CLIMITS__
-#include <limits.h>
-#endif
diff --git a/contrib/libstdc++/clocale b/contrib/libstdc++/clocale
deleted file mode 100644
index b67cf31..0000000
--- a/contrib/libstdc++/clocale
+++ /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/libstdc++/cmath b/contrib/libstdc++/cmath
deleted file mode 100644
index b18ea0b..0000000
--- a/contrib/libstdc++/cmath
+++ /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 "cmath"
-#endif
-
-extern "C++" {
-#if 0
-float acos (float);
-float asin (float);
-float atan (float);
-float atan2(float, float);
-float ceil (float);
-float cos (float);
-float cosh (float);
-float exp (float);
-float fabs (float);
-float floor(float);
-float fmod (float, float);
-float frexp(float, int*);
-float modf (float, float*);
-float ldexp(float, int);
-float log (float);
-float log10(float);
-float pow (float, float);
-float pow (float, int);
-float sin (float);
-float sinh (float);
-float sqrt (float);
-float tan (float);
-float tanh (float);
-#endif
-
-inline float abs (float x) { return fabs (x); }
-#if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */
-inline double abs (double x) { return fabs (x); }
-#endif
-
-#if 0
-double pow(double, int);
-
-long double acos (long double);
-long double asin (long double);
-long double atan (long double);
-long double atan2(long double, long double);
-long double ceil (long double);
-long double cos (long double);
-long double cosh (long double);
-long double exp (long double);
-long double fabs (long double);
-long double floor(long double);
-long double frexp(long double, int*);
-long double fmod (long double, long double);
-long double frexp(long double, int*);
-long double log (long double);
-long double log10(long double);
-long double modf (long double, long double*);
-long double pow (long double, long double);
-long double pow (long double, int);
-long double sin (long double);
-long double sinh (long double);
-long double sqrt (long double);
-long double tan (long double);
-long double tanh (long double);
-#endif
-inline long double abs (long double x) { return fabs (x); }
-
-} // extern "C++"
-
-#endif
diff --git a/contrib/libstdc++/cmathi.cc b/contrib/libstdc++/cmathi.cc
deleted file mode 100644
index afd740f..0000000
--- a/contrib/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 "cmath"
-#endif
-#include <cmath>
diff --git a/contrib/libstdc++/complex b/contrib/libstdc++/complex
deleted file mode 100644
index bfdd352..0000000
--- a/contrib/libstdc++/complex
+++ /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/libstdc++/complex.h b/contrib/libstdc++/complex.h
deleted file mode 100644
index 2e88de8..0000000
--- a/contrib/libstdc++/complex.h
+++ /dev/null
@@ -1,6 +0,0 @@
-// -*- C++ -*- backward compatiblity header.
-// Copyright (C) 1994 Free Software Foundation
-
-#ifndef __COMPLEX_H__
-#include <complex>
-#endif
diff --git a/contrib/libstdc++/config/abi/extract_symvers b/contrib/libstdc++/config/abi/extract_symvers
deleted file mode 100755
index e7b6645..0000000
--- a/contrib/libstdc++/config/abi/extract_symvers
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2002 Free Software Foundation, Inc.
-#
-# This file is part of the GNU ISO C++ Library. This library is free
-# software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this library; see the file COPYING. If not, write to the Free
-# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-# USA.
-#
-# As a special exception, you may use this file as part of a free software
-# library without restriction. Specifically, if other files instantiate
-# templates or use macros or inline functions from this file, or you compile
-# this file and link it with other files to produce an executable, this
-# file does not by itself cause the resulting executable to be covered by
-# the GNU General Public License. This exception does not however
-# invalidate any other reasons why the executable file might be covered by
-# the GNU General Public License.
-
-
-if test ${#} -lt 2 || test $1 = '--help'; then
- echo "Usage: extract_symvers shared_lib output_file" 1>&2
- exit 1
-fi
-
-lib=$1
-output=$2
-
-# GNU binutils, somewhere after version 2.11.2, requires -W/--wide to avoid
-# default line truncation. -W is not supported and truncation did not occur
-# by default before that point.
-readelf="readelf --symbols"
-if readelf --help | grep -- --wide > /dev/null; then
- readelf="$readelf --wide"
-fi
-
-# This avoids weird sorting problems later.
-export LC_ALL=C
-
-tmp=extract.$$
-
-${readelf} ${lib} | sed '/\.dynsym/,/^$/p;d' | egrep -v ' (LOCAL|UND) ' |\
-awk '{ if ($4 == "FUNC" || $4 == "NOTYPE")
- printf "%s:%s\n", $4, $8;
- else if ($4 == "OBJECT")
- printf "%s:%s:%s\n", $4, $3, $8;
- }' | sort | uniq > $tmp 2>&1
-# else printf "Huh? What is %s?\n", $8;
-
-
-# I think we'll be doing some more with this file, but for now, dump.
-mv $tmp $output
-
-exit 0
diff --git a/contrib/libstdc++/config/aix.ml b/contrib/libstdc++/config/aix.ml
deleted file mode 100644
index dec7a90..0000000
--- a/contrib/libstdc++/config/aix.ml
+++ /dev/null
@@ -1,9 +0,0 @@
-# AIX has wierd shared/non-shared libraries.
-
-ARLIB = libstdc++-ar.a.$(VERSION)
-ARLINK = libstdc++-ar.a
-SHLINK = libstdc++.a
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
-DEPLIBS = ../$(SHLIB)
-SHDEPS = -lm
-SHFLAGS = -Wl,-unix
diff --git a/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h b/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h
deleted file mode 100644
index aa639e4..0000000
--- a/contrib/libstdc++/config/cpu/sparc/sparc32/bits/atomicity.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Low-level functions for atomic operations: Sparc32 version -*- C++ -*-
-
-// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _BITS_ATOMICITY_H
-#define _BITS_ATOMICITY_H 1
-
-typedef int _Atomic_word;
-
-template <int __inst>
-struct __Atomicity_lock
-{
- static unsigned char _S_atomicity_lock;
-};
-
-template <int __inst>
-unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
-
-template unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
-
-static int
-__attribute__ ((__unused__))
-__exchange_and_add (volatile _Atomic_word* __mem, int __val)
-{
- _Atomic_word __result, __tmp;
-
- __asm__ __volatile__("1: ldstub [%1], %0\n\t"
- " cmp %0, 0\n\t"
- " bne 1b\n\t"
- " nop"
- : "=&r" (__tmp)
- : "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
- : "memory");
- __result = *__mem;
- *__mem += __val;
- __asm__ __volatile__("stb %%g0, [%0]"
- : /* no outputs */
- : "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
- : "memory");
- return __result;
-}
-
-static void
-__attribute__ ((__unused__))
-__atomic_add (volatile _Atomic_word* __mem, int __val)
-{
- _Atomic_word __tmp;
-
- __asm__ __volatile__("1: ldstub [%1], %0\n\t"
- " cmp %0, 0\n\t"
- " bne 1b\n\t"
- " nop"
- : "=&r" (__tmp)
- : "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
- : "memory");
- *__mem += __val;
- __asm__ __volatile__("stb %%g0, [%0]"
- : /* no outputs */
- : "r" (&__Atomicity_lock<0>::_S_atomicity_lock)
- : "memory");
-}
-
-#endif /* atomicity.h */
diff --git a/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h b/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h
deleted file mode 100644
index e13ca82..0000000
--- a/contrib/libstdc++/config/cpu/sparc/sparc64/bits/atomicity.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Low-level functions for atomic operations: Sparc64 version -*- C++ -*-
-
-// Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#ifndef _BITS_ATOMICITY_H
-#define _BITS_ATOMICITY_H 1
-
-typedef long _Atomic_word;
-
-static inline _Atomic_word
-__attribute__ ((__unused__))
-__exchange_and_add (volatile _Atomic_word *__mem, int __val)
-{
- _Atomic_word __tmp1, __tmp2;
-
- __asm__ __volatile__("1: ldx [%2], %0\n\t"
- " add %0, %3, %1\n\t"
- " casx [%2], %0, %1\n\t"
- " sub %0, %1, %0\n\t"
- " brnz,pn %0, 1b\n\t"
- " nop"
- : "=&r" (__tmp1), "=&r" (__tmp2)
- : "r" (__mem), "r" (__val)
- : "memory");
- return __tmp2;
-}
-
-static inline void
-__attribute__ ((__unused__))
-__atomic_add (volatile _Atomic_word* __mem, int __val)
-{
- _Atomic_word __tmp1, __tmp2;
-
- __asm__ __volatile__("1: ldx [%2], %0\n\t"
- " add %0, %3, %1\n\t"
- " casx [%2], %0, %1\n\t"
- " sub %0, %1, %0\n\t"
- " brnz,pn %0, 1b\n\t"
- " nop"
- : "=&r" (__tmp1), "=&r" (__tmp2)
- : "r" (__mem), "r" (__val)
- : "memory");
-}
-
-#endif /* atomicity.h */
diff --git a/contrib/libstdc++/config/dec-osf.ml b/contrib/libstdc++/config/dec-osf.ml
deleted file mode 100644
index a11f373..0000000
--- a/contrib/libstdc++/config/dec-osf.ml
+++ /dev/null
@@ -1,6 +0,0 @@
-# We don't need -fpic on the alpha, so let's install both the shared and
-# non-shared versions.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
-DEPLIBS = ../$(SHLIB)
-SHDEPS = -lm
diff --git a/contrib/libstdc++/config/delta.mt b/contrib/libstdc++/config/delta.mt
deleted file mode 100644
index b0b36db..0000000
--- a/contrib/libstdc++/config/delta.mt
+++ /dev/null
@@ -1,2 +0,0 @@
-# If FPU instructions are generated by default, we have to use a special libm.a
-MLDLIBS = $(LDLIBS) `case "$(CXXFLAGS)" in *-m68000* | *-mc68000* | *-msoft-float* ) echo -lm ;; * ) echo -lm881 ;; esac`
diff --git a/contrib/libstdc++/config/elf.ml b/contrib/libstdc++/config/elf.ml
deleted file mode 100644
index bd711de..0000000
--- a/contrib/libstdc++/config/elf.ml
+++ /dev/null
@@ -1,8 +0,0 @@
-# Elf without shared libm -- we have to link with the archive library, even
-# for programs that don't use complex.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
-SHFLAGS = -h $(SHLIB)
-DEPLIBS = ../$(SHLIB)
-LDLIBS = -L.. -lstdc++ -lm
-MLDLIBS = -L.. -lstdc++ -lm
diff --git a/contrib/libstdc++/config/elfshlibm.ml b/contrib/libstdc++/config/elfshlibm.ml
deleted file mode 100644
index 826f0bc..0000000
--- a/contrib/libstdc++/config/elfshlibm.ml
+++ /dev/null
@@ -1,6 +0,0 @@
-# Elf with shared libm, so we can link it into the shared libstdc++.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
-SHFLAGS = -h $(SHLIB)
-SHDEPS = -lm
-DEPLIBS = ../$(SHLIB)
diff --git a/contrib/libstdc++/config/freebsd.ml b/contrib/libstdc++/config/freebsd.ml
deleted file mode 100644
index 3ee6826..0000000
--- a/contrib/libstdc++/config/freebsd.ml
+++ /dev/null
@@ -1,6 +0,0 @@
-# Elf with shared libm, so we can link it into the shared libstdc++.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink
-SHFLAGS = -Wl,-soname,$(MSHLINK)
-SHDEPS = -lm
-DEPLIBS = ../$(SHLIB)
diff --git a/contrib/libstdc++/config/gnu.ml b/contrib/libstdc++/config/gnu.ml
deleted file mode 100644
index 2a03803..0000000
--- a/contrib/libstdc++/config/gnu.ml
+++ /dev/null
@@ -1,6 +0,0 @@
-# Elf with shared libm, so we can link it into the shared libstdc++.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
-SHFLAGS = -Wl,-soname,$(SHLIB)
-SHDEPS = -lm
-DEPLIBS = ../$(SHLIB)
diff --git a/contrib/libstdc++/config/hpux.ml b/contrib/libstdc++/config/hpux.ml
deleted file mode 100644
index a39602a..0000000
--- a/contrib/libstdc++/config/hpux.ml
+++ /dev/null
@@ -1,6 +0,0 @@
-# HPUX uses the .sl suffix for shared libraries.
-
-SHLIB = libstdc++.sl
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB)
-DEPLIBS = ../$(SHLIB)
-SHFLAGS = $(PICFLAG)
diff --git a/contrib/libstdc++/config/io/basic_file_libio.cc b/contrib/libstdc++/config/io/basic_file_libio.cc
deleted file mode 100644
index 60eb006..0000000
--- a/contrib/libstdc++/config/io/basic_file_libio.cc
+++ /dev/null
@@ -1,194 +0,0 @@
-// Wrapper of C-language FILE struct -*- C++ -*-
-
-// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 27.8 File-based streams
-//
-
-#include <bits/basic_file.h>
-
-namespace std
-{
- // __basic_file<char> definitions
- __basic_file<char>::__basic_file(__c_lock* __lock)
- {
-#ifdef _IO_MTSAFE_IO
- _lock = __lock;
-#endif
- // Don't set the orientation of the stream when initializing.
-#ifdef _GLIBCPP_USE_WCHAR_T
- _IO_no_init(this, 0, 0, &_M_wfile, 0);
-#else /* !defined(_GLIBCPP_USE_WCHAR_T) */
- _IO_no_init(this, 0, 0, NULL, 0);
-#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
- _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_file_jumps;
- _IO_file_init((_IO_FILE_plus*)this);
- }
-
- // NB: Unused.
- int
- __basic_file<char>::overflow(int __c)
- { return _IO_file_overflow(this, __c); }
-
- // NB: Unused.
- int
- __basic_file<char>::underflow()
- { return _IO_file_underflow(this); }
-
- // NB: Unused.
- int
- __basic_file<char>::uflow()
- { return _IO_default_uflow(this); }
-
- // NB: Unused.
- int
- __basic_file<char>::pbackfail(int __c)
- { return _IO_default_pbackfail(this, __c); }
-
- streamsize
- __basic_file<char>::xsputn(const char* __s, streamsize __n)
- { return _IO_file_xsputn(this, __s, __n); }
-
- streamoff
- __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
- ios_base::openmode __mode)
- { return _IO_file_seekoff(this, __off, __way, __mode); }
-
- streamoff
- __basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode)
- { return _IO_file_seekoff(this, __pos, ios_base::beg, __mode); }
-
- // NB: Unused.
- streambuf*
- __basic_file<char>::setbuf(char* __b, int __len)
- { return (streambuf*) _IO_file_setbuf(this,__b, __len); }
-
- int
- __basic_file<char>::sync()
- { return _IO_file_sync(this); }
-
- // NB: Unused.
- int
- __basic_file<char>::doallocate()
- { return _IO_file_doallocate(this); }
-
- // __basic_file<wchar_t> definitions
-#ifdef _GLIBCPP_USE_WCHAR_T
- __basic_file<wchar_t>::__basic_file(__c_lock* __lock)
- {
-#ifdef _IO_MTSAFE_IO
- _lock = __lock;
-#endif
- // Don't set the orientation of the stream when initializing.
- _IO_no_init(this, 0, 0, &_M_wfile, &_IO_wfile_jumps);
- _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_wfile_jumps;
- _IO_file_init((_IO_FILE_plus*)this);
-
- // In addition, need to allocate the buffer...
- _IO_wdoallocbuf(this);
- // Setup initial positions for this buffer...
- // if (!(_flags & _IO_NO_READS))
- _IO_wsetg(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base,
- _wide_data->_IO_buf_base);
- // if (!(_flags & _IO_NO_WRITES))
- _IO_wsetp(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base);
-
- // Setup codecvt bits...
- _codecvt = &__c_libio_codecvt;
-
- // Do the same for narrow bits...
- if (_IO_write_base == NULL)
- {
- _IO_doallocbuf(this);
- // if (!(_flags & _IO_NO_READS))
- _IO_setg(this, _IO_buf_base, _IO_buf_base, _IO_buf_base);
- // if (!(_flags & _IO_NO_WRITES))
- _IO_setp(this, _IO_buf_base, _IO_buf_base);
- }
- }
-
- int
- __basic_file<wchar_t>::overflow(int __c)
- { return _IO_wfile_overflow(this, __c); }
-
- int
- __basic_file<wchar_t>::underflow()
- { return _IO_wfile_underflow(this); }
-
- // NB: Unused.
- int
- __basic_file<wchar_t>::uflow()
- { return _IO_wdefault_uflow(this); }
-
- // NB: Unused.
- int
- __basic_file<wchar_t>::pbackfail(int __c)
- { return _IO_wdefault_pbackfail(this, __c); }
-
- streamsize
- __basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n)
- { return _IO_wfile_xsputn(this, __s, __n); }
-
- streamoff
- __basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way,
- ios_base::openmode __mode)
- { return _IO_wfile_seekoff(this, __off, __way, __mode); }
-
- streamoff
- __basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode)
- { return _IO_wfile_seekoff(this, __pos, ios_base::beg, __mode); }
-
- streambuf*
- __basic_file<wchar_t>::setbuf(wchar_t* __b, int __len)
- { return (streambuf*) _IO_wfile_setbuf(this,__b, __len); }
-
- int
- __basic_file<wchar_t>::sync()
- { return _IO_wfile_sync(this); }
-
- int
- __basic_file<wchar_t>::doallocate()
- { return _IO_wfile_doallocate(this); }
-#endif
-
- // Need to instantiate base class here for type-info bits, etc
- template struct __basic_file_base<char>;
- template class __basic_file<char>;
-#ifdef _GLIBCPP_USE_WCHAR_T
- template struct __basic_file_base<wchar_t>;
- template class __basic_file<wchar_t>;
-#endif
-} // namespace std
-
-
-
-
-
-
-
diff --git a/contrib/libstdc++/config/io/basic_file_libio.h b/contrib/libstdc++/config/io/basic_file_libio.h
deleted file mode 100644
index 57d83c4..0000000
--- a/contrib/libstdc++/config/io/basic_file_libio.h
+++ /dev/null
@@ -1,498 +0,0 @@
-// Wrapper of C-language FILE struct -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 27.8 File-based streams
-//
-
-/** @file basic_file.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_BASIC_FILE
-#define _CPP_BASIC_FILE 1
-
-#pragma GCC system_header
-
-#include <bits/c++config.h>
-#include <ios>
-#include <libioP.h>
-
-namespace std
-{
- // Ulrich is going to make some detailed comment here, explaining
- // all this unpleasantness, providing detailed performance analysis
- // as to why we have to do all this lame vtable hacking instead of a
- // sane, function-based approach. This verbiage will provide a clear
- // and detailed description of the whole object-layout,
- // vtable-swapping, sordid history of this hack.
- template<typename _CharT>
- struct __basic_file_base: public __c_file_type
- {
- virtual
- ~__basic_file_base() { };
-
- virtual int
- overflow(int __c = EOF) = 0;
-
- virtual int
- underflow() = 0;
-
- virtual int
- uflow() = 0;
-
- virtual int
- pbackfail(int __c) = 0;
-
- virtual streamsize
- xsputn(const _CharT* __s, streamsize __n) = 0;
-
- virtual streamsize
- xsgetn(_CharT* __s, streamsize __n) = 0;
-
- virtual streamoff
- seekoff(streamoff __off, ios_base::seekdir __way,
- ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
-
- virtual streamoff
- seekpos(streamoff __pos,
- ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
-
- virtual streambuf*
- setbuf(_CharT* __b, int __len) = 0;
-
- virtual int
- sync() = 0;
-
- virtual int
- doallocate() = 0;
-
- virtual streamsize
- sys_read(_CharT* __s, streamsize __n) = 0;
-
- virtual streamsize
- sys_write(const _CharT* __s, streamsize __n) = 0;
-
- virtual streamoff
- sys_seek(streamoff __off, ios_base::seekdir __way) = 0;
-
- virtual int
- sys_close() = 0;
-
- virtual int
- sys_stat(void* __v) = 0;
-
- virtual int
- showmanyc() = 0;
-
- virtual void
- imbue(void* __v) = 0;
- };
-
- // Some of these member functions are based on libio/filebuf.cc.
- // Also note that the order and number of virtual functions has to precisely
- // match the order and number in the _IO_jump_t struct defined in libioP.h.
- template<typename _CharT>
- class __basic_file: public __basic_file_base<_CharT>
- {
-# ifdef _GLIBCPP_USE_WCHAR_T
- __c_wfile_type _M_wfile;
-# endif
-
- public:
- __basic_file(__c_lock* __lock = 0);
-
- void
- _M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
- char* __c_mode);
-
- // Equivalent to the normal fopen function.
- __basic_file*
- open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
-
- // Used for opening the standard streams, cin, cout, cerr, clog,
- // and their wide-stream equivalents. Instead of calling open, it
- // just sets
- // - for libio: __c_file_type->_fileno and the respective _flags bits
- // - for stdio: _M_cfile = __file and some internal flags
- // and returns.
- __basic_file*
- sys_open(__c_file_type* __file, ios_base::openmode __mode);
-
- _CharT
- sys_getc();
-
- _CharT
- sys_ungetc(_CharT);
-
- __basic_file*
- close();
-
- bool
- is_open();
-
- int
- fd();
-
- // NB: Must match FILE specific jump table starting here--this
- // means all virtual functions starting with the dtor must match,
- // slot by slot. For glibc-based dystems, this means the _IO_FILE
- // as the FILE struct and _IO_jump_t as the jump table.
- virtual
- ~__basic_file(); // Takes the place of __finish.
-
- virtual int
- overflow(int __c = EOF);
-
- virtual int
- underflow();
-
- virtual int
- uflow();
-
- virtual int
- pbackfail(int __c);
-
- // A complex "write" function that sets all of __c_file_type's
- // pointers and associated data members correctly and manages its
- // relation to the external byte sequence.
- virtual streamsize
- xsputn(const _CharT* __s, streamsize __n);
-
- // A complex "read" function that sets all of __c_file_type's
- // pointers and associated data members correctly and manages its
- // relation to the external byte sequence.
- virtual streamsize
- xsgetn(_CharT* __s, streamsize __n);
-
- // A complex "seekoff" function that sets all of __c_file_type's
- // pointers and associated data members correctly and manages its
- // relation to the external byte sequence.
- virtual streamoff
- seekoff(streamoff __off, ios_base::seekdir __way,
- ios_base::openmode __mode = ios_base::in | ios_base::out);
-
- // A complex "seekpos" function that sets all of __c_file_type's
- // pointers and associated data members correctly and manages its
- // relation to the external byte sequence.
- virtual streamoff
- seekpos(streamoff __pos,
- ios_base::openmode __mode = ios_base::in | ios_base::out);
-
- virtual streambuf*
- setbuf(_CharT* __b, int __len);
-
- virtual int
- sync();
-
- virtual int
- doallocate();
-
- // A simple read function for the external byte sequence, that
- // does no mucking around with or setting of the pointers or flags
- // in __c_file_type.
- virtual streamsize
- sys_read(_CharT* __s, streamsize __n);
-
- // A simple write function for the external byte sequence, that
- // does no mucking around with or setting of the pointers or flags
- // in __c_file_type.
- virtual streamsize
- sys_write(const _CharT* __s, streamsize __n);
-
- // A simple seek function for the external byte sequence, that
- // does no mucking around with or setting of the pointers or flags
- // in __c_file_type.
- virtual streamoff
- sys_seek(streamoff __off, ios_base::seekdir __way);
-
- virtual int
- sys_close();
-
- virtual int
- sys_stat(void* __v);
-
- virtual int
- showmanyc();
-
- virtual void
- imbue(void* __v);
- };
-
- // __basic_file<char> specializations
- template<>
- __basic_file<char>::__basic_file(__c_lock* __lock);
-
- template<>
- int
- __basic_file<char>::overflow(int __c);
-
- template<>
- int
- __basic_file<char>::underflow();
-
- template<>
- int
- __basic_file<char>::uflow();
-
- template<>
- int
- __basic_file<char>::pbackfail(int __c);
-
- template<>
- streamsize
- __basic_file<char>::xsputn(const char* __s, streamsize __n);
-
- template<>
- streamoff
- __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
- ios_base::openmode __mode);
-
- template<>
- streamoff
- __basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode);
-
- template<>
- streambuf*
- __basic_file<char>::setbuf(char* __b, int __len);
-
- template<>
- int
- __basic_file<char>::sync();
-
- template<>
- int
- __basic_file<char>::doallocate();
-
- // __basic_file<wchar_t> specializations
-#ifdef _GLIBCPP_USE_WCHAR_T
- template<>
- __basic_file<wchar_t>::__basic_file(__c_lock* __lock);
-
- template<>
- int
- __basic_file<wchar_t>::overflow(int __c);
-
- template<>
- int
- __basic_file<wchar_t>::underflow();
-
- template<>
- int
- __basic_file<wchar_t>::uflow();
-
- template<>
- int
- __basic_file<wchar_t>::pbackfail(int __c);
-
- template<>
- streamsize
- __basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n);
-
- template<>
- streamoff
- __basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way,
- ios_base::openmode __mode);
-
- template<>
- streamoff
- __basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode);
-
- template<>
- streambuf*
- __basic_file<wchar_t>::setbuf(wchar_t* __b, int __len);
-
- template<>
- int
- __basic_file<wchar_t>::sync();
-
- template<>
- int
- __basic_file<wchar_t>::doallocate();
-#endif
-
- template<typename _CharT>
- __basic_file<_CharT>::~__basic_file()
- { _IO_file_finish(this, 0); }
-
- template<typename _CharT>
- void
- __basic_file<_CharT>::_M_open_mode(ios_base::openmode __mode,
- int& __p_mode, int& __rw_mode,
- char* /*__c_mode*/)
- {
-#ifdef O_BINARY
- bool __testb = __mode & ios_base::binary;
-#endif
- bool __testi = __mode & ios_base::in;
- bool __testo = __mode & ios_base::out;
- bool __testt = __mode & ios_base::trunc;
- bool __testa = __mode & ios_base::app;
-
- if (!__testi && __testo && !__testt && !__testa)
- {
- __p_mode = O_WRONLY | O_TRUNC | O_CREAT;
- __rw_mode = _IO_NO_READS;
- }
- if (!__testi && __testo && !__testt && __testa)
- {
- __p_mode = O_WRONLY | O_APPEND | O_CREAT;
- __rw_mode = _IO_NO_READS | _IO_IS_APPENDING;
- }
- if (!__testi && __testo && __testt && !__testa)
- {
- __p_mode = O_WRONLY | O_TRUNC | O_CREAT;
- __rw_mode = _IO_NO_READS;
- }
- if (__testi && !__testo && !__testt && !__testa)
- {
- __p_mode = O_RDONLY;
- __rw_mode = _IO_NO_WRITES;
- }
- if (__testi && __testo && !__testt && !__testa)
- {
- __p_mode = O_RDWR;
- __rw_mode = 0;
- }
- if (__testi && __testo && __testt && !__testa)
- {
- __p_mode = O_RDWR | O_TRUNC | O_CREAT;
- __rw_mode = 0;
- }
-#ifdef O_BINARY
- if (__testb)
- __p_mode |= O_BINARY;
-#endif
- }
-
- template<typename _CharT>
- __basic_file<_CharT>*
- __basic_file<_CharT>::sys_open(__c_file_type* __f,
- ios_base::openmode __mode)
- {
- __basic_file* __ret = NULL;
- int __fd = fileno(__f);
- int __p_mode = 0;
- int __rw_mode = _IO_NO_READS + _IO_NO_WRITES;
- char __c_mode[4];
-
- _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
-
- if (!_IO_file_is_open(this))
- {
- _fileno = __fd;
- _flags &= ~(_IO_NO_READS + _IO_NO_WRITES);
- _flags |= _IO_DELETE_DONT_CLOSE;
- _offset = _IO_pos_BAD;
- int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING;
- _IO_mask_flags(this, __rw_mode, __mask);
- }
-
- return __ret;
- }
-
- template<typename _CharT>
- __basic_file<_CharT>*
- __basic_file<_CharT>::open(const char* __name, ios_base::openmode __mode,
- int __prot)
- {
- __basic_file* __ret = NULL;
- int __p_mode = 0;
- int __rw_mode = _IO_NO_READS + _IO_NO_WRITES;
- char __c_mode[4];
-
- _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
- if (!_IO_file_is_open(this))
- {
- __c_file_type* __f;
- __f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0);
- __ret = __f ? this: NULL;
- }
- return __ret;
- }
-
- template<typename _CharT>
- bool
- __basic_file<_CharT>::is_open() { return _fileno >= 0; }
-
- template<typename _CharT>
- __basic_file<_CharT>*
- __basic_file<_CharT>::close()
- {
- return _IO_file_close_it(this) ? static_cast<__basic_file*>(NULL) : this;
- }
-
- template<typename _CharT>
- streamsize
- __basic_file<_CharT>::xsgetn(_CharT* __s, streamsize __n)
- { return _IO_file_xsgetn(this, __s, __n); }
-
- // NB: Unused.
- template<typename _CharT>
- streamsize
- __basic_file<_CharT>::sys_read(_CharT* __s, streamsize __n)
- { return _IO_file_read(this, __s, __n); }
-
- // NB: Unused.
- template<typename _CharT>
- streamsize
- __basic_file<_CharT>::sys_write(const _CharT* __s, streamsize __n)
- { return _IO_file_write(this, __s, __n); }
-
- // NB: Unused.
- template<typename _CharT>
- streamoff
- __basic_file<_CharT>::sys_seek(streamoff __pos, ios_base::seekdir __way)
- { return _IO_file_seek(this, __pos, __way); }
-
- // NB: Unused.
- template<typename _CharT>
- int
- __basic_file<_CharT>::sys_close()
- { return _IO_file_close(this); }
-
- // NB: Unused.
- template<typename _CharT>
- int
- __basic_file<_CharT>::sys_stat(void* __v)
- { return _IO_file_stat(this, __v); }
-
- // NB: Unused.
- template<typename _CharT>
- int
- __basic_file<_CharT>::showmanyc() { return EOF; }
-
- // NB: Unused.
- template<typename _CharT>
- void
- __basic_file<_CharT>::imbue(void* /*__v*/) { }
-} // namespace std
-
-#endif // _CPP_BASIC_FILE
diff --git a/contrib/libstdc++/config/io/c_io_libio.h b/contrib/libstdc++/config/io/c_io_libio.h
deleted file mode 100644
index acf6520..0000000
--- a/contrib/libstdc++/config/io/c_io_libio.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// underlying io library -*- C++ -*-
-
-// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// c_io_libio.h - Defines for using the GNU libio
-
-#ifndef _CPP_IO_LIBIO_H
-#define _CPP_IO_LIBIO_H 1
-
-#include <libio.h>
-
-namespace std
-{
-// from fpos.h
- typedef _IO_ssize_t streamsize; // Signed integral type
- typedef _IO_ssize_t wstreamsize;
-
-#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
- typedef _IO_off64_t streamoff;
- typedef _IO_fpos64_t __c_streampos;
-#else
- typedef _IO_off_t streamoff;
- typedef _IO_fpos_t __c_streampos;
-#endif
-
-#ifdef _GLIBCPP_USE_THREADS
- typedef _IO_lock_t __c_lock;
-#else
- typedef int __c_lock;
-#endif
-
-// from basic_file.h
- typedef _IO_FILE __c_file_type;
- typedef _IO_wide_data __c_wfile_type;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- extern "C" _IO_codecvt __c_libio_codecvt;
-#endif
-
-// from ios_base.h
- struct __ios_flags
- {
- typedef short __int_type;
-
- static const __int_type _S_boolalpha = _IO_BAD_SEEN;
- static const __int_type _S_dec = _IO_DEC;
- static const __int_type _S_fixed = _IO_FIXED;
- static const __int_type _S_hex = _IO_HEX;
- static const __int_type _S_internal = _IO_INTERNAL;
- static const __int_type _S_left = _IO_LEFT;
- static const __int_type _S_oct = _IO_OCT;
- static const __int_type _S_right = _IO_RIGHT;
- static const __int_type _S_scientific = _IO_SCIENTIFIC;
- static const __int_type _S_showbase = _IO_SHOWBASE;
- static const __int_type _S_showpoint = _IO_SHOWPOINT;
- static const __int_type _S_showpos = _IO_SHOWPOS;
- static const __int_type _S_skipws = _IO_SKIPWS;
- static const __int_type _S_unitbuf = _IO_UNITBUF;
- static const __int_type _S_uppercase = _IO_UPPERCASE;
- static const __int_type _S_adjustfield = _IO_LEFT | _IO_RIGHT
- | _IO_INTERNAL;
- static const __int_type _S_basefield = _IO_DEC | _IO_OCT | _IO_HEX;
- static const __int_type _S_floatfield = _IO_SCIENTIFIC | _IO_FIXED;
-
- // 27.4.2.1.3 Type ios_base::iostate
- static const __int_type _S_badbit = _IO_BAD_SEEN;
- static const __int_type _S_eofbit = _IO_EOF_SEEN;
- static const __int_type _S_failbit = _IO_ERR_SEEN;
-
- // 27.4.2.1.4 Type openmode
- static const __int_type _S_app = _IOS_APPEND;
- static const __int_type _S_ate = _IOS_ATEND;
- static const __int_type _S_bin = _IOS_BIN;
- static const __int_type _S_in = _IOS_INPUT;
- static const __int_type _S_out = _IOS_OUTPUT;
- static const __int_type _S_trunc = _IOS_TRUNC;
- };
-}
-
-#endif // _CPP_IO_LIBIO_H
-
-
-
-
-
-
-
-
diff --git a/contrib/libstdc++/config/io/c_io_libio_codecvt.c b/contrib/libstdc++/config/io/c_io_libio_codecvt.c
deleted file mode 100644
index 38d8b55..0000000
--- a/contrib/libstdc++/config/io/c_io_libio_codecvt.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-/* Slightly modified from glibc/libio/iofwide.c */
-
-#include <libio.h>
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-
-/* Prototypes of libio's codecvt functions. */
-static enum __codecvt_result
-do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const wchar_t *from_start, const wchar_t *from_end,
- const wchar_t **from_stop, char *to_start, char *to_end,
- char **to_stop);
-
-static enum __codecvt_result
-do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, char *to_start,
- char *to_end, char **to_stop);
-
-static enum __codecvt_result
-do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const char *from_start, const char *from_end, const char **from_stop,
- wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop);
-
-static int
-do_encoding(struct _IO_codecvt *codecvt);
-
-static int
-do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const char *from_start, const char *from_end, _IO_size_t max);
-
-static int
-do_max_length(struct _IO_codecvt *codecvt);
-
-static int
-do_always_noconv(struct _IO_codecvt *codecvt);
-
-
-/* The functions used in `codecvt' for libio are always the same. */
-struct _IO_codecvt __c_libio_codecvt =
-{
- .__codecvt_destr = NULL, /* Destructor, never used. */
- .__codecvt_do_out = do_out,
- .__codecvt_do_unshift = do_unshift,
- .__codecvt_do_in = do_in,
- .__codecvt_do_encoding = do_encoding,
- .__codecvt_do_always_noconv = do_always_noconv,
- .__codecvt_do_length = do_length,
- .__codecvt_do_max_length = do_max_length
-};
-
-static enum __codecvt_result
-do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const wchar_t *from_start, const wchar_t *from_end,
- const wchar_t **from_stop, char *to_start, char *to_end,
- char **to_stop)
-{
- enum __codecvt_result res = __codecvt_ok;
-
- while (from_start < from_end)
- {
- if (to_start >= to_end)
- {
- res = __codecvt_partial;
- break;
- }
- *to_start++ = (char) *from_start++;
- }
-
- *from_stop = from_start;
- *to_stop = to_start;
-
- return res;
-}
-
-
-static enum __codecvt_result
-do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- char *to_start, char *to_end, char **to_stop)
-{
- *to_stop = to_start;
- return __codecvt_ok;
-}
-
-
-static enum __codecvt_result
-do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const char *from_start, const char *from_end, const char **from_stop,
- wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
-{
- enum __codecvt_result res = __codecvt_ok;
-
- while (from_start < from_end)
- {
- if (to_start >= to_end)
- {
- res = __codecvt_partial;
- break;
- }
- *to_start++ = (wchar_t) *from_start++;
- }
-
- *from_stop = from_start;
- *to_stop = to_start;
-
- return res;
-}
-
-
-static int
-do_encoding(struct _IO_codecvt *codecvt)
-{ return 1; }
-
-
-static int
-do_always_noconv(struct _IO_codecvt *codecvt)
-{ return 0; }
-
-
-static int
-do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const char *from_start, const char *from_end, _IO_size_t max)
-{ return from_end - from_start; }
-
-
-static int
-do_max_length(struct _IO_codecvt *codecvt)
-{ return 1; }
-
-#endif /* _GLIBCPP_USE_WCHAR_T */
diff --git a/contrib/libstdc++/config/irix5.ml b/contrib/libstdc++/config/irix5.ml
deleted file mode 100644
index 055c832..0000000
--- a/contrib/libstdc++/config/irix5.ml
+++ /dev/null
@@ -1,6 +0,0 @@
-# We don't need -fpic on IRIX, so let's install both the shared and
-# non-shared versions.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
-DEPLIBS = ../$(SHLIB)
-SHDEPS = -lm
diff --git a/contrib/libstdc++/config/linux.ml b/contrib/libstdc++/config/linux.ml
deleted file mode 100644
index 14dcb45..0000000
--- a/contrib/libstdc++/config/linux.ml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Elf with shared libm, so we can link it into the shared libstdc++.
-
-ARLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).a
-MARLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).a.$(LIBSTDCXX_INTERFACE)
-SHLIB = libstdc++-$(LIBSTDCXX_INTERFACE)$(LIBC_INTERFACE)$(CXX_INTERFACE)-$(VERSION).so
-MSHLINK = libstdc++$(LIBC_INTERFACE)$(CXX_INTERFACE).so.$(LIBSTDCXX_INTERFACE)
-
-LIBS = $(ARLIB) marlink $(ARLINK) $(SHLIB) mshlink $(SHLINK)
-SHFLAGS = -Wl,-soname,$(MSHLINK)
-SHDEPS = -lm
-DEPLIBS = ../$(SHLIB)
diff --git a/contrib/libstdc++/config/linux.mt b/contrib/libstdc++/config/linux.mt
deleted file mode 100644
index 5848851..0000000
--- a/contrib/libstdc++/config/linux.mt
+++ /dev/null
@@ -1,2 +0,0 @@
-# tell we want the mt-safe version
-MT_CFLAGS = -D_IO_MTSAFE_IO
diff --git a/contrib/libstdc++/config/openbsd.ml b/contrib/libstdc++/config/openbsd.ml
deleted file mode 100644
index 09c4023..0000000
--- a/contrib/libstdc++/config/openbsd.ml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Base shared lib for OpenBSD i386
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK) mshlink
-SHFLAGS = -nostdlib -Wl,-Bshareable,-Bforcearchive
-SHDEPS = -lm
-DEPLIBS = ../$(SHLIB)
-
diff --git a/contrib/libstdc++/config/openbsd.mt b/contrib/libstdc++/config/openbsd.mt
deleted file mode 100644
index 29da11c..0000000
--- a/contrib/libstdc++/config/openbsd.mt
+++ /dev/null
@@ -1,3 +0,0 @@
-# tell we want the mt-safe version
-MT_CFLAGS = -D_IO_MTSAFE_IO -D_PTHREADS
-
diff --git a/contrib/libstdc++/config/posix.mt b/contrib/libstdc++/config/posix.mt
deleted file mode 100644
index 6afe1e5..0000000
--- a/contrib/libstdc++/config/posix.mt
+++ /dev/null
@@ -1 +0,0 @@
-MT_CFLAGS = -D_PTHREADS
diff --git a/contrib/libstdc++/config/sol2pth.mt b/contrib/libstdc++/config/sol2pth.mt
deleted file mode 100644
index 6afe1e5..0000000
--- a/contrib/libstdc++/config/sol2pth.mt
+++ /dev/null
@@ -1 +0,0 @@
-MT_CFLAGS = -D_PTHREADS
diff --git a/contrib/libstdc++/config/sol2shm.ml b/contrib/libstdc++/config/sol2shm.ml
deleted file mode 100644
index e87f079..0000000
--- a/contrib/libstdc++/config/sol2shm.ml
+++ /dev/null
@@ -1,6 +0,0 @@
-# Solaris2 with shared libm, so we can link it into the shared libstdc++.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
-SHFLAGS = -h $(SHLIB)
-SHDEPS = -lm
-DEPLIBS = ../$(SHLIB)
diff --git a/contrib/libstdc++/config/sol2solth.mt b/contrib/libstdc++/config/sol2solth.mt
deleted file mode 100644
index f809d0a..0000000
--- a/contrib/libstdc++/config/sol2solth.mt
+++ /dev/null
@@ -1 +0,0 @@
-MT_CFLAGS = -D_SOLTHREADS
diff --git a/contrib/libstdc++/config/sunos4.ml b/contrib/libstdc++/config/sunos4.ml
deleted file mode 100644
index 3c5de27..0000000
--- a/contrib/libstdc++/config/sunos4.ml
+++ /dev/null
@@ -1,9 +0,0 @@
-# SunOS doesn't provide a shared libm, so we have to link with the archive
-# library, even for programs that don't use complex.
-# SunOS requires a version number in shared library filenames.
-
-LIBS = $(ARLIB) $(ARLINK) $(SHLIB)
-SHFLAGS = $(PICFLAG)
-DEPLIBS = ../$(SHLIB)
-LDLIBS = -L.. -lstdc++ -lm
-MLDLIBS = -L.. -lstdc++ -lm
diff --git a/contrib/libstdc++/config/x86-interix.ml b/contrib/libstdc++/config/x86-interix.ml
deleted file mode 100644
index 8b8774e..0000000
--- a/contrib/libstdc++/config/x86-interix.ml
+++ /dev/null
@@ -1,9 +0,0 @@
-# x86 Interix. SHLINK is defined to be .dummy to avoid running into
-# the lack of symbolic links.
-
-SHLINK = .dummy
-SHLIB = libstdc++.so
-LIBS = $(ARLIB) $(SHLIB)
-DEPLIBS = ../$(SHLIB)
-SHFLAGS = $(PICFLAG)
-
diff --git a/contrib/libstdc++/configure.in b/contrib/libstdc++/configure.in
deleted file mode 100644
index b8d895f..0000000
--- a/contrib/libstdc++/configure.in
+++ /dev/null
@@ -1,554 +0,0 @@
-# Process this file with autoconf to produce a configure script, like so:
-# aclocal && autoconf && autoheader && automake
-
-AC_PREREQ(2.13)
-AC_INIT(src/ios.cc)
-
-# This works around the fact that libtool configuration may change LD
-# for this particular configuration, but some shells, instead of
-# keeping the changes in LD private, export them just because LD is
-# exported. Only used at the end of this file.
-ORIGINAL_LD_FOR_MULTILIBS=$LD
-
-PACKAGE=libstdc++
-AC_SUBST(PACKAGE)
-# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=5:5:0
-AC_SUBST(libtool_VERSION)
-
-GLIBCPP_TOPREL_CONFIGURE
-
-# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
-#
-# You will slowly go insane if you do not grok the following fact: when
-# building v3 as part of the compiler, the top-level /target/ becomes the
-# library's /host/. `configure' then causes --target to default to --host,
-# exactly like any other package using autoconf. Therefore, 'target' and
-# 'host' will always be the same. This makes sense both for native and
-# cross compilers, just think about it for a little while. :-)
-#
-# Also, if v3 is being configured as part of a cross compiler, the top-level
-# configure script will pass the "real" host as $with_cross_host.
-#
-# AC 2.5x sets target_alias iff the user specified --target, but we use it
-# everywhere, so we set it here just to be sure. In AC 2.13
-# AC_CANONICAL_TARGET was known as AC_CANONICAL_SYSTEM.
-AC_CANONICAL_SYSTEM
-target_alias=${target_alias-$target}
-AC_SUBST(target_alias)
-
-# Runs configure.target, finds CC, CXX and assorted other critical bits.
-# Must run this before the GLIBCPP_ENABLE_* macros below.
-GLIBCPP_CONFIGURE(.)
-
-AM_INIT_AUTOMAKE($PACKAGE, $gcc_version)
-AM_CONFIG_HEADER(config.h)
-
-AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
-AC_SUBST(enable_shared)
-AC_SUBST(enable_static)
-
-# Check for c++ or library specific bits that don't require linking.
-#GLIBCPP_CHECK_COMPILER_VERSION
-GLIBCPP_CHECK_GNU_MAKE
-
-# Enable all the variable C++ stuff. C_MBCHAR must come early.
-GLIBCPP_ENABLE_CSTDIO
-GLIBCPP_ENABLE_CLOCALE
-GLIBCPP_ENABLE_CHEADERS([$c_model])
-GLIBCPP_ENABLE_C_MBCHAR([yes])
-GLIBCPP_ENABLE_C99([yes])
-GLIBCPP_ENABLE_LONG_LONG([yes])
-GLIBCPP_ENABLE_THREADS
-GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
-GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
-GLIBCPP_ENABLE_CONCEPT_CHECKS
-GLIBCPP_ENABLE_CXX_FLAGS
-GLIBCPP_ENABLE_DEBUG([no])
-GLIBCPP_ENABLE_DEBUG_FLAGS([none])
-
-# Check for headers necessary for libsupc++ using dyn-string.c/cxa_demangle.c
-AC_CHECK_HEADERS(string.h stdlib.h)
-
-# No surprises, no surprises...
-if test $ATOMICITYH = cpu/generic ; then
- AC_MSG_WARN([No native atomic operations are provided yet for this platform.])
- if test $target_thread_file = single; then
- AC_MSG_WARN([They cannot be faked when thread support is disabled.])
- AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
- else
- AC_MSG_WARN([They will be faked using a mutex.])
- AC_MSG_WARN([Performance of certain classes will degrade as a result.])
- fi
-fi
-
-
-if test -n "$with_cross_host" || test x"$build" != x"$host"; then
-
- # We are being configured with some form of cross compiler.
- GLIBCPP_IS_CROSS_COMPILING=true
-
- # This lets us hard-code the functionality we know we'll have in the cross
- # target environment. "Let" is a sugar-coated word placed on an especially
- # dull and tedious hack, actually.
- #
- # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
- # that involve linking, can't be used:
- # "cannot open sim-crt0.o"
- # "cannot open crt0.o"
- # etc. All this is because there currently exists no unified, consistent
- # way for top level CC information to be passed down to target directories:
- # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
- # When all of that is done, all of this hokey, excessive AC_DEFINE junk for
- # crosses can be removed.
-
- # If Canadian cross, then don't pick up tools from the build directory.
- # Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?).
- if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
- CANADIAN=yes
- else
- CANADIAN=no
- fi
-
- # Construct crosses by hand, eliminating bits that need ld...
- # GLIBCPP_CHECK_COMPILER_FEATURES
- # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
- # GLIBCPP_CHECK_MATH_SUPPORT
-
- case "$target" in
- *-linux*)
- os_include_dir="os/gnu-linux"
- AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
- machine/endian.h machine/param.h sys/machine.h sys/types.h \
- fp.h locale.h float.h inttypes.h])
- SECTION_FLAGS='-ffunction-sections -fdata-sections'
- AC_SUBST(SECTION_FLAGS)
- GLIBCPP_CHECK_LINKER_FEATURES
- GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
- GLIBCPP_CHECK_WCHAR_T_SUPPORT
- AC_DEFINE(HAVE_COPYSIGN)
- AC_DEFINE(HAVE_COPYSIGNF)
- AC_DEFINE(HAVE_FINITE)
- AC_DEFINE(HAVE_FINITEF)
- AC_DEFINE(HAVE_FREXPF)
- AC_DEFINE(HAVE_HYPOTF)
- AC_DEFINE(HAVE_ISINF)
- AC_DEFINE(HAVE_ISINFF)
- AC_DEFINE(HAVE_ISNAN)
- AC_DEFINE(HAVE_ISNANF)
- AC_DEFINE(HAVE_SINCOS)
- AC_DEFINE(HAVE_SINCOSF)
- if test x"long_double_math_on_this_cpu" = x"yes"; then
- AC_DEFINE(HAVE_FINITEL)
- AC_DEFINE(HAVE_HYPOTL)
- AC_DEFINE(HAVE_ISINFL)
- AC_DEFINE(HAVE_ISNANL)
- fi
- ;;
- *-hpux*)
- # Check for available headers.
- AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
- machine/endian.h machine/param.h sys/machine.h sys/types.h \
- fp.h locale.h float.h inttypes.h])
- SECTION_FLAGS='-ffunction-sections -fdata-sections'
- AC_SUBST(SECTION_FLAGS)
- GLIBCPP_CHECK_LINKER_FEATURES
- GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
- GLIBCPP_CHECK_WCHAR_T_SUPPORT
- os_include_dir="os/hpux"
- AC_DEFINE(HAVE_COPYSIGN)
- AC_DEFINE(HAVE_COPYSIGNF)
- AC_DEFINE(HAVE_FREXPF)
- AC_DEFINE(HAVE_HYPOT)
- case "$target" in
- *-hpux10*)
- AC_DEFINE(HAVE_FINITE)
- AC_DEFINE(HAVE_FINITEF)
- AC_DEFINE(HAVE_ISINF)
- AC_DEFINE(HAVE_ISINFF)
- AC_DEFINE(HAVE_ISNAN)
- AC_DEFINE(HAVE_ISNANF)
- ;;
- esac
-
- ;;
- *-netbsd*)
- # Check for available headers.
- AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
- machine/endian.h machine/param.h sys/machine.h sys/types.h \
- fp.h locale.h float.h inttypes.h])
- SECTION_FLAGS='-ffunction-sections -fdata-sections'
- AC_SUBST(SECTION_FLAGS)
- GLIBCPP_CHECK_LINKER_FEATURES
- GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
- GLIBCPP_CHECK_WCHAR_T_SUPPORT
- os_include_dir="os/bsd/netbsd"
- AC_DEFINE(HAVE_COPYSIGN)
- AC_DEFINE(HAVE_COPYSIGNF)
- AC_DEFINE(HAVE_FINITEF)
- AC_DEFINE(HAVE_FINITE)
- AC_DEFINE(HAVE_FREXPF)
- AC_DEFINE(HAVE_HYPOTF)
- AC_DEFINE(HAVE_ISINF)
- AC_DEFINE(HAVE_ISINFF)
- AC_DEFINE(HAVE_ISNAN)
- AC_DEFINE(HAVE_ISNANF)
- if test x"long_double_math_on_this_cpu" = x"yes"; then
- AC_DEFINE(HAVE_FINITEL)
- AC_DEFINE(HAVE_ISINFL)
- AC_DEFINE(HAVE_ISNANL)
- fi
- ;;
- *-freebsd*)
- # Check for available headers.
- AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
- machine/endian.h machine/param.h sys/machine.h sys/types.h \
- fp.h locale.h float.h inttypes.h sys/resource.h sys/stat.h \
- sys/time.h unistd.h])
- SECTION_FLAGS='-ffunction-sections -fdata-sections'
- AC_SUBST(SECTION_FLAGS)
- GLIBCPP_CHECK_LINKER_FEATURES
- GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
- GLIBCPP_CHECK_WCHAR_T_SUPPORT
- os_include_dir="os/bsd/freebsd"
- AC_DEFINE(HAVE_LC_MESSAGES)
- AC_DEFINE(HAVE_DRAND48)
- AC_DEFINE(HAVE_GETPAGESIZE)
- AC_DEFINE(HAVE_SETENV)
- AC_DEFINE(HAVE_SIGSETJMP)
- AC_DEFINE(HAVE_COPYSIGN)
- AC_DEFINE(HAVE_COPYSIGNF)
- AC_DEFINE(HAVE_FINITEF)
- AC_DEFINE(HAVE_FINITE)
- AC_DEFINE(HAVE_FREXPF)
- AC_DEFINE(HAVE_HYPOT)
- AC_DEFINE(HAVE_HYPOTF)
- AC_DEFINE(HAVE_ISINF)
- AC_DEFINE(HAVE_ISNAN)
- AC_DEFINE(HAVE_ISNANF)
- if test x"long_double_math_on_this_cpu" = x"yes"; then
- AC_DEFINE(HAVE_FINITEL)
- AC_DEFINE(HAVE_ISINFL)
- AC_DEFINE(HAVE_ISNANL)
- fi
- ;;
- *-mingw32*)
- AC_CHECK_HEADERS([sys/types.h locale.h float.h])
- GLIBCPP_CHECK_LINKER_FEATURES
- GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
- GLIBCPP_CHECK_WCHAR_T_SUPPORT
- os_include_dir="os/mingw32"
- ;;
- *-windiss*)
- os_include_dir="os/windiss"
- ;;
-changequote(,)dnl
- *-qnx6.[12]*)
-changequote([,])dnl
- SECTION_FLAGS='-ffunction-sections -fdata-sections'
- AC_SUBST(SECTION_FLAGS)
- GLIBCPP_CHECK_LINKER_FEATURES
- GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
- GLIBCPP_CHECK_WCHAR_T_SUPPORT
- os_include_dir="os/qnx/qnx6.1"
- AC_DEFINE(HAVE_COSF)
- AC_DEFINE(HAVE_COSL)
- AC_DEFINE(HAVE_COSHF)
- AC_DEFINE(HAVE_COSHL)
- AC_DEFINE(HAVE_LOGF)
- AC_DEFINE(HAVE_LOGL)
- AC_DEFINE(HAVE_LOG10F)
- AC_DEFINE(HAVE_LOG10L)
- AC_DEFINE(HAVE_SINF)
- AC_DEFINE(HAVE_SINL)
- AC_DEFINE(HAVE_SINHF)
- AC_DEFINE(HAVE_SINHL)
- ;;
- *)
- os_include_dir="os/newlib"
- AC_DEFINE(HAVE_HYPOT)
- ;;
- esac
-
- case "$target" in
- *-mingw32*)
- ;;
- *-windiss*)
- AC_DEFINE(HAVE_ACOSF)
- AC_DEFINE(HAVE_ASINF)
- AC_DEFINE(HAVE_ATAN2F)
- AC_DEFINE(HAVE_ATANF)
- AC_DEFINE(HAVE_CEILF)
- AC_DEFINE(HAVE_COPYSIGN)
- AC_DEFINE(HAVE_COPYSIGNF)
- AC_DEFINE(HAVE_COSF)
- AC_DEFINE(HAVE_COSHF)
- AC_DEFINE(HAVE_EXPF)
- AC_DEFINE(HAVE_FABSF)
- AC_DEFINE(HAVE_FLOORF)
- AC_DEFINE(HAVE_FMODF)
- AC_DEFINE(HAVE_FREXPF)
- AC_DEFINE(HAVE_LDEXPF)
- AC_DEFINE(HAVE_LOG10F)
- AC_DEFINE(HAVE_LOGF)
- AC_DEFINE(HAVE_MODFF)
- AC_DEFINE(HAVE_POWF)
- AC_DEFINE(HAVE_SINF)
- AC_DEFINE(HAVE_SINHF)
- AC_DEFINE(HAVE_SQRTF)
- AC_DEFINE(HAVE_TANF)
- AC_DEFINE(HAVE_TANHF)
- ;;
- *-freebsd*)
- # Must replicate generic section since we don't have strtof or strtold.
- AC_DEFINE(HAVE_MMAP)
- AC_DEFINE(HAVE_ACOSF)
- AC_DEFINE(HAVE_ASINF)
- AC_DEFINE(HAVE_ATAN2F)
- AC_DEFINE(HAVE_ATANF)
- AC_DEFINE(HAVE_CEILF)
- AC_DEFINE(HAVE_COPYSIGN)
- AC_DEFINE(HAVE_COPYSIGNF)
- AC_DEFINE(HAVE_COSF)
- AC_DEFINE(HAVE_COSHF)
- AC_DEFINE(HAVE_EXPF)
- AC_DEFINE(HAVE_FABSF)
- AC_DEFINE(HAVE_FLOORF)
- AC_DEFINE(HAVE_FMODF)
- AC_DEFINE(HAVE_FREXPF)
- AC_DEFINE(HAVE_LDEXPF)
- AC_DEFINE(HAVE_LOG10F)
- AC_DEFINE(HAVE_LOGF)
- AC_DEFINE(HAVE_MODFF)
- AC_DEFINE(HAVE_POWF)
- AC_DEFINE(HAVE_SINF)
- AC_DEFINE(HAVE_SINHF)
- AC_DEFINE(HAVE_SQRTF)
- AC_DEFINE(HAVE_TANF)
- AC_DEFINE(HAVE_TANHF)
- ;;
- *)
- # GLIBCPP_CHECK_STDLIB_SUPPORT
- AC_DEFINE(HAVE_STRTOF)
- AC_DEFINE(HAVE_STRTOLD)
- # AC_FUNC_MMAP
- AC_DEFINE(HAVE_MMAP)
-
- AC_DEFINE(HAVE_ACOSF)
- AC_DEFINE(HAVE_ASINF)
- AC_DEFINE(HAVE_ATAN2F)
- AC_DEFINE(HAVE_ATANF)
- AC_DEFINE(HAVE_CEILF)
- AC_DEFINE(HAVE_COPYSIGN)
- AC_DEFINE(HAVE_COPYSIGNF)
- AC_DEFINE(HAVE_COSF)
- AC_DEFINE(HAVE_COSHF)
- AC_DEFINE(HAVE_EXPF)
- AC_DEFINE(HAVE_FABSF)
- AC_DEFINE(HAVE_FLOORF)
- AC_DEFINE(HAVE_FMODF)
- AC_DEFINE(HAVE_FREXPF)
- AC_DEFINE(HAVE_LDEXPF)
- AC_DEFINE(HAVE_LOG10F)
- AC_DEFINE(HAVE_LOGF)
- AC_DEFINE(HAVE_MODFF)
- AC_DEFINE(HAVE_POWF)
- AC_DEFINE(HAVE_SINF)
- AC_DEFINE(HAVE_SINHF)
- AC_DEFINE(HAVE_SQRTF)
- AC_DEFINE(HAVE_TANF)
- AC_DEFINE(HAVE_TANHF)
- ;;
- esac
-
- # At some point, we should differentiate between architectures
- # like x86, which have long double versions, and alpha/powerpc/etc.,
- # which don't. For the time being, punt.
- if test x"long_double_math_on_this_cpu" = x"yes"; then
- AC_DEFINE(HAVE_ACOSL)
- AC_DEFINE(HAVE_ASINL)
- AC_DEFINE(HAVE_ATAN2L)
- AC_DEFINE(HAVE_ATANL)
- AC_DEFINE(HAVE_CEILL)
- AC_DEFINE(HAVE_COPYSIGNL)
- AC_DEFINE(HAVE_COSL)
- AC_DEFINE(HAVE_COSHL)
- AC_DEFINE(HAVE_EXPL)
- AC_DEFINE(HAVE_FABSL)
- AC_DEFINE(HAVE_FLOORL)
- AC_DEFINE(HAVE_FMODL)
- AC_DEFINE(HAVE_FREXPL)
- AC_DEFINE(HAVE_LDEXPL)
- AC_DEFINE(HAVE_LOG10L)
- AC_DEFINE(HAVE_LOGL)
- AC_DEFINE(HAVE_MODFL)
- AC_DEFINE(HAVE_POWL)
- AC_DEFINE(HAVE_SINCOSL)
- AC_DEFINE(HAVE_SINL)
- AC_DEFINE(HAVE_SINHL)
- AC_DEFINE(HAVE_SQRTL)
- AC_DEFINE(HAVE_TANL)
- AC_DEFINE(HAVE_TANHL)
- fi
-
-else
-
- # We are being configured natively. We can do more elaborate tests
- # that include AC_TRY_COMPILE now, as the linker is assumed to be
- # working.
- GLIBCPP_IS_CROSS_COMPILING=false
- CANADIAN=no
-
- # Check for available headers.
- AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
- machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h sys/types.h])
-
- GLIBCPP_CHECK_COMPILER_FEATURES
- GLIBCPP_CHECK_LINKER_FEATURES
- GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
- GLIBCPP_CHECK_MATH_SUPPORT
- GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
- GLIBCPP_CHECK_WCHAR_T_SUPPORT
- GLIBCPP_CHECK_STDLIB_SUPPORT
- GLIBCPP_CHECK_UNISTD_SUPPORT
-
- # For showmanyc_helper().
- AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
- GLIBCPP_CHECK_POLL
- GLIBCPP_CHECK_S_ISREG_OR_S_IFREG
-
- AC_LC_MESSAGES
-
- AC_TRY_COMPILE([
- #include <setjmp.h>
- ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
- [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
- ])
-
- AC_FUNC_MMAP
-
-fi
-
-# This depends on GLIBCPP_CHECK_LINKER_FEATURES, but without it assumes no.
-GLIBCPP_ENABLE_SYMVERS([yes])
-
-# This depends on GLIBCPP_ENABLE_SYMVERS and GLIBCPP_IS_CROSS_COMPILING.
-GLIBCPP_CONFIGURE_TESTSUITE
-
-# Propagate the target-specific source directories through the build chain.
-# (Nothing currently uses cpu_include_dir directly; only ATOMICITYH
-# uses it, and it only gets used in this file.)
-OS_INC_SRCDIR=config/${os_include_dir}
-ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}
-AC_SUBST(OS_INC_SRCDIR)
-AC_SUBST(ATOMICITY_INC_SRCDIR)
-
-# Set up cross-compile flags
-AC_SUBST(GLIBCPP_IS_CROSS_COMPILING) dnl Unused so far.
-AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
-
-AC_CACHE_SAVE
-
-if test "${multilib}" = "yes"; then
- multilib_arg="--enable-multilib"
-else
- multilib_arg=
-fi
-
-# Export all the install information
-GLIBCPP_EXPORT_INSTALL_INFO
-
-# Export all the include and flag information to makefiles.
-GLIBCPP_EXPORT_INCLUDES
-GLIBCPP_EXPORT_FLAGS
-
-if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
- grep "enable shared" > /dev/null; then
- LIBSUPCXX_PICFLAGS=-prefer-pic
-else
- LIBSUPCXX_PICFLAGS=
-fi
-AC_SUBST(LIBSUPCXX_PICFLAGS)
-
-# Generate the various Makefiles, include files, and scripts.
-# NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
-# libsupc++/Makefile.am and testsuite/Makefile.am so that multilib installs
-# will end up installed in the correct place. To work around this not being
-# passed down from config-ml.in -> top_srcdir/Makefile.am ->
-# top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
-AC_OUTPUT(Makefile \
- include/Makefile src/Makefile \
- libmath/Makefile libio/Makefile libsupc++/Makefile \
- po/Makefile testsuite/Makefile mkcheck testsuite_flags,
-[if test -n "$CONFIG_FILES"; then
- LD="${ORIGINAL_LD_FOR_MULTILIBS}"
- ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
- grep '^MULTISUBDIR =' Makefile >> src/Makefile
- grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
- grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile
-fi
-chmod +x mkcheck
-chmod +x testsuite_flags
-],
-srcdir=${srcdir}
-host=${host}
-target=${target}
-with_multisubdir=${with_multisubdir}
-ac_configure_args="${multilib_arg} ${ac_configure_args}"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-glibcpp_basedir=${glibcpp_basedir}
-CC="${CC}"
-CXX="${CXX}"
-ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
-)
-dnl In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
-dnl AC_CONFIG_FILES(Makefile \
-dnl include/Makefile src/Makefile \
-dnl libmath/Makefile libio/Makefile libsupc++/Makefile \
-dnl po/Makefile testsuite/Makefile mkcheck testsuite_flags)
-dnl AC_CONFIG_COMMANDS([default],
-dnl [if test -n "$CONFIG_FILES"; then
-dnl ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
-dnl grep '^MULTISUBDIR =' Makefile >> src/Makefile
-dnl grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
-dnl grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile
-dnl fi
-dnl chmod +x mkcheck
-dnl chmod +x testsuite_flags
-dnl ],
-dnl srcdir=${srcdir}
-dnl host=${host}
-dnl target=${target}
-dnl with_multisubdir=${with_multisubdir}
-dnl ac_configure_args="${multilib_arg} ${ac_configure_args}"
-dnl CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-dnl glibcpp_basedir=${glibcpp_basedir}
-dnl CC="${CC}"
-dnl CXX="${CXX}"
-dnl )
-dnl AC_OUTPUT
-
-
-# Sanity checking & User-visible messages.
-# Checks down here, otherwise they get scrolled off before
-# the user will notice.
-
-# Trying to get more people to read documentation. Possibly remove
-# check and warn all the time. There is no "informational" AC_MSG_
-# macro, so these are going to be printed even when --quiet/--silent
-# is given.
-if test ! -f stamp-sanity-warned; then
- touch stamp-sanity-warned
- echo ""
- echo "Please make certain that you read the installation information here:"
- echo " faster => ${srcdir}/docs/html/install.html"
- echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
- echo ""
- echo "and the configuration information here:"
- echo " faster => ${srcdir}/docs/html/configopts.html"
- echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
- echo ""
- echo "before proceeding with ${_cv_gnu_make_command}."
- echo ""
-fi
diff --git a/contrib/libstdc++/configure.target b/contrib/libstdc++/configure.target
deleted file mode 100644
index c1d1cb1..0000000
--- a/contrib/libstdc++/configure.target
+++ /dev/null
@@ -1,200 +0,0 @@
-# configure.target
-#
-# This shell script handles all target based configuration for libstdc++.
-# It sets various shell variables based on the the target and the
-# configuration options. You can modify this shell script without needing
-# to rerun autoconf/aclocal/etc. This file is "sourced" not executed.
-#
-# You should read docs/html/17_intro/porting.* to make sense of this file.
-#
-#
-# It uses the following shell variables as set by config.guess:
-# target The configuration target (full CPU-vendor-OS triplet)
-# target_cpu The configuration target CPU
-# target_os The configuration target OS
-#
-#
-# It sets the following shell variables:
-#
-# cpu_include_dir CPU-specific directory, defaults to cpu/generic
-# if cpu/target_cpu doesn't exist. This is
-# used to set ATOMICITYH.
-#
-# os_include_dir OS-specific directory, defaults to os/generic.
-#
-# c_model the model to use for "C" headers, defaults to c_std.
-#
-# c_compatibility if "C" compatibility headers are necessary,
-# defaults to no.
-#
-# abi_baseline_pair directory name for ABI compat testing,
-# defaults to target (as per config.guess)
-#
-# ATOMICITYH location of atomicity.h,
-# defaults to cpu_include_dir
-#
-# It possibly modifies the following variables:
-#
-# OPT_LDFLAGS extra flags to pass when linking the library, of
-# the form '-Wl,blah'
-# (defaults to empty in acinclude.m4)
-#
-#
-# If the defaults will not work for your platform, you need only change the
-# variables that won't work, i.e., you do not need to explicitly set a
-# working variable to its default. Most targets only need to change the two
-# *_include_dir variables.
-
-
-# DEFAULTS
-# Try to guess a default cpu_include_dir based on the name of the CPU. We
-# cannot do this for os_include_dir; there are too many portable operating
-# systems out there. :-)
-c_model=c_std
-c_compatibility=no
-
-
-# TARGET-SPECIFIC OVERRIDES
-# Set any CPU-dependent bits.
-# Here we override defaults and catch more general cases due to naming
-# conventions (e.g., chip_name* to catch all variants).
-# THIS TABLE IS SORTED. KEEP IT THAT WAY.
-
-case "${target_cpu}" in
- alpha*)
- try_cpu=alpha
- ;;
- athlon* | i586 | i686 | i786 | x86_64)
- try_cpu=i486
- ;;
- hppa*)
- try_cpu=hppa
- ;;
- m680[246]0)
- try_cpu=m68k
- ;;
- powerpc* | rs6000)
- try_cpu=powerpc
- ;;
- s390x)
- try_cpu=s390
- ;;
- sparc* | ultrasparc)
- try_cpu=sparc
- ;;
- *)
- if test -d ${glibcpp_srcdir}/config/cpu/${target_cpu}; then
- try_cpu=${target_cpu}
- else
- try_cpu=generic
- fi
- ;;
-esac
-
-
-# Now look for the file(s) usually tied to a CPU model, and make
-# default choices for those if they haven't been explicitly set
-# already.
-cpu_include_dir="cpu/${try_cpu}"
-ATOMICITYH=$cpu_include_dir
-abi_baseline_pair=${try_cpu}-${host_os}
-
-# Set any OS-dependent bits.
-# Set the os_include_dir.
-# Set c_model, c_compatibility here.
-# If atomic ops and/or numeric limits are OS-specific rather than
-# CPU-specifc, set those here too.
-# THIS TABLE IS SORTED. KEEP IT THAT WAY.
-case "${target_os}" in
- aix4.[3456789]* | aix[56789]*)
- # We set os_include_dir to os/aix only on AIX 4.3 and newer, but
- # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
- # explicitly duplicate the directory for 4.[<3].
- os_include_dir="os/aix"
- ATOMICITYH="os/aix"
- OPT_LDFLAGS="-Wl,-G"
- ;;
- aix4.*)
- ATOMICITYH="os/aix"
- ;;
- aix*)
- ATOMICITYH="cpu/generic"
- ;;
- bsd*)
- # Plain BSD attempts to share FreeBSD files.
- os_include_dir="os/bsd/freebsd"
- ;;
- cygwin*)
- os_include_dir="os/newlib"
- ;;
- *djgpp*) # leading * picks up "msdosdjgpp"
- os_include_dir="os/djgpp"
- ;;
- freebsd*)
- os_include_dir="os/bsd/freebsd"
- ;;
- gnu* | linux*)
- os_include_dir="os/gnu-linux"
- ;;
- hpux*)
- os_include_dir="os/hpux"
- ;;
- irix[1-6] | irix[1-5].* | irix6.[0-4]*)
- # This is known to work on at least IRIX 5.2 and 6.3.
- os_include_dir="os/irix/irix5.2"
- ATOMICITYH=$os_include_dir
- ;;
- irix6.5*)
- os_include_dir="os/irix/irix6.5"
- ATOMICITYH=$os_include_dir
- ;;
- mingw32*)
- os_include_dir="os/mingw32"
- ;;
- netbsd*)
- os_include_dir="os/bsd/netbsd"
- ;;
- solaris2.5 | solaris2.5.[0-9])
- os_include_dir="os/solaris/solaris2.5"
- ;;
- solaris2.6)
- os_include_dir="os/solaris/solaris2.6"
- ;;
- solaris2.[789] | solaris2.1[0-9])
- os_include_dir="os/solaris/solaris2.7"
- ;;
- windiss*)
- os_include_dir="os/windiss"
- ;;
- qnx6.[12]*)
- os_include_dir="os/qnx/qnx6.1"
- c_model=c
- ;;
- *)
- os_include_dir="os/generic"
- ;;
-esac
-
-
-# Set any OS-dependent and CPU-dependent bits.
-# THIS TABLE IS SORTED. KEEP IT THAT WAY.
-case "${target}" in
- mips*-*-linux*)
- ATOMICITYH="cpu/mips"
- ;;
- x86_64-*-linux*)
- abi_baseline_pair="x86_64-linux-gnu"
- ;;
- alpha*-*-freebsd5*)
- abi_baseline_pair="alpha-freebsd5"
- ;;
- i*86-*-freebsd4*)
- abi_baseline_pair="i386-freebsd4"
- ;;
- i*86-*-freebsd5*)
- abi_baseline_pair="i386-freebsd5"
- ;;
- sparc*-*-freebsd5*)
- abi_baseline_pair="sparc-freebsd5"
- ;;
-esac
diff --git a/contrib/libstdc++/csetjmp b/contrib/libstdc++/csetjmp
deleted file mode 100644
index 4bba048..0000000
--- a/contrib/libstdc++/csetjmp
+++ /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/libstdc++/csignal b/contrib/libstdc++/csignal
deleted file mode 100644
index 6febfb7..0000000
--- a/contrib/libstdc++/csignal
+++ /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/libstdc++/cstdarg b/contrib/libstdc++/cstdarg
deleted file mode 100644
index 324f5a1..0000000
--- a/contrib/libstdc++/cstdarg
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __CSTDARG__
-#define __CSTDARG__
-#include <stdarg.h>
-#endif
diff --git a/contrib/libstdc++/cstddef b/contrib/libstdc++/cstddef
deleted file mode 100644
index db5cbe4..0000000
--- a/contrib/libstdc++/cstddef
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __CSTDDEF__
-#define __CSTDDEF__
-#include <stddef.h>
-#endif
diff --git a/contrib/libstdc++/cstdio b/contrib/libstdc++/cstdio
deleted file mode 100644
index 1fe1456..0000000
--- a/contrib/libstdc++/cstdio
+++ /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/libstdc++/cstdlib b/contrib/libstdc++/cstdlib
deleted file mode 100644
index e7c1a51..0000000
--- a/contrib/libstdc++/cstdlib
+++ /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 "cstdlib"
-#endif
-
-extern "C++" {
-
-#if _G_HAS_LABS
-inline long abs(long x) { return labs (x); }
-#else
-inline long abs(long x) { return x >= 0 ? x : -x; }
-#endif
-//inline ldiv_t div(long x, long y) { return ldiv (x, y); }
-
-} // extern "C++"
-
-#endif
diff --git a/contrib/libstdc++/cstdlibi.cc b/contrib/libstdc++/cstdlibi.cc
deleted file mode 100644
index abbfa03..0000000
--- a/contrib/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 "cstdlib"
-#endif
-#include <cstdlib>
diff --git a/contrib/libstdc++/cstring b/contrib/libstdc++/cstring
deleted file mode 100644
index d8d03a7..0000000
--- a/contrib/libstdc++/cstring
+++ /dev/null
@@ -1,96 +0,0 @@
-// The -*- C++ -*- null-terminated string header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __CSTRING__
-#define __CSTRING__
-
-#include <string.h>
-
-#if 0 // Let's not bother with this just yet.
-#include <cstddef>
-
-#ifdef __GNUG__
-#pragma interface "cstring"
-#endif
-
-// The ANSI C prototypes for these functions have a const argument type and
-// non-const return type, so we can't use them.
-
-extern "C++" {
-extern inline const char *
-_G_strchr (const char *s, int c)
-{
- return strchr (s, c);
-}
-
-extern inline char *
-_G_strchr (char *s, int c)
-{
- return const_cast<char *> (strchr (s, c));
-}
-
-extern inline const char *
-_G_strpbrk (const char *s1, const char *s2)
-{
- return strpbrk (s1, s2);
-}
-
-extern inline char *
-_G_strpbrk (char *s1, const char *s2)
-{
- return const_cast<char *> (strpbrk (s1, s2));
-}
-
-extern inline const char *
-_G_strrchr (const char *s, int c)
-{
- return strrchr (s, c);
-}
-
-extern inline char *
-_G_strrchr (char *s, int c)
-{
- return const_cast<char *> (strrchr (s, c));
-}
-
-extern inline const char *
-_G_strstr (const char *s1, const char *s2)
-{
- return strstr (s1, s2);
-}
-
-extern inline char *
-_G_strstr (char *s1, const char *s2)
-{
- return const_cast<char *> (strstr (s1, s2));
-}
-
-extern inline const void *
-_G_memchr (const void *s, int c, size_t n)
-{
- return memchr (s, c, n);
-}
-
-extern inline void *
-_G_memchr (void *s, int c, size_t n)
-{
- return const_cast<void *> (memchr (s, c, n));
-}
-} // extern "C++"
-
-// Lose any vendor macros for these functions.
-#undef strchr
-#undef strpbrk
-#undef strrchr
-#undef strstr
-#undef memchr
-
-// Ewww, namespace pollution. Anyone have a better idea?
-#define strchr _G_strchr
-#define strpbrk _G_strpbrk
-#define strrchr _G_strrchr
-#define strstr _G_strstr
-#define memchr _G_memchr
-#endif // 0
-
-#endif // !defined (__CSTRING__)
diff --git a/contrib/libstdc++/cstringi.cc b/contrib/libstdc++/cstringi.cc
deleted file mode 100644
index 2676feb..0000000
--- a/contrib/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 "cstring"
-#endif
-#include <cstring>
diff --git a/contrib/libstdc++/ctime b/contrib/libstdc++/ctime
deleted file mode 100644
index 0184da5..0000000
--- a/contrib/libstdc++/ctime
+++ /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/libstdc++/cwchar b/contrib/libstdc++/cwchar
deleted file mode 100644
index 1674c12..0000000
--- a/contrib/libstdc++/cwchar
+++ /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/libstdc++/cwctype b/contrib/libstdc++/cwctype
deleted file mode 100644
index 8112201..0000000
--- a/contrib/libstdc++/cwctype
+++ /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/libstdc++/fstream b/contrib/libstdc++/fstream
deleted file mode 100644
index 2c35ca9..0000000
--- a/contrib/libstdc++/fstream
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __FSTREAM__
-#define __FSTREAM__
-#include <fstream.h>
-#endif
diff --git a/contrib/libstdc++/include/bits/fpos.h b/contrib/libstdc++/include/bits/fpos.h
deleted file mode 100644
index 5432527..0000000
--- a/contrib/libstdc++/include/bits/fpos.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// File position object and stream types
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 27 Input/output library
-//
-
-/** @file fpos.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_BITS_FPOS_H
-#define _CPP_BITS_FPOS_H 1
-
-#pragma GCC system_header
-
-#include <bits/c++io.h>
-#include <cwchar> // For mbstate_t.
-
-namespace std
-{
- // 27.4.1 Types
-
- // [27.4.3] template class fpos
- /**
- * @doctodo
- */
- template<typename _StateT>
- class fpos
- {
- public:
- // Types:
- typedef _StateT __state_type;
-
- private:
- streamoff _M_off;
- __state_type _M_st;
-
- public:
- __state_type
- state() const { return _M_st; }
-
- void
- state(__state_type __st) { _M_st = __st; }
-
- // NB: The standard defines only the implicit copy ctor and the
- // previous two members. The rest is a "conforming extension".
- fpos(): _M_off(streamoff()), _M_st(__state_type()) { }
-
- fpos(streamoff __off, __state_type __st = __state_type())
- : _M_off(__off), _M_st(__st) { }
-
- operator streamoff() const { return _M_off; }
-
- fpos&
- operator+=(streamoff __off) { _M_off += __off; return *this; }
-
- fpos&
- operator-=(streamoff __off) { _M_off -= __off; return *this; }
-
- fpos
- operator+(streamoff __off)
- {
- fpos __t(*this);
- __t += __off;
- return __t;
- }
-
- fpos
- operator-(streamoff __off)
- {
- fpos __t(*this);
- __t -= __off;
- return __t;
- }
-
- bool
- operator==(const fpos& __pos) const
- { return _M_off == __pos._M_off; }
-
- bool
- operator!=(const fpos& __pos) const
- { return _M_off != __pos._M_off; }
-
- streamoff
- _M_position() const { return _M_off; }
-
- void
- _M_position(streamoff __off) { _M_off = __off; }
- };
-
- /// 27.2, paragraph 10 about fpos/char_traits circularity
- typedef fpos<mbstate_t> streampos;
-# ifdef _GLIBCPP_USE_WCHAR_T
- /// 27.2, paragraph 10 about fpos/char_traits circularity
- typedef fpos<mbstate_t> wstreampos;
-# endif
-} // namespace std
-
-#endif
diff --git a/contrib/libstdc++/include/bits/pthread_allocimpl.h b/contrib/libstdc++/include/bits/pthread_allocimpl.h
deleted file mode 100644
index 050b206..0000000
--- a/contrib/libstdc++/include/bits/pthread_allocimpl.h
+++ /dev/null
@@ -1,525 +0,0 @@
-// POSIX thread-related memory allocation -*- C++ -*-
-
-// Copyright (C) 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/** @file pthread_allocimpl.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_BITS_PTHREAD_ALLOCIMPL_H
-#define _CPP_BITS_PTHREAD_ALLOCIMPL_H 1
-
-// Pthread-specific node allocator.
-// This is similar to the default allocator, except that free-list
-// information is kept separately for each thread, avoiding locking.
-// This should be reasonably fast even in the presence of threads.
-// The down side is that storage may not be well-utilized.
-// It is not an error to allocate memory in thread A and deallocate
-// it in thread B. But this effectively transfers ownership of the memory,
-// so that it can only be reallocated by thread B. Thus this can effectively
-// result in a storage leak if it's done on a regular basis.
-// It can also result in frequent sharing of
-// cache lines among processors, with potentially serious performance
-// consequences.
-
-#include <bits/c++config.h>
-#include <cerrno>
-#include <bits/stl_alloc.h>
-#ifndef __RESTRICT
-# define __RESTRICT
-#endif
-
-#include <new>
-
-namespace std
-{
-
-#define __STL_DATA_ALIGNMENT 8
-
-union _Pthread_alloc_obj {
- union _Pthread_alloc_obj * __free_list_link;
- char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */
-};
-
-// Pthread allocators don't appear to the client to have meaningful
-// instances. We do in fact need to associate some state with each
-// thread. That state is represented by
-// _Pthread_alloc_per_thread_state<_Max_size>.
-
-template<size_t _Max_size>
-struct _Pthread_alloc_per_thread_state {
- typedef _Pthread_alloc_obj __obj;
- enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT };
- _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
- _Pthread_alloc_per_thread_state<_Max_size> * __next;
- // Free list link for list of available per thread structures.
- // When one of these becomes available for reuse due to thread
- // termination, any objects in its free list remain associated
- // with it. The whole structure may then be used by a newly
- // created thread.
- _Pthread_alloc_per_thread_state() : __next(0)
- {
- memset((void *)__free_list, 0, (size_t) _S_NFREELISTS * sizeof(__obj *));
- }
- // Returns an object of size __n, and possibly adds to size n free list.
- void *_M_refill(size_t __n);
-};
-
-// Pthread-specific allocator.
-// The argument specifies the largest object size allocated from per-thread
-// free lists. Larger objects are allocated using malloc_alloc.
-// Max_size must be a power of 2.
-template <size_t _Max_size = 128>
-class _Pthread_alloc_template {
-
-public: // but only for internal use:
-
- typedef _Pthread_alloc_obj __obj;
-
- // Allocates a chunk for nobjs of size size. nobjs may be reduced
- // if it is inconvenient to allocate the requested number.
- static char *_S_chunk_alloc(size_t __size, int &__nobjs);
-
- enum {_S_ALIGN = __STL_DATA_ALIGNMENT};
-
- static size_t _S_round_up(size_t __bytes) {
- return (((__bytes) + (int) _S_ALIGN-1) & ~((int) _S_ALIGN - 1));
- }
- static size_t _S_freelist_index(size_t __bytes) {
- return (((__bytes) + (int) _S_ALIGN-1)/(int)_S_ALIGN - 1);
- }
-
-private:
- // Chunk allocation state. And other shared state.
- // Protected by _S_chunk_allocator_lock.
- static pthread_mutex_t _S_chunk_allocator_lock;
- static char *_S_start_free;
- static char *_S_end_free;
- static size_t _S_heap_size;
- static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states;
- static pthread_key_t _S_key;
- static bool _S_key_initialized;
- // Pthread key under which per thread state is stored.
- // Allocator instances that are currently unclaimed by any thread.
- static void _S_destructor(void *instance);
- // Function to be called on thread exit to reclaim per thread
- // state.
- static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state();
- // Return a recycled or new per thread state.
- static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state();
- // ensure that the current thread has an associated
- // per thread state.
- class _M_lock;
- friend class _M_lock;
- class _M_lock {
- public:
- _M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); }
- ~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); }
- };
-
-public:
-
- /* n must be > 0 */
- static void * allocate(size_t __n)
- {
- __obj * volatile * __my_free_list;
- __obj * __RESTRICT __result;
- _Pthread_alloc_per_thread_state<_Max_size>* __a;
-
- if (__n > _Max_size) {
- return(malloc_alloc::allocate(__n));
- }
- if (!_S_key_initialized ||
- !(__a = (_Pthread_alloc_per_thread_state<_Max_size>*)
- pthread_getspecific(_S_key))) {
- __a = _S_get_per_thread_state();
- }
- __my_free_list = __a -> __free_list + _S_freelist_index(__n);
- __result = *__my_free_list;
- if (__result == 0) {
- void *__r = __a -> _M_refill(_S_round_up(__n));
- return __r;
- }
- *__my_free_list = __result -> __free_list_link;
- return (__result);
- };
-
- /* p may not be 0 */
- static void deallocate(void *__p, size_t __n)
- {
- __obj *__q = (__obj *)__p;
- __obj * volatile * __my_free_list;
- _Pthread_alloc_per_thread_state<_Max_size>* __a;
-
- if (__n > _Max_size) {
- malloc_alloc::deallocate(__p, __n);
- return;
- }
- if (!_S_key_initialized ||
- !(__a = (_Pthread_alloc_per_thread_state<_Max_size> *)
- pthread_getspecific(_S_key))) {
- __a = _S_get_per_thread_state();
- }
- __my_free_list = __a->__free_list + _S_freelist_index(__n);
- __q -> __free_list_link = *__my_free_list;
- *__my_free_list = __q;
- }
-
- static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz);
-
-} ;
-
-typedef _Pthread_alloc_template<> pthread_alloc;
-
-
-template <size_t _Max_size>
-void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance)
-{
- _M_lock __lock_instance; // Need to acquire lock here.
- _Pthread_alloc_per_thread_state<_Max_size>* __s =
- (_Pthread_alloc_per_thread_state<_Max_size> *)__instance;
- __s -> __next = _S_free_per_thread_states;
- _S_free_per_thread_states = __s;
-}
-
-template <size_t _Max_size>
-_Pthread_alloc_per_thread_state<_Max_size> *
-_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state()
-{
- /* lock already held here. */
- if (0 != _S_free_per_thread_states) {
- _Pthread_alloc_per_thread_state<_Max_size> *__result =
- _S_free_per_thread_states;
- _S_free_per_thread_states = _S_free_per_thread_states -> __next;
- return __result;
- } else {
- return new _Pthread_alloc_per_thread_state<_Max_size>;
- }
-}
-
-template <size_t _Max_size>
-_Pthread_alloc_per_thread_state<_Max_size> *
-_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state()
-{
- /*REFERENCED*/
- _M_lock __lock_instance; // Need to acquire lock here.
- int __ret_code;
- _Pthread_alloc_per_thread_state<_Max_size> * __result;
- if (!_S_key_initialized) {
- if (pthread_key_create(&_S_key, _S_destructor)) {
- std::__throw_bad_alloc(); // defined in funcexcept.h
- }
- _S_key_initialized = true;
- }
- __result = _S_new_per_thread_state();
- __ret_code = pthread_setspecific(_S_key, __result);
- if (__ret_code) {
- if (__ret_code == ENOMEM) {
- std::__throw_bad_alloc();
- } else {
- // EINVAL
- abort();
- }
- }
- return __result;
-}
-
-/* We allocate memory in large chunks in order to avoid fragmenting */
-/* the malloc heap too much. */
-/* We assume that size is properly aligned. */
-template <size_t _Max_size>
-char *_Pthread_alloc_template<_Max_size>
-::_S_chunk_alloc(size_t __size, int &__nobjs)
-{
- {
- char * __result;
- size_t __total_bytes;
- size_t __bytes_left;
- /*REFERENCED*/
- _M_lock __lock_instance; // Acquire lock for this routine
-
- __total_bytes = __size * __nobjs;
- __bytes_left = _S_end_free - _S_start_free;
- if (__bytes_left >= __total_bytes) {
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return(__result);
- } else if (__bytes_left >= __size) {
- __nobjs = __bytes_left/__size;
- __total_bytes = __size * __nobjs;
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return(__result);
- } else {
- size_t __bytes_to_get =
- 2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
- // Try to make use of the left-over piece.
- if (__bytes_left > 0) {
- _Pthread_alloc_per_thread_state<_Max_size>* __a =
- (_Pthread_alloc_per_thread_state<_Max_size>*)
- pthread_getspecific(_S_key);
- __obj * volatile * __my_free_list =
- __a->__free_list + _S_freelist_index(__bytes_left);
-
- ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
- *__my_free_list = (__obj *)_S_start_free;
- }
-# ifdef _SGI_SOURCE
- // Try to get memory that's aligned on something like a
- // cache line boundary, so as to avoid parceling out
- // parts of the same line to different threads and thus
- // possibly different processors.
- {
- const int __cache_line_size = 128; // probable upper bound
- __bytes_to_get &= ~(__cache_line_size-1);
- _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
- if (0 == _S_start_free) {
- _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
- }
- }
-# else /* !SGI_SOURCE */
- _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
-# endif
- _S_heap_size += __bytes_to_get;
- _S_end_free = _S_start_free + __bytes_to_get;
- }
- }
- // lock is released here
- return(_S_chunk_alloc(__size, __nobjs));
-}
-
-
-/* Returns an object of size n, and optionally adds to size n free list.*/
-/* We assume that n is properly aligned. */
-/* We hold the allocation lock. */
-template <size_t _Max_size>
-void *_Pthread_alloc_per_thread_state<_Max_size>
-::_M_refill(size_t __n)
-{
- int __nobjs = 128;
- char * __chunk =
- _Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs);
- __obj * volatile * __my_free_list;
- __obj * __result;
- __obj * __current_obj, * __next_obj;
- int __i;
-
- if (1 == __nobjs) {
- return(__chunk);
- }
- __my_free_list = __free_list
- + _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n);
-
- /* Build free list in chunk */
- __result = (__obj *)__chunk;
- *__my_free_list = __next_obj = (__obj *)(__chunk + __n);
- for (__i = 1; ; __i++) {
- __current_obj = __next_obj;
- __next_obj = (__obj *)((char *)__next_obj + __n);
- if (__nobjs - 1 == __i) {
- __current_obj -> __free_list_link = 0;
- break;
- } else {
- __current_obj -> __free_list_link = __next_obj;
- }
- }
- return(__result);
-}
-
-template <size_t _Max_size>
-void *_Pthread_alloc_template<_Max_size>
-::reallocate(void *__p, size_t __old_sz, size_t __new_sz)
-{
- void * __result;
- size_t __copy_sz;
-
- if (__old_sz > _Max_size
- && __new_sz > _Max_size) {
- return(realloc(__p, __new_sz));
- }
- if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
- __result = allocate(__new_sz);
- __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
- memcpy(__result, __p, __copy_sz);
- deallocate(__p, __old_sz);
- return(__result);
-}
-
-template <size_t _Max_size>
-_Pthread_alloc_per_thread_state<_Max_size> *
-_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0;
-
-template <size_t _Max_size>
-pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key;
-
-template <size_t _Max_size>
-bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false;
-
-template <size_t _Max_size>
-pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock
-= PTHREAD_MUTEX_INITIALIZER;
-
-template <size_t _Max_size>
-char *_Pthread_alloc_template<_Max_size>
-::_S_start_free = 0;
-
-template <size_t _Max_size>
-char *_Pthread_alloc_template<_Max_size>
-::_S_end_free = 0;
-
-template <size_t _Max_size>
-size_t _Pthread_alloc_template<_Max_size>
-::_S_heap_size = 0;
-
-
-template <class _Tp>
-class pthread_allocator {
- typedef pthread_alloc _S_Alloc; // The underlying allocator.
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
- template <class _NewType> struct rebind {
- typedef pthread_allocator<_NewType> other;
- };
-
- pthread_allocator() throw() {}
- pthread_allocator(const pthread_allocator& a) throw() {}
- template <class _OtherType>
- pthread_allocator(const pthread_allocator<_OtherType>&)
- throw() {}
- ~pthread_allocator() throw() {}
-
- pointer address(reference __x) const { return &__x; }
- const_pointer address(const_reference __x) const { return &__x; }
-
- // __n is permitted to be 0. The C++ standard says nothing about what
- // the return value is when __n == 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp)))
- : 0;
- }
-
- // p is not permitted to be a null pointer.
- void deallocate(pointer __p, size_type __n)
- { _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
-
- size_type max_size() const throw()
- { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
- void destroy(pointer _p) { _p->~_Tp(); }
-};
-
-template<>
-class pthread_allocator<void> {
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-
- template <class _NewType> struct rebind {
- typedef pthread_allocator<_NewType> other;
- };
-};
-
-template <size_t _Max_size>
-inline bool operator==(const _Pthread_alloc_template<_Max_size>&,
- const _Pthread_alloc_template<_Max_size>&)
-{
- return true;
-}
-
-template <class _T1, class _T2>
-inline bool operator==(const pthread_allocator<_T1>&,
- const pthread_allocator<_T2>& a2)
-{
- return true;
-}
-
-template <class _T1, class _T2>
-inline bool operator!=(const pthread_allocator<_T1>&,
- const pthread_allocator<_T2>&)
-{
- return false;
-}
-
-template <class _Tp, size_t _Max_size>
-struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type;
- typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> >
- allocator_type;
-};
-
-template <class _Tp, class _Atype, size_t _Max>
-struct _Alloc_traits<_Tp, __allocator<_Atype, _Pthread_alloc_template<_Max> > >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type;
- typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type;
-};
-
-template <class _Tp, class _Atype>
-struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type;
- typedef pthread_allocator<_Tp> allocator_type;
-};
-
-
-} // namespace std
-
-#endif /* _CPP_BITS_PTHREAD_ALLOCIMPL_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/include/bits/stl_alloc.h b/contrib/libstdc++/include/bits/stl_alloc.h
deleted file mode 100644
index 9677c3e..0000000
--- a/contrib/libstdc++/include/bits/stl_alloc.h
+++ /dev/null
@@ -1,974 +0,0 @@
-// Allocators -*- C++ -*-
-
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * Copyright (c) 1996-1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/** @file stl_alloc.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __GLIBCPP_INTERNAL_ALLOC_H
-#define __GLIBCPP_INTERNAL_ALLOC_H
-
-/**
- * @defgroup Allocators Memory Allocators
- * @if maint
- * stl_alloc.h implements some node allocators. These are NOT the same as
- * allocators in the C++ standard, nor in the original H-P STL. They do not
- * encapsulate different pointer types; we assume that there is only one
- * pointer type. The C++ standard allocators are intended to allocate
- * individual objects, not pools or arenas.
- *
- * In this file allocators are of two different styles: "standard" and
- * "SGI" (quotes included). "Standard" allocators conform to 20.4. "SGI"
- * allocators differ in AT LEAST the following ways (add to this list as you
- * discover them):
- *
- * - "Standard" allocate() takes two parameters (n_count,hint=0) but "SGI"
- * allocate() takes one paramter (n_size).
- * - Likewise, "standard" deallocate()'s argument is a count, but in "SGI"
- * is a byte size.
- * - max_size(), construct(), and destroy() are missing in "SGI" allocators.
- * - reallocate(p,oldsz,newsz) is added in "SGI", and behaves as
- * if p=realloc(p,newsz).
- *
- * "SGI" allocators may be wrapped in __allocator to convert the interface
- * into a "standard" one.
- * @endif
- *
- * @note The @c reallocate member functions have been deprecated for 3.2
- * and will be removed in 3.4. You must define @c _GLIBCPP_DEPRECATED
- * to make this visible in 3.2; see c++config.h.
- *
- * The canonical description of these classes is in docs/html/ext/howto.html
- * or online at http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3
-*/
-
-#include <cstddef>
-#include <cstdlib>
-#include <cstring>
-#include <bits/functexcept.h> // For __throw_bad_alloc
-#include <bits/stl_threads.h>
-
-#include <bits/atomicity.h>
-
-namespace std
-{
- /**
- * @if maint
- * A new-based allocator, as required by the standard. Allocation and
- * deallocation forward to global new and delete. "SGI" style, minus
- * reallocate().
- * @endif
- * (See @link Allocators allocators info @endlink for more.)
- */
- class __new_alloc
- {
- public:
- static void*
- allocate(size_t __n)
- { return ::operator new(__n); }
-
- static void
- deallocate(void* __p, size_t)
- { ::operator delete(__p); }
- };
-
-
- /**
- * @if maint
- * A malloc-based allocator. Typically slower than the
- * __default_alloc_template (below). Typically thread-safe and more
- * storage efficient. The template argument is unused and is only present
- * to permit multiple instantiations (but see __default_alloc_template
- * for caveats). "SGI" style, plus __set_malloc_handler for OOM conditions.
- * @endif
- * (See @link Allocators allocators info @endlink for more.)
- */
- template<int __inst>
- class __malloc_alloc_template
- {
- private:
- static void* _S_oom_malloc(size_t);
- static void* _S_oom_realloc(void*, size_t);
- static void (* __malloc_alloc_oom_handler)();
-
- public:
- static void*
- allocate(size_t __n)
- {
- void* __result = malloc(__n);
- if (__builtin_expect(__result == 0, 0))
- __result = _S_oom_malloc(__n);
- return __result;
- }
-
- static void
- deallocate(void* __p, size_t /* __n */)
- { free(__p); }
-
- static void*
- reallocate(void* __p, size_t /* old_sz */, size_t __new_sz)
- {
- void* __result = realloc(__p, __new_sz);
- if (__builtin_expect(__result == 0, 0))
- __result = _S_oom_realloc(__p, __new_sz);
- return __result;
- }
-
- static void (* __set_malloc_handler(void (*__f)()))()
- {
- void (* __old)() = __malloc_alloc_oom_handler;
- __malloc_alloc_oom_handler = __f;
- return __old;
- }
- };
-
- // malloc_alloc out-of-memory handling
- template<int __inst>
- void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;
-
- template<int __inst>
- void*
- __malloc_alloc_template<__inst>::
- _S_oom_malloc(size_t __n)
- {
- void (* __my_malloc_handler)();
- void* __result;
-
- for (;;)
- {
- __my_malloc_handler = __malloc_alloc_oom_handler;
- if (__builtin_expect(__my_malloc_handler == 0, 0))
- __throw_bad_alloc();
- (*__my_malloc_handler)();
- __result = malloc(__n);
- if (__result)
- return __result;
- }
- }
-
- template<int __inst>
- void*
- __malloc_alloc_template<__inst>::
- _S_oom_realloc(void* __p, size_t __n)
- {
- void (* __my_malloc_handler)();
- void* __result;
-
- for (;;)
- {
- __my_malloc_handler = __malloc_alloc_oom_handler;
- if (__builtin_expect(__my_malloc_handler == 0, 0))
- __throw_bad_alloc();
- (*__my_malloc_handler)();
- __result = realloc(__p, __n);
- if (__result)
- return __result;
- }
- }
-
- // Should not be referenced within the library anymore.
- typedef __new_alloc __mem_interface;
-
- /**
- * @if maint
- * This is used primarily (only?) in _Alloc_traits and other places to
- * help provide the _Alloc_type typedef. All it does is forward the
- * requests after some minimal checking.
- *
- * This is neither "standard"-conforming nor "SGI". The _Alloc parameter
- * must be "SGI" style.
- * @endif
- * (See @link Allocators allocators info @endlink for more.)
- */
- template<typename _Tp, typename _Alloc>
- class __simple_alloc
- {
- public:
- static _Tp*
- allocate(size_t __n)
- {
- _Tp* __ret = 0;
- if (__n)
- __ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)));
- return __ret;
- }
-
- static _Tp*
- allocate()
- { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
-
- static void
- deallocate(_Tp* __p, size_t __n)
- { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
-
- static void
- deallocate(_Tp* __p)
- { _Alloc::deallocate(__p, sizeof (_Tp)); }
- };
-
-
- /**
- * @if maint
- * An adaptor for an underlying allocator (_Alloc) to check the size
- * arguments for debugging.
- *
- * "There is some evidence that this can confuse Purify." - SGI comment
- *
- * This adaptor is "SGI" style. The _Alloc parameter must also be "SGI".
- * @endif
- * (See @link Allocators allocators info @endlink for more.)
- */
- template<typename _Alloc>
- class __debug_alloc
- {
- private:
- // Size of space used to store size. Note that this must be
- // large enough to preserve alignment.
- enum {_S_extra = 8};
-
- public:
- static void*
- allocate(size_t __n)
- {
- char* __result = (char*)_Alloc::allocate(__n + (int) _S_extra);
- *(size_t*)__result = __n;
- return __result + (int) _S_extra;
- }
-
- static void
- deallocate(void* __p, size_t __n)
- {
- char* __real_p = (char*)__p - (int) _S_extra;
- if (*(size_t*)__real_p != __n)
- abort();
- _Alloc::deallocate(__real_p, __n + (int) _S_extra);
- }
-
- static void*
- reallocate(void* __p, size_t __old_sz, size_t __new_sz)
- {
- char* __real_p = (char*)__p - (int) _S_extra;
- if (*(size_t*)__real_p != __old_sz)
- abort();
- char* __result = (char*) _Alloc::reallocate(__real_p,
- __old_sz + (int) _S_extra,
- __new_sz + (int) _S_extra);
- *(size_t*)__result = __new_sz;
- return __result + (int) _S_extra;
- }
- };
-
-
- /**
- * @if maint
- * Default node allocator. "SGI" style. Uses various allocators to
- * fulfill underlying requests (and makes as few requests as possible
- * when in default high-speed pool mode).
- *
- * Important implementation properties:
- * 0. If globally mandated, then allocate objects from __new_alloc
- * 1. If the clients request an object of size > _MAX_BYTES, the resulting
- * object will be obtained directly from __new_alloc
- * 2. In all other cases, we allocate an object of size exactly
- * _S_round_up(requested_size). Thus the client has enough size
- * information that we can return the object to the proper free list
- * without permanently losing part of the object.
- *
- * The first template parameter specifies whether more than one thread may
- * use this allocator. It is safe to allocate an object from one instance
- * of a default_alloc and deallocate it with another one. This effectively
- * transfers its ownership to the second one. This may have undesirable
- * effects on reference locality.
- *
- * The second parameter is unused and serves only to allow the creation of
- * multiple default_alloc instances. Note that containers built on different
- * allocator instances have different types, limiting the utility of this
- * approach. If you do not wish to share the free lists with the main
- * default_alloc instance, instantiate this with a non-zero __inst.
- *
- * @endif
- * (See @link Allocators allocators info @endlink for more.)
- */
- template<bool __threads, int __inst>
- class __default_alloc_template
- {
- private:
- enum {_ALIGN = 8};
- enum {_MAX_BYTES = 128};
- enum {_NFREELISTS = _MAX_BYTES / _ALIGN};
-
- union _Obj
- {
- union _Obj* _M_free_list_link;
- char _M_client_data[1]; // The client sees this.
- };
-
- static _Obj* volatile _S_free_list[_NFREELISTS];
-
- // Chunk allocation state.
- static char* _S_start_free;
- static char* _S_end_free;
- static size_t _S_heap_size;
-
- static _STL_mutex_lock _S_node_allocator_lock;
-
- static size_t
- _S_round_up(size_t __bytes)
- { return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); }
-
- static size_t
- _S_freelist_index(size_t __bytes)
- { return (((__bytes) + (size_t)_ALIGN - 1)/(size_t)_ALIGN - 1); }
-
- // Returns an object of size __n, and optionally adds to size __n
- // free list.
- static void*
- _S_refill(size_t __n);
-
- // Allocates a chunk for nobjs of size size. nobjs may be reduced
- // if it is inconvenient to allocate the requested number.
- static char*
- _S_chunk_alloc(size_t __size, int& __nobjs);
-
- // It would be nice to use _STL_auto_lock here. But we need a
- // test whether threads are in use.
- struct _Lock
- {
- _Lock() { if (__threads) _S_node_allocator_lock._M_acquire_lock(); }
- ~_Lock() { if (__threads) _S_node_allocator_lock._M_release_lock(); }
- } __attribute__ ((__unused__));
- friend struct _Lock;
-
- static _Atomic_word _S_force_new;
-
- public:
- // __n must be > 0
- static void*
- allocate(size_t __n)
- {
- void* __ret = 0;
-
- // If there is a race through here, assume answer from getenv
- // will resolve in same direction. Inspired by techniques
- // to efficiently support threading found in basic_string.h.
- if (_S_force_new == 0)
- {
- if (getenv("GLIBCPP_FORCE_NEW"))
- __atomic_add(&_S_force_new, 1);
- else
- __atomic_add(&_S_force_new, -1);
- }
-
- if ((__n > (size_t) _MAX_BYTES) || (_S_force_new > 0))
- __ret = __new_alloc::allocate(__n);
- else
- {
- _Obj* volatile* __my_free_list = _S_free_list
- + _S_freelist_index(__n);
- // Acquire the lock here with a constructor call. This
- // ensures that it is released in exit or during stack
- // unwinding.
- _Lock __lock_instance;
- _Obj* __restrict__ __result = *__my_free_list;
- if (__builtin_expect(__result == 0, 0))
- __ret = _S_refill(_S_round_up(__n));
- else
- {
- *__my_free_list = __result -> _M_free_list_link;
- __ret = __result;
- }
- if (__builtin_expect(__ret == 0, 0))
- __throw_bad_alloc();
- }
- return __ret;
- }
-
- // __p may not be 0
- static void
- deallocate(void* __p, size_t __n)
- {
- if ((__n > (size_t) _MAX_BYTES) || (_S_force_new > 0))
- __new_alloc::deallocate(__p, __n);
- else
- {
- _Obj* volatile* __my_free_list = _S_free_list
- + _S_freelist_index(__n);
- _Obj* __q = (_Obj*)__p;
-
- // Acquire the lock here with a constructor call. This
- // ensures that it is released in exit or during stack
- // unwinding.
- _Lock __lock_instance;
- __q -> _M_free_list_link = *__my_free_list;
- *__my_free_list = __q;
- }
- }
-
- static void*
- reallocate(void* __p, size_t __old_sz, size_t __new_sz);
- };
-
- template<bool __threads, int __inst> _Atomic_word
- __default_alloc_template<__threads, __inst>::_S_force_new = 0;
-
- template<bool __threads, int __inst>
- inline bool
- operator==(const __default_alloc_template<__threads,__inst>&,
- const __default_alloc_template<__threads,__inst>&)
- { return true; }
-
- template<bool __threads, int __inst>
- inline bool
- operator!=(const __default_alloc_template<__threads,__inst>&,
- const __default_alloc_template<__threads,__inst>&)
- { return false; }
-
-
- // We allocate memory in large chunks in order to avoid fragmenting the
- // heap too much. We assume that __size is properly aligned. We hold
- // the allocation lock.
- template<bool __threads, int __inst>
- char*
- __default_alloc_template<__threads, __inst>::
- _S_chunk_alloc(size_t __size, int& __nobjs)
- {
- char* __result;
- size_t __total_bytes = __size * __nobjs;
- size_t __bytes_left = _S_end_free - _S_start_free;
-
- if (__bytes_left >= __total_bytes)
- {
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return __result ;
- }
- else if (__bytes_left >= __size)
- {
- __nobjs = (int)(__bytes_left/__size);
- __total_bytes = __size * __nobjs;
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return __result;
- }
- else
- {
- size_t __bytes_to_get =
- 2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
- // Try to make use of the left-over piece.
- if (__bytes_left > 0)
- {
- _Obj* volatile* __my_free_list =
- _S_free_list + _S_freelist_index(__bytes_left);
-
- ((_Obj*)(void*)_S_start_free) -> _M_free_list_link = *__my_free_list;
- *__my_free_list = (_Obj*)(void*)_S_start_free;
- }
- _S_start_free = (char*) __new_alloc::allocate(__bytes_to_get);
- if (_S_start_free == 0)
- {
- size_t __i;
- _Obj* volatile* __my_free_list;
- _Obj* __p;
- // Try to make do with what we have. That can't hurt. We
- // do not try smaller requests, since that tends to result
- // in disaster on multi-process machines.
- __i = __size;
- for (; __i <= (size_t) _MAX_BYTES; __i += (size_t) _ALIGN)
- {
- __my_free_list = _S_free_list + _S_freelist_index(__i);
- __p = *__my_free_list;
- if (__p != 0)
- {
- *__my_free_list = __p -> _M_free_list_link;
- _S_start_free = (char*)__p;
- _S_end_free = _S_start_free + __i;
- return _S_chunk_alloc(__size, __nobjs);
- // Any leftover piece will eventually make it to the
- // right free list.
- }
- }
- _S_end_free = 0; // In case of exception.
- _S_start_free = (char*)__new_alloc::allocate(__bytes_to_get);
- // This should either throw an exception or remedy the situation.
- // Thus we assume it succeeded.
- }
- _S_heap_size += __bytes_to_get;
- _S_end_free = _S_start_free + __bytes_to_get;
- return _S_chunk_alloc(__size, __nobjs);
- }
- }
-
-
- // Returns an object of size __n, and optionally adds to "size
- // __n"'s free list. We assume that __n is properly aligned. We
- // hold the allocation lock.
- template<bool __threads, int __inst>
- void*
- __default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
- {
- int __nobjs = 20;
- char* __chunk = _S_chunk_alloc(__n, __nobjs);
- _Obj* volatile* __my_free_list;
- _Obj* __result;
- _Obj* __current_obj;
- _Obj* __next_obj;
- int __i;
-
- if (1 == __nobjs)
- return __chunk;
- __my_free_list = _S_free_list + _S_freelist_index(__n);
-
- // Build free list in chunk.
- __result = (_Obj*)(void*)__chunk;
- *__my_free_list = __next_obj = (_Obj*)(void*)(__chunk + __n);
- for (__i = 1; ; __i++)
- {
- __current_obj = __next_obj;
- __next_obj = (_Obj*)(void*)((char*)__next_obj + __n);
- if (__nobjs - 1 == __i)
- {
- __current_obj -> _M_free_list_link = 0;
- break;
- }
- else
- __current_obj -> _M_free_list_link = __next_obj;
- }
- return __result;
- }
-
-
- template<bool threads, int inst>
- void*
- __default_alloc_template<threads, inst>::
- reallocate(void* __p, size_t __old_sz, size_t __new_sz)
- {
- void* __result;
- size_t __copy_sz;
-
- if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES)
- return(realloc(__p, __new_sz));
- if (_S_round_up(__old_sz) == _S_round_up(__new_sz))
- return(__p);
- __result = allocate(__new_sz);
- __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
- memcpy(__result, __p, __copy_sz);
- deallocate(__p, __old_sz);
- return __result;
- }
-
- template<bool __threads, int __inst>
- _STL_mutex_lock
- __default_alloc_template<__threads,__inst>::_S_node_allocator_lock
- __STL_MUTEX_INITIALIZER;
-
- template<bool __threads, int __inst>
- char* __default_alloc_template<__threads,__inst>::_S_start_free = 0;
-
- template<bool __threads, int __inst>
- char* __default_alloc_template<__threads,__inst>::_S_end_free = 0;
-
- template<bool __threads, int __inst>
- size_t __default_alloc_template<__threads,__inst>::_S_heap_size = 0;
-
- template<bool __threads, int __inst>
- typename __default_alloc_template<__threads,__inst>::_Obj* volatile
- __default_alloc_template<__threads,__inst>::_S_free_list[_NFREELISTS];
-
- typedef __default_alloc_template<true,0> __alloc;
- typedef __default_alloc_template<false,0> __single_client_alloc;
-
-
- /**
- * @brief The "standard" allocator, as per [20.4].
- *
- * The private _Alloc is "SGI" style. (See comments at the top
- * of stl_alloc.h.)
- *
- * The underlying allocator behaves as follows.
- * - __default_alloc_template is used via two typedefs
- * - "__single_client_alloc" typedef does no locking for threads
- * - "__alloc" typedef is threadsafe via the locks
- * - __new_alloc is used for memory requests
- *
- * (See @link Allocators allocators info @endlink for more.)
- */
- template<typename _Tp>
- class allocator
- {
- typedef __alloc _Alloc; // The underlying allocator.
- public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
- template<typename _Tp1>
- struct rebind
- { typedef allocator<_Tp1> other; };
-
- allocator() throw() {}
- allocator(const allocator&) throw() {}
- template<typename _Tp1>
- allocator(const allocator<_Tp1>&) throw() {}
- ~allocator() throw() {}
-
- pointer
- address(reference __x) const { return &__x; }
-
- const_pointer
- address(const_reference __x) const { return &__x; }
-
- // NB: __n is permitted to be 0. The C++ standard says nothing
- // about what the return value is when __n == 0.
- _Tp*
- allocate(size_type __n, const void* = 0)
- {
- _Tp* __ret = 0;
- if (__n)
- {
- if (__n <= this->max_size())
- __ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)));
- else
- __throw_bad_alloc();
- }
- return __ret;
- }
-
- // __p is not permitted to be a null pointer.
- void
- deallocate(pointer __p, size_type __n)
- { _Alloc::deallocate(__p, __n * sizeof(_Tp)); }
-
- size_type
- max_size() const throw() { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
- void destroy(pointer __p) { __p->~_Tp(); }
- };
-
- template<>
- class allocator<void>
- {
- public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-
- template<typename _Tp1>
- struct rebind
- { typedef allocator<_Tp1> other; };
- };
-
-
- template<typename _T1, typename _T2>
- inline bool
- operator==(const allocator<_T1>&, const allocator<_T2>&)
- { return true; }
-
- template<typename _T1, typename _T2>
- inline bool
- operator!=(const allocator<_T1>&, const allocator<_T2>&)
- { return false; }
-
-
- /**
- * @if maint
- * Allocator adaptor to turn an "SGI" style allocator (e.g.,
- * __alloc, __malloc_alloc_template) into a "standard" conforming
- * allocator. Note that this adaptor does *not* assume that all
- * objects of the underlying alloc class are identical, nor does it
- * assume that all of the underlying alloc's member functions are
- * static member functions. Note, also, that __allocator<_Tp,
- * __alloc> is essentially the same thing as allocator<_Tp>.
- * @endif
- * (See @link Allocators allocators info @endlink for more.)
- */
- template<typename _Tp, typename _Alloc>
- struct __allocator
- {
- _Alloc __underlying_alloc;
-
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
- template<typename _Tp1>
- struct rebind
- { typedef __allocator<_Tp1, _Alloc> other; };
-
- __allocator() throw() {}
- __allocator(const __allocator& __a) throw()
- : __underlying_alloc(__a.__underlying_alloc) {}
-
- template<typename _Tp1>
- __allocator(const __allocator<_Tp1, _Alloc>& __a) throw()
- : __underlying_alloc(__a.__underlying_alloc) {}
-
- ~__allocator() throw() {}
-
- pointer
- address(reference __x) const { return &__x; }
-
- const_pointer
- address(const_reference __x) const { return &__x; }
-
- // NB: __n is permitted to be 0. The C++ standard says nothing
- // about what the return value is when __n == 0.
- _Tp*
- allocate(size_type __n, const void* = 0)
- {
- _Tp* __ret = 0;
- if (__n)
- __ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)));
- return __ret;
- }
-
- // __p is not permitted to be a null pointer.
- void
- deallocate(pointer __p, size_type __n)
- { __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }
-
- size_type
- max_size() const throw() { return size_t(-1) / sizeof(_Tp); }
-
- void
- construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
-
- void
- destroy(pointer __p) { __p->~_Tp(); }
- };
-
- template<typename _Alloc>
- struct __allocator<void, _Alloc>
- {
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-
- template<typename _Tp1>
- struct rebind
- { typedef __allocator<_Tp1, _Alloc> other; };
- };
-
- template<typename _Tp, typename _Alloc>
- inline bool
- operator==(const __allocator<_Tp,_Alloc>& __a1,
- const __allocator<_Tp,_Alloc>& __a2)
- { return __a1.__underlying_alloc == __a2.__underlying_alloc; }
-
- template<typename _Tp, typename _Alloc>
- inline bool
- operator!=(const __allocator<_Tp, _Alloc>& __a1,
- const __allocator<_Tp, _Alloc>& __a2)
- { return __a1.__underlying_alloc != __a2.__underlying_alloc; }
-
-
- //@{
- /** Comparison operators for all of the predifined SGI-style allocators.
- * This ensures that __allocator<malloc_alloc> (for example) will work
- * correctly. As required, all allocators compare equal.
- */
- template<int inst>
- inline bool
- operator==(const __malloc_alloc_template<inst>&,
- const __malloc_alloc_template<inst>&)
- { return true; }
-
- template<int __inst>
- inline bool
- operator!=(const __malloc_alloc_template<__inst>&,
- const __malloc_alloc_template<__inst>&)
- { return false; }
-
- template<typename _Alloc>
- inline bool
- operator==(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&)
- { return true; }
-
- template<typename _Alloc>
- inline bool
- operator!=(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&)
- { return false; }
- //@}
-
-
- /**
- * @if maint
- * Another allocator adaptor: _Alloc_traits. This serves two purposes.
- * First, make it possible to write containers that can use either "SGI"
- * style allocators or "standard" allocators. Second, provide a mechanism
- * so that containers can query whether or not the allocator has distinct
- * instances. If not, the container can avoid wasting a word of memory to
- * store an empty object. For examples of use, see stl_vector.h, etc, or
- * any of the other classes derived from this one.
- *
- * This adaptor uses partial specialization. The general case of
- * _Alloc_traits<_Tp, _Alloc> assumes that _Alloc is a
- * standard-conforming allocator, possibly with non-equal instances and
- * non-static members. (It still behaves correctly even if _Alloc has
- * static member and if all instances are equal. Refinements affect
- * performance, not correctness.)
- *
- * There are always two members: allocator_type, which is a standard-
- * conforming allocator type for allocating objects of type _Tp, and
- * _S_instanceless, a static const member of type bool. If
- * _S_instanceless is true, this means that there is no difference
- * between any two instances of type allocator_type. Furthermore, if
- * _S_instanceless is true, then _Alloc_traits has one additional
- * member: _Alloc_type. This type encapsulates allocation and
- * deallocation of objects of type _Tp through a static interface; it
- * has two member functions, whose signatures are
- *
- * - static _Tp* allocate(size_t)
- * - static void deallocate(_Tp*, size_t)
- *
- * The size_t parameters are "standard" style (see top of stl_alloc.h) in
- * that they take counts, not sizes.
- *
- * @endif
- * (See @link Allocators allocators info @endlink for more.)
- */
- //@{
- // The fully general version.
- template<typename _Tp, typename _Allocator>
- struct _Alloc_traits
- {
- static const bool _S_instanceless = false;
- typedef typename _Allocator::template rebind<_Tp>::other allocator_type;
- };
-
- template<typename _Tp, typename _Allocator>
- const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless;
-
- /// The version for the default allocator.
- template<typename _Tp, typename _Tp1>
- struct _Alloc_traits<_Tp, allocator<_Tp1> >
- {
- static const bool _S_instanceless = true;
- typedef __simple_alloc<_Tp, __alloc> _Alloc_type;
- typedef allocator<_Tp> allocator_type;
- };
- //@}
-
- //@{
- /// Versions for the predefined "SGI" style allocators.
- template<typename _Tp, int __inst>
- struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> >
- {
- static const bool _S_instanceless = true;
- typedef __simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
- typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
- };
-
- template<typename _Tp, bool __threads, int __inst>
- struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> >
- {
- static const bool _S_instanceless = true;
- typedef __simple_alloc<_Tp, __default_alloc_template<__threads, __inst> >
- _Alloc_type;
- typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> >
- allocator_type;
- };
-
- template<typename _Tp, typename _Alloc>
- struct _Alloc_traits<_Tp, __debug_alloc<_Alloc> >
- {
- static const bool _S_instanceless = true;
- typedef __simple_alloc<_Tp, __debug_alloc<_Alloc> > _Alloc_type;
- typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type;
- };
- //@}
-
- //@{
- /// Versions for the __allocator adaptor used with the predefined
- /// "SGI" style allocators.
- template<typename _Tp, typename _Tp1, int __inst>
- struct _Alloc_traits<_Tp,
- __allocator<_Tp1, __malloc_alloc_template<__inst> > >
- {
- static const bool _S_instanceless = true;
- typedef __simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
- typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
- };
-
- template<typename _Tp, typename _Tp1, bool __thr, int __inst>
- struct _Alloc_traits<_Tp, __allocator<_Tp1, __default_alloc_template<__thr, __inst> > >
- {
- static const bool _S_instanceless = true;
- typedef __simple_alloc<_Tp, __default_alloc_template<__thr,__inst> >
- _Alloc_type;
- typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> >
- allocator_type;
- };
-
- template<typename _Tp, typename _Tp1, typename _Alloc>
- struct _Alloc_traits<_Tp, __allocator<_Tp1, __debug_alloc<_Alloc> > >
- {
- static const bool _S_instanceless = true;
- typedef __simple_alloc<_Tp, __debug_alloc<_Alloc> > _Alloc_type;
- typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type;
- };
- //@}
-
- // Inhibit implicit instantiations for required instantiations,
- // which are defined via explicit instantiations elsewhere.
- // NB: This syntax is a GNU extension.
-#if _GLIBCPP_EXTERN_TEMPLATE
- extern template class allocator<char>;
- extern template class allocator<wchar_t>;
- extern template class __default_alloc_template<true,0>;
-#endif
-} // namespace std
-
-#endif
diff --git a/contrib/libstdc++/include/bits/stl_pthread_alloc.h b/contrib/libstdc++/include/bits/stl_pthread_alloc.h
deleted file mode 100644
index 09b7d72..0000000
--- a/contrib/libstdc++/include/bits/stl_pthread_alloc.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Wrapper of pthread allocation header -*- C++ -*-
-
-// Copyright (C) 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * Copyright (c) 1996-1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/** @file stl_pthread_alloc.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_BITS_STL_PTHREAD_ALLOC_H
-#define _CPP_BITS_STL_PTHREAD_ALLOC_H 1
-
-#include <bits/pthread_allocimpl.h>
-
-using std::_Pthread_alloc_template;
-using std::pthread_alloc;
-
-#endif /* _CPP_BITS_STL_PTHREAD_ALLOC_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/include/bits/valarray_meta.h b/contrib/libstdc++/include/bits/valarray_meta.h
deleted file mode 100644
index 29a2dac..0000000
--- a/contrib/libstdc++/include/bits/valarray_meta.h
+++ /dev/null
@@ -1,1147 +0,0 @@
-// The template and inlines for the -*- C++ -*- internal _Meta class.
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
-
-/** @file valarray_meta.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_VALARRAY_META_H
-#define _CPP_VALARRAY_META_H 1
-
-#pragma GCC system_header
-
-namespace std
-{
- //
- // Implementing a loosened valarray return value is tricky.
- // First we need to meet 26.3.1/3: we should not add more than
- // two levels of template nesting. Therefore we resort to template
- // template to "flatten" loosened return value types.
- // At some point we use partial specialization to remove one level
- // template nesting due to _Expr<>
- //
-
- // This class is NOT defined. It doesn't need to.
- template<typename _Tp1, typename _Tp2> class _Constant;
-
- // Implementations of unary functions applied to valarray<>s.
- // I use hard-coded object functions here instead of a generic
- // approach like pointers to function:
- // 1) correctness: some functions take references, others values.
- // we can't deduce the correct type afterwards.
- // 2) efficiency -- object functions can be easily inlined
- // 3) be Koenig-lookup-friendly
-
- struct __abs
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return abs(__t); }
- };
-
- struct __cos
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return cos(__t); }
- };
-
- struct __acos
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return acos(__t); }
- };
-
- struct __cosh
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return cosh(__t); }
- };
-
- struct __sin
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return sin(__t); }
- };
-
- struct __asin
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return asin(__t); }
- };
-
- struct __sinh
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return sinh(__t); }
- };
-
- struct __tan
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return tan(__t); }
- };
-
- struct __atan
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return atan(__t); }
- };
-
- struct __tanh
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return tanh(__t); }
- };
-
- struct __exp
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return exp(__t); }
- };
-
- struct __log
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return log(__t); }
- };
-
- struct __log10
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return log10(__t); }
- };
-
- struct __sqrt
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return sqrt(__t); }
- };
-
- // In the past, we used to tailor operator applications semantics
- // to the specialization of standard function objects (i.e. plus<>, etc.)
- // That is incorrect. Therefore we provide our own surrogates.
-
- struct __unary_plus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return +__t; }
- };
-
- struct __negate
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return -__t; }
- };
-
- struct __bitwise_not
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return ~__t; }
- };
-
- struct __plus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x + __y; }
- };
-
- struct __minus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x - __y; }
- };
-
- struct __multiplies
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x * __y; }
- };
-
- struct __divides
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x / __y; }
- };
-
- struct __modulus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x % __y; }
- };
-
- struct __bitwise_xor
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x ^ __y; }
- };
-
- struct __bitwise_and
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x & __y; }
- };
-
- struct __bitwise_or
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x | __y; }
- };
-
- struct __shift_left
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x << __y; }
- };
-
- struct __shift_right
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x >> __y; }
- };
-
- struct __logical_and
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x && __y; }
- };
-
- struct __logical_or
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x || __y; }
- };
-
- struct __logical_not
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x) const { return !__x; }
- };
-
- struct __equal_to
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x == __y; }
- };
-
- struct __not_equal_to
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x != __y; }
- };
-
- struct __less
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x < __y; }
- };
-
- struct __greater
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x > __y; }
- };
-
- struct __less_equal
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x <= __y; }
- };
-
- struct __greater_equal
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x >= __y; }
- };
-
- // The few binary functions we miss.
- struct __atan2
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return atan2(__x, __y); }
- };
-
- struct __pow
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return pow(__x, __y); }
- };
-
-
- // We need these bits in order to recover the return type of
- // some functions/operators now that we're no longer using
- // function templates.
- template<typename, typename _Tp>
- struct __fun
- {
- typedef _Tp result_type;
- };
-
- // several specializations for relational operators.
- template<typename _Tp>
- struct __fun<__logical_not, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__logical_and, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__logical_or, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__less, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__greater, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__less_equal, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__greater_equal, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__equal_to, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__not_equal_to, _Tp>
- {
- typedef bool result_type;
- };
-
- //
- // Apply function taking a value/const reference closure
- //
-
- template<typename _Dom, typename _Arg>
- class _FunBase
- {
- public:
- typedef typename _Dom::value_type value_type;
-
- _FunBase(const _Dom& __e, value_type __f(_Arg))
- : _M_expr(__e), _M_func(__f) {}
-
- value_type operator[](size_t __i) const
- { return _M_func (_M_expr[__i]); }
-
- size_t size() const { return _M_expr.size ();}
-
- private:
- const _Dom& _M_expr;
- value_type (*_M_func)(_Arg);
- };
-
- template<class _Dom>
- struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type>
- {
- typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
- typedef typename _Base::value_type value_type;
- typedef value_type _Tp;
-
- _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {}
- };
-
- template<typename _Tp>
- struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp>
- {
- typedef _FunBase<valarray<_Tp>, _Tp> _Base;
- typedef _Tp value_type;
-
- _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {}
- };
-
- template<class _Dom>
- struct _RefFunClos<_Expr,_Dom> :
- _FunBase<_Dom, const typename _Dom::value_type&>
- {
- typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
- typedef typename _Base::value_type value_type;
- typedef value_type _Tp;
-
- _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&))
- : _Base(__e, __f) {}
- };
-
- template<typename _Tp>
- struct _RefFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, const _Tp&>
- {
- typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
- typedef _Tp value_type;
-
- _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&))
- : _Base(__v, __f) {}
- };
-
- //
- // Unary expression closure.
- //
-
- template<class _Oper, class _Arg>
- class _UnBase
- {
- public:
- typedef typename _Arg::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _UnBase(const _Arg& __e) : _M_expr(__e) {}
-
- value_type operator[](size_t __i) const
- { return _Oper()(_M_expr[__i]); }
-
- size_t size() const { return _M_expr.size(); }
-
- private:
- const _Arg& _M_expr;
- };
-
- template<class _Oper, class _Dom>
- struct _UnClos<_Oper, _Expr, _Dom> : _UnBase<_Oper, _Dom>
- {
- typedef _Dom _Arg;
- typedef _UnBase<_Oper, _Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _UnClos(const _Arg& __e) : _Base(__e) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _UnClos<_Oper, _ValArray, _Tp> : _UnBase<_Oper, valarray<_Tp> >
- {
- typedef valarray<_Tp> _Arg;
- typedef _UnBase<_Oper, valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _UnClos(const _Arg& __e) : _Base(__e) {}
- };
-
-
- //
- // Binary expression closure.
- //
-
- template<class _Oper, class _FirstArg, class _SecondArg>
- class _BinBase
- {
- public:
- typedef typename _FirstArg::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _BinBase(const _FirstArg& __e1, const _SecondArg& __e2)
- : _M_expr1(__e1), _M_expr2(__e2) {}
-
- value_type operator[](size_t __i) const
- { return _Oper()(_M_expr1[__i], _M_expr2[__i]); }
-
- size_t size() const { return _M_expr1.size(); }
-
- private:
- const _FirstArg& _M_expr1;
- const _SecondArg& _M_expr2;
- };
-
-
- template<class _Oper, class _Clos>
- class _BinBase2
- {
- public:
- typedef typename _Clos::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _BinBase2(const _Clos& __e, const _Vt& __t)
- : _M_expr1(__e), _M_expr2(__t) {}
-
- value_type operator[](size_t __i) const
- { return _Oper()(_M_expr1[__i], _M_expr2); }
-
- size_t size() const { return _M_expr1.size(); }
-
- private:
- const _Clos& _M_expr1;
- const _Vt& _M_expr2;
- };
-
- template<class _Oper, class _Clos>
- class _BinBase1
- {
- public:
- typedef typename _Clos::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _BinBase1(const _Vt& __t, const _Clos& __e)
- : _M_expr1(__t), _M_expr2(__e) {}
-
- value_type operator[](size_t __i) const
- { return _Oper()(_M_expr1, _M_expr2[__i]); }
-
- size_t size() const { return _M_expr2.size(); }
-
- private:
- const _Vt& _M_expr1;
- const _Clos& _M_expr2;
- };
-
- template<class _Oper, class _Dom1, class _Dom2>
- struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
- : _BinBase<_Oper,_Dom1,_Dom2>
- {
- typedef _BinBase<_Oper,_Dom1,_Dom2> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp>
- : _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> >
- {
- typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w)
- : _Base(__v, __w) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type>
- : _BinBase<_Oper,_Dom,valarray<typename _Dom::value_type> >
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
- : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom>
- : _BinBase<_Oper,valarray<typename _Dom::value_type>,_Dom>
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2)
- : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type>
- : _BinBase2<_Oper,_Dom>
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase2<_Oper,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom>
- : _BinBase1<_Oper,_Dom>
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase1<_Oper,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp>
- : _BinBase2<_Oper,valarray<_Tp> >
- {
- typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp>
- : _BinBase1<_Oper,valarray<_Tp> >
- {
- typedef _BinBase1<_Oper,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {}
- };
-
-
- //
- // slice_array closure.
- //
- template<typename _Dom> class _SBase {
- public:
- typedef typename _Dom::value_type value_type;
-
- _SBase (const _Dom& __e, const slice& __s)
- : _M_expr (__e), _M_slice (__s) {}
- value_type operator[] (size_t __i) const
- { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; }
- size_t size() const { return _M_slice.size (); }
-
- private:
- const _Dom& _M_expr;
- const slice& _M_slice;
- };
-
- template<typename _Tp> class _SBase<_Array<_Tp> > {
- public:
- typedef _Tp value_type;
-
- _SBase (_Array<_Tp> __a, const slice& __s)
- : _M_array (__a._M_data+__s.start()), _M_size (__s.size()),
- _M_stride (__s.stride()) {}
- value_type operator[] (size_t __i) const
- { return _M_array._M_data[__i * _M_stride]; }
- size_t size() const { return _M_size; }
-
- private:
- const _Array<_Tp> _M_array;
- const size_t _M_size;
- const size_t _M_stride;
- };
-
- template<class _Dom> struct _SClos<_Expr,_Dom> : _SBase<_Dom> {
- typedef _SBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {}
- };
-
- template<typename _Tp>
- struct _SClos<_ValArray,_Tp> : _SBase<_Array<_Tp> > {
- typedef _SBase<_Array<_Tp> > _Base;
- typedef _Tp value_type;
-
- _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {}
- };
-
- //
- // gslice_array closure.
- //
- template<class _Dom> class _GBase {
- public:
- typedef typename _Dom::value_type value_type;
-
- _GBase (const _Dom& __e, const valarray<size_t>& __i)
- : _M_expr (__e), _M_index(__i) {}
- value_type operator[] (size_t __i) const
- { return _M_expr[_M_index[__i]]; }
- size_t size () const { return _M_index.size(); }
-
- private:
- const _Dom& _M_expr;
- const valarray<size_t>& _M_index;
- };
-
- template<typename _Tp> class _GBase<_Array<_Tp> > {
- public:
- typedef _Tp value_type;
-
- _GBase (_Array<_Tp> __a, const valarray<size_t>& __i)
- : _M_array (__a), _M_index(__i) {}
- value_type operator[] (size_t __i) const
- { return _M_array._M_data[_M_index[__i]]; }
- size_t size () const { return _M_index.size(); }
-
- private:
- const _Array<_Tp> _M_array;
- const valarray<size_t>& _M_index;
- };
-
- template<class _Dom> struct _GClos<_Expr,_Dom> : _GBase<_Dom> {
- typedef _GBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _GClos (const _Dom& __e, const valarray<size_t>& __i)
- : _Base (__e, __i) {}
- };
-
- template<typename _Tp>
- struct _GClos<_ValArray,_Tp> : _GBase<_Array<_Tp> > {
- typedef _GBase<_Array<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _GClos (_Array<_Tp> __a, const valarray<size_t>& __i)
- : _Base (__a, __i) {}
- };
-
- //
- // indirect_array closure
- //
-
- template<class _Dom> class _IBase {
- public:
- typedef typename _Dom::value_type value_type;
-
- _IBase (const _Dom& __e, const valarray<size_t>& __i)
- : _M_expr (__e), _M_index (__i) {}
- value_type operator[] (size_t __i) const
- { return _M_expr[_M_index[__i]]; }
- size_t size() const { return _M_index.size(); }
-
- private:
- const _Dom& _M_expr;
- const valarray<size_t>& _M_index;
- };
-
- template<class _Dom> struct _IClos<_Expr,_Dom> : _IBase<_Dom> {
- typedef _IBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _IClos (const _Dom& __e, const valarray<size_t>& __i)
- : _Base (__e, __i) {}
- };
-
- template<typename _Tp>
- struct _IClos<_ValArray,_Tp> : _IBase<valarray<_Tp> > {
- typedef _IBase<valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i)
- : _Base (__a, __i) {}
- };
-
- //
- // class _Expr
- //
- template<class _Clos, typename _Tp>
- class _Expr
- {
- public:
- typedef _Tp value_type;
-
- _Expr(const _Clos&);
-
- const _Clos& operator()() const;
-
- value_type operator[](size_t) const;
- valarray<value_type> operator[](slice) const;
- valarray<value_type> operator[](const gslice&) const;
- valarray<value_type> operator[](const valarray<bool>&) const;
- valarray<value_type> operator[](const valarray<size_t>&) const;
-
- _Expr<_UnClos<__unary_plus,std::_Expr,_Clos>, value_type>
- operator+() const;
-
- _Expr<_UnClos<__negate,std::_Expr,_Clos>, value_type>
- operator-() const;
-
- _Expr<_UnClos<__bitwise_not,std::_Expr,_Clos>, value_type>
- operator~() const;
-
- _Expr<_UnClos<__logical_not,std::_Expr,_Clos>, bool>
- operator!() const;
-
- size_t size() const;
- value_type sum() const;
-
- valarray<value_type> shift(int) const;
- valarray<value_type> cshift(int) const;
-
- value_type min() const;
- value_type max() const;
-
- valarray<value_type> apply(value_type (*)(const value_type&)) const;
- valarray<value_type> apply(value_type (*)(value_type)) const;
-
- private:
- const _Clos _M_closure;
- };
-
- template<class _Clos, typename _Tp>
- inline
- _Expr<_Clos,_Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {}
-
- template<class _Clos, typename _Tp>
- inline const _Clos&
- _Expr<_Clos,_Tp>::operator()() const
- { return _M_closure; }
-
- template<class _Clos, typename _Tp>
- inline _Tp
- _Expr<_Clos,_Tp>::operator[](size_t __i) const
- { return _M_closure[__i]; }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos,_Tp>::operator[](slice __s) const
- { return _M_closure[__s]; }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos,_Tp>::operator[](const gslice& __gs) const
- { return _M_closure[__gs]; }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos,_Tp>::operator[](const valarray<bool>& __m) const
- { return _M_closure[__m]; }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos,_Tp>::operator[](const valarray<size_t>& __i) const
- { return _M_closure[__i]; }
-
- template<class _Clos, typename _Tp>
- inline size_t
- _Expr<_Clos,_Tp>::size() const { return _M_closure.size (); }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos, _Tp>::shift(int __n) const
- { return valarray<_Tp>(_M_closure).shift(__n); }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos, _Tp>::cshift(int __n) const
- { return valarray<_Tp>(_M_closure).cshift(__n); }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const
- { return valarray<_Tp>(_M_closure).apply(__f); }
-
- template<class _Clos, typename _Tp>
- inline valarray<_Tp>
- _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const
- { return valarray<_Tp>(_M_closure).apply(__f); }
-
- // XXX: replace this with a more robust summation algorithm.
- template<class _Clos, typename _Tp>
- inline _Tp
- _Expr<_Clos,_Tp>::sum() const
- {
- size_t __n = _M_closure.size();
- if (__n == 0)
- return _Tp();
- else
- {
- _Tp __s = _M_closure[--__n];
- while (__n != 0)
- __s += _M_closure[--__n];
- return __s;
- }
- }
-
- template<class _Clos, typename _Tp>
- inline _Tp
- _Expr<_Clos, _Tp>::min() const
- { return __valarray_min(_M_closure); }
-
- template<class _Clos, typename _Tp>
- inline _Tp
- _Expr<_Clos, _Tp>::max() const
- { return __valarray_max(_M_closure); }
-
- template<class _Dom, typename _Tp>
- inline _Expr<_UnClos<__logical_not,_Expr,_Dom>, bool>
- _Expr<_Dom,_Tp>::operator!() const
- {
- typedef _UnClos<__logical_not,std::_Expr,_Dom> _Closure;
- return _Expr<_Closure,_Tp>(_Closure(this->_M_closure));
- }
-
-#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \
- template<class _Dom, typename _Tp> \
- inline _Expr<_UnClos<_Name,std::_Expr,_Dom>,_Tp> \
- _Expr<_Dom,_Tp>::operator _Op() const \
- { \
- typedef _UnClos<_Name,std::_Expr,_Dom> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(this->_M_closure)); \
- }
-
- _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)
- _DEFINE_EXPR_UNARY_OPERATOR(-, __negate)
- _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not)
-
-#undef _DEFINE_EXPR_UNARY_OPERATOR
-
-
-#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \
- template<class _Dom1, class _Dom2> \
- inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, \
- typename __fun<_Name, typename _Dom1::value_type>::result_type>\
- operator _Op(const _Expr<_Dom1,typename _Dom1::value_type>& __v, \
- const _Expr<_Dom2,typename _Dom2::value_type>& __w) \
- { \
- typedef typename _Dom1::value_type _Arg; \
- typedef typename __fun<_Name, _Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure; \
- return _Expr<_Closure,_Value>(_Closure(__v(), __w())); \
- } \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>,\
- typename __fun<_Name, typename _Dom::value_type>::result_type>\
-operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __v, \
- const typename _Dom::value_type& __t) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef typename __fun<_Name, _Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure; \
- return _Expr<_Closure,_Value>(_Closure(__v(), __t)); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>,\
- typename __fun<_Name, typename _Dom::value_type>::result_type>\
-operator _Op(const typename _Dom::value_type& __t, \
- const _Expr<_Dom,typename _Dom::value_type>& __v) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef typename __fun<_Name, _Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure; \
- return _Expr<_Closure,_Value>(_Closure(__t, __v())); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>,\
- typename __fun<_Name, typename _Dom::value_type>::result_type>\
-operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \
- const valarray<typename _Dom::value_type>& __v) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef typename __fun<_Name, _Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Arg> _Closure; \
- return _Expr<_Closure,_Value>(_Closure(__e(), __v)); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>,\
- typename __fun<_Name, typename _Dom::value_type>::result_type>\
-operator _Op(const valarray<typename _Dom::value_type>& __v, \
- const _Expr<_Dom,typename _Dom::value_type>& __e) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef typename __fun<_Name, _Tp>::result_type _Value; \
- typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure; \
- return _Expr<_Closure,_Value> (_Closure (__v, __e ())); \
-}
-
- _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)
- _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)
- _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies)
- _DEFINE_EXPR_BINARY_OPERATOR(/, __divides)
- _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus)
- _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)
- _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)
- _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or)
- _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left)
- _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right)
- _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
- _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or)
- _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to)
- _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to)
- _DEFINE_EXPR_BINARY_OPERATOR(<, __less)
- _DEFINE_EXPR_BINARY_OPERATOR(>, __greater)
- _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal)
- _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal)
-
-#undef _DEFINE_EXPR_BINARY_OPERATOR
-
-#define _DEFINE_EXPR_UNARY_FUNCTION(_Name) \
- template<class _Dom> \
- inline _Expr<_UnClos<__##_Name,_Expr,_Dom>,typename _Dom::value_type>\
- _Name(const _Expr<_Dom,typename _Dom::value_type>& __e) \
- { \
- typedef typename _Dom::value_type _Tp; \
- typedef _UnClos<__##_Name,_Expr,_Dom> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__e())); \
- } \
- \
- template<typename _Tp> \
- inline _Expr<_UnClos<__##_Name,_ValArray,_Tp>,_Tp> \
- _Name(const valarray<_Tp>& __v) \
- { \
- typedef _UnClos<__##_Name,_ValArray,_Tp> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__v)); \
- }
-
- _DEFINE_EXPR_UNARY_FUNCTION(abs)
- _DEFINE_EXPR_UNARY_FUNCTION(cos)
- _DEFINE_EXPR_UNARY_FUNCTION(acos)
- _DEFINE_EXPR_UNARY_FUNCTION(cosh)
- _DEFINE_EXPR_UNARY_FUNCTION(sin)
- _DEFINE_EXPR_UNARY_FUNCTION(asin)
- _DEFINE_EXPR_UNARY_FUNCTION(sinh)
- _DEFINE_EXPR_UNARY_FUNCTION(tan)
- _DEFINE_EXPR_UNARY_FUNCTION(tanh)
- _DEFINE_EXPR_UNARY_FUNCTION(atan)
- _DEFINE_EXPR_UNARY_FUNCTION(exp)
- _DEFINE_EXPR_UNARY_FUNCTION(log)
- _DEFINE_EXPR_UNARY_FUNCTION(log10)
- _DEFINE_EXPR_UNARY_FUNCTION(sqrt)
-
-#undef _DEFINE_EXPR_UNARY_FUNCTION
-
-#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun) \
- template<class _Dom1, class _Dom2> \
- inline _Expr<_BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2>, \
- typename _Dom1::value_type> \
- _Fun(const _Expr<_Dom1,typename _Dom1::value_type>& __e1, \
- const _Expr<_Dom2,typename _Dom2::value_type>& __e2) \
- { \
- typedef typename _Dom1::value_type _Tp; \
- typedef _BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__e1(), __e2())); \
- } \
- \
- template<class _Dom> \
- inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom, \
- typename _Dom::value_type>, \
- typename _Dom::value_type> \
- _Fun(const _Expr<_Dom,typename _Dom::value_type>& __e, \
- const valarray<typename _Dom::value_type>& __v) \
- { \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure;\
- return _Expr<_Closure,_Tp>(_Closure(__e(), __v)); \
- } \
- \
- template<class _Dom> \
- inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr, \
- typename _Dom::value_type,_Dom>, \
- typename _Dom::value_type> \
- _Fun(const valarray<typename _Dom::valarray>& __v, \
- const _Expr<_Dom,typename _Dom::value_type>& __e) \
- { \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinClos<__##_Fun,_ValArray,_Expr,_Tp,_Dom> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__v, __e())); \
- } \
- \
- template<class _Dom> \
- inline _Expr<_BinClos<__##_Fun,_Expr,_Constant,_Dom, \
- typename _Dom::value_type>, \
- typename _Dom::value_type> \
- _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \
- const typename _Dom::value_type& __t) \
- { \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinClos<__##_Fun,_Expr,_Constant,_Dom,_Tp> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__e(), __t)); \
- } \
- \
- template<class _Dom> \
- inline _Expr<_BinClos<__##_Fun,_Constant,_Expr, \
- typename _Dom::value_type,_Dom>, \
- typename _Dom::value_type> \
- _Fun(const typename _Dom::value_type& __t, \
- const _Expr<_Dom,typename _Dom::value_type>& __e) \
- { \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinClos<__##_Fun, _Constant,_Expr,_Tp,_Dom> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__t, __e())); \
- } \
- \
- template<typename _Tp> \
- inline _Expr<_BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp>, _Tp> \
- _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
- { \
- typedef _BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__v, __w)); \
- } \
- \
- template<typename _Tp> \
- inline _Expr<_BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp>,_Tp> \
- _Fun(const valarray<_Tp>& __v, const _Tp& __t) \
- { \
- typedef _BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__v, __t)); \
- } \
- \
- template<typename _Tp> \
- inline _Expr<_BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp>,_Tp> \
- _Fun(const _Tp& __t, const valarray<_Tp>& __v) \
- { \
- typedef _BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__t, __v)); \
- }
-
-_DEFINE_EXPR_BINARY_FUNCTION(atan2)
-_DEFINE_EXPR_BINARY_FUNCTION(pow)
-
-#undef _DEFINE_EXPR_BINARY_FUNCTION
-
-} // std::
-
-
-#endif /* _CPP_VALARRAY_META_H */
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/include/ext/stl_hash_fun.h b/contrib/libstdc++/include/ext/stl_hash_fun.h
deleted file mode 100644
index 562fe7a..0000000
--- a/contrib/libstdc++/include/ext/stl_hash_fun.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// 'struct hash' from SGI -*- C++ -*-
-
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * 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.
- *
- */
-
-/** @file ext/stl_hash_fun.h
- * This file is a GNU extension to the Standard C++ Library (possibly
- * containing extensions from the HP/SGI STL subset). You should only
- * include this header if you are using GCC 3 or later.
- */
-
-#ifndef _CPP_BITS_STL_HASH_FUN_H
-#define _CPP_BITS_STL_HASH_FUN_H 1
-
-#include <cstddef>
-
-namespace __gnu_cxx
-{
-using std::size_t;
-
-template <class _Key> struct hash { };
-
-inline size_t __stl_hash_string(const char* __s)
-{
- unsigned long __h = 0;
- for ( ; *__s; ++__s)
- __h = 5*__h + *__s;
-
- return size_t(__h);
-}
-
-template<> struct hash<char*>
-{
- size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
-};
-
-template<> struct hash<const char*>
-{
- size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
-};
-
-template<> struct hash<char> {
- size_t operator()(char __x) const { return __x; }
-};
-template<> struct hash<unsigned char> {
- size_t operator()(unsigned char __x) const { return __x; }
-};
-template<> struct hash<signed char> {
- size_t operator()(unsigned char __x) const { return __x; }
-};
-template<> struct hash<short> {
- size_t operator()(short __x) const { return __x; }
-};
-template<> struct hash<unsigned short> {
- size_t operator()(unsigned short __x) const { return __x; }
-};
-template<> struct hash<int> {
- size_t operator()(int __x) const { return __x; }
-};
-template<> struct hash<unsigned int> {
- size_t operator()(unsigned int __x) const { return __x; }
-};
-template<> struct hash<long> {
- size_t operator()(long __x) const { return __x; }
-};
-template<> struct hash<unsigned long> {
- size_t operator()(unsigned long __x) const { return __x; }
-};
-
-} // namespace __gnu_cxx
-
-#endif /* _CPP_BITS_STL_HASH_FUN_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/include/ext/stl_hashtable.h b/contrib/libstdc++/include/ext/stl_hashtable.h
deleted file mode 100644
index b41c821..0000000
--- a/contrib/libstdc++/include/ext/stl_hashtable.h
+++ /dev/null
@@ -1,996 +0,0 @@
-// Hashtable implementation used by containers -*- C++ -*-
-
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/** @file ext/stl_hashtable.h
- * This file is a GNU extension to the Standard C++ Library (possibly
- * containing extensions from the HP/SGI STL subset). You should only
- * include this header if you are using GCC 3 or later.
- */
-
-#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
-#define __SGI_STL_INTERNAL_HASHTABLE_H
-
-// Hashtable class, used to implement the hashed associative containers
-// hash_set, hash_map, hash_multiset, and hash_multimap.
-
-#include <vector>
-#include <iterator>
-#include <bits/stl_algo.h>
-#include <bits/stl_function.h>
-#include <ext/stl_hash_fun.h>
-
-namespace __gnu_cxx
-{
-using std::size_t;
-using std::ptrdiff_t;
-using std::forward_iterator_tag;
-using std::input_iterator_tag;
-using std::_Alloc_traits;
-using std::_Construct;
-using std::_Destroy;
-using std::distance;
-using std::vector;
-using std::pair;
-using std::__iterator_category;
-
-template <class _Val>
-struct _Hashtable_node
-{
- _Hashtable_node* _M_next;
- _Val _M_val;
-};
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc = std::__alloc>
-class hashtable;
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_iterator;
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_const_iterator;
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_iterator {
- typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
- _Hashtable;
- typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
- _ExtractKey, _EqualKey, _Alloc>
- iterator;
- typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
- _ExtractKey, _EqualKey, _Alloc>
- const_iterator;
- typedef _Hashtable_node<_Val> _Node;
-
- typedef forward_iterator_tag iterator_category;
- typedef _Val value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef _Val& reference;
- typedef _Val* pointer;
-
- _Node* _M_cur;
- _Hashtable* _M_ht;
-
- _Hashtable_iterator(_Node* __n, _Hashtable* __tab)
- : _M_cur(__n), _M_ht(__tab) {}
- _Hashtable_iterator() {}
- reference operator*() const { return _M_cur->_M_val; }
- pointer operator->() const { return &(operator*()); }
- iterator& operator++();
- iterator operator++(int);
- bool operator==(const iterator& __it) const
- { return _M_cur == __it._M_cur; }
- bool operator!=(const iterator& __it) const
- { return _M_cur != __it._M_cur; }
-};
-
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_const_iterator {
- typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
- _Hashtable;
- typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
- _ExtractKey,_EqualKey,_Alloc>
- iterator;
- typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
- _ExtractKey, _EqualKey, _Alloc>
- const_iterator;
- typedef _Hashtable_node<_Val> _Node;
-
- typedef forward_iterator_tag iterator_category;
- typedef _Val value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef const _Val& reference;
- typedef const _Val* pointer;
-
- const _Node* _M_cur;
- const _Hashtable* _M_ht;
-
- _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
- : _M_cur(__n), _M_ht(__tab) {}
- _Hashtable_const_iterator() {}
- _Hashtable_const_iterator(const iterator& __it)
- : _M_cur(__it._M_cur), _M_ht(__it._M_ht) {}
- reference operator*() const { return _M_cur->_M_val; }
- pointer operator->() const { return &(operator*()); }
- const_iterator& operator++();
- const_iterator operator++(int);
- bool operator==(const const_iterator& __it) const
- { return _M_cur == __it._M_cur; }
- bool operator!=(const const_iterator& __it) const
- { return _M_cur != __it._M_cur; }
-};
-
-// Note: assumes long is at least 32 bits.
-enum { __stl_num_primes = 28 };
-
-static const unsigned long __stl_prime_list[__stl_num_primes] =
-{
- 53ul, 97ul, 193ul, 389ul, 769ul,
- 1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
- 49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
- 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
- 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
- 1610612741ul, 3221225473ul, 4294967291ul
-};
-
-inline unsigned long __stl_next_prime(unsigned long __n)
-{
- const unsigned long* __first = __stl_prime_list;
- const unsigned long* __last = __stl_prime_list + (int)__stl_num_primes;
- const unsigned long* pos = std::lower_bound(__first, __last, __n);
- return pos == __last ? *(__last - 1) : *pos;
-}
-
-// Forward declaration of operator==.
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-class hashtable;
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
- const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2);
-
-
-// Hashtables handle allocators a bit differently than other containers
-// do. If we're using standard-conforming allocators, then a hashtable
-// unconditionally has a member variable to hold its allocator, even if
-// it so happens that all instances of the allocator type are identical.
-// This is because, for hashtables, this extra storage is negligible.
-// Additionally, a base class wouldn't serve any other purposes; it
-// wouldn't, for example, simplify the exception-handling code.
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-class hashtable {
-public:
- typedef _Key key_type;
- typedef _Val value_type;
- typedef _HashFcn hasher;
- typedef _EqualKey key_equal;
-
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- hasher hash_funct() const { return _M_hash; }
- key_equal key_eq() const { return _M_equals; }
-
-private:
- typedef _Hashtable_node<_Val> _Node;
-
-public:
- typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type;
- allocator_type get_allocator() const { return _M_node_allocator; }
-private:
- typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator;
- _Node* _M_get_node() { return _M_node_allocator.allocate(1); }
- void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); }
-
-private:
- hasher _M_hash;
- key_equal _M_equals;
- _ExtractKey _M_get_key;
- vector<_Node*,_Alloc> _M_buckets;
- size_type _M_num_elements;
-
-public:
- typedef _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
- iterator;
- typedef _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,
- _Alloc>
- const_iterator;
-
- friend struct
- _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
- friend struct
- _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
-
-public:
- hashtable(size_type __n,
- const _HashFcn& __hf,
- const _EqualKey& __eql,
- const _ExtractKey& __ext,
- const allocator_type& __a = allocator_type())
- : _M_node_allocator(__a),
- _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(__ext),
- _M_buckets(__a),
- _M_num_elements(0)
- {
- _M_initialize_buckets(__n);
- }
-
- hashtable(size_type __n,
- const _HashFcn& __hf,
- const _EqualKey& __eql,
- const allocator_type& __a = allocator_type())
- : _M_node_allocator(__a),
- _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(_ExtractKey()),
- _M_buckets(__a),
- _M_num_elements(0)
- {
- _M_initialize_buckets(__n);
- }
-
- hashtable(const hashtable& __ht)
- : _M_node_allocator(__ht.get_allocator()),
- _M_hash(__ht._M_hash),
- _M_equals(__ht._M_equals),
- _M_get_key(__ht._M_get_key),
- _M_buckets(__ht.get_allocator()),
- _M_num_elements(0)
- {
- _M_copy_from(__ht);
- }
-
- hashtable& operator= (const hashtable& __ht)
- {
- if (&__ht != this) {
- clear();
- _M_hash = __ht._M_hash;
- _M_equals = __ht._M_equals;
- _M_get_key = __ht._M_get_key;
- _M_copy_from(__ht);
- }
- return *this;
- }
-
- ~hashtable() { clear(); }
-
- size_type size() const { return _M_num_elements; }
- size_type max_size() const { return size_type(-1); }
- bool empty() const { return size() == 0; }
-
- void swap(hashtable& __ht)
- {
- std::swap(_M_hash, __ht._M_hash);
- std::swap(_M_equals, __ht._M_equals);
- std::swap(_M_get_key, __ht._M_get_key);
- _M_buckets.swap(__ht._M_buckets);
- std::swap(_M_num_elements, __ht._M_num_elements);
- }
-
- iterator begin()
- {
- for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
- if (_M_buckets[__n])
- return iterator(_M_buckets[__n], this);
- return end();
- }
-
- iterator end() { return iterator(0, this); }
-
- const_iterator begin() const
- {
- for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
- if (_M_buckets[__n])
- return const_iterator(_M_buckets[__n], this);
- return end();
- }
-
- const_iterator end() const { return const_iterator(0, this); }
-
- template <class _Vl, class _Ky, class _HF, class _Ex, class _Eq, class _Al>
- friend bool operator== (const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,
- const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&);
-public:
-
- size_type bucket_count() const { return _M_buckets.size(); }
-
- size_type max_bucket_count() const
- { return __stl_prime_list[(int)__stl_num_primes - 1]; }
-
- size_type elems_in_bucket(size_type __bucket) const
- {
- size_type __result = 0;
- for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next)
- __result += 1;
- return __result;
- }
-
- pair<iterator, bool> insert_unique(const value_type& __obj)
- {
- resize(_M_num_elements + 1);
- return insert_unique_noresize(__obj);
- }
-
- iterator insert_equal(const value_type& __obj)
- {
- resize(_M_num_elements + 1);
- return insert_equal_noresize(__obj);
- }
-
- pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
- iterator insert_equal_noresize(const value_type& __obj);
-
- template <class _InputIterator>
- void insert_unique(_InputIterator __f, _InputIterator __l)
- {
- insert_unique(__f, __l, __iterator_category(__f));
- }
-
- template <class _InputIterator>
- void insert_equal(_InputIterator __f, _InputIterator __l)
- {
- insert_equal(__f, __l, __iterator_category(__f));
- }
-
- template <class _InputIterator>
- void insert_unique(_InputIterator __f, _InputIterator __l,
- input_iterator_tag)
- {
- for ( ; __f != __l; ++__f)
- insert_unique(*__f);
- }
-
- template <class _InputIterator>
- void insert_equal(_InputIterator __f, _InputIterator __l,
- input_iterator_tag)
- {
- for ( ; __f != __l; ++__f)
- insert_equal(*__f);
- }
-
- template <class _ForwardIterator>
- void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
- forward_iterator_tag)
- {
- size_type __n = distance(__f, __l);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- template <class _ForwardIterator>
- void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
- forward_iterator_tag)
- {
- size_type __n = distance(__f, __l);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-
- reference find_or_insert(const value_type& __obj);
-
- iterator find(const key_type& __key)
- {
- size_type __n = _M_bkt_num_key(__key);
- _Node* __first;
- for ( __first = _M_buckets[__n];
- __first && !_M_equals(_M_get_key(__first->_M_val), __key);
- __first = __first->_M_next)
- {}
- return iterator(__first, this);
- }
-
- const_iterator find(const key_type& __key) const
- {
- size_type __n = _M_bkt_num_key(__key);
- const _Node* __first;
- for ( __first = _M_buckets[__n];
- __first && !_M_equals(_M_get_key(__first->_M_val), __key);
- __first = __first->_M_next)
- {}
- return const_iterator(__first, this);
- }
-
- size_type count(const key_type& __key) const
- {
- const size_type __n = _M_bkt_num_key(__key);
- size_type __result = 0;
-
- for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), __key))
- ++__result;
- return __result;
- }
-
- pair<iterator, iterator>
- equal_range(const key_type& __key);
-
- pair<const_iterator, const_iterator>
- equal_range(const key_type& __key) const;
-
- size_type erase(const key_type& __key);
- void erase(const iterator& __it);
- void erase(iterator __first, iterator __last);
-
- void erase(const const_iterator& __it);
- void erase(const_iterator __first, const_iterator __last);
-
- void resize(size_type __num_elements_hint);
- void clear();
-
-private:
- size_type _M_next_size(size_type __n) const
- { return __stl_next_prime(__n); }
-
- void _M_initialize_buckets(size_type __n)
- {
- const size_type __n_buckets = _M_next_size(__n);
- _M_buckets.reserve(__n_buckets);
- _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
- _M_num_elements = 0;
- }
-
- size_type _M_bkt_num_key(const key_type& __key) const
- {
- return _M_bkt_num_key(__key, _M_buckets.size());
- }
-
- size_type _M_bkt_num(const value_type& __obj) const
- {
- return _M_bkt_num_key(_M_get_key(__obj));
- }
-
- size_type _M_bkt_num_key(const key_type& __key, size_t __n) const
- {
- return _M_hash(__key) % __n;
- }
-
- size_type _M_bkt_num(const value_type& __obj, size_t __n) const
- {
- return _M_bkt_num_key(_M_get_key(__obj), __n);
- }
-
- _Node* _M_new_node(const value_type& __obj)
- {
- _Node* __n = _M_get_node();
- __n->_M_next = 0;
- try {
- _Construct(&__n->_M_val, __obj);
- return __n;
- }
- catch(...)
- {
- _M_put_node(__n);
- __throw_exception_again;
- }
- }
-
- void _M_delete_node(_Node* __n)
- {
- _Destroy(&__n->_M_val);
- _M_put_node(__n);
- }
-
- void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
- void _M_erase_bucket(const size_type __n, _Node* __last);
-
- void _M_copy_from(const hashtable& __ht);
-
-};
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
-{
- const _Node* __old = _M_cur;
- _M_cur = _M_cur->_M_next;
- if (!_M_cur) {
- size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
- while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
- _M_cur = _M_ht->_M_buckets[__bucket];
- }
- return *this;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
-{
- iterator __tmp = *this;
- ++*this;
- return __tmp;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
-{
- const _Node* __old = _M_cur;
- _M_cur = _M_cur->_M_next;
- if (!_M_cur) {
- size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
- while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
- _M_cur = _M_ht->_M_buckets[__bucket];
- }
- return *this;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
-{
- const_iterator __tmp = *this;
- ++*this;
- return __tmp;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
- const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2)
-{
- typedef typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::_Node _Node;
- if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
- return false;
- for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) {
- _Node* __cur1 = __ht1._M_buckets[__n];
- _Node* __cur2 = __ht2._M_buckets[__n];
- // Check same length of lists
- for ( ; __cur1 && __cur2;
- __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
- {}
- if (__cur1 || __cur2)
- return false;
- // Now check one's elements are in the other
- for (__cur1 = __ht1._M_buckets[__n] ; __cur1; __cur1 = __cur1->_M_next)
- {
- bool _found__cur1 = false;
- for (_Node* __cur2 = __ht2._M_buckets[__n];
- __cur2; __cur2 = __cur2->_M_next)
- {
- if (__cur1->_M_val == __cur2->_M_val)
- {
- _found__cur1 = true;
- break;
- }
- }
- if (!_found__cur1)
- return false;
- }
- }
- return true;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
- const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) {
- return !(__ht1 == __ht2);
-}
-
-template <class _Val, class _Key, class _HF, class _Extract, class _EqKey,
- class _All>
-inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
- hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) {
- __ht1.swap(__ht2);
-}
-
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::insert_unique_noresize(const value_type& __obj)
-{
- const size_type __n = _M_bkt_num(__obj);
- _Node* __first = _M_buckets[__n];
-
- for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
- return pair<iterator, bool>(iterator(__cur, this), false);
-
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __first;
- _M_buckets[__n] = __tmp;
- ++_M_num_elements;
- return pair<iterator, bool>(iterator(__tmp, this), true);
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::insert_equal_noresize(const value_type& __obj)
-{
- const size_type __n = _M_bkt_num(__obj);
- _Node* __first = _M_buckets[__n];
-
- for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) {
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __cur->_M_next;
- __cur->_M_next = __tmp;
- ++_M_num_elements;
- return iterator(__tmp, this);
- }
-
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __first;
- _M_buckets[__n] = __tmp;
- ++_M_num_elements;
- return iterator(__tmp, this);
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
-{
- resize(_M_num_elements + 1);
-
- size_type __n = _M_bkt_num(__obj);
- _Node* __first = _M_buckets[__n];
-
- for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
- return __cur->_M_val;
-
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __first;
- _M_buckets[__n] = __tmp;
- ++_M_num_elements;
- return __tmp->_M_val;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator,
- typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
-{
- typedef pair<iterator, iterator> _Pii;
- const size_type __n = _M_bkt_num_key(__key);
-
- for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next)
- if (_M_equals(_M_get_key(__first->_M_val), __key)) {
- for (_Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next)
- if (!_M_equals(_M_get_key(__cur->_M_val), __key))
- return _Pii(iterator(__first, this), iterator(__cur, this));
- for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
- if (_M_buckets[__m])
- return _Pii(iterator(__first, this),
- iterator(_M_buckets[__m], this));
- return _Pii(iterator(__first, this), end());
- }
- return _Pii(end(), end());
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator,
- typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::equal_range(const key_type& __key) const
-{
- typedef pair<const_iterator, const_iterator> _Pii;
- const size_type __n = _M_bkt_num_key(__key);
-
- for (const _Node* __first = _M_buckets[__n] ;
- __first;
- __first = __first->_M_next) {
- if (_M_equals(_M_get_key(__first->_M_val), __key)) {
- for (const _Node* __cur = __first->_M_next;
- __cur;
- __cur = __cur->_M_next)
- if (!_M_equals(_M_get_key(__cur->_M_val), __key))
- return _Pii(const_iterator(__first, this),
- const_iterator(__cur, this));
- for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
- if (_M_buckets[__m])
- return _Pii(const_iterator(__first, this),
- const_iterator(_M_buckets[__m], this));
- return _Pii(const_iterator(__first, this), end());
- }
- }
- return _Pii(end(), end());
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key)
-{
- const size_type __n = _M_bkt_num_key(__key);
- _Node* __first = _M_buckets[__n];
- size_type __erased = 0;
-
- if (__first) {
- _Node* __cur = __first;
- _Node* __next = __cur->_M_next;
- while (__next) {
- if (_M_equals(_M_get_key(__next->_M_val), __key)) {
- __cur->_M_next = __next->_M_next;
- _M_delete_node(__next);
- __next = __cur->_M_next;
- ++__erased;
- --_M_num_elements;
- }
- else {
- __cur = __next;
- __next = __cur->_M_next;
- }
- }
- if (_M_equals(_M_get_key(__first->_M_val), __key)) {
- _M_buckets[__n] = __first->_M_next;
- _M_delete_node(__first);
- ++__erased;
- --_M_num_elements;
- }
- }
- return __erased;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const iterator& __it)
-{
- _Node* __p = __it._M_cur;
- if (__p) {
- const size_type __n = _M_bkt_num(__p->_M_val);
- _Node* __cur = _M_buckets[__n];
-
- if (__cur == __p) {
- _M_buckets[__n] = __cur->_M_next;
- _M_delete_node(__cur);
- --_M_num_elements;
- }
- else {
- _Node* __next = __cur->_M_next;
- while (__next) {
- if (__next == __p) {
- __cur->_M_next = __next->_M_next;
- _M_delete_node(__next);
- --_M_num_elements;
- break;
- }
- else {
- __cur = __next;
- __next = __cur->_M_next;
- }
- }
- }
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::erase(iterator __first, iterator __last)
-{
- size_type __f_bucket = __first._M_cur ?
- _M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size();
- size_type __l_bucket = __last._M_cur ?
- _M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size();
-
- if (__first._M_cur == __last._M_cur)
- return;
- else if (__f_bucket == __l_bucket)
- _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
- else {
- _M_erase_bucket(__f_bucket, __first._M_cur, 0);
- for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
- _M_erase_bucket(__n, 0);
- if (__l_bucket != _M_buckets.size())
- _M_erase_bucket(__l_bucket, __last._M_cur);
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline void
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const_iterator __first,
- const_iterator __last)
-{
- erase(iterator(const_cast<_Node*>(__first._M_cur),
- const_cast<hashtable*>(__first._M_ht)),
- iterator(const_cast<_Node*>(__last._M_cur),
- const_cast<hashtable*>(__last._M_ht)));
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline void
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const const_iterator& __it)
-{
- erase(iterator(const_cast<_Node*>(__it._M_cur),
- const_cast<hashtable*>(__it._M_ht)));
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::resize(size_type __num_elements_hint)
-{
- const size_type __old_n = _M_buckets.size();
- if (__num_elements_hint > __old_n) {
- const size_type __n = _M_next_size(__num_elements_hint);
- if (__n > __old_n) {
- vector<_Node*, _All> __tmp(__n, (_Node*)(0),
- _M_buckets.get_allocator());
- try {
- for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
- _Node* __first = _M_buckets[__bucket];
- while (__first) {
- size_type __new_bucket = _M_bkt_num(__first->_M_val, __n);
- _M_buckets[__bucket] = __first->_M_next;
- __first->_M_next = __tmp[__new_bucket];
- __tmp[__new_bucket] = __first;
- __first = _M_buckets[__bucket];
- }
- }
- _M_buckets.swap(__tmp);
- }
- catch(...) {
- for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) {
- while (__tmp[__bucket]) {
- _Node* __next = __tmp[__bucket]->_M_next;
- _M_delete_node(__tmp[__bucket]);
- __tmp[__bucket] = __next;
- }
- }
- __throw_exception_again;
- }
- }
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
-{
- _Node* __cur = _M_buckets[__n];
- if (__cur == __first)
- _M_erase_bucket(__n, __last);
- else {
- _Node* __next;
- for (__next = __cur->_M_next;
- __next != __first;
- __cur = __next, __next = __cur->_M_next)
- ;
- while (__next != __last) {
- __cur->_M_next = __next->_M_next;
- _M_delete_node(__next);
- __next = __cur->_M_next;
- --_M_num_elements;
- }
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::_M_erase_bucket(const size_type __n, _Node* __last)
-{
- _Node* __cur = _M_buckets[__n];
- while (__cur != __last) {
- _Node* __next = __cur->_M_next;
- _M_delete_node(__cur);
- __cur = __next;
- _M_buckets[__n] = __cur;
- --_M_num_elements;
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear()
-{
- for (size_type __i = 0; __i < _M_buckets.size(); ++__i) {
- _Node* __cur = _M_buckets[__i];
- while (__cur != 0) {
- _Node* __next = __cur->_M_next;
- _M_delete_node(__cur);
- __cur = __next;
- }
- _M_buckets[__i] = 0;
- }
- _M_num_elements = 0;
-}
-
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::_M_copy_from(const hashtable& __ht)
-{
- _M_buckets.clear();
- _M_buckets.reserve(__ht._M_buckets.size());
- _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
- try {
- for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
- const _Node* __cur = __ht._M_buckets[__i];
- if (__cur) {
- _Node* __local_copy = _M_new_node(__cur->_M_val);
- _M_buckets[__i] = __local_copy;
-
- for (_Node* __next = __cur->_M_next;
- __next;
- __cur = __next, __next = __cur->_M_next) {
- __local_copy->_M_next = _M_new_node(__next->_M_val);
- __local_copy = __local_copy->_M_next;
- }
- }
- }
- _M_num_elements = __ht._M_num_elements;
- }
- catch(...)
- {
- clear();
- __throw_exception_again;
- }
-}
-
-} // namespace __gnu_cxx
-
-#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/include/ext/stl_rope.h b/contrib/libstdc++/include/ext/stl_rope.h
deleted file mode 100644
index eae2613..0000000
--- a/contrib/libstdc++/include/ext/stl_rope.h
+++ /dev/null
@@ -1,2503 +0,0 @@
-// SGI's rope implementation -*- C++ -*-
-
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * Copyright (c) 1997-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/** @file ext/stl_rope.h
- * This file is a GNU extension to the Standard C++ Library (possibly
- * containing extensions from the HP/SGI STL subset). You should only
- * include this header if you are using GCC 3 or later.
- */
-
-// rope<_CharT,_Alloc> is a sequence of _CharT.
-// Ropes appear to be mutable, but update operations
-// really copy enough of the data structure to leave the original
-// valid. Thus ropes can be logically copied by just copying
-// a pointer value.
-
-#ifndef __SGI_STL_INTERNAL_ROPE_H
-# define __SGI_STL_INTERNAL_ROPE_H
-
-# ifdef __GC
-# define __GC_CONST const
-# else
-# include <bits/stl_threads.h>
-# define __GC_CONST // constant except for deallocation
-# endif
-
-#include <ext/memory> // For uninitialized_copy_n
-
-namespace __gnu_cxx
-{
-using std::size_t;
-using std::ptrdiff_t;
-using std::allocator;
-using std::iterator;
-using std::reverse_iterator;
-using std::_Alloc_traits;
-using std::_Destroy;
-using std::_Refcount_Base;
-
-// The _S_eos function is used for those functions that
-// convert to/from C-like strings to detect the end of the string.
-
-// The end-of-C-string character.
-// This is what the draft standard says it should be.
-template <class _CharT>
-inline _CharT _S_eos(_CharT*) { return _CharT(); }
-
-// Test for basic character types.
-// For basic character types leaves having a trailing eos.
-template <class _CharT>
-inline bool _S_is_basic_char_type(_CharT*) { return false; }
-template <class _CharT>
-inline bool _S_is_one_byte_char_type(_CharT*) { return false; }
-
-inline bool _S_is_basic_char_type(char*) { return true; }
-inline bool _S_is_one_byte_char_type(char*) { return true; }
-inline bool _S_is_basic_char_type(wchar_t*) { return true; }
-
-// Store an eos iff _CharT is a basic character type.
-// Do not reference _S_eos if it isn't.
-template <class _CharT>
-inline void _S_cond_store_eos(_CharT&) {}
-
-inline void _S_cond_store_eos(char& __c) { __c = 0; }
-inline void _S_cond_store_eos(wchar_t& __c) { __c = 0; }
-
-// char_producers are logically functions that generate a section of
-// a string. These can be convereted to ropes. The resulting rope
-// invokes the char_producer on demand. This allows, for example,
-// files to be viewed as ropes without reading the entire file.
-template <class _CharT>
-class char_producer {
- public:
- virtual ~char_producer() {};
- virtual void operator()(size_t __start_pos, size_t __len,
- _CharT* __buffer) = 0;
- // Buffer should really be an arbitrary output iterator.
- // That way we could flatten directly into an ostream, etc.
- // This is thoroughly impossible, since iterator types don't
- // have runtime descriptions.
-};
-
-// Sequence buffers:
-//
-// Sequence must provide an append operation that appends an
-// array to the sequence. Sequence buffers are useful only if
-// appending an entire array is cheaper than appending element by element.
-// This is true for many string representations.
-// This should perhaps inherit from ostream<sequence::value_type>
-// and be implemented correspondingly, so that they can be used
-// for formatted. For the sake of portability, we don't do this yet.
-//
-// For now, sequence buffers behave as output iterators. But they also
-// behave a little like basic_ostringstream<sequence::value_type> and a
-// little like containers.
-
-template<class _Sequence, size_t _Buf_sz = 100>
-class sequence_buffer : public iterator<std::output_iterator_tag,void,void,void,void>
-{
- public:
- typedef typename _Sequence::value_type value_type;
- protected:
- _Sequence* _M_prefix;
- value_type _M_buffer[_Buf_sz];
- size_t _M_buf_count;
- public:
- void flush() {
- _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
- _M_buf_count = 0;
- }
- ~sequence_buffer() { flush(); }
- sequence_buffer() : _M_prefix(0), _M_buf_count(0) {}
- sequence_buffer(const sequence_buffer& __x) {
- _M_prefix = __x._M_prefix;
- _M_buf_count = __x._M_buf_count;
- copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
- }
- sequence_buffer(sequence_buffer& __x) {
- __x.flush();
- _M_prefix = __x._M_prefix;
- _M_buf_count = 0;
- }
- sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {}
- sequence_buffer& operator= (sequence_buffer& __x) {
- __x.flush();
- _M_prefix = __x._M_prefix;
- _M_buf_count = 0;
- return *this;
- }
- sequence_buffer& operator= (const sequence_buffer& __x) {
- _M_prefix = __x._M_prefix;
- _M_buf_count = __x._M_buf_count;
- copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
- return *this;
- }
- void push_back(value_type __x)
- {
- if (_M_buf_count < _Buf_sz) {
- _M_buffer[_M_buf_count] = __x;
- ++_M_buf_count;
- } else {
- flush();
- _M_buffer[0] = __x;
- _M_buf_count = 1;
- }
- }
- void append(value_type* __s, size_t __len)
- {
- if (__len + _M_buf_count <= _Buf_sz) {
- size_t __i = _M_buf_count;
- size_t __j = 0;
- for (; __j < __len; __i++, __j++) {
- _M_buffer[__i] = __s[__j];
- }
- _M_buf_count += __len;
- } else if (0 == _M_buf_count) {
- _M_prefix->append(__s, __s + __len);
- } else {
- flush();
- append(__s, __len);
- }
- }
- sequence_buffer& write(value_type* __s, size_t __len)
- {
- append(__s, __len);
- return *this;
- }
- sequence_buffer& put(value_type __x)
- {
- push_back(__x);
- return *this;
- }
- sequence_buffer& operator=(const value_type& __rhs)
- {
- push_back(__rhs);
- return *this;
- }
- sequence_buffer& operator*() { return *this; }
- sequence_buffer& operator++() { return *this; }
- sequence_buffer& operator++(int) { return *this; }
-};
-
-// The following should be treated as private, at least for now.
-template<class _CharT>
-class _Rope_char_consumer {
- public:
- // If we had member templates, these should not be virtual.
- // For now we need to use run-time parametrization where
- // compile-time would do. Hence this should all be private
- // for now.
- // The symmetry with char_producer is accidental and temporary.
- virtual ~_Rope_char_consumer() {};
- virtual bool operator()(const _CharT* __buffer, size_t __len) = 0;
-};
-
-// First a lot of forward declarations. The standard seems to require
-// much stricter "declaration before use" than many of the implementations
-// that preceded it.
-template<class _CharT, class _Alloc=allocator<_CharT> > class rope;
-template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
-template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
-template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
-template<class _CharT, class _Alloc> struct _Rope_RopeSubstring;
-template<class _CharT, class _Alloc> class _Rope_iterator;
-template<class _CharT, class _Alloc> class _Rope_const_iterator;
-template<class _CharT, class _Alloc> class _Rope_char_ref_proxy;
-template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy;
-
-template<class _CharT, class _Alloc>
-bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y);
-
-template<class _CharT, class _Alloc>
-_Rope_const_iterator<_CharT,_Alloc> operator-
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
-
-template<class _CharT, class _Alloc>
-_Rope_const_iterator<_CharT,_Alloc> operator+
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
-
-template<class _CharT, class _Alloc>
-_Rope_const_iterator<_CharT,_Alloc> operator+
- (ptrdiff_t __n,
- const _Rope_const_iterator<_CharT,_Alloc>& __x);
-
-template<class _CharT, class _Alloc>
-bool operator==
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
-
-template<class _CharT, class _Alloc>
-bool operator<
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
-
-template<class _CharT, class _Alloc>
-ptrdiff_t operator-
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
-
-template<class _CharT, class _Alloc>
-_Rope_iterator<_CharT,_Alloc> operator-
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
-
-template<class _CharT, class _Alloc>
-_Rope_iterator<_CharT,_Alloc> operator+
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
-
-template<class _CharT, class _Alloc>
-_Rope_iterator<_CharT,_Alloc> operator+
- (ptrdiff_t __n,
- const _Rope_iterator<_CharT,_Alloc>& __x);
-
-template<class _CharT, class _Alloc>
-bool operator==
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
-
-template<class _CharT, class _Alloc>
-bool operator<
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
-
-template<class _CharT, class _Alloc>
-ptrdiff_t operator-
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
-
-template<class _CharT, class _Alloc>
-rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right);
-
-template<class _CharT, class _Alloc>
-rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left,
- const _CharT* __right);
-
-template<class _CharT, class _Alloc>
-rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left,
- _CharT __right);
-
-// Some helpers, so we can use power on ropes.
-// See below for why this isn't local to the implementation.
-
-// This uses a nonstandard refcount convention.
-// The result has refcount 0.
-template<class _CharT, class _Alloc>
-struct _Rope_Concat_fn
- : public std::binary_function<rope<_CharT,_Alloc>, rope<_CharT,_Alloc>,
- rope<_CharT,_Alloc> > {
- rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x,
- const rope<_CharT,_Alloc>& __y) {
- return __x + __y;
- }
-};
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
-{
- return rope<_CharT,_Alloc>();
-}
-
-
-//
-// What follows should really be local to rope. Unfortunately,
-// that doesn't work, since it makes it impossible to define generic
-// equality on rope iterators. According to the draft standard, the
-// template parameters for such an equality operator cannot be inferred
-// from the occurrence of a member class as a parameter.
-// (SGI compilers in fact allow this, but the __result wouldn't be
-// portable.)
-// Similarly, some of the static member functions are member functions
-// only to avoid polluting the global namespace, and to circumvent
-// restrictions on type inference for template functions.
-//
-
-//
-// The internal data structure for representing a rope. This is
-// private to the implementation. A rope is really just a pointer
-// to one of these.
-//
-// A few basic functions for manipulating this data structure
-// are members of _RopeRep. Most of the more complex algorithms
-// are implemented as rope members.
-//
-// Some of the static member functions of _RopeRep have identically
-// named functions in rope that simply invoke the _RopeRep versions.
-//
-// A macro to introduce various allocation and deallocation functions
-// These need to be defined differently depending on whether or not
-// we are using standard conforming allocators, and whether the allocator
-// instances have real state. Thus this macro is invoked repeatedly
-// with different definitions of __ROPE_DEFINE_ALLOC.
-// __ROPE_DEFINE_ALLOC(type,name) defines
-// type * name_allocate(size_t) and
-// void name_deallocate(tipe *, size_t)
-// Both functions may or may not be static.
-
-#define __ROPE_DEFINE_ALLOCS(__a) \
- __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \
- typedef _Rope_RopeConcatenation<_CharT,__a> __C; \
- __ROPE_DEFINE_ALLOC(__C,_C) \
- typedef _Rope_RopeLeaf<_CharT,__a> __L; \
- __ROPE_DEFINE_ALLOC(__L,_L) \
- typedef _Rope_RopeFunction<_CharT,__a> __F; \
- __ROPE_DEFINE_ALLOC(__F,_F) \
- typedef _Rope_RopeSubstring<_CharT,__a> __S; \
- __ROPE_DEFINE_ALLOC(__S,_S)
-
-// Internal rope nodes potentially store a copy of the allocator
-// instance used to allocate them. This is mostly redundant.
-// But the alternative would be to pass allocator instances around
-// in some form to nearly all internal functions, since any pointer
-// assignment may result in a zero reference count and thus require
-// deallocation.
-// The _Rope_rep_base class encapsulates
-// the differences between SGI-style allocators and standard-conforming
-// allocators.
-
-#define __STATIC_IF_SGI_ALLOC /* not static */
-
-// Base class for ordinary allocators.
-template <class _CharT, class _Allocator, bool _IsStatic>
-class _Rope_rep_alloc_base {
-public:
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _M_data_allocator; }
- _Rope_rep_alloc_base(size_t __size, const allocator_type& __a)
- : _M_size(__size), _M_data_allocator(__a) {}
- size_t _M_size; // This is here only to avoid wasting space
- // for an otherwise empty base class.
-
-
-protected:
- allocator_type _M_data_allocator;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- /*static*/ _Tp * __name##_allocate(size_t __n) \
- { return __name##Allocator(_M_data_allocator).allocate(__n); } \
- void __name##_deallocate(_Tp* __p, size_t __n) \
- { __name##Allocator(_M_data_allocator).deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator);
-# undef __ROPE_DEFINE_ALLOC
-};
-
-// Specialization for allocators that have the property that we don't
-// actually have to store an allocator object.
-template <class _CharT, class _Allocator>
-class _Rope_rep_alloc_base<_CharT,_Allocator,true> {
-public:
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
- _Rope_rep_alloc_base(size_t __size, const allocator_type&)
- : _M_size(__size) {}
- size_t _M_size;
-
-protected:
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- void __name##_deallocate(_Tp *__p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator);
-# undef __ROPE_DEFINE_ALLOC
-};
-
-template <class _CharT, class _Alloc>
-struct _Rope_rep_base
- : public _Rope_rep_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
-{
- typedef _Rope_rep_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
- _Rope_rep_base(size_t __size, const allocator_type& __a)
- : _Base(__size, __a) {}
-};
-
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc>
-# ifndef __GC
- , _Refcount_Base
-# endif
-{
- public:
- enum { _S_max_rope_depth = 45 };
- enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
- _Tag _M_tag:8;
- bool _M_is_balanced:8;
- unsigned char _M_depth;
- __GC_CONST _CharT* _M_c_string;
- /* Flattened version of string, if needed. */
- /* typically 0. */
- /* If it's not 0, then the memory is owned */
- /* by this node. */
- /* In the case of a leaf, this may point to */
- /* the same memory as the data field. */
- typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
- allocator_type;
- _Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size,
- allocator_type __a)
- : _Rope_rep_base<_CharT,_Alloc>(__size, __a),
-# ifndef __GC
- _Refcount_Base(1),
-# endif
- _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
- { }
-# ifdef __GC
- void _M_incr () {}
-# endif
- static void _S_free_string(__GC_CONST _CharT*, size_t __len,
- allocator_type __a);
-# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
- // Deallocate data section of a leaf.
- // This shouldn't be a member function.
- // But its hard to do anything else at the
- // moment, because it's templatized w.r.t.
- // an allocator.
- // Does nothing if __GC is defined.
-# ifndef __GC
- void _M_free_c_string();
- void _M_free_tree();
- // Deallocate t. Assumes t is not 0.
- void _M_unref_nonnil()
- {
- if (0 == _M_decr()) _M_free_tree();
- }
- void _M_ref_nonnil()
- {
- _M_incr();
- }
- static void _S_unref(_Rope_RopeRep* __t)
- {
- if (0 != __t) {
- __t->_M_unref_nonnil();
- }
- }
- static void _S_ref(_Rope_RopeRep* __t)
- {
- if (0 != __t) __t->_M_incr();
- }
- static void _S_free_if_unref(_Rope_RopeRep* __t)
- {
- if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree();
- }
-# else /* __GC */
- void _M_unref_nonnil() {}
- void _M_ref_nonnil() {}
- static void _S_unref(_Rope_RopeRep*) {}
- static void _S_ref(_Rope_RopeRep*) {}
- static void _S_free_if_unref(_Rope_RopeRep*) {}
-# endif
-
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
- public:
- // Apparently needed by VC++
- // The data fields of leaves are allocated with some
- // extra space, to accommodate future growth and for basic
- // character types, to hold a trailing eos character.
- enum { _S_alloc_granularity = 8 };
- static size_t _S_rounded_up_size(size_t __n) {
- size_t __size_with_eos;
-
- if (_S_is_basic_char_type((_CharT*)0)) {
- __size_with_eos = __n + 1;
- } else {
- __size_with_eos = __n;
- }
-# ifdef __GC
- return __size_with_eos;
-# else
- // Allow slop for in-place expansion.
- return (__size_with_eos + _S_alloc_granularity-1)
- &~ (_S_alloc_granularity-1);
-# endif
- }
- __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */
- /* The allocated size is */
- /* _S_rounded_up_size(size), except */
- /* in the GC case, in which it */
- /* doesn't matter. */
- typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
- allocator_type;
- _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, allocator_type __a)
- : _Rope_RopeRep<_CharT,_Alloc>(_S_leaf, 0, true, __size, __a),
- _M_data(__d)
- {
- if (_S_is_basic_char_type((_CharT *)0)) {
- // already eos terminated.
- _M_c_string = __d;
- }
- }
- // The constructor assumes that d has been allocated with
- // the proper allocator and the properly padded size.
- // In contrast, the destructor deallocates the data:
-# ifndef __GC
- ~_Rope_RopeLeaf() {
- if (_M_data != _M_c_string) {
- _M_free_c_string();
- }
- __STL_FREE_STRING(_M_data, _M_size, get_allocator());
- }
-# endif
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> {
- public:
- _Rope_RopeRep<_CharT,_Alloc>* _M_left;
- _Rope_RopeRep<_CharT,_Alloc>* _M_right;
- typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
- allocator_type;
- _Rope_RopeConcatenation(_Rope_RopeRep<_CharT,_Alloc>* __l,
- _Rope_RopeRep<_CharT,_Alloc>* __r,
- allocator_type __a)
-
- : _Rope_RopeRep<_CharT,_Alloc>(_S_concat,
- std::max(__l->_M_depth, __r->_M_depth) + 1,
- false,
- __l->_M_size + __r->_M_size, __a),
- _M_left(__l), _M_right(__r)
- {}
-# ifndef __GC
- ~_Rope_RopeConcatenation() {
- _M_free_c_string();
- _M_left->_M_unref_nonnil();
- _M_right->_M_unref_nonnil();
- }
-# endif
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> {
- public:
- char_producer<_CharT>* _M_fn;
-# ifndef __GC
- bool _M_delete_when_done; // Char_producer is owned by the
- // rope and should be explicitly
- // deleted when the rope becomes
- // inaccessible.
-# else
- // In the GC case, we either register the rope for
- // finalization, or not. Thus the field is unnecessary;
- // the information is stored in the collector data structures.
- // We do need a finalization procedure to be invoked by the
- // collector.
- static void _S_fn_finalization_proc(void * __tree, void *) {
- delete ((_Rope_RopeFunction *)__tree) -> _M_fn;
- }
-# endif
- typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
- allocator_type;
- _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
- bool __d, allocator_type __a)
- : _Rope_RopeRep<_CharT,_Alloc>(_S_function, 0, true, __size, __a)
- , _M_fn(__f)
-# ifndef __GC
- , _M_delete_when_done(__d)
-# endif
- {
-# ifdef __GC
- if (__d) {
- GC_REGISTER_FINALIZER(
- this, _Rope_RopeFunction::_S_fn_finalization_proc, 0, 0, 0);
- }
-# endif
- }
-# ifndef __GC
- ~_Rope_RopeFunction() {
- _M_free_c_string();
- if (_M_delete_when_done) {
- delete _M_fn;
- }
- }
-# endif
-};
-// Substring results are usually represented using just
-// concatenation nodes. But in the case of very long flat ropes
-// or ropes with a functional representation that isn't practical.
-// In that case, we represent the __result as a special case of
-// RopeFunction, whose char_producer points back to the rope itself.
-// In all cases except repeated substring operations and
-// deallocation, we treat the __result as a RopeFunction.
-template<class _CharT, class _Alloc>
-struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>,
- public char_producer<_CharT> {
- public:
- // XXX this whole class should be rewritten.
- _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0
- size_t _M_start;
- virtual void operator()(size_t __start_pos, size_t __req_len,
- _CharT* __buffer) {
- switch(_M_base->_M_tag) {
- case _S_function:
- case _S_substringfn:
- {
- char_producer<_CharT>* __fn =
- ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
- (*__fn)(__start_pos + _M_start, __req_len, __buffer);
- }
- break;
- case _S_leaf:
- {
- __GC_CONST _CharT* __s =
- ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
- uninitialized_copy_n(__s + __start_pos + _M_start, __req_len,
- __buffer);
- }
- break;
- default:
- break;
- }
- }
- typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
- allocator_type;
- _Rope_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
- size_t __l, allocator_type __a)
- : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a),
- char_producer<_CharT>(),
- _M_base(__b),
- _M_start(__s)
- {
-# ifndef __GC
- _M_base->_M_ref_nonnil();
-# endif
- _M_tag = _S_substringfn;
- }
- virtual ~_Rope_RopeSubstring()
- {
-# ifndef __GC
- _M_base->_M_unref_nonnil();
- // _M_free_c_string(); -- done by parent class
-# endif
- }
-};
-
-
-// Self-destructing pointers to Rope_rep.
-// These are not conventional smart pointers. Their
-// only purpose in life is to ensure that unref is called
-// on the pointer either at normal exit or if an exception
-// is raised. It is the caller's responsibility to
-// adjust reference counts when these pointers are initialized
-// or assigned to. (This convention significantly reduces
-// the number of potentially expensive reference count
-// updates.)
-#ifndef __GC
- template<class _CharT, class _Alloc>
- struct _Rope_self_destruct_ptr {
- _Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
- ~_Rope_self_destruct_ptr()
- { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
-#ifdef __EXCEPTIONS
- _Rope_self_destruct_ptr() : _M_ptr(0) {};
-#else
- _Rope_self_destruct_ptr() {};
-#endif
- _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
- _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
- _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
- operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; }
- _Rope_self_destruct_ptr& operator= (_Rope_RopeRep<_CharT,_Alloc>* __x)
- { _M_ptr = __x; return *this; }
- };
-#endif
-
-// Dereferencing a nonconst iterator has to return something
-// that behaves almost like a reference. It's not possible to
-// return an actual reference since assignment requires extra
-// work. And we would get into the same problems as with the
-// CD2 version of basic_string.
-template<class _CharT, class _Alloc>
-class _Rope_char_ref_proxy {
- friend class rope<_CharT,_Alloc>;
- friend class _Rope_iterator<_CharT,_Alloc>;
- friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
-# ifdef __GC
- typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr;
-# else
- typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
-# endif
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- typedef rope<_CharT,_Alloc> _My_rope;
- size_t _M_pos;
- _CharT _M_current;
- bool _M_current_valid;
- _My_rope* _M_root; // The whole rope.
- public:
- _Rope_char_ref_proxy(_My_rope* __r, size_t __p)
- : _M_pos(__p), _M_current_valid(false), _M_root(__r) {}
- _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)
- : _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {}
- // Don't preserve cache if the reference can outlive the
- // expression. We claim that's not possible without calling
- // a copy constructor or generating reference to a proxy
- // reference. We declare the latter to have undefined semantics.
- _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
- : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
- inline operator _CharT () const;
- _Rope_char_ref_proxy& operator= (_CharT __c);
- _Rope_char_ptr_proxy<_CharT,_Alloc> operator& () const;
- _Rope_char_ref_proxy& operator= (const _Rope_char_ref_proxy& __c) {
- return operator=((_CharT)__c);
- }
-};
-
-template<class _CharT, class __Alloc>
-inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
- _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
- _CharT __tmp = __a;
- __a = __b;
- __b = __tmp;
-}
-
-template<class _CharT, class _Alloc>
-class _Rope_char_ptr_proxy {
- // XXX this class should be rewritten.
- friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
- size_t _M_pos;
- rope<_CharT,_Alloc>* _M_root; // The whole rope.
- public:
- _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
- _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
- _Rope_char_ptr_proxy() {}
- _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) {
- }
- _Rope_char_ptr_proxy&
- operator= (const _Rope_char_ptr_proxy& __x) {
- _M_pos = __x._M_pos;
- _M_root = __x._M_root;
- return *this;
- }
- template<class _CharT2, class _Alloc2>
- friend bool operator== (const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __x,
- const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __y);
- _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos);
- }
-};
-
-
-// Rope iterators:
-// Unlike in the C version, we cache only part of the stack
-// for rope iterators, since they must be efficiently copyable.
-// When we run out of cache, we have to reconstruct the iterator
-// value.
-// Pointers from iterators are not included in reference counts.
-// Iterators are assumed to be thread private. Ropes can
-// be shared.
-
-template<class _CharT, class _Alloc>
-class _Rope_iterator_base
- : public iterator<std::random_access_iterator_tag, _CharT>
-{
- friend class rope<_CharT,_Alloc>;
- public:
- typedef _Alloc _allocator_type; // used in _Rope_rotate, VC++ workaround
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- // Borland doesn't want this to be protected.
- protected:
- enum { _S_path_cache_len = 4 }; // Must be <= 9.
- enum { _S_iterator_buf_len = 15 };
- size_t _M_current_pos;
- _RopeRep* _M_root; // The whole rope.
- size_t _M_leaf_pos; // Starting position for current leaf
- __GC_CONST _CharT* _M_buf_start;
- // Buffer possibly
- // containing current char.
- __GC_CONST _CharT* _M_buf_ptr;
- // Pointer to current char in buffer.
- // != 0 ==> buffer valid.
- __GC_CONST _CharT* _M_buf_end;
- // One past __last valid char in buffer.
- // What follows is the path cache. We go out of our
- // way to make this compact.
- // Path_end contains the bottom section of the path from
- // the root to the current leaf.
- const _RopeRep* _M_path_end[_S_path_cache_len];
- int _M_leaf_index; // Last valid __pos in path_end;
- // _M_path_end[0] ... _M_path_end[leaf_index-1]
- // point to concatenation nodes.
- unsigned char _M_path_directions;
- // (path_directions >> __i) & 1 is 1
- // iff we got from _M_path_end[leaf_index - __i - 1]
- // to _M_path_end[leaf_index - __i] by going to the
- // __right. Assumes path_cache_len <= 9.
- _CharT _M_tmp_buf[_S_iterator_buf_len];
- // Short buffer for surrounding chars.
- // This is useful primarily for
- // RopeFunctions. We put the buffer
- // here to avoid locking in the
- // multithreaded case.
- // The cached path is generally assumed to be valid
- // only if the buffer is valid.
- static void _S_setbuf(_Rope_iterator_base& __x);
- // Set buffer contents given
- // path cache.
- static void _S_setcache(_Rope_iterator_base& __x);
- // Set buffer contents and
- // path cache.
- static void _S_setcache_for_incr(_Rope_iterator_base& __x);
- // As above, but assumes path
- // cache is valid for previous posn.
- _Rope_iterator_base() {}
- _Rope_iterator_base(_RopeRep* __root, size_t __pos)
- : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) {}
- void _M_incr(size_t __n);
- void _M_decr(size_t __n);
- public:
- size_t index() const { return _M_current_pos; }
- _Rope_iterator_base(const _Rope_iterator_base& __x) {
- if (0 != __x._M_buf_ptr) {
- *this = __x;
- } else {
- _M_current_pos = __x._M_current_pos;
- _M_root = __x._M_root;
- _M_buf_ptr = 0;
- }
- }
-};
-
-template<class _CharT, class _Alloc> class _Rope_iterator;
-
-template<class _CharT, class _Alloc>
-class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
- friend class rope<_CharT,_Alloc>;
- protected:
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- // The one from the base class may not be directly visible.
- _Rope_const_iterator(const _RopeRep* __root, size_t __pos):
- _Rope_iterator_base<_CharT,_Alloc>(
- const_cast<_RopeRep*>(__root), __pos)
- // Only nonconst iterators modify root ref count
- {}
- public:
- typedef _CharT reference; // Really a value. Returning a reference
- // Would be a mess, since it would have
- // to be included in refcount.
- typedef const _CharT* pointer;
-
- public:
- _Rope_const_iterator() {};
- _Rope_const_iterator(const _Rope_const_iterator& __x) :
- _Rope_iterator_base<_CharT,_Alloc>(__x) { }
- _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x);
- _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) :
- _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) {}
- _Rope_const_iterator& operator= (const _Rope_const_iterator& __x) {
- if (0 != __x._M_buf_ptr) {
- *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x;
- } else {
- _M_current_pos = __x._M_current_pos;
- _M_root = __x._M_root;
- _M_buf_ptr = 0;
- }
- return(*this);
- }
- reference operator*() {
- if (0 == _M_buf_ptr) _S_setcache(*this);
- return *_M_buf_ptr;
- }
- _Rope_const_iterator& operator++() {
- __GC_CONST _CharT* __next;
- if (0 != _M_buf_ptr && (__next = _M_buf_ptr + 1) < _M_buf_end) {
- _M_buf_ptr = __next;
- ++_M_current_pos;
- } else {
- _M_incr(1);
- }
- return *this;
- }
- _Rope_const_iterator& operator+=(ptrdiff_t __n) {
- if (__n >= 0) {
- _M_incr(__n);
- } else {
- _M_decr(-__n);
- }
- return *this;
- }
- _Rope_const_iterator& operator--() {
- _M_decr(1);
- return *this;
- }
- _Rope_const_iterator& operator-=(ptrdiff_t __n) {
- if (__n >= 0) {
- _M_decr(__n);
- } else {
- _M_incr(-__n);
- }
- return *this;
- }
- _Rope_const_iterator operator++(int) {
- size_t __old_pos = _M_current_pos;
- _M_incr(1);
- return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos);
- // This makes a subsequent dereference expensive.
- // Perhaps we should instead copy the iterator
- // if it has a valid cache?
- }
- _Rope_const_iterator operator--(int) {
- size_t __old_pos = _M_current_pos;
- _M_decr(1);
- return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos);
- }
- template<class _CharT2, class _Alloc2>
- friend _Rope_const_iterator<_CharT2,_Alloc2> operator-
- (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
- ptrdiff_t __n);
- template<class _CharT2, class _Alloc2>
- friend _Rope_const_iterator<_CharT2,_Alloc2> operator+
- (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
- ptrdiff_t __n);
- template<class _CharT2, class _Alloc2>
- friend _Rope_const_iterator<_CharT2,_Alloc2> operator+
- (ptrdiff_t __n,
- const _Rope_const_iterator<_CharT2,_Alloc2>& __x);
- reference operator[](size_t __n) {
- return rope<_CharT,_Alloc>::_S_fetch(_M_root, _M_current_pos + __n);
- }
-
- template<class _CharT2, class _Alloc2>
- friend bool operator==
- (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
- const _Rope_const_iterator<_CharT2,_Alloc2>& __y);
- template<class _CharT2, class _Alloc2>
- friend bool operator<
- (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
- const _Rope_const_iterator<_CharT2,_Alloc2>& __y);
- template<class _CharT2, class _Alloc2>
- friend ptrdiff_t operator-
- (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
- const _Rope_const_iterator<_CharT2,_Alloc2>& __y);
-};
-
-template<class _CharT, class _Alloc>
-class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
- friend class rope<_CharT,_Alloc>;
- protected:
- typedef typename _Rope_iterator_base<_CharT,_Alloc>::_RopeRep _RopeRep;
- rope<_CharT,_Alloc>* _M_root_rope;
- // root is treated as a cached version of this,
- // and is used to detect changes to the underlying
- // rope.
- // Root is included in the reference count.
- // This is necessary so that we can detect changes reliably.
- // Unfortunately, it requires careful bookkeeping for the
- // nonGC case.
- _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos)
- : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr, __pos),
- _M_root_rope(__r)
- { _RopeRep::_S_ref(_M_root); if (!(__r -> empty()))_S_setcache(*this); }
-
- void _M_check();
- public:
- typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
- typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer;
-
- public:
- rope<_CharT,_Alloc>& container() { return *_M_root_rope; }
- _Rope_iterator() {
- _M_root = 0; // Needed for reference counting.
- };
- _Rope_iterator(const _Rope_iterator& __x) :
- _Rope_iterator_base<_CharT,_Alloc>(__x) {
- _M_root_rope = __x._M_root_rope;
- _RopeRep::_S_ref(_M_root);
- }
- _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos);
- ~_Rope_iterator() {
- _RopeRep::_S_unref(_M_root);
- }
- _Rope_iterator& operator= (const _Rope_iterator& __x) {
- _RopeRep* __old = _M_root;
-
- _RopeRep::_S_ref(__x._M_root);
- if (0 != __x._M_buf_ptr) {
- _M_root_rope = __x._M_root_rope;
- *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x;
- } else {
- _M_current_pos = __x._M_current_pos;
- _M_root = __x._M_root;
- _M_root_rope = __x._M_root_rope;
- _M_buf_ptr = 0;
- }
- _RopeRep::_S_unref(__old);
- return(*this);
- }
- reference operator*() {
- _M_check();
- if (0 == _M_buf_ptr) {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(
- _M_root_rope, _M_current_pos);
- } else {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(
- _M_root_rope, _M_current_pos, *_M_buf_ptr);
- }
- }
- _Rope_iterator& operator++() {
- _M_incr(1);
- return *this;
- }
- _Rope_iterator& operator+=(ptrdiff_t __n) {
- if (__n >= 0) {
- _M_incr(__n);
- } else {
- _M_decr(-__n);
- }
- return *this;
- }
- _Rope_iterator& operator--() {
- _M_decr(1);
- return *this;
- }
- _Rope_iterator& operator-=(ptrdiff_t __n) {
- if (__n >= 0) {
- _M_decr(__n);
- } else {
- _M_incr(-__n);
- }
- return *this;
- }
- _Rope_iterator operator++(int) {
- size_t __old_pos = _M_current_pos;
- _M_incr(1);
- return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
- }
- _Rope_iterator operator--(int) {
- size_t __old_pos = _M_current_pos;
- _M_decr(1);
- return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
- }
- reference operator[](ptrdiff_t __n) {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(
- _M_root_rope, _M_current_pos + __n);
- }
-
- template<class _CharT2, class _Alloc2>
- friend bool operator==
- (const _Rope_iterator<_CharT2,_Alloc2>& __x,
- const _Rope_iterator<_CharT2,_Alloc2>& __y);
- template<class _CharT2, class _Alloc2>
- friend bool operator<
- (const _Rope_iterator<_CharT2,_Alloc2>& __x,
- const _Rope_iterator<_CharT2,_Alloc2>& __y);
- template<class _CharT2, class _Alloc2>
- friend ptrdiff_t operator-
- (const _Rope_iterator<_CharT2,_Alloc2>& __x,
- const _Rope_iterator<_CharT2,_Alloc2>& __y);
- template<class _CharT2, class _Alloc2>
- friend _Rope_iterator<_CharT2,_Alloc2> operator-
- (const _Rope_iterator<_CharT2,_Alloc2>& __x,
- ptrdiff_t __n);
- template<class _CharT2, class _Alloc2>
- friend _Rope_iterator<_CharT2,_Alloc2> operator+
- (const _Rope_iterator<_CharT2,_Alloc2>& __x,
- ptrdiff_t __n);
- template<class _CharT2, class _Alloc2>
- friend _Rope_iterator<_CharT2,_Alloc2> operator+
- (ptrdiff_t __n,
- const _Rope_iterator<_CharT2,_Alloc2>& __x);
-};
-
-// The rope base class encapsulates
-// the differences between SGI-style allocators and standard-conforming
-// allocators.
-
-// Base class for ordinary allocators.
-template <class _CharT, class _Allocator, bool _IsStatic>
-class _Rope_alloc_base {
-public:
- typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep;
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _M_data_allocator; }
- _Rope_alloc_base(_RopeRep *__t, const allocator_type& __a)
- : _M_tree_ptr(__t), _M_data_allocator(__a) {}
- _Rope_alloc_base(const allocator_type& __a)
- : _M_data_allocator(__a) {}
-
-protected:
- // The only data members of a rope:
- allocator_type _M_data_allocator;
- _RopeRep* _M_tree_ptr;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- _Tp* __name##_allocate(size_t __n) const \
- { return __name##Allocator(_M_data_allocator).allocate(__n); } \
- void __name##_deallocate(_Tp *__p, size_t __n) const \
- { __name##Allocator(_M_data_allocator).deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator)
-# undef __ROPE_DEFINE_ALLOC
-};
-
-// Specialization for allocators that have the property that we don't
-// actually have to store an allocator object.
-template <class _CharT, class _Allocator>
-class _Rope_alloc_base<_CharT,_Allocator,true> {
-public:
- typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep;
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
- _Rope_alloc_base(_RopeRep *__t, const allocator_type&)
- : _M_tree_ptr(__t) {}
- _Rope_alloc_base(const allocator_type&) {}
-
-protected:
- // The only data member of a rope:
- _RopeRep *_M_tree_ptr;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- static void __name##_deallocate(_Tp *__p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator)
-# undef __ROPE_DEFINE_ALLOC
-};
-
-template <class _CharT, class _Alloc>
-struct _Rope_base
- : public _Rope_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
-{
- typedef _Rope_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- // The one in _Base may not be visible due to template rules.
- _Rope_base(_RopeRep* __t, const allocator_type& __a) : _Base(__t, __a) {}
- _Rope_base(const allocator_type& __a) : _Base(__a) {}
-};
-
-
-/**
- * This is an SGI extension.
- * @ingroup SGIextensions
- * @doctodo
-*/
-template <class _CharT, class _Alloc>
-class rope : public _Rope_base<_CharT,_Alloc> {
- public:
- typedef _CharT value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef _CharT const_reference;
- typedef const _CharT* const_pointer;
- typedef _Rope_iterator<_CharT,_Alloc> iterator;
- typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator;
- typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
- typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer;
-
- friend class _Rope_iterator<_CharT,_Alloc>;
- friend class _Rope_const_iterator<_CharT,_Alloc>;
- friend struct _Rope_RopeRep<_CharT,_Alloc>;
- friend class _Rope_iterator_base<_CharT,_Alloc>;
- friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
- friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
- friend struct _Rope_RopeSubstring<_CharT,_Alloc>;
-
- protected:
- typedef _Rope_base<_CharT,_Alloc> _Base;
- typedef typename _Base::allocator_type allocator_type;
- using _Base::_M_tree_ptr;
- typedef __GC_CONST _CharT* _Cstrptr;
-
- static _CharT _S_empty_c_str[1];
-
- static bool _S_is0(_CharT __c) { return __c == _S_eos((_CharT*)0); }
- enum { _S_copy_max = 23 };
- // For strings shorter than _S_copy_max, we copy to
- // concatenate.
-
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
- typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
- typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
- typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring;
-
- // Retrieve a character at the indicated position.
- static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
-
-# ifndef __GC
- // Obtain a pointer to the character at the indicated position.
- // The pointer can be used to change the character.
- // If such a pointer cannot be produced, as is frequently the
- // case, 0 is returned instead.
- // (Returns nonzero only if all nodes in the path have a refcount
- // of 1.)
- static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
-# endif
-
- static bool _S_apply_to_pieces(
- // should be template parameter
- _Rope_char_consumer<_CharT>& __c,
- const _RopeRep* __r,
- size_t __begin, size_t __end);
- // begin and end are assumed to be in range.
-
-# ifndef __GC
- static void _S_unref(_RopeRep* __t)
- {
- _RopeRep::_S_unref(__t);
- }
- static void _S_ref(_RopeRep* __t)
- {
- _RopeRep::_S_ref(__t);
- }
-# else /* __GC */
- static void _S_unref(_RopeRep*) {}
- static void _S_ref(_RopeRep*) {}
-# endif
-
-
-# ifdef __GC
- typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr;
-# else
- typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
-# endif
-
- // _Result is counted in refcount.
- static _RopeRep* _S_substring(_RopeRep* __base,
- size_t __start, size_t __endp1);
-
- static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
- const _CharT* __iter, size_t __slen);
- // Concatenate rope and char ptr, copying __s.
- // Should really take an arbitrary iterator.
- // Result is counted in refcount.
- static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
- const _CharT* __iter, size_t __slen)
- // As above, but one reference to __r is about to be
- // destroyed. Thus the pieces may be recycled if all
- // relevant reference counts are 1.
-# ifdef __GC
- // We can't really do anything since refcounts are unavailable.
- { return _S_concat_char_iter(__r, __iter, __slen); }
-# else
- ;
-# endif
-
- static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right);
- // General concatenation on _RopeRep. _Result
- // has refcount of 1. Adjusts argument refcounts.
-
- public:
- void apply_to_pieces( size_t __begin, size_t __end,
- _Rope_char_consumer<_CharT>& __c) const {
- _S_apply_to_pieces(__c, _M_tree_ptr, __begin, __end);
- }
-
-
- protected:
-
- static size_t _S_rounded_up_size(size_t __n) {
- return _RopeLeaf::_S_rounded_up_size(__n);
- }
-
- static size_t _S_allocated_capacity(size_t __n) {
- if (_S_is_basic_char_type((_CharT*)0)) {
- return _S_rounded_up_size(__n) - 1;
- } else {
- return _S_rounded_up_size(__n);
- }
- }
-
- // Allocate and construct a RopeLeaf using the supplied allocator
- // Takes ownership of s instead of copying.
- static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s,
- size_t __size, allocator_type __a)
- {
- _RopeLeaf* __space = typename _Base::_LAllocator(__a).allocate(1);
- return new(__space) _RopeLeaf(__s, __size, __a);
- }
-
- static _RopeConcatenation* _S_new_RopeConcatenation(
- _RopeRep* __left, _RopeRep* __right,
- allocator_type __a)
- {
- _RopeConcatenation* __space = typename _Base::_CAllocator(__a).allocate(1);
- return new(__space) _RopeConcatenation(__left, __right, __a);
- }
-
- static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f,
- size_t __size, bool __d, allocator_type __a)
- {
- _RopeFunction* __space = typename _Base::_FAllocator(__a).allocate(1);
- return new(__space) _RopeFunction(__f, __size, __d, __a);
- }
-
- static _RopeSubstring* _S_new_RopeSubstring(
- _Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
- size_t __l, allocator_type __a)
- {
- _RopeSubstring* __space = typename _Base::_SAllocator(__a).allocate(1);
- return new(__space) _RopeSubstring(__b, __s, __l, __a);
- }
-
- static
- _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
- size_t __size, allocator_type __a)
-# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
- _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
- {
- if (0 == __size) return 0;
- _CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
-
- uninitialized_copy_n(__s, __size, __buf);
- _S_cond_store_eos(__buf[__size]);
- try {
- return _S_new_RopeLeaf(__buf, __size, __a);
- }
- catch(...)
- {
- _RopeRep::__STL_FREE_STRING(__buf, __size, __a);
- __throw_exception_again;
- }
- }
-
-
- // Concatenation of nonempty strings.
- // Always builds a concatenation node.
- // Rebalances if the result is too deep.
- // Result has refcount 1.
- // Does not increment left and right ref counts even though
- // they are referenced.
- static _RopeRep*
- _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
-
- // Concatenation helper functions
- static _RopeLeaf*
- _S_leaf_concat_char_iter(_RopeLeaf* __r,
- const _CharT* __iter, size_t __slen);
- // Concatenate by copying leaf.
- // should take an arbitrary iterator
- // result has refcount 1.
-# ifndef __GC
- static _RopeLeaf* _S_destr_leaf_concat_char_iter
- (_RopeLeaf* __r, const _CharT* __iter, size_t __slen);
- // A version that potentially clobbers __r if __r->_M_ref_count == 1.
-# endif
-
- private:
-
- static size_t _S_char_ptr_len(const _CharT* __s);
- // slightly generalized strlen
-
- rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
- : _Base(__t,__a) { }
-
-
- // Copy __r to the _CharT buffer.
- // Returns __buffer + __r->_M_size.
- // Assumes that buffer is uninitialized.
- static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
-
- // Again, with explicit starting position and length.
- // Assumes that buffer is uninitialized.
- static _CharT* _S_flatten(_RopeRep* __r,
- size_t __start, size_t __len,
- _CharT* __buffer);
-
- static const unsigned long
- _S_min_len[_RopeRep::_S_max_rope_depth + 1];
-
- static bool _S_is_balanced(_RopeRep* __r)
- { return (__r->_M_size >= _S_min_len[__r->_M_depth]); }
-
- static bool _S_is_almost_balanced(_RopeRep* __r)
- { return (__r->_M_depth == 0 ||
- __r->_M_size >= _S_min_len[__r->_M_depth - 1]); }
-
- static bool _S_is_roughly_balanced(_RopeRep* __r)
- { return (__r->_M_depth <= 1 ||
- __r->_M_size >= _S_min_len[__r->_M_depth - 2]); }
-
- // Assumes the result is not empty.
- static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left,
- _RopeRep* __right)
- {
- _RopeRep* __result = _S_concat(__left, __right);
- if (_S_is_balanced(__result)) __result->_M_is_balanced = true;
- return __result;
- }
-
- // The basic rebalancing operation. Logically copies the
- // rope. The result has refcount of 1. The client will
- // usually decrement the reference count of __r.
- // The result is within height 2 of balanced by the above
- // definition.
- static _RopeRep* _S_balance(_RopeRep* __r);
-
- // Add all unbalanced subtrees to the forest of balanceed trees.
- // Used only by balance.
- static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
-
- // Add __r to forest, assuming __r is already balanced.
- static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
-
- // Print to stdout, exposing structure
- static void _S_dump(_RopeRep* __r, int __indent = 0);
-
- // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
- static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
-
- public:
- bool empty() const { return 0 == _M_tree_ptr; }
-
- // Comparison member function. This is public only for those
- // clients that need a ternary comparison. Others
- // should use the comparison operators below.
- int compare(const rope& __y) const {
- return _S_compare(_M_tree_ptr, __y._M_tree_ptr);
- }
-
- rope(const _CharT* __s, const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
- __a),__a)
- { }
-
- rope(const _CharT* __s, size_t __len,
- const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, __a), __a)
- { }
-
- // Should perhaps be templatized with respect to the iterator type
- // and use Sequence_buffer. (It should perhaps use sequence_buffer
- // even now.)
- rope(const _CharT *__s, const _CharT *__e,
- const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, __a), __a)
- { }
-
- rope(const const_iterator& __s, const const_iterator& __e,
- const allocator_type& __a = allocator_type())
- : _Base(_S_substring(__s._M_root, __s._M_current_pos,
- __e._M_current_pos), __a)
- { }
-
- rope(const iterator& __s, const iterator& __e,
- const allocator_type& __a = allocator_type())
- : _Base(_S_substring(__s._M_root, __s._M_current_pos,
- __e._M_current_pos), __a)
- { }
-
- rope(_CharT __c, const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- _CharT* __buf = _Data_allocate(_S_rounded_up_size(1));
-
- std::_Construct(__buf, __c);
- try {
- _M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a);
- }
- catch(...)
- {
- _RopeRep::__STL_FREE_STRING(__buf, 1, __a);
- __throw_exception_again;
- }
- }
-
- rope(size_t __n, _CharT __c,
- const allocator_type& __a = allocator_type());
-
- rope(const allocator_type& __a = allocator_type())
- : _Base(0, __a) {}
-
- // Construct a rope from a function that can compute its members
- rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- _M_tree_ptr = (0 == __len) ?
- 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
- }
-
- rope(const rope& __x, const allocator_type& __a = allocator_type())
- : _Base(__x._M_tree_ptr, __a)
- {
- _S_ref(_M_tree_ptr);
- }
-
- ~rope()
- {
- _S_unref(_M_tree_ptr);
- }
-
- rope& operator=(const rope& __x)
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr = __x._M_tree_ptr;
- _S_ref(_M_tree_ptr);
- _S_unref(__old);
- return(*this);
- }
-
- void clear()
- {
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = 0;
- }
-
- void push_back(_CharT __x)
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr = _S_destr_concat_char_iter(_M_tree_ptr, &__x, 1);
- _S_unref(__old);
- }
-
- void pop_back()
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr =
- _S_substring(_M_tree_ptr, 0, _M_tree_ptr->_M_size - 1);
- _S_unref(__old);
- }
-
- _CharT back() const
- {
- return _S_fetch(_M_tree_ptr, _M_tree_ptr->_M_size - 1);
- }
-
- void push_front(_CharT __x)
- {
- _RopeRep* __old = _M_tree_ptr;
- _RopeRep* __left =
- __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator());
- try {
- _M_tree_ptr = _S_concat(__left, _M_tree_ptr);
- _S_unref(__old);
- _S_unref(__left);
- }
- catch(...)
- {
- _S_unref(__left);
- __throw_exception_again;
- }
- }
-
- void pop_front()
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr = _S_substring(_M_tree_ptr, 1, _M_tree_ptr->_M_size);
- _S_unref(__old);
- }
-
- _CharT front() const
- {
- return _S_fetch(_M_tree_ptr, 0);
- }
-
- void balance()
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr = _S_balance(_M_tree_ptr);
- _S_unref(__old);
- }
-
- void copy(_CharT* __buffer) const {
- _Destroy(__buffer, __buffer + size());
- _S_flatten(_M_tree_ptr, __buffer);
- }
-
- // This is the copy function from the standard, but
- // with the arguments reordered to make it consistent with the
- // rest of the interface.
- // Note that this guaranteed not to compile if the draft standard
- // order is assumed.
- size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const
- {
- size_t __size = size();
- size_t __len = (__pos + __n > __size? __size - __pos : __n);
-
- _Destroy(__buffer, __buffer + __len);
- _S_flatten(_M_tree_ptr, __pos, __len, __buffer);
- return __len;
- }
-
- // Print to stdout, exposing structure. May be useful for
- // performance debugging.
- void dump() {
- _S_dump(_M_tree_ptr);
- }
-
- // Convert to 0 terminated string in new allocated memory.
- // Embedded 0s in the input do not terminate the copy.
- const _CharT* c_str() const;
-
- // As above, but lso use the flattened representation as the
- // the new rope representation.
- const _CharT* replace_with_c_str();
-
- // Reclaim memory for the c_str generated flattened string.
- // Intentionally undocumented, since it's hard to say when this
- // is safe for multiple threads.
- void delete_c_str () {
- if (0 == _M_tree_ptr) return;
- if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag &&
- ((_RopeLeaf*)_M_tree_ptr)->_M_data ==
- _M_tree_ptr->_M_c_string) {
- // Representation shared
- return;
- }
-# ifndef __GC
- _M_tree_ptr->_M_free_c_string();
-# endif
- _M_tree_ptr->_M_c_string = 0;
- }
-
- _CharT operator[] (size_type __pos) const {
- return _S_fetch(_M_tree_ptr, __pos);
- }
-
- _CharT at(size_type __pos) const {
- // if (__pos >= size()) throw out_of_range; // XXX
- return (*this)[__pos];
- }
-
- const_iterator begin() const {
- return(const_iterator(_M_tree_ptr, 0));
- }
-
- // An easy way to get a const iterator from a non-const container.
- const_iterator const_begin() const {
- return(const_iterator(_M_tree_ptr, 0));
- }
-
- const_iterator end() const {
- return(const_iterator(_M_tree_ptr, size()));
- }
-
- const_iterator const_end() const {
- return(const_iterator(_M_tree_ptr, size()));
- }
-
- size_type size() const {
- return(0 == _M_tree_ptr? 0 : _M_tree_ptr->_M_size);
- }
-
- size_type length() const {
- return size();
- }
-
- size_type max_size() const {
- return _S_min_len[_RopeRep::_S_max_rope_depth-1] - 1;
- // Guarantees that the result can be sufficirntly
- // balanced. Longer ropes will probably still work,
- // but it's harder to make guarantees.
- }
-
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
-
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
-
- const_reverse_iterator const_rbegin() const {
- return const_reverse_iterator(end());
- }
-
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- const_reverse_iterator const_rend() const {
- return const_reverse_iterator(begin());
- }
-
- template<class _CharT2, class _Alloc2>
- friend rope<_CharT2,_Alloc2>
- operator+ (const rope<_CharT2,_Alloc2>& __left,
- const rope<_CharT2,_Alloc2>& __right);
-
- template<class _CharT2, class _Alloc2>
- friend rope<_CharT2,_Alloc2>
- operator+ (const rope<_CharT2,_Alloc2>& __left,
- const _CharT2* __right);
-
- template<class _CharT2, class _Alloc2>
- friend rope<_CharT2,_Alloc2>
- operator+ (const rope<_CharT2,_Alloc2>& __left, _CharT2 __right);
- // The symmetric cases are intentionally omitted, since they're presumed
- // to be less common, and we don't handle them as well.
-
- // The following should really be templatized.
- // The first argument should be an input iterator or
- // forward iterator with value_type _CharT.
- rope& append(const _CharT* __iter, size_t __n) {
- _RopeRep* __result =
- _S_destr_concat_char_iter(_M_tree_ptr, __iter, __n);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(const _CharT* __c_string) {
- size_t __len = _S_char_ptr_len(__c_string);
- append(__c_string, __len);
- return(*this);
- }
-
- rope& append(const _CharT* __s, const _CharT* __e) {
- _RopeRep* __result =
- _S_destr_concat_char_iter(_M_tree_ptr, __s, __e - __s);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(const_iterator __s, const_iterator __e) {
- _Self_destruct_ptr __appendee(_S_substring(
- __s._M_root, __s._M_current_pos, __e._M_current_pos));
- _RopeRep* __result =
- _S_concat(_M_tree_ptr, (_RopeRep*)__appendee);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(_CharT __c) {
- _RopeRep* __result =
- _S_destr_concat_char_iter(_M_tree_ptr, &__c, 1);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append() { return append(_CharT()); } // XXX why?
-
- rope& append(const rope& __y) {
- _RopeRep* __result = _S_concat(_M_tree_ptr, __y._M_tree_ptr);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(size_t __n, _CharT __c) {
- rope<_CharT,_Alloc> __last(__n, __c);
- return append(__last);
- }
-
- void swap(rope& __b) {
- _RopeRep* __tmp = _M_tree_ptr;
- _M_tree_ptr = __b._M_tree_ptr;
- __b._M_tree_ptr = __tmp;
- }
-
-
- protected:
- // Result is included in refcount.
- static _RopeRep* replace(_RopeRep* __old, size_t __pos1,
- size_t __pos2, _RopeRep* __r) {
- if (0 == __old) { _S_ref(__r); return __r; }
- _Self_destruct_ptr __left(
- _S_substring(__old, 0, __pos1));
- _Self_destruct_ptr __right(
- _S_substring(__old, __pos2, __old->_M_size));
- _RopeRep* __result;
-
- if (0 == __r) {
- __result = _S_concat(__left, __right);
- } else {
- _Self_destruct_ptr __left_result(_S_concat(__left, __r));
- __result = _S_concat(__left_result, __right);
- }
- return __result;
- }
-
- public:
- void insert(size_t __p, const rope& __r) {
- _RopeRep* __result =
- replace(_M_tree_ptr, __p, __p, __r._M_tree_ptr);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- void insert(size_t __p, size_t __n, _CharT __c) {
- rope<_CharT,_Alloc> __r(__n,__c);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const _CharT* __i, size_t __n) {
- _Self_destruct_ptr __left(_S_substring(_M_tree_ptr, 0, __p));
- _Self_destruct_ptr __right(_S_substring(_M_tree_ptr, __p, size()));
- _Self_destruct_ptr __left_result(
- _S_concat_char_iter(__left, __i, __n));
- // _S_ destr_concat_char_iter should be safe here.
- // But as it stands it's probably not a win, since __left
- // is likely to have additional references.
- _RopeRep* __result = _S_concat(__left_result, __right);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- void insert(size_t __p, const _CharT* __c_string) {
- insert(__p, __c_string, _S_char_ptr_len(__c_string));
- }
-
- void insert(size_t __p, _CharT __c) {
- insert(__p, &__c, 1);
- }
-
- void insert(size_t __p) {
- _CharT __c = _CharT();
- insert(__p, &__c, 1);
- }
-
- void insert(size_t __p, const _CharT* __i, const _CharT* __j) {
- rope __r(__i, __j);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const const_iterator& __i,
- const const_iterator& __j) {
- rope __r(__i, __j);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const iterator& __i,
- const iterator& __j) {
- rope __r(__i, __j);
- insert(__p, __r);
- }
-
- // (position, length) versions of replace operations:
-
- void replace(size_t __p, size_t __n, const rope& __r) {
- _RopeRep* __result =
- replace(_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- void replace(size_t __p, size_t __n,
- const _CharT* __i, size_t __i_len) {
- rope __r(__i, __i_len);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n, _CharT __c) {
- rope __r(__c);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n, const _CharT* __c_string) {
- rope __r(__c_string);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const _CharT* __i, const _CharT* __j) {
- rope __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const const_iterator& __i, const const_iterator& __j) {
- rope __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const iterator& __i, const iterator& __j) {
- rope __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- // Single character variants:
- void replace(size_t __p, _CharT __c) {
- iterator __i(this, __p);
- *__i = __c;
- }
-
- void replace(size_t __p, const rope& __r) {
- replace(__p, 1, __r);
- }
-
- void replace(size_t __p, const _CharT* __i, size_t __i_len) {
- replace(__p, 1, __i, __i_len);
- }
-
- void replace(size_t __p, const _CharT* __c_string) {
- replace(__p, 1, __c_string);
- }
-
- void replace(size_t __p, const _CharT* __i, const _CharT* __j) {
- replace(__p, 1, __i, __j);
- }
-
- void replace(size_t __p, const const_iterator& __i,
- const const_iterator& __j) {
- replace(__p, 1, __i, __j);
- }
-
- void replace(size_t __p, const iterator& __i,
- const iterator& __j) {
- replace(__p, 1, __i, __j);
- }
-
- // Erase, (position, size) variant.
- void erase(size_t __p, size_t __n) {
- _RopeRep* __result = replace(_M_tree_ptr, __p, __p + __n, 0);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- // Erase, single character
- void erase(size_t __p) {
- erase(__p, __p + 1);
- }
-
- // Insert, iterator variants.
- iterator insert(const iterator& __p, const rope& __r)
- { insert(__p.index(), __r); return __p; }
- iterator insert(const iterator& __p, size_t __n, _CharT __c)
- { insert(__p.index(), __n, __c); return __p; }
- iterator insert(const iterator& __p, _CharT __c)
- { insert(__p.index(), __c); return __p; }
- iterator insert(const iterator& __p )
- { insert(__p.index()); return __p; }
- iterator insert(const iterator& __p, const _CharT* c_string)
- { insert(__p.index(), c_string); return __p; }
- iterator insert(const iterator& __p, const _CharT* __i, size_t __n)
- { insert(__p.index(), __i, __n); return __p; }
- iterator insert(const iterator& __p, const _CharT* __i,
- const _CharT* __j)
- { insert(__p.index(), __i, __j); return __p; }
- iterator insert(const iterator& __p,
- const const_iterator& __i, const const_iterator& __j)
- { insert(__p.index(), __i, __j); return __p; }
- iterator insert(const iterator& __p,
- const iterator& __i, const iterator& __j)
- { insert(__p.index(), __i, __j); return __p; }
-
- // Replace, range variants.
- void replace(const iterator& __p, const iterator& __q,
- const rope& __r)
- { replace(__p.index(), __q.index() - __p.index(), __r); }
- void replace(const iterator& __p, const iterator& __q, _CharT __c)
- { replace(__p.index(), __q.index() - __p.index(), __c); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __c_string)
- { replace(__p.index(), __q.index() - __p.index(), __c_string); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __i, size_t __n)
- { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __i, const _CharT* __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
- void replace(const iterator& __p, const iterator& __q,
- const const_iterator& __i, const const_iterator& __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
- void replace(const iterator& __p, const iterator& __q,
- const iterator& __i, const iterator& __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
-
- // Replace, iterator variants.
- void replace(const iterator& __p, const rope& __r)
- { replace(__p.index(), __r); }
- void replace(const iterator& __p, _CharT __c)
- { replace(__p.index(), __c); }
- void replace(const iterator& __p, const _CharT* __c_string)
- { replace(__p.index(), __c_string); }
- void replace(const iterator& __p, const _CharT* __i, size_t __n)
- { replace(__p.index(), __i, __n); }
- void replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
- { replace(__p.index(), __i, __j); }
- void replace(const iterator& __p, const_iterator __i,
- const_iterator __j)
- { replace(__p.index(), __i, __j); }
- void replace(const iterator& __p, iterator __i, iterator __j)
- { replace(__p.index(), __i, __j); }
-
- // Iterator and range variants of erase
- iterator erase(const iterator& __p, const iterator& __q) {
- size_t __p_index = __p.index();
- erase(__p_index, __q.index() - __p_index);
- return iterator(this, __p_index);
- }
- iterator erase(const iterator& __p) {
- size_t __p_index = __p.index();
- erase(__p_index, 1);
- return iterator(this, __p_index);
- }
-
- rope substr(size_t __start, size_t __len = 1) const {
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __start, __start + __len));
- }
-
- rope substr(iterator __start, iterator __end) const {
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __start.index(), __end.index()));
- }
-
- rope substr(iterator __start) const {
- size_t __pos = __start.index();
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __pos, __pos + 1));
- }
-
- rope substr(const_iterator __start, const_iterator __end) const {
- // This might eventually take advantage of the cache in the
- // iterator.
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __start.index(), __end.index()));
- }
-
- rope<_CharT,_Alloc> substr(const_iterator __start) {
- size_t __pos = __start.index();
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __pos, __pos + 1));
- }
-
- static const size_type npos;
-
- size_type find(_CharT __c, size_type __pos = 0) const;
- size_type find(const _CharT* __s, size_type __pos = 0) const {
- size_type __result_pos;
- const_iterator __result =
- std::search(const_begin() + __pos, const_end(),
- __s, __s + _S_char_ptr_len(__s));
- __result_pos = __result.index();
-# ifndef __STL_OLD_ROPE_SEMANTICS
- if (__result_pos == size()) __result_pos = npos;
-# endif
- return __result_pos;
- }
-
- iterator mutable_begin() {
- return(iterator(this, 0));
- }
-
- iterator mutable_end() {
- return(iterator(this, size()));
- }
-
- typedef reverse_iterator<iterator> reverse_iterator;
-
- reverse_iterator mutable_rbegin() {
- return reverse_iterator(mutable_end());
- }
-
- reverse_iterator mutable_rend() {
- return reverse_iterator(mutable_begin());
- }
-
- reference mutable_reference_at(size_type __pos) {
- return reference(this, __pos);
- }
-
-# ifdef __STD_STUFF
- reference operator[] (size_type __pos) {
- return _char_ref_proxy(this, __pos);
- }
-
- reference at(size_type __pos) {
- // if (__pos >= size()) throw out_of_range; // XXX
- return (*this)[__pos];
- }
-
- void resize(size_type __n, _CharT __c) {}
- void resize(size_type __n) {}
- void reserve(size_type __res_arg = 0) {}
- size_type capacity() const {
- return max_size();
- }
-
- // Stuff below this line is dangerous because it's error prone.
- // I would really like to get rid of it.
- // copy function with funny arg ordering.
- size_type copy(_CharT* __buffer, size_type __n,
- size_type __pos = 0) const {
- return copy(__pos, __n, __buffer);
- }
-
- iterator end() { return mutable_end(); }
-
- iterator begin() { return mutable_begin(); }
-
- reverse_iterator rend() { return mutable_rend(); }
-
- reverse_iterator rbegin() { return mutable_rbegin(); }
-
-# else
-
- const_iterator end() { return const_end(); }
-
- const_iterator begin() { return const_begin(); }
-
- const_reverse_iterator rend() { return const_rend(); }
-
- const_reverse_iterator rbegin() { return const_rbegin(); }
-
-# endif
-
-};
-
-template <class _CharT, class _Alloc>
-const typename rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos =
- (size_type)(-1);
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos == __y._M_current_pos &&
- __x._M_root == __y._M_root);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos < __y._M_current_pos);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return !(__x == __y);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return __y < __x;
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return !(__y < __x);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return !(__x < __y);
-}
-
-template <class _CharT, class _Alloc>
-inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos;
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) {
- return _Rope_const_iterator<_CharT,_Alloc>(
- __x._M_root, __x._M_current_pos - __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) {
- return _Rope_const_iterator<_CharT,_Alloc>(
- __x._M_root, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) {
- return _Rope_const_iterator<_CharT,_Alloc>(
- __x._M_root, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos == __y._M_current_pos &&
- __x._M_root_rope == __y._M_root_rope);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos < __y._M_current_pos);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return !(__x == __y);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return __y < __x;
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return !(__y < __x);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return !(__x < __y);
-}
-
-template <class _CharT, class _Alloc>
-inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos;
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n) {
- return _Rope_iterator<_CharT,_Alloc>(
- __x._M_root_rope, __x._M_current_pos - __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator+(const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n) {
- return _Rope_iterator<_CharT,_Alloc>(
- __x._M_root_rope, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) {
- return _Rope_iterator<_CharT,_Alloc>(
- __x._M_root_rope, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right)
-{
- return rope<_CharT,_Alloc>(
- rope<_CharT,_Alloc>::_S_concat(__left._M_tree_ptr, __right._M_tree_ptr));
- // Inlining this should make it possible to keep __left and
- // __right in registers.
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right)
-{
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left,
- const _CharT* __right) {
- size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
- return rope<_CharT,_Alloc>(
- rope<_CharT,_Alloc>::_S_concat_char_iter(
- __left._M_tree_ptr, __right, __rlen));
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left,
- const _CharT* __right) {
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) {
- return rope<_CharT,_Alloc>(
- rope<_CharT,_Alloc>::_S_concat_char_iter(
- __left._M_tree_ptr, &__right, 1));
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) {
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-bool
-operator< (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- return __left.compare(__right) < 0;
-}
-
-template <class _CharT, class _Alloc>
-bool
-operator== (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- return __left.compare(__right) == 0;
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
- return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root);
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return !(__x == __y);
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return __y < __x;
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return !(__y < __x);
-}
-
-template <class _CharT, class _Alloc>
-inline bool
-operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) {
- return !(__x < __y);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
- return !(__x == __y);
-}
-
-template<class _CharT, class _Traits, class _Alloc>
-std::basic_ostream<_CharT, _Traits>& operator<<
- (std::basic_ostream<_CharT, _Traits>& __o,
- const rope<_CharT, _Alloc>& __r);
-
-typedef rope<char> crope;
-typedef rope<wchar_t> wrope;
-
-inline crope::reference __mutable_reference_at(crope& __c, size_t __i)
-{
- return __c.mutable_reference_at(__i);
-}
-
-inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i)
-{
- return __c.mutable_reference_at(__i);
-}
-
-template <class _CharT, class _Alloc>
-inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y) {
- __x.swap(__y);
-}
-
-// Hash functions should probably be revisited later:
-template<> struct hash<crope>
-{
- size_t operator()(const crope& __str) const
- {
- size_t __size = __str.size();
-
- if (0 == __size) return 0;
- return 13*__str[0] + 5*__str[__size - 1] + __size;
- }
-};
-
-
-template<> struct hash<wrope>
-{
- size_t operator()(const wrope& __str) const
- {
- size_t __size = __str.size();
-
- if (0 == __size) return 0;
- return 13*__str[0] + 5*__str[__size - 1] + __size;
- }
-};
-
-} // namespace __gnu_cxx
-
-# include <ext/ropeimpl.h>
-
-# endif /* __SGI_STL_INTERNAL_ROPE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/iomanip b/contrib/libstdc++/iomanip
deleted file mode 100644
index 8179485..0000000
--- a/contrib/libstdc++/iomanip
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __IOMANIP__
-#define __IOMANIP__
-#include <iomanip.h>
-#endif
diff --git a/contrib/libstdc++/iosfwd b/contrib/libstdc++/iosfwd
deleted file mode 100644
index 8314cf7..0000000
--- a/contrib/libstdc++/iosfwd
+++ /dev/null
@@ -1,15 +0,0 @@
-// -*- C++ -*- I/O forward declaration header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __IOSFWD__
-#define __IOSFWD__
-class ios;
-class streambuf;
-class istream;
-class ostream;
-class iostream;
-class filebuf;
-class ifstream;
-class ofstream;
-class fstream;
-#endif
diff --git a/contrib/libstdc++/iostream b/contrib/libstdc++/iostream
deleted file mode 100644
index 7ecba6e..0000000
--- a/contrib/libstdc++/iostream
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __IOSTREAM__
-#define __IOSTREAM__
-#include <iostream.h>
-#endif
diff --git a/contrib/libstdc++/libio/ChangeLog b/contrib/libstdc++/libio/ChangeLog
deleted file mode 100644
index d0055fd..0000000
--- a/contrib/libstdc++/libio/ChangeLog
+++ /dev/null
@@ -1,2802 +0,0 @@
-2002-11-19 Release Manager
-
- * GCC 3.2.1 Released.
-
-2002-11-19 Release Manager
-
- * GCC 3.2.1 Released.
-
-2002-11-18 Release Manager
-
- * GCC 3.2.1 Released.
-
-2002-08-14 Release Manager
-
- * GCC 3.2 Released.
-
-2002-07-25 Release Manager
-
- * GCC 3.1.1 Released.
-
-2002-05-14 Release Manager
-
- * GCC 3.1 Released.
-
-2002-05-14 Release Manager
-
- * GCC 3.1 Released.
-
-2001-02-03 Alexandre Oliva <aoliva@redhat.com>
- Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-
- * Makefile.am (mkinstalldirs): Set.
-
-2001-01-28 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (LIBIO_SRCS): Remove stdio.c.
-
-2000-10-29 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (INCLUDES): Change to $(top_builddir)/include.
-
-2000-10-29 Mark Mitchell <mark@codesourcery.com>
-
- * iofopen.c (_IO_new_fopen): Don't define `_IO_wide_data wd'
- if _GLIBCPP_USE_WCHAR_T is not defined.
- * iofwide.c: Don't define codecvt functions when
- _GLIBCPP_USE_WCHAR_T is not defined.
- (_IO_fwide): Don't try to put the stream in wide mode when
- _GLIBCPP_USE_WCHAR_T is not defined.
- * libio.h (_IO_wide_data): Define it as an incomplete struct
- when _GLIBCPP_USE_WCHAR_T is not defined.
- * wfiledoalloc.c: Don't define anything when
- _GLIBCPP_USE_WCHAR_T is not defined.
- * wfileops.c: Likewise.
- * wgenops.c: Likewise.
-
- * _G_config.h (_G_USING_THUNKS): Allow overrides from
- OS-configuration files.
- * libioP.h: Test _G_USING_THUNKS with #if, rather than #ifdef.
-
-2000-10-17 Benjamin Kosnik <bkoz@gnu.org>
-
- * libioP.h: Break up extern "C" bits around includes.
- * libio.h: Only include C headers, or else _C_legacy namespaces
- will be nested.
- * libioP.h: Same here.
-
-2000-10-11 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am: Add includes from GLIBCPP_EXPORT_INCLUDES.
-
-2000-10-10 Benjamin Kosnik <bkoz@gnu.org>
-
- * _G_config.h (__need_ptrdiff_t): Add.
-
-2000-10-08 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (INCLUDES): Simplify.
- * libioP.h (JUMP1): If compiling c++, use std headers.
- * _G_config.h: Same.
-
-2000-10-07 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (CONFIG_INCLUDES): Remove.
-
-2000-10-06 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (libio_la_DEPENDENCIES): Remove extaneous cruft.
- (libio_la_SOURCES): Remove.
-
-2000-10-05 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (INCLUDES): Add glibcpp_includedir.
-
-2000-10-04 Benjamin Kosnik <bkoz@gnu.org>
-
- * _G_config.h : Re-guard the __mbstate_t declaration.
-
-2000-09-27 Benjamin Kosnik <bkoz@gnu.org>
-
- * libioP.h: Remove fcntl.h include.
-
-2000-08-22 Benjamin Kosnik <bkoz@gnu.org>
-
- * iofwide.c (_IO_fwide): Simplify, as nl_langinfo is assumed.
-
-2000-08-14 Benjamin Kosnik <bkoz@gnu.org>
-
- * *: Merge with mainline glibc sources.
- * filedoalloc.c (_IO_file_doallocate): Don't call
- _IO_cleanup_registration_needed, even if not libc.
- * iofwide.c (_IO_fwide): Correct placement of defines.
- * cleanup.c: Remove.
-
-2000-08-04 benjamin kosnik <bkoz@haight.constant.com>
-
- * genops.c (_IO_unbuffer_write): Don't call _IO_SETBUF if the
- stream is not orientated.
-
-2000-08-04 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (LIBIO_SRCS): Add c_codecvt.c
-
-2000-07-12 benjamin kosnik <bkoz@gnu.org>
-
- * _G_config.h: Smoke less crack, don't define _G_HAVE_ST_BLKSIZE.
-
-2000-04-25 Benjamin Kosnik <bkoz@gnu.org>
-
- * libio.h: Change decls for seekoff/seekpos.
- * Makefile.am: Add bits to not generate _G_config.h on linux.
- * gen-params: Remove sigset_t declaration.
-
-2000-02-29 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (libio_headers): Strip out deadweight.
-
-2000-02-21 Benjamin Kosnik <bkoz@cygnus.com>
-
- * gen-params (CONFIG_NM): Specifically add in nm as the
- default CONFIG_NM.
-
-2000-02-10 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am: Add bits for _G_config.h generation.
- * gen-params: New file.
-
-2000-02-07 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am: Change license.
-
-1999-07-28 Benjamin Kosnik <bkoz@gnu.org>
-
- * Makefile.am (libio_la_SOURCES): Remove cleanup.c, so that
- _IO_cleanup will not be undefined.
-
-1998-11-26 Manfred Hollstein <manfred@s-direktnet.de>
-
- * configure.in (compiler_name): Add check to detect if this
- language's compiler has been built.
-
-1998-10-12 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * config.shared (depend.new): delete libc-lock.h from
- dependencies, and fix _G_config.h -> $(_G_CONFIG_H) rule
- * depend: Rebuilt.
-
-Sun Oct 11 01:51:42 1998 Jeffrey A Law (law@cygnus.com)
-
- * config.shared (depend.new): Fix typo.
- * depend: Rebuilt.
-
-1998-09-09 Manfred Hollstein <manfred@s-direktnet.de>
-
- * configure.in (INSTALLDIR): Fix comment about changing INSTALLDIR's
- value; don't change its value if --enable-version-specific-runtime-libs
- has been specified.
-
-Wed Sep 2 21:05:39 1998 H.J. Lu (hjl@gnu.org)
-
- * configure.in: Fix INSTALLDIR replacement for cross-compile.
-
-Sun Aug 30 22:27:02 1998 Lutz Wohlrab <lutz.wohlrab@informatik.tu-chemnitz.de>
-
- * dbz/Makefile.in: Avoid assumptions about "tr" behaves when
- LANG is set to something other than English.
-
-Sun Aug 30 22:17:00 1998 H.J. Lu (hjl@gnu.org)
-
- * config.shared: Set libsubdir.
-
-1998-08-25 14:34 Ulrich Drepper <drepper@cygnus.com>
-
- * libio/iogetline.c (_IO_getline_info): Don't read anything for
- N == 0. Patch by HJ Lu.
-
-1998-08-23 Mark Mitchell <mark@markmitchell.com>
-
- * iomanip.h: Use __extension__ for `extern' explicit template
- instantiations.
-
-1998-08-17 Ulrich Drepper <drepper@cygnus.com>
-
- * strfile.h: Define __PMT if not already defined.
-
-1998-08-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
-
- * libioP.h: Use __PMT in typedefs.
- * strfile.h: Likewise.
-
-1998-06-29 Ulrich Drepper <drepper@cygnus.com>
-
- * libio.h: Rewrite __PMT change so that it works with platforms
- defining __P but not __PMT.
-
- * libio.h (__PMT): New macro. Defined like __P. Use is for
- function pointers.
-
-1998-06-27 Manfred Hollstein <manfred@s-direktnet.de>
-
- * Makefile.in (install): Remove superfluous /include.
-
-1998-06-26 Manfred Hollstein <manfred@s-direktnet.de>
-
- * config.shared (FLAGS_TO_PASS): Add gcc_version_trigger.
- (Makefile): Add dependency upon $(gcc_version_trigger).
-
-1998-06-24 Manfred Hollstein <manfred@s-direktnet.de>
-
- * Makefile.in (install): Install _G_config.h depending on new flag
- --enable-version-specific-runtime-libs.
- * config/linux.mt (gxx_include_dir): Remove definition here as we use
- gcc's default anyway.
-
-1998-06-24 Manfred Hollstein <manfred@s-direktnet.de>
-
- * config.shared (FLAGS_TO_PASS): Add gcc_version.
-
-1998-06-19 Manfred Hollstein <manfred@s-direktnet.de>
-
- * config.shared (FLAGS_TO_PASS): Add libsubdir.
-
-1998-06-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- * genops.c (__underflow): Read character from read pointer as unsigned.
- (__uflow): Likewise.
-
-1998-05-22 Ulrich Drepper <drepper@cygnus.com>
-
- * strops.c (_IO_str_underflow): Read newly available character
- from buffer as unsigned.
-
-Sun Apr 19 22:13:36 1998 H.J. Lu (hjl@gnu.org)
-
- * isgetline.cc (istream::get): Fix a typo.
-
-Thu Mar 5 09:23:28 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * configure.in: Make locating frag files failsafe even for the
- special case if configuring and building in srcdir.
-
-1998-02-24 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- Changes for _G_IO_IO_FILE_VERSION == 0x20001:
- * libioP.h (_IO_showmanyc_t, _IO_SHOWMANYC, _IO_imbue_t,
- _IO_IMBUE): New definitions.
- (struct _IO_jump_t): Add __showmanyc and __imbue fields.
- (_IO_file_fopen): Add new fourth argument.
- * filebuf.cc (filebuf::open): Pass new fourth argument to
- _IO_file_fopen.
- * iolibio.h (_IO_freopen): Likewise.
- * streambuf.cc (streambuf::showmanyc, streambuf::imbue): New
- functions.
- * streambuf.h (_IO_wchar_t): Define to _G_wchar_t.
- (ios::fill): Remove casts.
- (struct streambuf): Add showmanyc and imbue members.
-
- * iostream.cc (ostream::operator<<(double n)) [__GLIBC_MINOR__ >=
- 1]: Initialize new fields is_char of struct printf_info.
- (ostream::operator<<(long double n)) [__GLIBC_MINOR__ >= 1]:
- Likewise.
-
-Sun Feb 22 17:24:53 1998 Jeffrey A Law (law@cygnus.com)
-
- * config.shared: Bring back changes from Ian and Fred that were
- accidentally clobbered. Should eliminate the need for Dave's
- recent change.
-
-Tue Feb 17 21:56:25 1998 H.J. Lu (hjl@gnu.org)
-
- * config/linux.mt (IO_OBJECTS): Add iogetline.o.
- * config/linuxlibc1.mt: Ditto.
-
- * iogetline.c (_IO_getline_info): Renamed from _IO_getline.
- (_IO_getline): Just call _IO_getline_info.
-
- * isgetline.cc (istream::getline, istream::get, _sb_readline):
- Call _IO_getline_info instead of _IO_getline and get the EOF
- information.
- * sbgetline.cc (streambuf::sgetline): Ditto.
-
- * libioP.h (_IO_getline_info): New declaration.
-
- * iogetline.c (_IO_getline): Handle the case when there is no
- buffer.
-
-Fri Feb 13 00:57:20 1998 Krister Walfridsson (cato@df.lth.se)
-
- * fileops.c: #include <unistd.h>.
- * ioprims.c: Likewise.
-
-1998-02-10 Mark Mitchell <mmitchell@usa.net>
-
- * iostream.cc (ostream::operator<<(long double)): Don't use
- labeled initializers.
-
-Fri Feb 6 01:35:56 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * config.shared (FLAGS_TO_PASS): Don't emit PICFLAG.
- (.c.o): Check value of enable_shared, not PICFLAG.
- (.C.o): Dito.
- (.cc.o): Dito.
- (stamp-picdir): Dito.
-
-Thu Feb 5 17:41:26 1998 Dave Brolley <brolley@cygnus.com>
-
- * config.shared (LIBS): Change to -L../../libstdc++ (was -L../libstdc++)
- if ${DOING_GPERF} is true.
-
-1998-01-20 Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
-
- * iostream.cc (istream::operator>>(long double&))
- [!_G_HAVE_LONG_DOUBLE_IO]: Scan value into separate variable, in
- case long double is bigger than double.
- (ostream::operator<<(double)) [_G_HAVE_PRINTF_FP]: Fix order of
- initializers of struct printf_info to match declaration order,
- to work around g++ bug.
- (ostream::operator<<(long double)) [_G_HAVE_PRINTF_FP]: Likewise.
-
- * gen-params: Add missing quotes. Avoid useless use of command
- substitution.
-
-Sun Feb 1 13:29:47 1998 H.J. Lu (hjl@gnu.org)
-
- * filebuf.cc (filebuf::open): Call _IO_file_open if
- _G_HAVE_IO_FILE_OPEN is 1.
-
- * libio.h (_IO_fpos64_t, _IO_off64_t): Defined if
- _G_IO_IO_FILE_VERSION == 0x20001.
-
- * libioP.h (_IO_file_open): New declaration.
-
- * libio.h (_IO_FILE, _IO_stdin_, _IO_stdout_, _IO_stderr_,
- _IO_seekoff, _IO_seekpos): Add support for libio in glibc 2.1.
- * libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t,
- _IO_seekoff, _IO_seekpos, _IO_default_seekoff,
- _IO_default_seekpos, _IO_default_seek, _IO_file_seekoff,
- _IO_file_seek, _IO_str_seekoff, _IO_pos_BAD, _IO_pos_as_off,
- _IO_pos_0): Ditto.
- * streambuf.h (streamoff, streampos): Ditto.
-
- * gen-params (__extension__): Use only if gcc version >= 2.8.
-
-Sun Feb 1 13:08:18 1998 Krister Walfridsson (cato@df.lth.se)
-
- * dbz/dbz.c (putconf): Handle systems which use "long long" as type
- for "off_t".
- * dbz/dbzmain.c (mkfiles): Likewise.
-
-Wed Jan 28 10:27:11 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * config.shared (FLAGS_TO_PASS): Add gxx_include_dir.
-
- * stdio/configure.in, tests/configure.in: Update with yesterday's
- toplevel configure.in changes.
- * testsuite/configure.in: Likewise.
-
- * config.shared: Fix typo in yesterday's changes.
-
-Tue Jan 27 23:26:07 1998 Manfred Hollstein <manfred@s-direktnet.de>
-
- * config.shared: Emit everything which needs to be re-definable
- via file descriptor 1; the generic stuff is emitted using redirection
- onto fd 2.
-
- * configure.in (package_makefile_rules_frag): New variable
- which is used in the call to config.shared; redirect file descriptor 2
- to ${package_makefile_rules_frag}.
-
-Tue Jan 27 10:35:22 1998 H.J. Lu (hjl@gnu.org)
-
- * configure.in (topsrcdir): New.
- (CHECK_SUBDIRS, configdirs): Check ${topsrcdir}/gcc instead.
- (config-ml.in): Use ${topsrcdir}/config-ml.in.
-
- * tests/configure.in (topsrcdir): New.
- (CHECK): Check ${topsrcdir}/gcc instead.
-
-Fri Jan 16 00:48:03 1998 Manfred Hollstein <manfred@lts.sel.alcatel.de>
-
- * config.shared (FLAGS_TO_PASS): Add SHELL.
-
-Thu Jan 15 00:21:58 1998 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: For *-*-cygwin32*, add a -I for winsup to both
- XCINCLUDES and XCXXINCLUDES.
- * config.shared: Use ${host_includes} when setting CXXINCLUDES in
- the DOING_LIBGXX case.
- * Makefile.in (_G_config.h): Pass $(CINCLUDES) in CC and
- $(CXXINCLUDES) in CXX when running gen-params.
-
-Tue Jan 13 21:32:08 1998 H.J. Lu (hjl@gnu.org)
-
- * configure.in (CHECK_SUBDIRS): Set to testsuite only if
- ${srcdir}/../gcc exists.
- (configdirs): Include testsuite only if ${srcdir}/../gcc exists.
-
- * tests/Makefile.in (check): Depend on $(CHECK).
-
- * tests/configure.in (CHECK): Set to "check-iostream
- check-stdio" if ${srcdir}/../../gcc doesn't exists.
-
-Thu Jan 8 18:09:03 1998 Fred Fish <fnf@cygnus.com>
-
- * config.shared (THIS_FILE): Really found via TOLIBIO instead
- of TOLIBCXX, which is empty when configuring gperf.
- (LIBS): When linking gperf, find libstdc++ relative to TO_TOPDIR
- instead of hardcoded "../".
-
-1997-12-12 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- Don't make gperf depend upon libg++.
- * config.shared (TOLIBGCXX) [DOING_GPERF]: Delete.
- (LIBS) [DOING_GPERF]: Make it just `-L../libstdc++ -lstdc++'.
-
-Thu Dec 11 11:20:59 1997 H.J. Lu (hjl@gnu.org)
-
- * configure.in (target frags): Add *-linux-gnu.
-
-Fri Dec 5 16:22:15 1997 H.J. Lu (hjl@gnu.org)
-
- * streambuf.cc (streambuf::~streambuf): Don't delete _lock
- for _IO_stdin/_IO_stdout/_IO_stderr.
-
-Thu Nov 27 01:32:43 1997 Jeffrey A Law (law@cygnus.com)
-
- * Makefile.in (install): Change gxx_includedir to gcc_include_dir.
- * config.shared (gxx_includedir): Remove default definition.
- * config/linux.mt: Change gxx_includedir to gxx_include_dir.
- * config/linuxaxp1.mt: Likewise.
-
-Wed Nov 26 16:08:50 1997 Richard Henderson (rth@cygnus.com)
-
- * configure.in (target frags): Add powerpc*-linux-gnulibc1.
- (stdio-lock): Similarly.
-
- * configure.in (target frags): Add alpha*-linux-gnulibc1.
- (pic frags): Its alpha*- not alpha-.
- (stdio-lock): Kill everything. Add alpha*-linux-gnulibc1.
- * libio.h: Check __GLIBC_MINOR__ to find stdio-lock.h. If not
- _IO_MTSAFE_IO & GLIBC, make sure the lock pointer is still there.
- * libioP.h: Check __GLIBC_MINOR__ to find libc-lock.h.
-
- * config/linuxaxp1-libc-lock.h: New file.
- * config/linuxaxp1-stdio-lock.h: New file.
- * config/linuxaxp1.mt: New file.
-
- * gen-params (va_list): Check for and use __gnuc_va_list.
- (NULL): Work around some linux kernel headers and redefine NULL.
-
-Mon Nov 24 17:04:18 1997 Michael Meissner <meissner@cygnus.com>
-
- * stdiostream.cc (sys_read): Declare ch with int type, rather than
- without a type.
-
-Tue Nov 18 09:53:58 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
-
- * stdstrbufs.cc (DEF_STDFILE): Use STD_VTABLE.
-
-Tue Nov 11 01:40:17 1997 Oleg Krivosheev <kriol@fnal.gov>
-
- * iomanip.h: Fix guiding decls.
-
-1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * libio.h (__P): Name its arg `p' instead of `params'.
- Avoids problems with an unchanged Solaris math.h header.
-
-Wed Oct 29 23:01:47 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * gen-params: Override NULL.
-
-1997-10-27 03:53 Ulrich Drepper <drepper@cygnus.com>
-
- * stdio-lock.h: Removed. Was never needed.
-
-Wed Oct 22 19:19:32 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
-
- * libio.h (_IO_LOCK_T): Handle glibc 2 when _IO_MTSAFE_IO is
- not defined.
-
- * iovsscanf.c (vsscanf): Make it weak alias of _IO_vsscanf if
- __linux__ is defined instead of __ELF__
-
- * config/linuxlibc1.mt (USER_INCLUDES): Add libio.h.
-
-1997-10-15 Ulrich Drepper <drepper@cygnus.com>
-
- * configure.in: Create compatibility code in bits/libc-lock.h file.
-
-Thu Oct 9 07:08:41 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
-
- * libio.h (_IO_LOCK_T): Handle glibc 2 when _IO_MTSAFE_IO is
- not defined.
-
- * filedoalloc.c (_IO_file_doallocate): Don't call
- _IO_cleanup_registration_needed if __linux__ is defined.
-
- * iofclose.c (fclose): Make it weak alias of _IO_fclose if
- __ELF__ is defined.
-
- * iovsprintf.c (vsprintf): Make it weak alias of _IO_vsprintf
- if __ELF__ is defined.
-
- * iovsscanf.c (vsscanf): Make it weak alias of _IO_vsscanf if
- __ELF__ is defined.
-
- * config/linuxlibc1.mt (MT_CFLAGS): Defined as -D_G_HAVE_MMAP.
- (IO_OBJECTS): Add filedoalloc.o fileops.o genops.o iofclose.o
- iovsprintf.o iovsscanf.o strops.o.
-
-Fri Oct 3 10:13:13 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * iostream.cc, libio.h: Convert other uses of #ifdef
- _G_HAVE_PRINTF_FP to #if.
-
-1997-10-02 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * iostream.cc (operator<<): Use `#if _G_HAVE_PRINTF_FP', not ifdef.
-
-Thu Oct 2 10:36:49 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * gen-params: Fix __printf_fp test.
- * config/linuxlibc1.mt (gxx_includedir): Don't define.
-
-Thu Oct 2 10:36:26 1997 Ulrich Drepper <drepper@rtl.cygnus.com>
-
- * config/linuxlibc1.mt (_G_CONFIG_H): Don't define.
- * gen-params: Add test for __printf_fp.
-
-Sun Sep 28 12:09:04 1997 Mark Mitchell <mmitchell@usa.net>
-
- * iomanip.h: Use new friend <> syntax.
-
-Sun Sep 28 12:04:21 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * libio.h: Don't use _IO_LOCK_T if it's not defined.
-
-Fri Sep 26 20:56:41 1997
-
- Based on a patch by H.J. Lu (hjl@gnu.ai.mit.edu).
-
- * Makefile.in (STDIO_OBJECTS): New. Defined as stdfiles.o.
- (LIBIO_OBJECTS): Add $(STDIO_OBJECTS).
- (PICFLAG): New, empty. moved to here from config.shared.
-
- * config.shared (DISTCLEAN): Add target-mkfrag.
- (PICFLAG): Removed.
-
- * configure.in (*-linux-gnulibc1): Remove warning.
- (*-linux-gnu): Use linux.mt mtsafe.mt.
- (alpha-*-linux*): Use mh-elfalphapic.
-
- * gen-params (_G_ullong): Also check unsigned long long int.
- (_G_llong): Also check long long int.
-
- * libio.h (_IO_lock_t): Add support for the Linux libc 5.
- (_IO_peekc): Defined as _IO_peekc_unlocked if _IO_MTSAFE_IO
- is not defined.
-
- * iostream.cc (__cvt_double): Fix a typo in declaration.
- (info): Use expr != 0 to initialize the bit fields. Don't
- initialize "extra" for the Linux libc 5.
-
- * streambuf.h (_G_NEED_STDARG_H): Changed from _IO_NEED_STDARG_H.
-
- * config/linux.mt (STDIO_OBJECTS): New, empty.
- (MT_CFLAGS): Removed.
-
- * config/linuxlibc1.mt: Rewrite. it's identical to linux.mt but
- IO_OBJECTS mentions files not in early libc5 versions.
-
- * config/mtsafe.mt: New.
-
- * dbz/Makefile.in (check): Support make -j.
-
- * tests/tFile.cc (tempfile): Fix a typo.
-
-1997-09-19 11:52 Jim Wilson <wilson@cygnus.com>
-
- * Makefile.in (LIBIO_OBJECTS): Depend on _G_CONFIG_H.
-
-1997-09-17 04:08 Ulrich Drepper <drepper@cygnus.com>
-
- * iostream.cc: Add forward declaration for __cvt_double.
- * libio.h: Define _IO_USE_DTOA is _G_HAVE_PRINTF_FP is not defined.
- * strops.c (_IO_str_count): Correct last change.
-
-1997-09-17 02:50 Ulrich Drepper <drepper@cygnus.com>
-
- * libioP.h: Define __set_errno if not already defined.
-
-1997-09-15 02:37 Ulrich Drepper <drepper@cygnus.com>
-
- * config/linux.mt: Rewrite for use with glibc 2.
- * config/linuxlibc1.mt: Old content of linux.mt, fir libc4 and
- libc5.
-
- * config.shared (COMPILE.c): Allow new flags in MT_CFLAGS be
- passed.
- (COMPILE.cc): Likewise.
-
- * configure.in (*-linux*): Remove goal. We now have...
- (*-linux-gnulibc1): For libc4 and libc5. Emit warning.
- (*-linux-gnu)): For glibc 2.
- Create links to find headers for multi-threading if necessary.
-
- * fileops.c: Make thread-safe by using _IO_cleanup_region_start
- etc to handle cancelation. Acquire locks in functions which are
- called directly.
- (_IO_file_read, _IO_file_write): Remove dead code.
-
- * include/empty.h: Define stub macros for locking.
-
- * iolibio.h: Add prototypes for obstack printing functions.
-
- * ioseekoff.c (_IO_seekoff): Lock stream before working.
- * ioseekpos.c (_IO_seekpos): Likewise.
-
- * iostream.cc: Add support for long double I/O.
- Use __printf_fp from glibc is available.
- Use _IO_cleanup_region_start to handle cancelation correctly.
- * iostream.h (class ostream): Change opfx and osfx to lock/unlock
- stream
- (class istream): Likewise for ipfx, ipfx0, ipfx1, and isfx.
- Declare new function lock and unlock for ostream and istream.
- * osform.cc: Use _IO_cleanup_region_start to handle cancelation
- correctly.
-
- * libio.h: Update from glibc version. Pretty printing.
- * libioP.h: Likewise.
-
- * outfloat.c: Only compile if _IO_USE_DTOA is defined.
-
- * stdio/feof.c: Make thread safe.
- * stdio/ferror.c: Likewise.
- * stdio/getc.c : Likewise.
- * stdio/putc.c : Likewise.
- * stdio/stdio.h: Declare function of thread-safe API.
-
- * stdio/obprintf.c: New file.
- * stdio/vasprintf.c: New file.
-
- * stdio-lock.h: Removed.
-
- * stdstrbufs.c: Add definitions for thread-safe streams.
-
- * streambuf.cc: Initialize lock.
-
- * strops.c (_IO_str_count): Undo last change.
-
- * tests/tFile.cc: Support parallel builds by avoiding fixed
- name for test file.
-
-Thu Sep 11 18:43:56 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (iostream.list): Remove STDIO_WRAP_OBJECTS.
-
-Mon Sep 8 01:30:27 1997 Weiwen Liu <liu@hepunix.physics.yale.edu>
-
- * libio.h: Fix typo.
-
-Sun Sep 7 23:00:18 1997 Jim Wilson (wilson@cygnus.com)
-
- * linux.mt (LIBIOSTREAM_DEP): Change stdio.list to stmp-stdio.
-
-Fri Sep 5 09:58:43 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Makefile.in (iostream.list): Instead of adding stdio.list, add
- STDIO_WRAP_OBJECTS.
- (iostream.list): Lose dependency on stmp-stdio, not necessary for
- our stuff. The stdio stuff is present here just for uniformity
- with glibc.
-
-Thu Sep 4 17:26:22 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * parsestream.cc (general_parsebuf): Cast return of malloc to char*.
-
-1997-09-04 16:11 Ulrich Drepper <drepper@cygnus.com>
-
- Change compared to version initially intended to in:
- * strops.c (_IO_str_count): Still use _IO_write_ptr, not
- _IO_write_end, for now.
-
- * iofeof.c, ioferror.c, iofflush_u.c, iogetc.c, ioputc.c, peekc.c,
- stdio-lock.h: New files.
-
- * include: New dir.
- * include/empty.h: New header.
-
- * filedoalloc.c: Update and reformat copyright.
- Don't use DEFUN.
- Use __set_errno throughout the code to support multi-threaded
- programs.
- Correct layout to follow the Coding Standard.
- Add casts to prevent warnings.
- * fileops.c: Likewise.
- * genops.c: Likewise.
- * iofclose.c: Likewise.
- * iofdopen.c: Likewise.
- * iofflush.c: Likewise.
- * iofgetpos.c: Likewise.
- * iofgets.c: Likewise.
- * iofopen.c: Likewise.
- * iofprintf.c: Likewise.
- * iofputs.c: Likewise.
- * iofread.c: Likewise.
- * iofsetpos.c: Likewise.
- * ioftell.c: Likewise.
- * iofwrite.c: Likewise.
- * iogetdelim.c: Likewise.
- * iogetline.c: Likewise.
- * iogets.c: Likewise.
- * iopadn.c: Likewise.
- * iopopen.c: Likewise.
- * ioputs.c: Likewise.
- * ioseekoff.c: Likewise.
- * iosetbuffer.c: Likewise.
- * iosetvbuf.c: Likewise.
- * iosprintf.c: Likewise.
- * ioungetc.c: Likewise.
- * iovsprintf.c: Likewise.
- * iovsscanf.c: Likewise.
- * libio.h: Likewise.
- * libioP.h: Likewise.
- * stdfiles.c: Likewise.
- * strfile.h: Likewise.
- * strops.c: Likewise.
-
- * Makefile.in (IO_OBJECTS): Add peekc.o, iogetc.o, ioputc.o,
- iofeof.o, and ioferror.o.
- (iostream.list): Depend upon stmp-stdio. Add the entries
- from stdio.list to iostream.list.
- (stmp-stdio): New name for what was the stdio/stdio.list rule.
- All it now does is cd down into stdio and build stdio.list.
-
- * configure.in (ALL): Add libiostream.a.
-
- * libio.h [_IO_MTSFE_IO]: Include header declaring locking code.
- Otherwise define opaque _IO_lock_t.
- Define _IO_cookie_file.
- Rename _IO_getc to _IO_getc_unlocked, _IO_peekc to _IO_peekc_unlocked,
- _IO_putc to _IO_putc_unlocked, _IO_feof to _IO_feof_unclocked, and
- _IO_ferror to _IO_ferror_unlocked.
- Add prototypes for _IO_getc, _IO_putc, _IO_feof, _IO_ferror,
- and _IO_peekc_locked.
- Add declarations for _IO_flockfile, _IO_funlockfile, and
- _IO_ftrylockfile. If !_IO_MTSAFE_IO define _IO_flockfile,
- _IO_funlockfile, _IO_ftrylockfile, _IO_cleanup_region_start, and
- _IO_cleanup_region_end as empty macros.
-
- * libioP.h: Change type of finish function to take an additional int
- argument and change declaration of finish functions.
- Add prototypes for _IO_seekoff and _IO_seekpos.
- If _G_HAVE_MMAP is defined use stream buffers allocated with mmap.
- Redefine FREE_BUF and ALLOC_BUF macros to help in both situations.
- (FILEBUF_LITERAL): If we compile for a thread-safe library also
- initialize lock member.
-
- * filedoalloc.c: Take care for systems already defining _POSIX_SOURCE.
- Keep name space clean on systems which require this.
- (_IO_file_doallocate): Adopt ALLOC_BUF call for changed semantic.
-
- * fileops.c: Keep name space clean on systems which require this.
- (_IO_file_attach): Don't fail if seek failed because it's used on a
- pipe.
- (_IO_file_underflow): Update buffer pointers before calling `read'
- since the `read' might not return anymore.
- (_IO_file_overflow): If stream allows no writes set error flag.
- (_IO_seekoff): Make sure that after flushing the file pointer in
- the underlying file is exact.
- (_IO_file_read): Don't restart `read' syscall if it return EINTR.
- This violates POSIX.
- (_IO_file_write): Likewise for `write'.
- (_IO_cleanup): Install as exit handler in glibc.
-
- * genops.c (_IO_setb): Correctly use FREE_BUF.
- (_IO_default_doallocate): Correctly use ALLOC_BUF.
- (_IO_init): Initialize lock in stream structure.
- (_IO_default_finish): Destroy lock.
- (_IO_get_column): Don't compile since it's not needed.
- (_IO_nobackup_default): Likewise.
-
- * iopopen.c: Take care for systems already defining _POSIX_SOURCE.
- Correct _IO_fork and _IO_dup2 prototypes.
-
- * iofclose.c: Acquire lock before starting the work.
- * iofflush.c: Likewise.
- * iofgetpos.c: Likewise.
- * iofgets.c: Likewise.
- * iofputs.c: Likewise.
- * iofread.c: Likewise.
- * iofsetpos.c: Likewise.
- * ioftell.c: Likewise.
- * iofwrite.c: Likewise.
- * iogetdelim.c: Likewise.
- * iogets.c: Likewise.
- * ioputs.c: Likewise.
- * iosetbuffer.c: Likewise.
- * iosetvbuf.c: Likewise.
- * ioungetc.c: Likewise.
-
- * iofdopen.c: Create and initialize lock for new stream.
- * iofopen.c: Likewise.
- * iopopen.c (_IO_popen): Likewise.
- * iovsprintf.c: Likewise.
- * iovsscanf.c: Likewise.
-
- * genops.c: Make weak aliases for various functions.
- * iofclose.c: Likewise.
- * iofdopen.c: Likewise.
- * iofflush.c: Likewise.
- * iofgetpos.c: Likewise.
- * iofgets.c: Likewise.
- * iofopen.c: Likewise.
- * iofputs.c: Likewise.
- * iofread.c: Likewise.
- * iofsetpos.c: Likewise.
- * ioftell.c: Likewise.
- * iofwrite.c: Likewise.
- * iogetdelim.c: Likewise.
- * iogets.c: Likewise.
- * ioputs.c: Likewise.
- * iosetbuffer.c: Likewise.
- * iosetvbuf.c: Likewise.
- * ioungetc.c: Likewise.
- * iovsprintf.c: Likewise.
- * iovsscanf.c: Likewise.
-
- * iofflush_u.c: New file. fflush_unlocked implementation.
-
- * iostream.h [_G_HAVE_LONG_DOUBLE_IO]: Declare real long double
- output operator.
-
- * peekc.c: New file. Implement _IO_peekc_locked function.
-
- * stdfiles.c: If we compile for a thread-safe library also define
- lock variable.
-
-Tue Aug 26 12:24:01 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
-
- * testsuite/Makefile.in (check): Don't depend on site.exp.
- (just-check): Depend on site.exp.
-
-Wed Aug 20 02:01:34 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * iostream.h: Add copy assignment ops for _IO_?stream_withassign.
-
-Tue Jul 22 10:31:41 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * config.shared (CHECK_SUBDIRS): Use install-sh, not install.sh.
-
-Wed Jun 25 12:20:55 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * config.shared (DOING_GPERF): Look for this, defining TOLIBGXX
- and LIBS for it.
-
-Wed Jun 18 11:03:34 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * config.shared (FLAGS_TO_PASS): Don't include RUNTEST.
-
-Tue Jun 17 22:23:48 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * config.shared (FLAGS_TO_PASS): Pass RUNTEST and RUNTESTFLAGS.
-
-Fri May 16 21:08:53 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * iovfprintf.c: Declare __cvt_double before use.
-
- * floatconv.c (d2b): Use _G_int32_t instead of int for the
- e and bits parameters.
- (_IO_strtod): Use _G_int32_t.
-
- * gen-params: Look for NO_USE_DTOA and USE_INT32_FLAGS.
-
- * strops.c (_IO_str_init_static): use _G_int32_t appropriately.
-
- * libio.h: If _G_NO_USE_DTOA is set, then don't define
- _IO_USE_DTOA.
-
- * config/mn10200.mt: Don't use dtoa, it only works
- for "real" doubles.
-
-Thu May 15 17:44:12 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * configure.in: Set CHECK_SUBDIRS to testsuite if we're doing
- a cross compile.
-
- * config.shared(check): Only run make check in the directories
- specified by CHECK_SUBDIRS. Set CHECK_SUBDIRS to SUBDIRS
- if it has no previous value.
-
-Thu May 1 17:35:19 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (test, tpipe): Add $(CFLAGS).
-
-Wed Apr 30 12:16:29 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * configure.in: Don't turn on multilib here.
-
-Sat Apr 26 13:38:21 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * configure.in (configdirs): Add testsuite directory.
-
- * testsuite/ChangeLog:
- * testsuite/Makefile.in:
- * testsuite/libio.tests/tiomanip.exp:
- * testsuite/libio.tests/tstdiomisc.exp:
- * testsuite/libio.tests/tiomisc.exp:
- * testsuite/libio.tests/tFile.exp:
- * testsuite/libio.tests/tfformat.exp:
- * testsuite/libio.tests/tiformat.exp:
- * testsuite/libio.tests/hounddog.exp:
- * testsuite/libio.tests/putbackdog.exp:
- * testsuite/configure.in:
- * testsuite/lib/libio.exp:
- * testsuite/config/default.exp:
- New files for DejaGnu-style testsuite.
-
-Fri Apr 4 03:16:44 1997 Ulrich Drepper <drepepr@cygnus.com>
-
- * configure.in: Enable multilibing by default.
- Update multilib template to read config-ml.in.
-
- * floatconv.c: Enable use in cross targets which use the
- newlib ieeefp.h header.
-
-Thu Jan 23 09:16:16 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * libioP.h (_IO_file_attach): Delete redundant decl.
-
-Tue Jan 21 22:13:45 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * streambuf.h (class ios): Take out STREAMSIZE member, since we
- only need (and should only have) the global one.
-
-Tue Jan 7 14:02:40 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * iostream.h (long long fns): Use __extension__.
-
- * gen-params: Use _G_llong and _G_ullong instead of long long for
- deduced types.
-
-Fri Dec 6 13:13:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * dbz/dbz.c: Use off_t.
-
-Sat Nov 23 15:44:37 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (install): Don't install _G_config.h with other headers.
-
-Mon Nov 18 17:12:41 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * config.shared (SUBDIRS): Use -O instead of -O3 for debugging.
-
-Sun Nov 3 12:43:34 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * iostream.cc (write_int): Treat string literals as const.
-
-Thu Sep 26 10:09:18 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * depend: Regenerate.
-
-Wed Sep 25 22:54:45 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * config.shared (depend.new): Deal with headers that don't end in .h.
-
-Thu Aug 29 17:05:53 1996 Michael Meissner <meissner@tiktok.cygnus.com>
-
- * configure.in (i[345]86-*-*): Recognize i686 for pentium pro.
-
-Mon Aug 5 01:26:32 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * config{ure.in,.shared} (DISTCLEAN): Add multilib.out.
-
-Fri Aug 2 17:39:35 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * libio.h (NULL): Use __null.
- * libioP.h (NULL): Ditto.
- * streambuf.h (NULL): Ditto.
- * ioextend.cc (get_array_element): Use NULL instead of (void*)0.
-
-Fri Jul 5 18:26:41 1996 Jim Wilson <wilson@cygnus.com>
-
- * strfile.h (struct _IO_streambuf): New struct type.
- (struct _IO_strfile): Use it.
-
-Tue Jun 18 18:24:21 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * fstream.h (fstreambase): Make __my_fb mutable.
- From Joe Buck.
-
-Tue Jun 18 11:03:53 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * dbz/fake.c (main): Set return type to int.
- * dbz/dbzmain.c (main): Likewise.
- * dbz/byteflip.c (main): Likewise.
-
-Mon Jun 17 14:05:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * gen-params: Check if clog conflicts with system libraries.
- * stdstreams.cc: If it does, use __IO_clog.
- * iostream.h: Likewise.
-
-Tue Jun 11 13:39:31 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * stdiostream.h (istdiostream (FILE*)): Put istream base
- initializer before init for __f.
- (ostdiostream (FILE*)): Likewise for ostream base init.
-
-Tue May 14 11:47:21 1996 Per Bothner <bothner@andros.cygnus.com>
-
- * strfile.h (_IO_str_fields): Removed _len field.
- (_IO_STR_DYNAMIC, _IO_STR_FROZEN): new macros.
- * strstream.h (strstreambuf::is_static): Removed.
- (strstreambuf::frozen): Use _IO_STR_DYNAMIC instead of is_static.
- * strstream.h, strstream.cc: Remove support for !_IO_NEW_STREAMS.
- * strstream.cc (strstreambuf::init_dynamic): Don't set _s._len.
- * strops.c (_IO_str_init_static): Better handling of the
- negative (== unbounded) size case.
- (_IO_str_overflow, _IO_str_underflow, _IO_str_count): Re-write
- to not use _s._len, and otherwise cleanup/fix.
- * strstream.h, strstream.cc (strstreambase::strstreambase()): Call
- ios::init here.
- (other constructors): Simplify - init already called.
-
-Tue May 14 10:55:21 1996 Per Bothner <bothner@deneb.cygnus.com>
-
- Change so that strstreambuf default constructor does no allocation.
- * strstream.h (strstreambuf::init_dynamic): Default initial size = 0.
- * strstream.cc (strstreambuf::init_dynamic): Don't allocate a
- buffer (yet) if initial_size is 0.
- * strops.c (_IO_str_overflow): Add 100 to size of re-allocated
- buffer, to handle case when initial size is 0.
-
- * iostdio.h (remove, rename, tmpfile, tempnam): Comment out.
-
-Mon May 13 23:19:39 1996 Per Bothner <bothner@deneb.cygnus.com>
-
- * fileops.c (_IO_file_close_it): Just call _IO_do_flush rather
- than _IO_file_sync, to avoid useless lseek.
-
-Tue May 14 10:48:48 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * floatconv.c (_IO_strtod): Force rv into the stack.
-
- * config.shared (gxx_includedir): Now $(includedir)/g++.
-
-Sat Apr 27 02:37:49 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * libioP.h (JUMP*): Implement for thunks.
- (_IO_jump_t): Add second dummy field for thunks.
-
-Thu Apr 25 13:20:00 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * config.shared (CXX): Use gcc, not g++.
-
-Wed Apr 24 10:29:50 1996 Doug Evans <dje@blues.cygnus.com>
-
- * config.shared (depend.new): Delete $(srcdir)/ from foo.{c,cc}
- for SunOS VPATH.
- * depend: Regenerated.
-
-Fri Apr 19 17:24:51 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Version 2.8.0b3.
-
-Wed Apr 10 17:16:01 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * configure.in (ALL): Don't build iostream.a.
-
-Mon Apr 8 14:44:11 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iosetvbuf.c (_IO_setvbuf): Clear _IO_UNBUFFERED unless _IONBF.
-
-Mon Apr 8 15:08:23 1996 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Permit --enable-shared to specify a list of
- directories.
-
-Fri Apr 5 17:48:56 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * config.shared (MOSTLYCLEAN): Also remove ${EXTRA_MOSTLYCLEAN}.
-
-Fri Mar 22 23:25:00 1996 Ulrich Drepper <drepepr@gnu.ai.mit.edu>
-
- * genops.c (_IO_sputbackc, _IO_sungetc): Clear EOF flag if putsh
- back was successful.
-
-Wed Mar 27 11:54:08 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Version 2.8.0b2.
-
-Fri Mar 22 15:39:36 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * fileops.c (_IO_do_write): Revert previous fix. (It fails to
- handle the case that fp->_IO_read_end != fp->_IO_write_base.)
- (_IO_file_overflow): Instead, if _IO_read_ptr is at the end of
- the buffer, reset all the read pointers to _IO_buf_base.
-
-Tue Mar 12 12:03:17 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * fileops.c (_IO_do_write): Even if to_do==0, must re-set buffer
- pointers. Bug and solution from Luke Blanshard <luke@cs.wisc.edu>.
-
-Wed Feb 28 10:00:24 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Version 2.8.0b1.
-
-Tue Feb 27 18:08:16 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iopopen.c (_IO_proc_open): Use (char*)0 rather than imprecise NULL.
-
- * streambuf.h (ios): Add ios::binary; deprecate ios::bin.
- * filebuf.cc (filebuf::open): Handle ios::binary.
-
-Fri Feb 9 12:40:19 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * cleanup.c (_IO_cleanup_registration_needed) [!_G_HAVE_ATEXIT]: Init
- to NULL.
- * filedoalloc.c (_IO_cleanup_registration_needed): Remove decl.
-
-Thu Feb 8 08:12:50 1996 Brendan Kehoe <brendan@cygnus.com>
-
- * filedoalloc.c (_IO_cleanup_registration_needed): Revert previous
- change, since cleanup.c only defines it if _G_HAVE_ATEXIT.
-
-Wed Feb 7 15:10:17 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * filedoalloc.c (_IO_cleanup_registration_needed): Declare as extern.
-
-Tue Dec 12 17:21:13 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * indstream.h, instream.cc (indirectbuf::uflow): New method.
- * indstream.cc (indirectbuf::underflow): Fix to use sgetc, not sbumpc.
- Fixes bug reported by Kevin Beyer <beyer@cs.wisc.edu>.
-
- * indstream.cc (indirectbuf::seekpos): Add paranoia test.
-
-Fri Dec 8 14:55:34 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * stream.h: Add warning to not use these functions.
- * stream.cc (str, chr): Re-implement here (from libg++).
-
-Tue Nov 28 15:07:01 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * config.shared: Use test instead of [ to avoid DEC Unix lossage.
-
-Thu Nov 23 14:51:43 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iopopen.c: Move #include <sys/types.h> ahead of #include <signal.h>
- to deal with BSDI's literal implementation of Posix.
-
-Sat Nov 25 11:21:55 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * Makefile.in (install): Set rootme.
- * config.shared (TOPDIR): Set with ${foo-...} rather than ${foo=...}.
- (INSTALL): Handle absolute, dot, relative-not-dot values of srcdir.
- (TEXIDIR): Likewise.
-
-Tue Nov 21 14:12:05 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * configure.in: Check ${with_cross_host} rather than comparing
- ${host} and ${target}.
-
-Mon Nov 20 13:55:29 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * configure.in: Match *-sco3.2v[45]*.
-
-Wed Nov 15 20:19:31 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * config.shared (FLAGS_TO_PASS): Also pass SHLIB and SHCURSES.
-
-Tue Nov 14 01:41:08 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * config.shared (TO_REAL_TOPDIR): Define.
- (MULTITOP): Deleted.
- (MULTISRCTOP, MULTIBUILDTOP): New.
- (TOPDIR): Change MULTITOP to MULTIBUILDTOP, and use TO_REAL_TOPDIR.
- (INSTALL): Add with_multisrctop, TO_REAL_TOPDIR.
- (TEXIDIR): Use TO_REAL_TOPDIR.
- (LIBS): Delete MULTITOP.
- (FLAGS_TO_PASS): Add NM.
- (CXXINCLUDES): Delete MULTITOP.
- (depend.new): Delete adding MULTITOP to ../ build tree references.
- Add MULTISRCTOP to ../ source tree references.
- * configure.in: Delete call to cfg-ml-com.in. Call config-ml.in
- instead of cfg-ml-pos.in.
-
-Sun Nov 12 16:30:48 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Makefile.in (VERSION): Set to 2.7.1.
- * configure.in: Add warning for Linux.
- * config.shared (DISTCLEAN): Add EXTRA_DISTCLEAN.
-
- * editbuf.h (edit_mark::index_in_buffer): Avoid unused param warning.
-
- * iostream.cc (istream::operator>> (char*)): Improve ANSI compliance.
-
-Fri Nov 10 08:41:37 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * config.shared (check): Add missing semicolon.
-
-Thu Nov 9 17:27:22 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * configure.in (ALL): Remove $(OSPRIM_OBJECTS).
- * config.shared (check): Set LD_LIBRARY_PATH.
- * NEWS: Fix typo.
- * iogetdelim.c (_IO_getdelim): Index *lineptr, rather than lineptr.
- From alan@spri.levels.unisa.edu.au (Alan Modra).
-
-Mon Nov 6 15:03:33 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * streambuf.cc, editbuf.cc, isgetline.cc, parsestream.cc:
- Fixes to avoid -Wall warnings.
-
-Fri Nov 3 16:41:41 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * gen-params [!__STDC__]: Include varargs.h instead of stdarg.h.
-
-Thu Nov 2 15:04:03 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * config.shared: Re-write if X then Y else true fi to (not X) || Y.
-
-Wed Nov 1 13:26:44 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iostream.h (istream::ipfx): Add default argument value.
- Reported by Yotam Medini <yotam_medini@tmai.com>.
-
- * libioP.h (_IO_blen): Fix typo.
- Reported by Bryan T. Vold <btv@ldl.healthpartners.com>.
-
-Fri Oct 27 19:26:20 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Makefile.in (_G_config.h): Set CC to $(CC) rather than to $(CXX),
- now that CXX defaults to g++ and CC default to gcc (when found).
- * config.shared: Simplify CXX and CC, since they get overridden
- by ../configure anyway.
-
-Wed Oct 25 19:45:50 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * iostdio.h: Wrap including the file with #ifndef _IOSTDIO_H.
-
-Wed Oct 25 11:14:25 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * libio.h (_IO_seekoff, _IO_seekpos): New declarations.
- * libioP.h (_IO_seekoff, _IO_seekpos): Remove declarations.
- * libioP.h: Cleanup; remove old !_IO_UNIFIED_JUMPTABLES stuff.
-
- * filebuf.cc (filebuf::~filebuf): Only call SYSYCLOSE if currently
- open. Bug found by Martin Gerbershagen <ger@ezis-ulm.de>.
-
- * streambuf.h (streambuf::pubseekoff, streambuf::pubseekpos):
- Added, from ANSI draft.
- * filebuf.cc (filebuf::open), iostream.cc (variables places), SFile.cc:
- Use pubseekoff/pubseekpos rather than sseekoff/sseekpos.
-
- * Makefile.in (install): Don't install libiostream.a.
-
- * filedoalloc.c: Also #include <unistd.h>.
-
-Mon Oct 9 18:09:54 1995 Jason Molenda <crash@phydeaux.cygnus.com>
-
- * config.shared (SUFFIXES): add .c.
-
-Tue Sep 26 16:08:01 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * procbuf.cc: Move #pragma implementation to beginning.
-
-Wed Sep 20 17:53:33 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * procbuf.h, procbuf.cc: Add #pragma interface/implementation stuff.
-
-Wed Sep 20 18:59:00 1995 John Eaton <jwe@bevo.che.wisc.edu>
-
- * procbuf.h: Protect from being included multiple times.
-
-Wed Sep 20 15:47:14 1995 John Eaton <jwe@bevo.che.wisc.edu>
-
- * procbuf.h (procbuf): Add '_next' pointer field for compatibility
- with _IO_proc_file.
-
-Wed Sep 20 13:54:02 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * config.shared: Add support for maintainer-clean target as a
- synonym for realclean.
- * dbz/Makefile.in: Likewise.
-
-Mon Sep 11 12:11:19 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iopopen.c: #include <sys/types.h> before <sys/wait.h>.
- This is in accordance with Posix, and needed for ISC.
-
-Fri Sep 8 00:11:55 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * gen-params: Use double quotes in the eval setting $TYPE to
- $VALUE, to preserve any single quotes in $VALUE.
-
-Mon Aug 21 11:39:09 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * gen-params: Test for an appropriate version of gcc before using
- mode attributes.
-
- * config.shared: Add $(PICDIR) to $ALL.
-
-Mon Aug 7 17:51:40 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * gen-params: Generate new macro _G_HAVE_SYS_CDEFS.
- * libio.h: If _G_HAVE_SYS_CDEFS, get __P from <sys/cdefs.h>.
-
-Fri Aug 4 23:21:17 1995 Paul Eggert <eggert@twinsun.com>
-
- * gen-params: When following typedef changes, allow typedefs
- that do not have a space before the defined type name,
- e.g. `typedef void *__gnuc_va_list;' as in Linux. Also,
- not require a space in the definiens, e.g. `typedef void*foo;'.
-
-Thu Aug 3 17:54:15 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iostream.h, iostream.cc (istream::sync): Added missing method.
-
-Thu Aug 3 17:49:34 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * configure.in: Remove netbsd special case.
- * config/netbsd.mt: Removed; no longer used.
-
-Tue Jun 20 16:07:12 1995 Paul Eggert <eggert@twinsun.com>
-
- * gen-params: Take transitive closure of `typedef' relation.
- This is needed for BSD/OS 2.0, which has
- fpos_t -> off_t -> quad_t -> long long.
-
-Mon Jul 24 18:28:10 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * config.shared (TOPDIR): Delete extra '/', $rootme may be empty.
-
-Sat Jul 22 13:27:45 1995 Doug Evans <dje@canuck.cygnus.com>
-
- * config.shared (depend.new): Fix quoting in DO NOT EDIT line.
-
- * Makefile.in (_G_config.h): Add multilib support.
- (install): Likewise.
- * config.shared: Likewise.
- * configure.in: Likewise.
-
-Wed Jun 28 17:40:25 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * PlotFile.h, SFile.h, builtinbuf.h, editbuf.h, fstream.h,
- indstream.h, iomanip.h, iostream.h, parsestream.h, pfstream.h,
- procbuf.h, stdiostream.h, stream.h, streambuf.h, strstream.h: Wrap
- with extern "C++".
-
-Thu Jun 22 04:34:01 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * gen-params: Surround attributes with __.
-
-Mon Jun 19 00:33:22 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * config.shared (SUBDIRS): Massage broken shells that require
- 'else true'.
-
-Sat Jun 17 11:25:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * streambuf.h: Declare inline members inline in class.
-
-Thu Jun 15 20:45:13 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Makefile.in (VERSION): Update to version 2.7.0.
-
-Wed Jun 14 21:41:11 1995 Jason Merrill <jason@python.cygnus.com>
-
- * Makefile.in (STDIO_WRAP_OBJECTS): Remove stdfiles.o.
- (LIBIO_OBJECTS): Add stdfiles.o.
-
-Wed Jun 7 16:11:36 1995 Jason Merrill <jason@python.cygnus.com>
-
- * config.shared (all): Appease bash.
-
-Wed Jun 7 11:16:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * configure.in (MOSTLYCLEAN): Remove stamp-picdir.
-
- * config.shared (MOSTLYCLEAN): Ditto.
- (CLEAN): Don't.
-
-Mon Jun 5 18:29:39 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * config/mh-*pic: Removed.
-
- * configure.in (MOSTLYCLEAN): Remove pic objects.
- (frags): Use toplevel pic fragments.
-
- * config.shared (CXXFLAGS): Use -O3.
- (PICFLAG, PICDIR): New macros.
- (all): Depend on $(PICDIR).
- (FLAGS_TO_PASS): Pass PICFLAG.
- (.x.o): Also build pic object.
- (stamp-picdir): Create directory for pic objects.
- (MOSTLYCLEAN): Remove pic objects.
- (CLEAN): Remove stamp-picdir.
-
- * Makefile.in (iostream.list): Depend on stamp-picdir.
- (c++clean): Don't remove _G_config.h.
-
-Mon Jun 5 15:03:47 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * strstream.h, strstream.cc (strstream::strstream()): Re-implement to
- be like ostrstream::ostrestream(), and not leak memory.
-
- * streambuf.h: Use #if !_IO_UNIFIED_JUMPTABLES instead of #ifndef.
-
- * iolibio.h (_IO_rewind): Add missing flags when calling _IO_seekoff.
-
-Thu May 25 22:30:21 1995 J.T. Conklin <jtc@rtl.cygnus.com>
-
- * config/netbsd.mt (G_CONFIG_ARGS): Add defn for off_t. Another
- layer of typedefs has been added and the gen-params script can
- not handle it.
-
-Wed May 10 03:02:58 1995 Jason Merrill <jason@python.cygnus.com>
-
- * iolibio.h (_IO_rewind): Add new argument to _IO_seekoff.
-
- * config/linux.mt (LIBIOSTREAM_OBJECTS): Include $(STDIO_WRAP_OBJECTS).
- (LIBIOSTREAM_DEP): Include stdio.list.
- (LIBIOSTREAM_USE): Include `cat stdio.list`.
-
- * Makefile.in (LIBIOSTREAM_DEP): New variable.
- (LIBIOSTREAM_USE): Ditto.
- (libiostream.a): Use them.
- (iostream.list): Ditto.
- (stdio.list): New rule.
- (stdio/stdio.list): Ditto.
-
-Tue May 9 18:29:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * libioP.h (_IO_jump_t): Change TYPE for __dummy from int to
- _G_size_t.
-
-Sat May 6 13:50:37 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * libio.h (_IO_UNIFIED_JUMPTABLES): #define as true.
- (_IO_FILE): Remove _jumps field (#if _IO_UNIFIED_JUMPTABLES).
-
- * libioP.h (enum _IO_seekflags_): Removed.
-
- * libioP.h (_IO_setbuf_t): Change return value of setpos jumptable
- function to match C++ streambuf::setpos. (Return NULL on failure.)
- * fileops.c (_IO_file_setbuf), genops.c (_IO_default_setbuf),
- filebuf.cc, iosetvbuf.c: Update to use new setbuf conventions.
-
- * streambuf.h (streambuf): Re-order virtual functions more logically.
- * streambuf.cc (streambuf::uflow), streambuf.h: New virtual.
- * libioP.h (struct _IO_jump_t): Define using new JUMP_FIELD macro.
- And re-order in more logical order consistent with streambuf vtable.
- * fileops.c (_IO_file_jumps), iopopen.c (_IO_proc_jumps), iovfprintf.c
- (_IO_helper_jumps), streambuf.cc (_IO_streambuf_jumps), strops.c
- (_IO_str_jumps): Update accordingly, using JUMP_INIT macro.
- * stdfiles.c: Set vtable to point to _IO_file_jumps.
- * filebuf.cc, iopopen.c, iovfprintf.c (helper_vfprintf), iovsprintf.c,
- iovsscanf.c: Use macros and #if to set jumptables.
-
- * streambuf.c: _IO_streambuf_jumps and the _IO_sb_* methods are not
- needed #if _IO_UNIFIED_JUMPTABLES.
- * filebuf.cc (filebuf::__new): Also no longer needed.
- * fstream.cc (fstreambase::__fb_init, fstreambase::fstreambase): Fix.
- * stdstrbufs.c: Use filebuf vtable instead of builtinbuf's.
- * builtinbuf.h, builtinbuf.cc (builtinbuf): Commented out #if
- _IO_UNIFIED_JUMPTABLES - no longer needed.
- * strstream.cc (SET_STR_JUMPS): Does nothing now.
-
- * builtinbuf.cc, fileops.c, genops.c, iofgetpos.c, iofsetpos.c,
- ioftell.c, iopopen.c, ioseekoff.c, ioseekpos.c, iosetvbuf.c,
- iovfprintf.c, iovfscanf.c, strops.c: Use DEFUN and DEFUN_VOID.
- * filebuf.cc, fileops.c, genops.c, iopopen.c, ioseekoff.c, ioseekpos.c,
- iosetvbuf.c, iovfscanf.c: Use new JUMP_* and IO_OVERFLOW/... macros.
-
- * libioP.h (_IO_seekpos_t): Third arg is now an int (using _IOS_INPUT
- and _IOS_OUTPUT), not an enum _IO_seekflags_. Flags values are
- changed, and their sense inverted (to match streambuf::seekpos).
- * libioP.h (_IO_seekoff_t): Similarly match streambuf::seekoff.
- * filebuf.cc, fileops.c (_IO_file_fopen, _IO_file_seekoff), genops.c
- (_IO_default_seekpos, _IO_default_seekpos), iofgetpos.c, iofsetpos.c,
- iolibio.h (_IO_fseek), ioftell.c, ioseekoff.c, ioseekpos.c,
- iostream.cc, streambuf.cc, strops.c (_IO_str_seekoff), strstream.cc:
- New seekpos/seekoff conventions.
- * iostreamP.h (convert_to_seekflags): Removed - no longer needed.
-
- * iolibio.h (_IO_fread): New declaration.
-
- * dbz/Makefile.in: Re-arrange for cleaner dependencies.
-
-Fri May 5 15:55:22 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * libioP.h (_IO_JUMPS. JUMP_FIELD, JUMP0, JUMP1, JUMP2, JUMP3,
- JUMP_INIT, _IO_FINISH, _IO_OVERFLOW, ... _IO_SYSSTAT): New macros
- in preparation for new unified jumptable/vtable implementation.
- * cleanup.c, filedoalloc.c, iofclose.c, iofflush.c, iofiledoalloc.c,
- ioprims.c, iosetbuffer.c, iostrerror.c, ioungetc.c: Use DEFUN.
- * filedoalloc.c, iofclose, iofflush, iosetbuffer.c: Use new macros.
-
- * iofopen.c, iofdopen.c: Use macros and #if for new jumptables.
-
- * gen-params: Do not #include <sys/types.h>.
- Add missing quote in 'eval'.
- Do add #include <sys/types.h> in test for <sys/resource.h>.
- * config/netbsd.mt: New file, defining _G_CONFIG_ARGS (for fpos_t).
- * configure.in: Use netbsd.mt for NetBSD.
-
-Wed May 3 15:03:47 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * libioP.h (DEFUN, DEFUN_VOID, AND): New macros, from ansidecl.h.
- * iofdopen.c, iofgets.c, iofopen.c, iofputs.c, iofread.c, iofwrite.c,
- iogetdelim.c, iogetline.c, iogets.c, ioignore.c, iopadn.c, ioperror.c,
- ioputs.c, iovsprintf.c, iovsscanf.c, outfloat.c: Use DEFUN.
-
-Mon May 1 16:22:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * gen-params: #include <sys/types.h>. Don't use __WCHAR_TYPE__ in
- definition of _G_wchar_t. Use __attribute__ ((mode)) to get
- specific-sized ints under gcc, don't worry about int8 or int64
- otherwise. Provide defaults if deduction fails.
-
-Thu Apr 27 18:27:53 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * streambuf.h (ios::~ios): Delete _arrays.
- (_IO_NEW_STREAMS): Turn on.
- * libio.h (__adjust_column): Remove bogus declaration.
- * genops.c (_IO_set_column): Fix typo (in commented-out code).
-
-Tue Apr 25 17:14:29 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * config.shared (CXXINCLUDES): Use a shell variable with a
- different name from the make variable.
- * configure.in: Update accordingly.
-
-Mon Apr 17 17:19:40 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * streambuf.h (__adjust_column): Remove redundant declaration.
-
-Sat Apr 15 11:39:25 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * config.shared (do-clean-dvi): Also remove *.cps.
-
- * gen-params: Use ${SED} instead of sed.
-
- * libio.h: Remove #if'd out stuff (confuses makedepend).
-
- * stdstreams.cc (STD_STR): Standard streams start with ios::dec set.
-
-Fri Apr 14 23:46:31 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iostream.h, iostream.cc (istream::read, ostream::write):
- Use streamsize for the length parameter.
-
- * streambuf.h: Removed redundant __overflow and __underflow.
-
- * fstream.h, fstream.cc: Add void fstreambase::attach(int).
-
- * iosscanf.c (_IO_sscanf): Fix non-__STDC__ missing declaration.
-
-Mon Apr 3 15:40:55 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * indstream.*: Fix prototypes of xsputn and xsgetn.
-
- * fileops.c: Avoid ??? trigraph.
-
-Mon Mar 27 16:16:38 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * iomanip.h (operator<< (ostream&, const omanip<TP>&): Define
- separately.
- (operator>> (istream&, const imanip<TP>&): Ditto.
-
-Mon Mar 27 08:56:00 1995 Brendan Kehoe (brendan@lisa.cygnus.com)
-
- * builtinbuf.cc (builtinbuf::setbuf): Cast NULL to streambuf*, to
- avoid warning/error about conversion from void*.
- * indstream.cc (indirectbuf::seekoff): Likewise.
- (indirectbuf::seekpos): Likewise.
- * filebuf.cc (filebuf::setbuf): Likewise.
- (filebuf::close): Cast NULL to filebuf*.
-
-Wed Mar 1 14:23:18 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * configure.in (DISTCLEAN): Add, with target-mkfrag.
-
-Fri Feb 24 01:01:08 1995 Jason Merrill <jason@python.cygnus.com>
-
- * configure.in (frags): Don't require so many dashes in the
- canonical target name.
-
-Sat Feb 18 13:18:30 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * streambuf.cc (streambuf::sync): Always return 0, even for
- non-flushed output. This is required by the ANSI/ISO draft.
- * genops.c (_IO_sync): Likewise always return 0.
-
-Fri Feb 17 16:33:28 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * fileops.c (_IO_file_close_it): Call _IO_file_sync, rather
- than _IO_do_flush, because we want to adjust the file pointer
- if reading and not at end (as in SVR4, and as in fflush).
- Also, make sure to return error indication if sync fails.
- (_IO_file_sync): Ignore seek error if it is ESPIPE.
- (_IO_file_seekoff): If not readable, do dumb lseek.
- * iofclose.c (_IO_fclose): If closing a non-filebuf, return -1
- if _IO_ERR_SEEN.
-
-Fri Feb 17 19:31:00 1995 Ian Lance Taylor <ian@cygnus.com>
-
- * gen-params: Check for struct tms in <sys/times.h>, defining
- HAVE_SYS_TIMES accordingly.
-
-Wed Feb 15 21:05:11 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * strops.c (_IO_str_count): Use LEN macro.
- (_IO_str_seekoff): Update _len field.
-
-Mon Feb 6 19:29:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * gen-params: Default to short, long and long long for 16, 32 and
- 64 bit types, in case detection fails.
-
-Wed Jan 25 18:07:30 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * gen-params (_G_wint_t): Allow for broken promotions.
-
-Tue Jan 24 16:15:40 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * stdstrbufs.cc (_IO_fake_stdiobufs): Add an extra layer of struct,
- to force correct alignment on i960s.
- (DEF_STDIOBUF, _IO_{stdin,stdout,stderr}_buf): Update accordingly.
-
-Thu Jan 19 18:30:53 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * config.shared (CXXINCLUDES): Add libstdc++ to includes for
- building libg++.
- (LIBS): Also link with libstdc++ when building libg++ toys.
- Don't set EXPORT_ALL_VARIABLES; users will have to set
- LD_LIBRARY_PATH themselves.
-
-Fri Dec 30 16:38:13 1994 Mike Stump <mrs@cygnus.com>
-
- * config/linux.mt: Fix build problem on linux 1.0.8.
-
-Thu Dec 22 11:49:45 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
-
- * config/netware.mt: Use gcc to pre-link iostream.nlm's objects
- instead of using nlmconv, so that references to functions in
- libgcc.a are resolved.
-
- * configure.in: Append .mt to target makefile fragment file names.
-
- * floatconv.c (tens, tinytens, bigtens): Added const qualifier.
-
-Tue Dec 20 09:59:50 1994 Mike Stump <mrs@cygnus.com>
-
- * gen-params (VTABLE_LABEL_PREFIX): Since some systems have GNU nm
- as nm, and they demangle by default, we have to notice this, and
- try --no-cplus (linux) or --no-demangle when running nm.
-
-Wed Dec 14 18:13:58 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * gen-params: To determine vt-name-mangling using dummy.C add
- #include and #prama interface/implementation to avoid problem with
- assemblers that don't emit local symbols. Reported under HPUX 8
- by Thomas Arend <arend@blasius.Chemietechnik.Uni-Dortmund.DE>.
-
- * streambuf.h (ios::ios): Move inline definition after
- that of ios::init (which ios::ios calls).
-
-Sun Dec 4 19:50:32 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * fileops.c (_IO_file_init, _IO_file_close_it, _IO_file_sync):
- Set _offset to _IO_pos_BAD, to support applications that follow
- POSIX.1 rules on mixing file handles.
-
- * fileops.c (_IO_file_overflow): Handle case that buffer was
- allocated (perhaps by setvbuf) but _IO_write_base is still 0.
-
- * iostdio.h (setbuffer): #define as _IO_setbuffer.
- * streambuf.h, filebuf.cc: Removed filebuf::do_write.
-
-Tue Nov 29 23:38:57 1994 Per Bothner (bothner@rtl.cygnus.com)
-
- * floatconv.c (setword0, setword1): Fix typo.
-
-Tue Nov 29 15:37:29 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * config.shared: Move -fno-implicit-template from CXXFLAGS
- to LIBCXXFLAGS. Tests are better run without it.
-
- * floatconv.c (word0, word1): Re-place/re-implement using unions
- instead of casts to avoid optimizer problems.
-
- * dbz/dbzmain.c: Renamed dirname -> dir_name to avoid OSF
- header file braindamage.
-
-Sat Nov 5 19:44:00 1994 Jason Merrill (jason@phydeaux.cygnus.com)
-
- * config.shared (LIBCFLAGS): Define.
- (LIBCXXFLAGS): Define.
- (DOING_LIBGXX): Define TOLIBGXX. Change LIBS to use -lg++. Add
- LD_LIBRARY_PATH and .EXPORT_ALL_VARIABLES:.
- (FLAGS_TO_PASS): Add LIBC{,XX}FLAGS.
- (XC{,XX}FLAGS): Set to LIBCFLAGS or CFLAGS depending on $LIBDIR.
- (COMPILE.c): Define, use in .c.o rule.
- (COMPILE.cc): Define, use in .cc.o rule.
-
-Sat Nov 5 15:12:12 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Makefile.in (VERSION): Update to 0.67.
-
- * streambuf.h (ios::dont_close): Is now set by default.
- * fstream.h, fstream.cc (__fb_init): New function. Clears
- ios::dont_close. Change fstreambase constructors to call it.
- * strstream.cc: *strstream constructors must clear ios::dont_close.
- * iostream.cc: Simplify - don't need to set ios::dont_close.
- * ioassign.cc: Simplify - assume ios::dont_close is always set.
-
- * fstream.h, fstream.cc: If _IO_NEW_STREAMS, put the
- filebuf as a member __my_fb.
- * strstream.{h,cc}: Likewile use a strstreambuf member __my_sb.
- * streambuf.h, stdstreams.cc, ioextend.cc:
- Fix if _IO_NEW_STREAMS to not use ios::dont_close.
-
- * streambuf.h (class ios): Move rdbuf later, to avoid
- inability of g++ to inline.
- * filebuf.cc (filebuf::~filebuf): Call _IO_do_flush.
-
- * config.shared: Emit rules to make depend.
- * depend: New file.
-
-Fri Nov 4 17:19:11 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * README: Fix typos.
- * libio.h: Add comment. Update Copyright notice.
-
-Fri Nov 4 21:46:30 1994 Paul Eggert <eggert@twinsun.com>
-
- * libio.h (__P): Change argument name spelling from
- `paramlist' to `protos' for compatibility with BSDI 1.1.
-
-Thu Nov 3 00:45:16 1994 Jason Merrill (jason@phydeaux.cygnus.com)
-
- * config.shared (CXXFLAGS): Add -fno-implicit-templates.
-
-Mon Oct 24 15:57:35 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * config.shared: Define NOSTDIC and use it for libio too.
-
-Thu Oct 20 19:45:35 1994 Jason Merrill (jason@phydeaux.cygnus.com)
-
- * iogetdelim.c: #include <stdlib.h>.
-
-Thu Oct 20 17:09:52 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * iostream.h: Add classes _IO_istream_withassign and
- _IO_ostream_withassign. Re-type cin, cout, cerr, clog.
- (class iostream): Don't add extra _gcount field.
- * ioassign.cc: New file. Implement operator= for cin etc.
- * streambuf.h (class ios): Change return type of operator=.
- * Makefile.in (IOSTREAM_OBJECTS): Add ioassign.o.
-
- * Makefile.in: Re-arrange, so linux.mt overrides can work.
-
- * fileops.c (_IO_file_seekoff): Optimize seeks within buffer.
-
-Wed Oct 19 14:25:47 1994 Jason Merrill (jason@phydeaux.cygnus.com)
-
- * gen-params (wint_t): Return to using __WCHAR_TYPE__ for
- compatibility with gcc versions prior to 2.6.1.
-
-Tue Oct 18 17:08:18 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Makefile.in: Define _G_CONFOG_H as _G_config.h for Linux. Use it.
- (IO_OBJECTS): Add iogetdelim.o.
- * config/linux.mt: New file.
- * configure.in: Select config/linux.mt if Linux.
- * iogetdelim.c: Verious cleanups, many from
- Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>.
- * libioP.h: Add _IO_getdelim. Use (void) for no-parameter functions.
-
-Thu Oct 13 16:30:56 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * libio.h: Rename USE_DTOA to _IO_USE_DTOA for namespace reasons.
- * iostream.cc, iovfscanf.c, iovfprintf, floatconv.c:
- Update USE_DTOA -> _IO_USE_DTOA.
-
- * libio.h (_IO_feof, _IO_ferror): Move to here ...
- * iolibio: ... from here
-
- * iostream.cc (istream::get, istream::ignore, istream::read):
- Set _gcount to 0 if ipfx0 failed.
-
- * iostream.cc (flush): Do virtual function call, rather than
- going through jumptable. (To get correct method in derived class.)
- Bug and fix from John Wiegley <jw@cis.ohio-state.edu>.
-
- * iofdopen.c (O_ACCMODE): Define using O_RDWR, not O_RDWRITE.
-
- * streambuf.h (ios::rdbuf(streambuf*)): New.
- * streambuf.h (ios::operator=): Make private (i.e. dis-allow).
-
-Wed Oct 12 19:09:20 1994 Jason Merrill (jason@phydeaux.cygnus.com)
-
- * gen-params: Define _G_NO_NRV and _G_NO_EXTERN_TEMPLATES if not
- compiling with g++.
-
-Thu Oct 6 16:03:43 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iostream.texi (ostrstream::str): Note that NUL is not written
- automatically.
-
-Wed Oct 5 17:28:29 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iogetdelim.c (_IO_getdelim): New function.
-
-Wed Oct 5 15:40:22 1994 J.T. Conklin (jtc@phishhead.cygnus.com)
-
- * config/netware.mt: New file, first cut at Netware NLM support.
- * configure.in (*-*-netware*): Use config/netware.mt.
-
- * config.shared (NLMCONV, LD): New definition.
-
- * gen-params: check for nm in ${binutils}/nm.new.
- * config.shared: Likewise.
-
-Tue Oct 4 12:20:01 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iomanip.h (omanip::operator<<): Make 2nd arg be const.
- Bug and fix reported by Greg McGary <gkm@magilla.cichlid.com>.
-
- * strstream.cc (strstreambuf::pcount): Simplify, to match
- ANSI/ISO specification.
-
-Mon Sep 26 15:19:52 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * gen-params: Include <wchar.h> and <wctype.h> if they exist.
-
-Thu Sep 8 14:41:41 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * iostream.h (class istream): Declare operator>>(long double&).
- (class ostream): Define operator<<(long double).
-
- * iostream.cc (istream::operator>>(long double&)): Define.
-
-Wed Sep 7 14:42:29 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iostream.texi (Overflow): Fix bugs in example.
-
-Fri Sep 2 17:45:57 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iostream.tex: Document a little on how to write your
- own streambuf-derived class, with an example.
-
-Tue Aug 30 13:03:57 1994 Brendan Kehoe (brendan@lisa.cygnus.com)
-
- * floatconv.c (s2b): Declare X and Y to be _G_int32_t.
- (diff, quorem): Declare BORROW, Y, and Z likewise.
- (ulp): Declare L likewise.
- (_IO_strtod): Declare L and AADJ likewise.
- (_IO_dtoa): Declare L and D likewise. Cast division of D by DS to
- _G_int32_t.
-
-Mon Aug 29 16:01:54 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iosetvbuf.c (_IO_setvbuf): If setting _IOFBF and no
- buffer was specified, call __doallocate.
-
- * fileops.c, floatconv.c: Add a bunch of parentheses to
- shut up gcc warnings. Patch from H.J.Lu.
-
- * stdiostream.cc (stdiobuf::sys_read): Inline call to getc
- for the normal case (size==1).
-
-Sat Aug 20 12:14:52 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in (VERSION): Increase to 0.66.
-
-Fri Aug 19 17:28:41 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iolibio.h: Added _IO_printf prototype.
- Added extern "C" { ... } wrappers #ifdef __cplusplus.
- Bugs reported by Neal Becker <neal@ctd.comsat.com>.
-
-Wed Aug 17 18:17:15 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * fileops.c (_IO_file_seekoff): For _IO_seek_cur, adjust for
- read-ahead before jumping to label dumb.
-
-Wed Aug 3 13:15:01 1994 H.J. Lu (hjl@nynexst.com)
-
- * libioP.h (CHECK_FILE(FILE,RET)): new, which checks for
- FILE == NULL and _IO_MAGIC_MASK.
- (COERCE_FILE(FILE)): merged into CHECK_FILE(FILE,RET)
- with typo fixes.
-
- * iofread.c, iofwrite.c: add CHECK_FILE(fp, 0);
- * iofclose.c: add CHECK_FILE(fp, EOF); remove _IO_MAGIC_MASK check.
-
- * iofflush.c, iofgetpos.c, iofputs.c, iofscanf.c,
- iofsetpos.c, iofvbuf.c, ioungetc.c:
- Add CHECK_FILE(fp, EOF) and remove COERCE_FILE(fp).
-
- * iofgets.c: add CHECK_FILE(fp, NULL) and remove COERCE_FILE(fp).
- * iofprintf.c: add CHECK_FILE(fp, -1) and remove COERCE_FILE(fp).
- * ioftell.c: add CHECK_FILE(fp, -1L) and remove COERCE_FILE(fp).
- * iosetbuffer.c: add CHECK_FILE(fp, ) and remove COERCE_FILE(fp).
-
-Fri Aug 12 15:35:39 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iofdopen.c (_IO_fdopen): #define O_ACCMODE if it isn't.
- Still set O_APPEND if "a" is given, but don't unset it
- if it isn't. Added comment.
-
-Mon Aug 8 13:11:00 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * gen-params (VTABLE_LABEL_PREFIX): Changes in the implementation.
- For look for _*vt[$_.]7*filebuf in the nm output, because that
- matches what g++ produces and has produced. Thus it should be
- somewhat more robust.
-
-Sun Aug 7 22:52:49 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * gen-params (CC): Remove no-longer-needed -I options
- passed to xgcc (now they are implied by the -B options).
-
-Wed Jul 20 16:41:13 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in (tooldir): Added definition, so we can do
- 'make install' in this directory.
- Bug reported by Klamer Schutte <schutte@tpd.tno.nl>.
-
-Mon Jul 18 18:02:34 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * gen-params (VTABLE_LABEL_PREFIX): Remove filename sppearing
- by itself. Add comment explaining what is going on.
-
-Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@jalod)
-
- * libio.h: define _IO_uid_t and _IO_HAVE_ST_BLKSIZE
- as _G_xxxxxxxx.
-
-Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@jalod)
-
- * iopopen.c: Don't include <errno.h>. It is included in "libioP.h".
-
- * iopopen.c (_IO_proc_close) : check if fp is on the list
- before close it.
-
-Thu Jul 14 16:38:47 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * gen-params (CONFIG_NM): Make sed scripts to find vtable name
- mangling more robost for different forms of nm output.
-
-Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@jalod)
-
- * iofopen.c (_IO_fopen): don't check [redundantly] fp == NULL after
- IO_file_init(&fp->_file).
-
- * iomanip.h (template<class TP> class iapp):
- change ostream to istream.
-
-Tue Jul 12 14:09:02 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in (VERSION): Increase to 0.65.
- * libioP.h (builtinbuf_vtable): Only define #ifdef __cplusplus.
-
- * gen-params (_G_int8_t): Only define if defined(__STDC__),
- because K&R C compilers don't have signed char.
- (_G_int64_t, _G_uint64_t): Only define if defined(__GNUC__)
- because other compilers may not have long long.
-
-Sun Mar 06 13:10:21 1994 H.J. Lu (hjl@nynexst.com)
-
- * floatconv.c (_IO_dtoa ()): fix a small memory leak, set the
- "on_stack" field to be 0 if "result" is not NULL.
-
-Sat Mar 05 13:18:20 1994 H.J. Lu (hjl@nynexst.com)
-
- * floatconv.c (_IO_dtoa ()): if the number of digits of the
- floating point number is more than the previous one, free the
- old string and allocate a new one.
- [Minor optimization to avoid Bcopy. -PB]
-
-Mon Jul 11 10:53:41 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * fileops.c (_IO_file_underflow): 'count' should be unsigned,
- since it contains the return value of read. Reported by
- Teemu Torma <tot@trema.fi>.
-
-Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@nynexst.com)
-
- * floatconv.c (_IO_strtod ()): make "+" and "-" as error.
-
-Sat Jul 9 15:09:21 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- Make sure _IO_FILE::_flags is always initialized correctly, for the
- C functions (fopen, fdopen, popen), and not just the C++ functions.
- * fileops.c (_IO_file_init): Set _flags to CLOSED_FILEBUF_FLAGS.
- * fileops.c (_IO_file_fopen): Remove bogus assignment.
- * filebuf.cc (filebuf constructors): Don't pass CLOSED_FILEBUF_FLAGS
- to streambuf constructor - _IO_file_init does it instead.
- * filebuf.cc (CLOSED_FILEBUF_FLAGS): Removed.
- * iopopen.c (_IO_proc_open): Use _IO_mask_flags.
-
-Thu Jun 30 08:49:53 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * dbz/Makefile.in (mostlyclean): Add target.
-
-Wed Jun 29 09:30:12 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * gen-params: Woops, can't run a C program to determine target
- characteristics. Sigh.
-
-Tue Jun 28 03:11:33 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * gen-params: Add _G_{,u}int{8,16,64}_t, use a short C program to
- determine what all these should be rather than trying to compare
- the MAX numbers in the shell.
-
-Sun Jun 26 21:04:24 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * stdiostream.h, stdiostream.cc (stdiobuf::xsgetn): Removed.
- Too hairy. If we want to optimize it, we should do so in
- filebuf::xsgetn (or rather _IO_file_xsgetn).
-
- * stdiostream.h (class stdiobuf), stdiostream.cc: Fix parameter
- and return types of virtual function to matcher base types (Oops!).
- * streamstream.cc (stdiobuf::xsgetn, stdiobuf::xsputn):
- Optimize to call fread.fwrite directly if !buffered.
- * fileops.c: Fix comment.
-
-Fri Jun 24 11:28:18 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * stdiostream.h (istdiostream, ostdiostream): New classes.
-
- More robust final cleanup.
- * cleanup.c (_IO_register_cleanup): Register _IO_cleanup,
- rather than _IO_flush_all.
- * filedoalloc.c: Update comment.
- * genops.c (_IO_unbuffer_all): New. Makes all files unbuffered.
- * genops.c (_IO_cleanup), libioP.h: New function. Call
- _IO_flush_all, and then _IO_unbuffer_all. This is in case C++
- destructors try to do output *after* _IO_cleanup is called.
-
- Construct standard stdiobufs statically (using type punning).
- * stdstrbufs.c; Unless _STDIO_USES_IOSTREAM declare standard
- stdiobufs (for stdin, stdout, and stderr), using type punning
- (struct _IO_fake_stdiobuf). This avoids constructor-time problems.
- * stdstreams.cc: Remove the declarations of the stdiobufs.
- Instead use the new (fake) ones in stdstrbufs.cc. We no longer
- have to call ios::sync_with_stdio at constructor time.
-
- Preliminary support for new ANSI streambuf::uflow virtual.
- * libioP.h (struct _IO_jump_t): Add __uflow field.
- * genops.c (_IO_default_uflow), libioP.h: New function.
- * fileops.c (_IO_file_jumps), iopopen.c (IO_proc_jumps),
- iovfprintf.c (_IO_helper_jumps), strops.c (_IO_str_jumps),
- streambuf.cc (_IO_streambuf_jumps): Add _IO_default_uflow.
- * genops.c (__uflow): New function.
- (save_for_backup): New function. Some code shared by
- __underflow and __uflow, moved out from the former.
- (_IO_default_uflow): New function.
- * libio.h (_IO_getc): Call __uflow, not __underflow.
-
-Wed Jun 22 20:22:49 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- Make sure that the vtable of a streambuf is always valid,
- which makes ios::rdbuf simpler and faster.
- * gen-params: Add code to determine _G_VTABLE_LABEL_HAS_LENGTH,
- _G_VTABLE_LABEL_PREFIX, _G_VTABLE_LABEL_PREFIX_ID, and
- _G_USING_THUNKS, which describe how virtual function tables are named.
- * stdfiles.c (FILEBUF_LITERAL): Moved to libioP.h.
- * libioP.h (builtinbuf_vtable): New (complicated) declaration.
- * filebuf.cc (filebuf::__new), strstream.cc (SET_STR_JUMPS):
- Initialize vtable to builtinbuf_vtable, not NULL.
- * stdstrbufs.cc: New file. Same as stdfiles.c, except that
- vtable is initialized to builtinbuf_vtable, not NULL.
- * streambuf.h (ios::rdbuf): Can now simplify/optimize, due to
- above changes. Always, just return _strbuf.
- * builtinbuf.h, builtinbuf.cc (builtinbuf::vtable,
- builtinbuf::get_builtin_vtable): Removed. No longer needed.
- * streambuf.h, builtinbuf.cc (ios::_IO_fix_vtable): No longer needed.
- Only defined #ifdef _STREAM_COMPAT, for binary compatibility.
- * Makefile.in: Move stdfiles.o from IO_OBJECTS to STDIO_WRAP_OBJECTS.
- (IOSTREAM_OBJECT): Add stdstrbufs.o.
- * Makefile.in (_G_config.h): Pass $(CXXFLAGS) as part of $(CXX).
-
-Fri Feb 11 11:08:01 1994 SBPM Marc GINGOLD (marc@david.saclay.cea.fr)
-
- * iovfprintf.c (helper_vfprintf): add
- hp->_IO_file_flags = _IO_MAGIC|(_IO_IS_FILEBUF+_IO_NO_READS);
- [This is needed because _IO_vfprintf checks for _IO_UNBUFFERED. -PB]
- [Actually: don't set _IO_IS_FILEBUF. -PB]
-
-Wed Jun 22 13:49:22 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * stdiostream.cc, stdiostream.h (stdiobuf::buffered): New methods.
-
- * iofdopen.c (_IO_fdopen): Various minor improvements.
-
- * iovfscanf.c: Don't return EOF on control_failure.
-
-Tue Dec 21 13:02:48 1993 H.J. Lu (hjl@nynexst.com)
-
- * iovfscanf.c: Enforce the sequence of the conversion specifications.
-
-Fri Jun 17 20:57:22 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iofdopen.c: Use fcntl to check that requested access mode is
- compatible with existing access mode, and to change the
- O_APPEND file status flag if need be.
-
-Thu Jun 16 17:33:50 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * streambuf.h (ios::init): Initialize all the fields.
- This may be overkill, but the current ANSI working paper requires it.
- * streambuf.h (ios::ios): Reimplement in terms of ios::init.
- * iostream.cc (Non-default constructors istream::istream,
- ostream::ostream, iostream::iostream): Cannot use a mem-initializer,
- because it is ignored if initializing a derived class. Instead,
- call ios::init.
-
-Wed Jun 15 13:35:37 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * stdstreams.cc (ISTREAM_DEF): Fix typo (it's a _fake_istream, not
- a _fake_ostream). Reported by Jason Shirk <jshirk@gomez.intel.com>.
-
- * stdiostream.h, stdiostream.cc (stdiobuf::~stdiobuf): New.
- Call _IO_do_flush.
- * stdiostream.cc (stdiobuf::sync): Call _IO_do_flush rather
- than filebuf::sync (to avoid bad seeks).
-
- * libioP.h (_IO_do_flush): Add missing parentheses.
-
-Fri Jun 3 19:16:57 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * config.shared (CXXFLAGS): Remove -fno-implicit-templates.
-
- * iomanip.h: Add explicit external instantiations.
-
-Wed Jun 1 14:14:44 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * libio.h (struct _IO_FILE_plus): Move definition from here ...
- * libioP.h (struct _IO_FILE_plus): ... to here. Since this
- file is private to the implementation, we can rename the fields
- from the implementor's to the user's name anme space.
- (This avoids a lossage on SCO, whose stdio.h has a #define _file.)
- * iofdopen.c, iofopen.c, stdfiles.c: Fix field references accordingly.
- * iopopen.c (struct_IO_proc_file): Rename fields from
- implementor's name space to user's, and update usages.
- * streambuf.h (streambuf::_vtable): Re-implement to not need
- struct _IO_FILE_plus.
- * strfile.h (struct _IO_strfile_): Likewise.
-
-Wed Jun 1 13:57:48 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * config.shared (CXXFLAGS): Use -fno-implicit-templates instead of
- -fexternal-templates.
-
-Tue May 31 08:49:28 1994 Mike Stump (mrs@cygnus.com)
-
- * genops.c, iofclose.c, iofdopen.c, iofopen.c, iopopen.c: Be
- consistent about protecting #include <stdlib.h>.
-
- * ioputs.c: Add #include <string.h>, to avoid warning on alpha.
-
- * iofdopen.c: Add #include <stdlib.h>, so that malloc works on
- machines where sizeof(int) != sizeof(void *).
-
-Mon May 30 17:26:49 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * pfstream.cc (ipfstream::ipfstream, opfstream::opfstream):
- Reverse sense of test of return value of procbuf::open.
- (It returns NULL on failure.)
-
- * filedoalloc.c (_IO_file_doallocate): Remove dead code for
- USE_MALLOC_BUF. Add code to return EOF if ALLOC_BUF fails.
-
-Sat May 28 13:47:47 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * iomanip.cc: Explicitly instantiate smanip<int> and
- smanip<ios::fmtflags>.
-
-Wed May 25 16:04:12 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * strfile.h: Use __P instead of _PARAMS.
-
-Fri May 20 11:42:17 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * libio.h: Rename _PARAMS macro to __P for better glibc and BSD
- compatibility. (Also define _PARAMS for backwards compatibility.)
- * cleanup.c, iolibio.h, ioperror.c, iovfprintf.c, iovfscanf.c,
- libioP.h: Use __P instead of _PARAMS.
- * iostdio.h: Use __P instead of _ARGS.
-
- * fileops.c (_IO_file_read): Minor stylistic tweak. (It is
- preferable to test errno *after* the error return.)
-
-Fri May 13 15:25:36 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * iostream.*: Add insertor and extractor for bool (just pretend
- it's an int).
-
-Fri May 13 14:12:03 1994 Mike Stump (mrs@cygnus.com)
-
- * gen-params: Check for builtin bool support.
-
-Wed May 11 00:48:35 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- Make libg++ build with gcc -ansi -pedantic-errors
- * gen-params: #ifdef __STRICT_ANSI__, #define _G_NO_NRV.
- * pfstream.cc (ipfstream::ipfstream): Wrap use of variable-size
- array in #ifndef __STRICT_ANSI__.
-
-Fri May 6 12:42:21 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in (VERSION): Increase to 0.64.
-
- * isgetline.cc (istream::getline): The delimiter should *not*
- be included in the gcount().
-
- * filedoalloc.c: #include <stdlib.h> (If __STDC__) to get malloc.
- * iostream.h (ostream::put): Remove overloaded versions, to match
- new working paper. (Actually just put inside _STREAM_COMPAT, for now.)
-
-Tue May 3 14:14:57 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * genops.c (_IO_default_finish): Make robust when called
- multiple times on the same _IO_FILE*. (One way this can
- happen is by the builtinbuf destructor being followed by the
- streambuf destructor.)
-
-Mon May 2 13:55:26 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * gen-params: Actually determine wint_t rather than depending on
- cpp to provide it or defaulting to the underlying type for
- wchar_t.
-
-Sat Apr 30 14:47:30 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * gen-params: Add _G_wint_t, allow __*_TYPE__ to override values
- at compile time, fix definition of _G_ARGS.
-
-Fri Apr 29 16:55:37 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * libio.h: Remove #pragma interface. (There is no implementation.)
-
-Mon Mar 28 14:22:26 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iostream.cc (ostream::operator<<(double)): Add/fix support
- for printing '+' when ios::showpos is set.
- (Fixes bug reported by Doug Moore <dougm@cs.rice.edu>.)
- * iostream.cc (istream::read): Set eofbit as well as failbit on eof.
- * iostream.cc (ostream::operator<<(int)): Fix conversion
- to unsigned (used to lose on INT_MIN).
- * iostream.cc (ostream::operator<<(long)): Use (unsigned long),
- rather than (unsigned) for temporary.
-
- * config.shared, Makefile.in: Remove definitions and uses
- of XTRAFLAGS. It is no longer needed, since it is
- now implied by the -B flag.
-
-Fri Mar 25 00:31:22 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * builtinbuf.h: Add put /**/ around comment on trailing #endif.
-
- * Makefile.in (c++clean): Make clean in tests subdir, too.
-
-Wed Mar 23 16:42:09 1994 Doug Evans (dje@canuck.cygnus.com)
-
- * configure.in: Remove Makefile.tem before creating it.
- Needed when configuring from read-only source trees.
-
-Wed Mar 16 14:06:42 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * stdstreams.cc: Fix so that stdiobuf are used for cin/cout/cerr,
- unless _STDIO_USES_IOSTREAM is defined.
- * filebuf.cc (filebuf::setbuf): Fix confusion about return
- value from _IO_file_setbuf.
-
-Sun Mar 13 00:54:12 1994 Paul Eggert (eggert@twinsun.com)
-
- * config.shared: Ensure that `all' precedes `.PHONY';
- BSDI 1.1 needs this.
-
-Sat Mar 12 03:58:00 1994 Paul Eggert (eggert@twinsun.com)
-
- * config.shared: Output a definition of INSTALL that uses
- $${rootme}, not ${rootme}. Most `make's don't care, but BSDI
- 1.1 `make' does.
-
-Fri Mar 4 17:33:01 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iopopen.c: #define _POSIX_SOURCE.
- * isgetline.c (istream::getline): Various fixes.
-
-Thu Mar 3 17:58:20 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iostream.cc (write_int): Fix test for when to add initial '0'
- when ios::oct and ios::showbase are set.
- For hex, showbase adds initial 0x (or 0X) regardless of val==0.
- Bugs reported by Phil Roth <proth@cs.uiuc.edu>.
-
-Mon Feb 21 13:18:20 1994 H.J. Lu (hjl@nynexst.com)
-
- * libio.h (_IO_PENDING_OUTPUT_COUNT(_fp)): return the
- pending output count in _fp.
-
-Fri Feb 25 09:26:57 1994 Ian Lance Taylor (ian@cygnus.com)
-
- * gen-params: For HAVE_SYS_WAIT, compile dummy.c, not dummy.C.
-
-Tue Feb 22 11:19:09 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * streambuf.h, genops.c, libioP.h: Rename references to
- _IO_FILE fields other_gbase => _IO_save_base,
- _aux_limit => _IO_backup_base, and _other_egptr => _IO_save_end.
- * libio.h: Remove no-longer needed macros _other_gbase,
- _aux_limit, and _other_egptr.
- * genops.c (__underflow, _IO_default_finishh, _IO_unsave_markers):
- Check _IO_save_base for NULL before FREEing it or calling
- _IO_free_backup_area.
-
-Thu Feb 17 15:26:59 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * gen-params: Improve deduction of _G_uint32 and _G_int32.
- Should now work for 16-bit, 32-bit, or 64-bit targets.
- * gen-params: Check for sys/wait.h using ${CC}, since it's
- now used in a C file, not a C++ file.
- * floatconv.c: Typedef _G_uint32_t as unsigned32, and use
- unsigned32 in place of unsigned long. (Needed for Alpha.)
-
-Tue Feb 8 13:40:15 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * fileops.c (_IO_file_close_it): Simplify by using _IO_do_flush.
- * fileops.c (_IO_file_finish): Don't call _IO_file_close_it -
- do it inline. Call _IO_do_flush even if _IO_DELETE_DONT_CLOSE.
- * fileops.c (_IO_file_attach): Set _IO_DELETE_DONT_CLOSE.
- * genops.c (_IO_flush_all): Only call overflow if there is
- something to write.
- * iofclose.c (_IO_fclose): Check that magic number is correct,
- and clear it when done. Avoids crashing some buggy applications.
- * iogetline.c (_IO_getline): Don't gratuitously increment old_len.
- * iogets.c (_IO_gets): Take care to get required ANSi semantics.
-
-Sun Feb 6 19:50:39 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * iomanip.cc: Explicitly instantiate operator<< and >>.
-
-Fri Feb 4 12:28:22 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * config.shared (CXXFLAGS): Use -fexternal-templates.
-
- * iomanip.h: Uncomment #pragma interface.
-
-Thu Jan 20 13:48:40 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- If no characters are read by fgets, ANSI C doesn't allow '\0' to
- be written to the buffer, but it is required by ANSI C++
- for istream::get and istream::getline. Both use _IO_getline ...
- * iogetline.c (_IO_getline): Don't write a '\0' at the end
- of the read data. The input buffer length does not include
- space for a '\0'.
- * iofgets.c, iogets.c: Change appropriately.
- Also check for _IO_ERR_SEEN, as required by ANSI.
- * isgetline.cc: Update accordingly.
-
-Mon Jan 17 13:24:26 1994 Jason Merrill (jason@deneb.cygnus.com)
-
- * Makefile.in (c++clean): Added target for compiler testing
- (i.e. make c++clean all).
-
-Mon Jan 10 11:20:42 1994 Per Bothner (bothner@kalessin.cygnus.com)
-
- * libio.h (_IO_putc): Add parentheses.
- Patch from Rik Faith <faith@cs.unc.edu>.
-
-Tue Jan 4 01:32:28 1993 Hongjiu Lu (hjl@nynexst.com)
-
- * genops.c (_IO_default_xsputn):
- (_IO_default_xsgetn):
- * ioignore.c: change "_IO_size_t count" to
- "_IO_ssize_t count".
- * iogetline.c: change "_IO_size_t len" to
- "_IO_ssize_t len".
-
-Mon Dec 20 00:31:21 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * config.shared (CXXINCLUDES): Fix quoting of $(NOSTDINC).
-
-Sun Dec 19 21:03:45 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in (VERSION): Increase to 0.63.
-
-Fri Dec 17 13:02:44 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iofread.c (_IO_fread): Return 0 if either size or count is 0.
- * iofwrite.c (_IO_fwrite): Return 0 if either size or count is 0.
- (This is consistent with fread, and most implementations, but not
- with a literal reading of the ANSI spec.)
- * iovfscanf.c (_IO_vfscanf): If got EOF while skipping spaces,
- set seen_eof and break (instead of returning).
- * sbscan.cc (streambuf::vscan): Set error state before returning.
- * streambuf.h: Add a forward declarations for class istream
- to work around a g++ vtable name mangling bug. (Patch from
- harry@pdsrc.hilco.com via Jeffrey A Law <law@snake.cs.utah.edu>.)
- * NEWS: New file.
-
-Sat Dec 11 16:21:08 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iovfprintf.c (struct helper_file, _IO_helper_overflow,
- helper_vfprintf, _IO_helper_jumps): New structs and functions.
- (_IO_vfprintf): Use helper_vfprintf to make printing to
- unbuffered files more efficient.
- * genops.c (_IO_default_underflow), libioP.h: New function.
-
- * iovsscanf.c (_IO_vsscanf): The input string's length marks
- its logical end-of-file.
-
-Wed Dec 8 13:20:46 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * indstream.cc (indirectbuf::sync()): Don't crash if get_stream()
- or put_stream() are NULL; sync() both streams even if error.
-
-Sun Dec 5 19:24:29 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
-
- * iostreamP.h (convert_to_seekflags): Use _IO_seek_set instead of
- 0 inside the conditial expressions.
-
- * iofsetpos.c (_IO_fsetpos): Delete unused var `pos'.
-
-Sat Dec 4 15:57:26 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * filedoalloc.c (_IO_file_doallocate): Change type of couldbetty
- to int, and type of size to _IO_size_t, instead of size_t.
- (Change needed for Ultrix, which incorrectly deliberately doesn't
- define size_t in <sys/types.h> if _POSIX_SOURCE is defined.)
-
-Thu Dec 2 22:43:03 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * fileops.c (_IO_file_finish): Remove redundant call to _IO_un_link.
- * iofclose.c (_IO_fclose): Don't call fp->_jumps->__close; it's
- too low-level. Instead call _IO_file_close_it.
- * dbz/Makefile.in (rclean, distclean): Add some missing files.
-
-Wed Dec 1 13:19:14 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * config/hpux.mt (MATH_H_INLINES): No longer define.
- Patch from Jeffrey A Law <law@snake.cs.utah.edu>.
-
-Fri Nov 26 13:28:36 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * config.shared (CINCLUDES): Define default if libg++.
- * iofread.c: Use _IO_sgetn.c.
- * iolibio.h (_IO_clearerr): Fix typo.
- * genops.c (_IO_seekmark): Return 0 on success.
- * floactconv.c (Binit): Change to static.
- * iofclose.c (_IO_fclose): Check if file is _IO_stdin, _IO_stdout,
- or _IO_stderr; if so don't try to free it. Fix from hjl@nynexst.com.
-
- * genops.c (_IO_default_sync), libioP.h: New function.
- * libioP.h (_IO_default_close): Use _IO_default_sync -same interface.
-
- * Makefile.in: Increase version to 0.62.
- * iopopen.c (_IO_proc_close): Use waitpid (available in libibarty,
- if needed), rather than wait. Don't block/ignore SIGINT etc,
- as this is counter to Posix.2.
- * iopopen.c: Chain open proc_files, and have the child close
- the ones that are open (as required by Posix.2).
-
- * fstream.h (fstreambase::rdbuf), strstream.h (strstreambase
- ::rdbuf): Call ios::rdbuf() instead of getting _strbuf directly.
-
- * sbscan.cc (streambuf::vscan): Comment out duplicate default arg.
- * floatconv.c: Recognize Alpha and i860 as little-endian.
- * streambuf.cc: Return two bogus value returns from void functions.
- * iolibio.h, iofwrite.c: Fix buffer type to (const void*).
- * libio.h: Predefine of struct _IO_FILE to help non-g++-compilers.
- * libioP.h, pfstream.cc, stdfiles.c, iovfscanf.c: Cleanup syntax junk.
- * stdstreams.cc: Minor simplification.
- * streambuf.h, builtinbuf.cc: Add non-const ios::_IO_fix_vtable()
- for temporary binary compatibility.
-
- * filedoalloc.c, fileops.c: Add _POSIX_SOURCE.
- * fileops.c, iofopen.c, iofputs.c, iostream.cc, strops.c,
- strstream.cc, genops.c: Add some missing #includes.
- * iofopen.c, iofdopen.c: Return NULL if malloc fails.
- * iovfscanf.c: Fix return type in strtol prototype.
- * fwrite.c: Remove bogus file.
-
-Wed Nov 17 14:09:42 1993 Per Bothner (bothner@cygnus.com)
-
- * builtinbuf.cc (ios::_IO_fix_vtable), streambuf.h: Make method
- const, to reduce problems with -Wcast-qual.
-
-Tue Nov 16 19:30:42 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * config.shared (CXXINCLUDE): use ${} instead of $() for NOSTDINC
-
-Tue Nov 16 14:15:45 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iopopen.c (_IO_proc_close): Re-structure to avoid
- declarations after statements.
- * floatconv.c: If not __STDC__, #define DBL_MANT_DIG.
- * config/isc.mt (G_CONFIG_ARGS): Remove bogus spaces.
- Patch from David A. Avery <daa@nic.cerf.net>.
-
-Tue Nov 16 15:58:31 1993 Mark Eichin (eichin@cygnus.com)
-
- * Makefile.in (_G_config.h): explicitly use $(SHELL) to run
- gen-params, since we know it is a script (we're explicitly looking
- in ${srcdir} for it) and /bin/sh might not be good enough.
-
-Mon Nov 15 13:26:22 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * builtinbuf.cc: Don't depend on initialization of static
- variable builtinbuf::vtable, since that might happen after
- we need it (for a static constructor). Instead, initialize
- it when needed by inlining the code from get_builtin_vtable
- into ios::_IO_fix_vtable().
-
- * floatconv.c: Avoid using #elif, which some C compilers lack.
- * iogetline.c, libioP.h: Make char parameter be int, to avoid
- some default promotion anomalies.
-
-Fri Nov 5 11:49:46 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * config.shared (do-clean-dvi): Remove TeX work files.
- * iopopen.c (extern _IO_fork): Don't use parameter type void.
- * strops.c (_IO_str_init_static): Clear the allocate_buffer
- function pointer, to mark the strfile as being static.
- Bug fix from Mike Raisbeck <mike@pudding.rtr.COM>.
-
-Thu Nov 4 10:44:24 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * filebuf.cc (filebuf:): Use sseekoff rather than seekoff
- (which loses if vtable pointer is NULL).
-
- * iostream.cc (ostream::operator<<(long long n)): Fix thinko.
-
- * Makefile.in (VERSION): Increase to 0.60.
- * Makefile.in (IO_OBJECTS): Added iopopen.o.
- * config.shared (DISTCLEAN): Also remove Make.pack.
- * config.shared (CXXINCLUDES): Add $(NOSTDINC).
-
- * config.shared (INSTALL): Fix so it ues the correct install.sh
- whether $srcdir is absolute or relative.
-
- * floatconv.c (DBL_MAX_10_EXP): Fix default value.
-
-Wed Nov 3 10:20:49 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * gen-params: Make more robust to allow random junk (NeXT
- has spaces) before typedefs.
-
- * fileops.c (_IO_file_overflow): Reduce code duplication.
- * Makefile.in (IO_OBJECTS): Remove ioputs.o.
-
- * iovfscanf.c, libio.h: Extra parameter to _IO_vfscanf,
- for optionally setting an error indication..
- * iofscanf.c, ioscanf.c, iofscanf.c, iovsscanf.c: Fix calls to
- _IO_vfscanf to pass an extra NULL.
- * sbscan.cc (streambuf::vscan): If passed an extra stream,
- set its error state (using new _IO_vfscanf parameter.
-
- * filedoalloc.c, fileops.c, genops.c, iogetline.c, ioignore.c,
- libio.h, libioP.h, streambuf.cc streambuf.h, strfile.h, strops.c,
- strstream.cc: Replace macros (_base, _ebuf, _eback, _gptr, _egptr,
- _pbase, _pptr, _epptr) by field names (_IO_buf_base, _IO_buf_end,
- _IO_read_base, _IO_read_pre, IO_read_end, _IO_write_base,
- _IO_write_ptr, _IO_write_end).
- * libio.h: Remove the old macros (which fixes a conflict.
-
-Mon Nov 1 15:22:12 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iostream.cc: Use _IO_sputn instead of sputn. _IO_sputn does
- not require a vtable pointer, and is also slightly faster.
-
- * builtinbuf.{h,cc} (builtinbuf::setbuf): Fix return and
- parameter types.
-
-Mon Oct 25 12:56:33 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- Kludge to make sure _IO_FILE buffers get flushed before exit.
- * dbz/dbzmain.c, dbz/fake.c, dbz/byteflip.c:
- Invoke DBZ_FINISH macro (if defined) before (normal) exits.
- * dbz/Makefile.in (CFLAGS): Define DBZ_FINISH to call _IO_flush_all.
-
-Sat Oct 23 22:10:53 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in (VERSION): Set to 0.60 for libg++ release.
- * fileops.c (_IO_file_attach): Set _offset to _IO_pos_BAD.
- * iostream.cc (ostream::flush): Fix thinkp.
- * editbuf.cc, isgetsb.cc, isscan.cc, osform.cc, parsestream.cc,
- pfstream.cc, sbform.cc, sbscan.cc, stdstreams.cc, stream.cc:
- Replace #include "ioprivate.h" by #include "libioP.h" (and
- sometimes stdarg.h, stdlib.h and/or string.h).
- * ioprivate.h: Removed.
-
-
-Thu Oct 21 19:24:02 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * PlotFile.h, SFile.h, editbuf.cc, editbuf.h, filebuf.cc,
- fstream.cc, fstream.h, indstream.cc, indstream.h, iomanip.cc,
- iomanip.h, ioprivate.h, iostream.cc, iostream.h, isgetline.cc,
- isgetsb.cc, parsestream.cc, parsestream.h, pfstream.cc,
- pfstream.h, procbuf.cc, procbuf.h, stdiostream.cc, stdiostream.h,
- stdstreams.cc, streambuf.cc, streambuf.h, strstream.cc,
- strstream.h: Remove old (duplicate) copyright notices.
-
- * iostream.cc: Fix calls to sync() to be safe in the presence
- of vtable-less streambufs.
-
-Wed Oct 20 15:22:04 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * streambuf.h (streambuf::underflow, streambuf::overflow):
- Don't make virtual functions pure.
- * streambuf.cc (streambuf::underflow, streambuf::overflow):
- Default definitions (return EOF).
- * fstream.h: Add new (int fd, char* buf, int len) constructors.
- These are deprecated, but added for AT&T compatibility.
- * fstream.cc fstreambase::fstreambase(int fd, char *p, int l): New.
-
-Thu Oct 14 14:57:01 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * configure.in: use 'mv -f' instead of 'mv'
-
-Tue Oct 12 05:01:44 1993 Mike Stump (mrs@cygnus.com)
-
- * floatconv.c: Fix typo, change __STDC to __STDC__.
-
-Mon Oct 11 17:03:12 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * cleanup.c: It should be #if _G_HAVE_ATEXIT, not #ifdef.
-
- * floatconv.c, iostrerror.c, iovfprintf.c, iovfscanf.c, libioP.h:
- Bunch of fixes to allow use of non-ANSI (K&R) C compilers.
-
- * Makefile.in (iostream.list): Use CC=$(CXX) to force use of gcc.
- * README: New file.
-
-Fri Oct 8 16:19:58 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in: Move ioungetc.o from STDIO_WRAP_OBJECTS to
- IO_OBJECTS (since it is needed for iovfscanf.c).
- * iostrerror.c: Add declaration of strerror.
-
-Thu Oct 7 12:02:28 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * cleanup.c: New file, to cause flushing at exit.
- * filedoalloc.c: Cause flushing on exit.
- * Makefile.in (OSPRIM_OBJECTS): Add cleanup.o.
- * gen-params: Check for atexit.
-
-Tue Oct 5 19:11:14 1993 Mike Stump (mrs@cygnus.com)
-
- * ioperror.c (_IO_strerror): Add missing ()s in _PARAMS usage.
-
-Tue Oct 5 10:33:37 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iofprintf.c, iofscanf.c, ioprintf.c, ioscanf.c, iosprintf.c,
- iosscanf.c: Remove bogus semi-colon after va_dcl.
- * ioperror.c: Fix typos in declaration.
-
-Mon Oct 4 17:12:22 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * configure.in (CLEAN): Define (as _G_config.h *.a).
-
- * fileops.c (_IO_file_read): Don't assume EINTR is defined.
- * iosetbuf.c: Replace by generalized ...
- * iosetbuffer.c: ... variant, derived from BSD.
- * Makefile.in (STDIO_WRAP_OBJECTS): Change correspondingly.
- * iosetvbuf.c (iosetvbuf): Minor ANSI tweak.
- * iostdio.h (setbuf, setlinebuf): New #defines.
- * iolibio.h (_IO_setbuf, _IO_setlinebuf): (Re-)define as macros.
- * Makefile.in (LIBIO_OBJECTS): New macro.
-
-Tue Sep 28 14:15:52 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * libioP.h (_IO_proc_open, _IO_proc_close): Add missing return types.
- * procbuf.cc: Belated fixes.
-
-Mon Sep 27 14:04:47 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in: List new files. Add STDIO_WRAP_OBJECTS macro.
- * floatconv.c (d2b): Use Exp_msk11 instead of Exp_msk1.
- * iofgetpos.c (_IO_fgetpos), iofsetpos.c (_IO_fsetpos): Clean up.
- * iolibio.h: New file. Declarations of _IO_foo, for most foo
- where foo is a stdio function. (Remove these from libio.h.)
- * iostream.h (istream::istreambuf, ostream::ostreambuf): Move
- obsolete functions inside #ifdef _STREAM_COMPAT.
- * libio.h, libioP.h, streambuf.h, parsestream.h, stdiostream.h:
- Use _IO_fpos_t rather than _IO_pos_t.
- * iopopen.c: New file type, for pipe (popen-like) streams.
- * procbuf.cc: Now just a C++ wrapper for the files in iopopen.c.
- * streambuf.h (ios::unsetf): Return complete old value of flags.
- * iogets.c (_IO_gets(), ioungetc.c (_IO_ungetc), ioperror.c
- (_IO_perror), iostrerror.c (_IO_strerror): New files and
- functions, for stdio implementation.
- * iostdio.h: Add declarations for various recently-added functions.
-
-Sun Sep 12 14:24:55 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * streambuf.h (ios::showpos):: Fix typo.
-
-Fri Aug 27 12:05:47 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iopadn.c (_IO_padn): Change to return count of chars written.
- * outfloat.c, iovfprintf.c: Change for new _IO_padn interface.
- * iostream.cc (ostream::operator<<): Make sure to set badbit
- on a failure (many places). Use _IO_padn more.
- * iostream.cc (ostream& ostream::operator<<(const void *p): Move to
- * osform.cc: ... here, to reduce linking-in-the-world syndrome.
- * osform.cc: Use rdbuf(), instead of _strbuf directly.
-
- * genops.c (_IO_sgetn), libio.h: New function.
- * streambuf.h (streambuf.h::sgetn): Use _IO_sgetn.
- * SFile.cc (SFile::operator[]): Use sseekoff, not seekoff.
-
-Thu Aug 26 10:16:31 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * config.shared (SUBDIRS): only recurse if the directory is configured
-
-Wed Aug 25 12:56:12 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * config/{hpux.mt, isc.mt, sco4.mt}:
- Moved from ../libg++/config (since they affect _G_config.h).
- * configure.in: Set target_make_frag to one of the above files.
-
-Fri Aug 20 00:53:14 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * iofopen.c (iofopen): Fix type passed to _IO_un_link().
- * Makefile.in (_G_config.h): Pass $CC (not $CXX) as CC.
-
- * configure.in (configdirs): Add dbz and stdio.
- * fileops.c (_IO_file_seekoff): Convert more old functionality.
- * iofdopen.c: Use mode parameter to set _flags.
- * iofscanf.c, ioputs.c, ioscanf.c, iosprintf.c: New files.
- * Makefile.in (IO_OBJECTS): Added new objects.
- * iostdio.h: Add feof. fscanf, puts, sprintf, vsprintf.
- * libio.h: Add _IO_vprintf macro.
- * iofopen.c: Invoke _IO_un_link if failure.
- * iovsprintf.c: Write terminating NUL.
-
- * libioP.h: Add COERCE_FILE macro (by default does nothing).
- * iofclose.c, iofflush.c, iofgets.c, iofprintf.c, iofputs.c,
- iofread.c, ioftell.c, iofwrite.c, iosetbuf.c, iosetvbuf.c:
- Invoke COERCE_FILE macro.
- * ioftell.c: Use _IO_seekoff.
-
-Wed Aug 18 22:49:56 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * sbform.cc (streambuf::form), sbscan.cc (streambuf::scan):
- Remove cast to _IO_va_list. (Loses if array type.)
-
- * libio.h: Handle _IO_va_list for systems that need <stdarg.h>.
- * floatconv.h: Fix typo (reported by H.J.Lu).
-
-Wed Aug 18 19:34:04 1993 david d `zoo' zuhn (zoo@rtl.cygnus.com)
-
- * configure.in (INSTALLDIR): handle native vs. cross case
-
- * Makefile.in (install): don't use $TARGETLIB, set INSTALLDIR to
- $(libdir)
-
-Wed Aug 18 12:10:03 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in: Rename iostream-files to iostream.list.
- * configure.in: Add iostream.list to MOSTLYCLEAN.
-
-Tue Aug 17 18:56:59 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- * Makefile.in: Depend on _G_config.h where appropriate.
- * config.shared (CXXINCLUDES): If doing libg++, search ../libio.
-
-Tue Aug 17 17:34:24 1993 Per Bothner (bothner@kalessin.cygnus.com)
-
- New directory. Based on old libg++/iostream code,
- but extensively re-written.
diff --git a/contrib/libstdc++/libio/Makefile.am b/contrib/libstdc++/libio/Makefile.am
deleted file mode 100644
index dbba6ff..0000000
--- a/contrib/libstdc++/libio/Makefile.am
+++ /dev/null
@@ -1,67 +0,0 @@
-## Makefile for the libio subdirectory of the GNU C++ Standard library.
-##
-## Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-##
-## This file is part of the libstdc++ version 3 distribution.
-## Process this file with automake to produce Makefile.in.
-
-## This file is part of the GNU ISO C++ Library. This library is free
-## software; you can redistribute it and/or modify it under the
-## terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 2, or (at your option)
-## any later version.
-
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-
-## You should have received a copy of the GNU General Public License along
-## with this library; see the file COPYING. If not, write to the Free
-## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-## USA.
-
-AUTOMAKE_OPTIONS = 1.3 cygnus
-
-mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
-
-if GLIBCPP_BUILD_LIBIO
-noinst_LTLIBRARIES = libio.la
-else
-noinst_LTLIBRARIES =
-endif
-
-# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
-GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
-TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
-LIBIO_INCLUDES = @LIBIO_INCLUDES@
-
-INCLUDES = \
- -nostdinc++ \
- $(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
-
-libio_headers = \
- libio.h libioP.h iolibio.h
-
-if GLIBCPP_NEED_LIBIO
-LIBIO_SRCS = \
- filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c \
- iofclose.c iofopen.c
-else
-LIBIO_SRCS =
-endif
-
-if GLIBCPP_NEED_WLIBIO
-LIBIO_WSRCS = \
- wfiledoalloc.c wfileops.c wgenops.c iofwide.c
-else
-LIBIO_WSRCS =
-endif
-
-
-EXTRA_DIST = iostreamP.h
-
-libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
-
-
-AM_CFLAGS = -D_GNU_SOURCE @DEBUG_FLAGS@
diff --git a/contrib/libstdc++/libio/Makefile.in b/contrib/libstdc++/libio/Makefile.in
deleted file mode 100644
index a5384b8..0000000
--- a/contrib/libstdc++/libio/Makefile.in
+++ /dev/null
@@ -1,406 +0,0 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_alias = @build_alias@
-build_triplet = @build@
-host_alias = @host_alias@
-host_triplet = @host@
-target_alias = @target_alias@
-target_triplet = @target@
-AR = @AR@
-AS = @AS@
-ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
-AWK = @AWK@
-BASIC_FILE_H = @BASIC_FILE_H@
-CC = @CC@
-CCODECVT_C = @CCODECVT_C@
-CCODECVT_H = @CCODECVT_H@
-CLOCALE_H = @CLOCALE_H@
-CMESSAGES_H = @CMESSAGES_H@
-CPP = @CPP@
-CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@
-CSTDIO_H = @CSTDIO_H@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-C_INCLUDE_DIR = @C_INCLUDE_DIR@
-DEBUG_FLAGS = @DEBUG_FLAGS@
-DLLTOOL = @DLLTOOL@
-EXEEXT = @EXEEXT@
-EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
-GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
-LIBMATHOBJS = @LIBMATHOBJS@
-LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
-LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
-LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
-LIBTOOL = @LIBTOOL@
-LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
-OPT_LDFLAGS = @OPT_LDFLAGS@
-OS_INC_SRCDIR = @OS_INC_SRCDIR@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-SECTION_FLAGS = @SECTION_FLAGS@
-SECTION_LDFLAGS = @SECTION_LDFLAGS@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-WARN_FLAGS = @WARN_FLAGS@
-WERROR = @WERROR@
-baseline_file = @baseline_file@
-check_msgfmt = @check_msgfmt@
-enable_shared = @enable_shared@
-enable_static = @enable_static@
-glibcpp_CXX = @glibcpp_CXX@
-glibcpp_MOFILES = @glibcpp_MOFILES@
-glibcpp_POFILES = @glibcpp_POFILES@
-glibcpp_basedir = @glibcpp_basedir@
-glibcpp_builddir = @glibcpp_builddir@
-glibcpp_localedir = @glibcpp_localedir@
-glibcpp_prefixdir = @glibcpp_prefixdir@
-glibcpp_srcdir = @glibcpp_srcdir@
-glibcpp_thread_h = @glibcpp_thread_h@
-glibcpp_toolexecdir = @glibcpp_toolexecdir@
-glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
-gxx_include_dir = @gxx_include_dir@
-ifGNUmake = @ifGNUmake@
-libio_la = @libio_la@
-libtool_VERSION = @libtool_VERSION@
-toplevel_srcdir = @toplevel_srcdir@
-
-AUTOMAKE_OPTIONS = 1.3 cygnus
-
-mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
-@GLIBCPP_BUILD_LIBIO_TRUE@noinst_LTLIBRARIES = @GLIBCPP_BUILD_LIBIO_TRUE@libio.la
-@GLIBCPP_BUILD_LIBIO_FALSE@noinst_LTLIBRARIES =
-
-# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
-GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
-TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
-LIBIO_INCLUDES = @LIBIO_INCLUDES@
-
-INCLUDES = \
- -nostdinc++ \
- $(GLIBCPP_INCLUDES) $(LIBIO_INCLUDES) $(TOPLEVEL_INCLUDES)
-
-
-libio_headers = \
- libio.h libioP.h iolibio.h
-
-@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS = @GLIBCPP_NEED_LIBIO_TRUE@\
-@GLIBCPP_NEED_LIBIO_TRUE@ filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c \
-@GLIBCPP_NEED_LIBIO_TRUE@ iofclose.c iofopen.c
-@GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS =
-@GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS = @GLIBCPP_NEED_WLIBIO_TRUE@\
-@GLIBCPP_NEED_WLIBIO_TRUE@ wfiledoalloc.c wfileops.c wgenops.c iofwide.c
-@GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS =
-
-EXTRA_DIST = iostreamP.h
-
-libio_la_SOURCES = $(LIBIO_SRCS) $(LIBIO_WSRCS)
-
-AM_CFLAGS = -D_GNU_SOURCE @DEBUG_FLAGS@
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I..
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-libio_la_LDFLAGS =
-libio_la_LIBADD =
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo fileops.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@c_codecvt.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfiledoalloc.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wfileops.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@wgenops.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@iofwide.lo
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS = \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfiledoalloc.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wfileops.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@wgenops.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_FALSE@iofwide.lo
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@libio_la_OBJECTS = \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@filedoalloc.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@genops.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@fileops.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@stdfiles.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@c_codecvt.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofclose.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@iofopen.lo
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@libio_la_OBJECTS =
-CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON = ChangeLog Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = gtar
-GZIP_ENV = --best
-SOURCES = $(libio_la_SOURCES)
-OBJECTS = $(libio_la_OBJECTS)
-
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .S .c .lo .o .obj .s
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --cygnus libio/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-mostlyclean-noinstLTLIBRARIES:
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-
-distclean-noinstLTLIBRARIES:
-
-maintainer-clean-noinstLTLIBRARIES:
-
-.c.o:
- $(COMPILE) -c $<
-
-# FIXME: We should only use cygpath when building on Windows,
-# and only if it is available.
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.o:
- $(COMPILE) -c $<
-
-mostlyclean-compile:
- -rm -f *.o core *.core
- -rm -f *.$(OBJEXT)
-
-clean-compile:
-
-distclean-compile:
- -rm -f *.tab.c
-
-maintainer-clean-compile:
-
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.s.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.S.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-distclean-libtool:
-
-maintainer-clean-libtool:
-
-libio.la: $(libio_la_OBJECTS) $(libio_la_DEPENDENCIES)
- $(LINK) $(libio_la_LDFLAGS) $(libio_la_OBJECTS) $(libio_la_LIBADD) $(LIBS)
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = libio
-
-distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am:
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-info-am:
-install-info: install-info-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile $(LTLIBRARIES)
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
-mostlyclean-am: mostlyclean-noinstLTLIBRARIES mostlyclean-compile \
- mostlyclean-libtool mostlyclean-tags \
- mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-noinstLTLIBRARIES clean-compile clean-libtool \
- clean-tags clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-noinstLTLIBRARIES distclean-compile \
- distclean-libtool distclean-tags distclean-generic \
- clean-am
- -rm -f libtool
-
-distclean: distclean-am
-
-maintainer-clean-am: maintainer-clean-noinstLTLIBRARIES \
- maintainer-clean-compile maintainer-clean-libtool \
- maintainer-clean-tags maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: mostlyclean-noinstLTLIBRARIES distclean-noinstLTLIBRARIES \
-clean-noinstLTLIBRARIES maintainer-clean-noinstLTLIBRARIES \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile mostlyclean-libtool distclean-libtool \
-clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
-dvi-am dvi check check-am installcheck-am installcheck install-info-am \
-install-info install-exec-am install-exec install-data-am install-data \
-install-am install uninstall-am uninstall all-redirect all-am all \
-installdirs mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/contrib/libstdc++/libio/_G_config.h b/contrib/libstdc++/libio/_G_config.h
deleted file mode 100644
index d6738c2..0000000
--- a/contrib/libstdc++/libio/_G_config.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* This file is needed by libio to define various configuration parameters.
- These are always the same in the GNU C library. */
-
-#ifndef _G_config_h
-#define _G_config_h 1
-
-#ifndef _LIBC
-# include <bits/c++config.h>
-# ifdef _GLIBCPP_USE_THREADS
-# define _IO_MTSAFE_IO
-# endif
-#endif
-
-/* Define types for libio in terms of the standard internal type names. */
-
-#include <sys/types.h>
-#define __need_size_t
-#define __need_wchar_t
-#define __need_wint_t
-#define __need_NULL
-#define __need_ptrdiff_t
-#ifdef __cplusplus
-# include <cstddef>
-#else
-# include <stddef.h>
-#endif
-
-
-#ifndef _WINT_T
-/* Integral type unchanged by default argument promotions that can
- hold any value corresponding to members of the extended character
- set, as well as at least one value that does not correspond to any
- member of the extended character set. */
-# define _WINT_T
-typedef unsigned int wint_t;
-#endif
-
-/* For use as part of glibc (native) or as part of libstdc++ (maybe
- not glibc) */
-#ifndef __c_mbstate_t_defined
-# define __c_mbstate_t_defined 1
-/*# ifdef _GLIBCPP_USE_WCHAR_T*/
-typedef struct
-{
- int count;
- wint_t value;
-}__c_mbstate_t;
-/*# endif*/
-#endif
-#undef __need_mbstate_t
-
-typedef size_t _G_size_t;
-
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-typedef struct
-{
- __off_t __pos;
- __c_mbstate_t __state;
-} _G_fpos_t;
-
-typedef struct
-{
- __off64_t __pos;
- __c_mbstate_t __state;
-} _G_fpos64_t;
-#else
-typedef __off_t _G_fpos_t;
-typedef __off64_t _G_fpos64_t;
-#endif
-#define _G_ssize_t __ssize_t
-#define _G_off_t __off_t
-#define _G_off64_t __off64_t
-#define _G_pid_t __pid_t
-#define _G_uid_t __uid_t
-#define _G_wchar_t wchar_t
-#define _G_wint_t wint_t
-#define _G_stat64 stat64
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# include <iconv.h>
-typedef iconv_t _G_iconv_t;
-#endif
-
-typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
-typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
-typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
-typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
-
-#define _G_HAVE_BOOL 1
-
-
-/* These library features are always available in the GNU C library. */
-#define _G_HAVE_ATEXIT 1
-#define _G_HAVE_SYS_CDEFS 1
-#define _G_HAVE_SYS_WAIT 1
-#define _G_NEED_STDARG_H 1
-#define _G_va_list __gnuc_va_list
-
-#define _G_HAVE_PRINTF_FP 1
-#define _G_HAVE_MMAP 1
-#define _G_HAVE_LONG_DOUBLE_IO 1
-#define _G_HAVE_IO_FILE_OPEN 1
-#define _G_HAVE_IO_GETLINE_INFO 1
-
-#define _G_IO_IO_FILE_VERSION 0x20001
-
-//#define _G_OPEN64 __open64
-//#define _G_LSEEK64 __lseek64
-//#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
-
-/* This is defined by <bits/stat.h> if `st_blksize' exists. */
-/*#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)*/
-
-#define _G_BUFSIZ 8192
-
-/* These are the vtbl details for ELF. */
-#define _G_NAMES_HAVE_UNDERSCORE 0
-#define _G_VTABLE_LABEL_HAS_LENGTH 1
-#ifndef _G_USING_THUNKS
-# define _G_USING_THUNKS 1
-#endif /* _G_USING_THUNKS */
-#define _G_VTABLE_LABEL_PREFIX "__vt_"
-#define _G_VTABLE_LABEL_PREFIX_ID __vt_
-
-#define _G_INTERNAL_CCS "UCS4"
-#define _G_HAVE_WEAK_SYMBOL 1
-#define _G_STDIO_USES_LIBIO 1
-
-#if defined __cplusplus || defined __STDC__
-# define _G_ARGS(ARGLIST) ARGLIST
-#else
-# define _G_ARGS(ARGLIST) ()
-#endif
-
-#endif /* _G_config.h */
-
diff --git a/contrib/libstdc++/libio/filedoalloc.c b/contrib/libstdc++/libio/filedoalloc.c
deleted file mode 100644
index 12c1135..0000000
--- a/contrib/libstdc++/libio/filedoalloc.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/* Modified for GNU iostream by Per Bothner 1991, 1992. */
-
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
-#include "libioP.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#include <unistd.h>
-#endif
-
-#ifdef _LIBC
-# undef isatty
-# define isatty(Fd) __isatty (Fd)
-#endif
-
-/*
- * Allocate a file buffer, or switch to unbuffered I/O.
- * Per the ANSI C standard, ALL tty devices default to line buffered.
- *
- * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
- * optimisation) right after the _fstat() that finds the buffer size.
- */
-
-int
-_IO_file_doallocate (fp)
- _IO_FILE *fp;
-{
- _IO_size_t size;
- int couldbetty;
- char *p;
- struct _G_stat64 st;
-
- if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
- {
- couldbetty = 0;
- size = _IO_BUFSIZ;
-#if 0
- /* do not try to optimise fseek() */
- fp->_flags |= __SNPT;
-#endif
- }
- else
- {
- couldbetty = S_ISCHR (st.st_mode);
-#if _IO_HAVE_ST_BLKSIZE
- size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
-#else
- size = _IO_BUFSIZ;
-#endif
- }
- ALLOC_BUF (p, size, EOF);
- _IO_setb (fp, p, p + size, 1);
- if (couldbetty && isatty (fp->_fileno))
- fp->_flags |= _IO_LINE_BUF;
- return 1;
-}
diff --git a/contrib/libstdc++/libio/fileops.c b/contrib/libstdc++/libio/fileops.c
deleted file mode 100644
index a830b5c..0000000
--- a/contrib/libstdc++/libio/fileops.c
+++ /dev/null
@@ -1,1049 +0,0 @@
-/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
- Written by Per Bothner <bothner@cygnus.com>.
-
- 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 _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
-#include "libioP.h"
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#if _LIBC
-# include "../wcsmbs/wcsmbsload.h"
-# include <shlib-compat.h>
-#endif
-#ifndef errno
-extern int errno;
-#endif
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-
-
-#ifdef _LIBC
-# define open(Name, Flags, Prot) __open (Name, Flags, Prot)
-# define close(FD) __close (FD)
-# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
-# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
-# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
-#else
-# define _IO_new_do_write _IO_do_write
-# define _IO_new_file_attach _IO_file_attach
-# define _IO_new_file_close_it _IO_file_close_it
-# define _IO_new_file_finish _IO_file_finish
-# define _IO_new_file_fopen _IO_file_fopen
-# define _IO_new_file_init _IO_file_init
-# define _IO_new_file_setbuf _IO_file_setbuf
-# define _IO_new_file_sync _IO_file_sync
-# define _IO_new_file_overflow _IO_file_overflow
-# define _IO_new_file_seekoff _IO_file_seekoff
-# define _IO_new_file_underflow _IO_file_underflow
-# define _IO_new_file_write _IO_file_write
-# define _IO_new_file_xsputn _IO_file_xsputn
-#endif
-
-/* An fstream can be in at most one of put mode, get mode, or putback mode.
- Putback mode is a variant of get mode.
-
- In a filebuf, there is only one current position, instead of two
- separate get and put pointers. In get mode, the current position
- is that of gptr(); in put mode that of pptr().
-
- The position in the buffer that corresponds to the position
- in external file system is normally _IO_read_end, except in putback
- mode, when it is _IO_save_end.
- If the field _fb._offset is >= 0, it gives the offset in
- the file as a whole corresponding to eGptr(). (?)
-
- PUT MODE:
- If a filebuf is in put mode, then all of _IO_read_ptr, _IO_read_end,
- and _IO_read_base are equal to each other. These are usually equal
- to _IO_buf_base, though not necessarily if we have switched from
- get mode to put mode. (The reason is to maintain the invariant
- that _IO_read_end corresponds to the external file position.)
- _IO_write_base is non-NULL and usually equal to _IO_base_base.
- We also have _IO_write_end == _IO_buf_end, but only in fully buffered mode.
- The un-flushed character are those between _IO_write_base and _IO_write_ptr.
-
- GET MODE:
- If a filebuf is in get or putback mode, eback() != egptr().
- In get mode, the unread characters are between gptr() and egptr().
- The OS file position corresponds to that of egptr().
-
- PUTBACK MODE:
- Putback mode is used to remember "excess" characters that have
- been sputbackc'd in a separate putback buffer.
- In putback mode, the get buffer points to the special putback buffer.
- The unread characters are the characters between gptr() and egptr()
- in the putback buffer, as well as the area between save_gptr()
- and save_egptr(), which point into the original reserve buffer.
- (The pointers save_gptr() and save_egptr() are the values
- of gptr() and egptr() at the time putback mode was entered.)
- The OS position corresponds to that of save_egptr().
-
- LINE BUFFERED OUTPUT:
- During line buffered output, _IO_write_base==base() && epptr()==base().
- However, ptr() may be anywhere between base() and ebuf().
- This forces a call to filebuf::overflow(int C) on every put.
- If there is more space in the buffer, and C is not a '\n',
- then C is inserted, and pptr() incremented.
-
- UNBUFFERED STREAMS:
- If a filebuf is unbuffered(), the _shortbuf[1] is used as the buffer.
-*/
-
-#define CLOSED_FILEBUF_FLAGS \
- (_IO_IS_FILEBUF+_IO_NO_READS+_IO_NO_WRITES+_IO_TIED_PUT_GET)
-
-
-void
-_IO_new_file_init (fp)
- struct _IO_FILE_plus *fp;
-{
- /* POSIX.1 allows another file handle to be used to change the position
- of our file descriptor. Hence we actually don't know the actual
- position before we do the first fseek (and until a following fflush). */
- fp->file._offset = _IO_pos_BAD;
- fp->file._IO_file_flags |= CLOSED_FILEBUF_FLAGS;
-
- _IO_link_in (fp);
- fp->file._fileno = -1;
-}
-
-int
-_IO_new_file_close_it (fp)
- _IO_FILE *fp;
-{
- int write_status, close_status;
- if (!_IO_file_is_open (fp))
- return EOF;
-
- write_status = _IO_do_flush (fp);
-
- _IO_unsave_markers(fp);
-
- close_status = _IO_SYSCLOSE (fp);
-
- /* Free buffer. */
- if (fp->_mode <= 0)
- {
- _IO_setb (fp, NULL, NULL, 0);
- _IO_setg (fp, NULL, NULL, NULL);
- _IO_setp (fp, NULL, NULL);
- }
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- else
- {
- _IO_wsetb (fp, NULL, NULL, 0);
- _IO_wsetg (fp, NULL, NULL, NULL);
- _IO_wsetp (fp, NULL, NULL);
- }
-#endif
-
- _IO_un_link ((struct _IO_FILE_plus *) fp);
- fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
- fp->_fileno = -1;
- fp->_offset = _IO_pos_BAD;
-
- return close_status ? close_status : write_status;
-}
-
-void
-_IO_new_file_finish (fp, dummy)
- _IO_FILE *fp;
- int dummy;
-{
- if (_IO_file_is_open (fp))
- {
- _IO_do_flush (fp);
- if (!(fp->_flags & _IO_DELETE_DONT_CLOSE))
- _IO_SYSCLOSE (fp);
- }
- _IO_default_finish (fp, 0);
-}
-
-#if defined __GNUC__ && __GNUC__ >= 2
-__inline__
-#endif
-_IO_FILE *
-_IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
- _IO_FILE *fp;
- const char *filename;
- int posix_mode;
- int prot;
- int read_write;
- int is32not64;
-{
- int fdesc;
-#ifdef _G_OPEN64
- fdesc = (is32not64
- ? open (filename, posix_mode, prot)
- : _G_OPEN64 (filename, posix_mode, prot));
-#else
- fdesc = open (filename, posix_mode, prot);
-#endif
- if (fdesc < 0)
- return NULL;
- fp->_fileno = fdesc;
- _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
- if (read_write & _IO_IS_APPENDING)
- if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
- == _IO_pos_BAD && errno != ESPIPE)
- return NULL;
- _IO_link_in ((struct _IO_FILE_plus *) fp);
- return fp;
-}
-
-_IO_FILE *
-_IO_new_file_fopen (fp, filename, mode, is32not64)
- _IO_FILE *fp;
- const char *filename;
- const char *mode;
- int is32not64;
-{
- int oflags = 0, omode;
- int read_write;
- int oprot = 0666;
- int i;
- _IO_FILE *result;
-#if _LIBC
- const char *cs;
-#endif
-
- if (_IO_file_is_open (fp))
- return 0;
- switch (*mode)
- {
- case 'r':
- omode = O_RDONLY;
- read_write = _IO_NO_WRITES;
- break;
- case 'w':
- omode = O_WRONLY;
- oflags = O_CREAT|O_TRUNC;
- read_write = _IO_NO_READS;
- break;
- case 'a':
- omode = O_WRONLY;
- oflags = O_CREAT|O_APPEND;
- read_write = _IO_NO_READS|_IO_IS_APPENDING;
- break;
- default:
- __set_errno (EINVAL);
- return NULL;
- }
- for (i = 1; i < 4; ++i)
- {
- switch (*++mode)
- {
- case '\0':
- break;
- case '+':
- omode = O_RDWR;
- read_write &= _IO_IS_APPENDING;
- continue;
- case 'x':
- oflags |= O_EXCL;
- continue;
- case 'b':
- default:
- /* Ignore. */
- continue;
- }
- break;
- }
-
- result = _IO_file_open (fp, filename, omode|oflags, oprot, read_write,
- is32not64);
-
-
-#if _LIBC
- /* Test whether the mode string specifies the conversion. */
- cs = strstr (mode, ",ccs=");
- if (cs != NULL)
- {
- /* Yep. Load the appropriate conversions and set the orientation
- to wide. */
- struct gconv_fcts fcts;
- struct _IO_codecvt *cc;
-
- if (! _IO_CHECK_WIDE (fp) || __wcsmbs_named_conv (&fcts, cs + 5) != 0)
- {
- /* Something went wrong, we cannot load the conversion modules.
- This means we cannot proceed since the user explicitly asked
- for these. */
- _IO_new_fclose (result);
- return NULL;
- }
-
- cc = fp->_codecvt = &fp->_wide_data->_codecvt;
-
- /* The functions are always the same. */
- *cc = __libio_codecvt;
-
- cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
- cc->__cd_in.__cd.__steps = fcts.towc;
-
- cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
- cc->__cd_in.__cd.__data[0].__internal_use = 1;
- cc->__cd_in.__cd.__data[0].__flags = __GCONV_IS_LAST;
- cc->__cd_in.__cd.__data[0].__statep = &result->_wide_data->_IO_state;
-
- cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */
- cc->__cd_out.__cd.__steps = fcts.tomb;
-
- cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
- cc->__cd_out.__cd.__data[0].__internal_use = 1;
- cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
- cc->__cd_out.__cd.__data[0].__statep = &result->_wide_data->_IO_state;
-
- /* Set the mode now. */
- result->_mode = 1;
- }
-#endif /* GNU libc */
-
- return result;
-}
-
-_IO_FILE *
-_IO_new_file_attach (fp, fd)
- _IO_FILE *fp;
- int fd;
-{
- if (_IO_file_is_open (fp))
- return NULL;
- fp->_fileno = fd;
- fp->_flags &= ~(_IO_NO_READS+_IO_NO_WRITES);
- fp->_flags |= _IO_DELETE_DONT_CLOSE;
- /* Get the current position of the file. */
- /* We have to do that since that may be junk. */
- fp->_offset = _IO_pos_BAD;
- if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
- == _IO_pos_BAD && errno != ESPIPE)
- return NULL;
- return fp;
-}
-
-_IO_FILE *
-_IO_new_file_setbuf (fp, p, len)
- _IO_FILE *fp;
- char *p;
- _IO_ssize_t len;
-{
- if (_IO_default_setbuf (fp, p, len) == NULL)
- return NULL;
-
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
- = fp->_IO_buf_base;
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
-
- return fp;
-}
-
-static int new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
-
-/* Write TO_DO bytes from DATA to FP.
- Then mark FP as having empty buffers. */
-
-int
-_IO_new_do_write (fp, data, to_do)
- _IO_FILE *fp;
- const char *data;
- _IO_size_t to_do;
-{
- return (to_do == 0 || new_do_write (fp, data, to_do) == to_do) ? 0 : EOF;
-}
-
-static
-int
-new_do_write (fp, data, to_do)
- _IO_FILE *fp;
- const char *data;
- _IO_size_t to_do;
-{
- _IO_size_t count;
- if (fp->_flags & _IO_IS_APPENDING)
- /* On a system without a proper O_APPEND implementation,
- you would need to sys_seek(0, SEEK_END) here, but is
- is not needed nor desirable for Unix- or Posix-like systems.
- Instead, just indicate that offset (before and after) is
- unpredictable. */
- fp->_offset = _IO_pos_BAD;
- else if (fp->_IO_read_end != fp->_IO_write_base)
- {
- _IO_off64_t new_pos
- = _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
- if (new_pos == _IO_pos_BAD)
- return 0;
- fp->_offset = new_pos;
- }
- count = _IO_SYSWRITE (fp, data, to_do);
- if (fp->_cur_column && count)
- fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, count) + 1;
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
- fp->_IO_write_end = (fp->_mode < 0
- && (fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
- ? fp->_IO_buf_base : fp->_IO_buf_end);
- return count;
-}
-
-int
-_IO_new_file_underflow (fp)
- _IO_FILE *fp;
-{
- _IO_ssize_t count;
-#if 0
- /* SysV does not make this test; take it out for compatibility */
- if (fp->_flags & _IO_EOF_SEEN)
- return (EOF);
-#endif
-
- if (fp->_flags & _IO_NO_READS)
- {
- fp->_flags |= _IO_ERR_SEEN;
- __set_errno (EBADF);
- return EOF;
- }
- if (fp->_IO_read_ptr < fp->_IO_read_end)
- return *(unsigned char *) fp->_IO_read_ptr;
-
- if (fp->_IO_buf_base == NULL)
- {
- /* Maybe we already have a push back pointer. */
- if (fp->_IO_save_base != NULL)
- {
- free (fp->_IO_save_base);
- fp->_flags &= ~_IO_IN_BACKUP;
- }
- _IO_doallocbuf (fp);
- }
-
- /* Flush all line buffered files before reading. */
- /* FIXME This can/should be moved to genops ?? */
- if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
- _IO_flush_all_linebuffered ();
-
- _IO_switch_to_get_mode (fp);
-
- /* This is very tricky. We have to adjust those
- pointers before we call _IO_SYSREAD () since
- we may longjump () out while waiting for
- input. Those pointers may be screwed up. H.J. */
- fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
- fp->_IO_read_end = fp->_IO_buf_base;
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
- = fp->_IO_buf_base;
-
- count = _IO_SYSREAD (fp, fp->_IO_buf_base,
- fp->_IO_buf_end - fp->_IO_buf_base);
- if (count <= 0)
- {
- if (count == 0)
- fp->_flags |= _IO_EOF_SEEN;
- else
- fp->_flags |= _IO_ERR_SEEN, count = 0;
- }
- fp->_IO_read_end += count;
- if (count == 0)
- return EOF;
- if (fp->_offset != _IO_pos_BAD)
- _IO_pos_adjust (fp->_offset, count);
- return *(unsigned char *) fp->_IO_read_ptr;
-}
-
-int
-_IO_new_file_overflow (f, ch)
- _IO_FILE *f;
- int ch;
-{
- if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
- {
- f->_flags |= _IO_ERR_SEEN;
- __set_errno (EBADF);
- return EOF;
- }
- /* If currently reading or no buffer allocated. */
- if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0 || f->_IO_write_base == 0)
- {
- /* Allocate a buffer if needed. */
- if (f->_IO_write_base == 0)
- {
- _IO_doallocbuf (f);
- _IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
- }
- /* Otherwise must be currently reading.
- If _IO_read_ptr (and hence also _IO_read_end) is at the buffer end,
- logically slide the buffer forwards one block (by setting the
- read pointers to all point at the beginning of the block). This
- makes room for subsequent output.
- Otherwise, set the read pointers to _IO_read_end (leaving that
- alone, so it can continue to correspond to the external position). */
- if (f->_IO_read_ptr == f->_IO_buf_end)
- f->_IO_read_end = f->_IO_read_ptr = f->_IO_buf_base;
- f->_IO_write_ptr = f->_IO_read_ptr;
- f->_IO_write_base = f->_IO_write_ptr;
- f->_IO_write_end = f->_IO_buf_end;
- f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
-
- f->_flags |= _IO_CURRENTLY_PUTTING;
- if (f->_mode < 0 && f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
- f->_IO_write_end = f->_IO_write_ptr;
- }
- if (ch == EOF)
- return _IO_new_do_write(f, f->_IO_write_base,
- f->_IO_write_ptr - f->_IO_write_base);
- if (f->_IO_write_ptr == f->_IO_buf_end ) /* Buffer is really full */
- if (_IO_do_flush (f) == EOF)
- return EOF;
- *f->_IO_write_ptr++ = ch;
- if ((f->_flags & _IO_UNBUFFERED)
- || ((f->_flags & _IO_LINE_BUF) && ch == '\n'))
- if (_IO_new_do_write(f, f->_IO_write_base,
- f->_IO_write_ptr - f->_IO_write_base) == EOF)
- return EOF;
- return (unsigned char) ch;
-}
-
-int
-_IO_new_file_sync (fp)
- _IO_FILE *fp;
-{
- _IO_ssize_t delta;
- int retval = 0;
-
- /* char* ptr = cur_ptr(); */
- if (fp->_IO_write_ptr > fp->_IO_write_base)
- if (_IO_do_flush(fp)) return EOF;
- delta = fp->_IO_read_ptr - fp->_IO_read_end;
- if (delta != 0)
- {
-#ifdef TODO
- if (_IO_in_backup (fp))
- delta -= eGptr () - Gbase ();
-#endif
- _IO_off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
- if (new_pos != (_IO_off64_t) EOF)
- fp->_IO_read_end = fp->_IO_read_ptr;
-#ifdef ESPIPE
- else if (errno == ESPIPE)
- ; /* Ignore error from unseekable devices. */
-#endif
- else
- retval = EOF;
- }
- if (retval != EOF)
- fp->_offset = _IO_pos_BAD;
- /* FIXME: Cleanup - can this be shared? */
- /* setg(base(), ptr, ptr); */
- return retval;
-}
-
-_IO_off64_t
-_IO_new_file_seekoff (fp, offset, dir, mode)
- _IO_FILE *fp;
- _IO_off64_t offset;
- int dir;
- int mode;
-{
- _IO_off64_t result;
- _IO_off64_t delta, new_offset;
- long count;
- /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
- offset of the underlying file must be exact. */
- int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end
- && fp->_IO_write_base == fp->_IO_write_ptr);
-
- if (mode == 0)
- dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
-
- /* Flush unwritten characters.
- (This may do an unneeded write if we seek within the buffer.
- But to be able to switch to reading, we would need to set
- egptr to ptr. That can't be done in the current design,
- which assumes file_ptr() is eGptr. Anyway, since we probably
- end up flushing when we close(), it doesn't make much difference.)
- FIXME: simulate mem-papped files. */
-
- if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
- if (_IO_switch_to_get_mode (fp))
- return EOF;
-
- if (fp->_IO_buf_base == NULL)
- {
- /* It could be that we already have a pushback buffer. */
- if (fp->_IO_read_base != NULL)
- {
- free (fp->_IO_read_base);
- fp->_flags &= ~_IO_IN_BACKUP;
- }
- _IO_doallocbuf (fp);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
- }
-
- switch (dir)
- {
- case _IO_seek_cur:
- /* Adjust for read-ahead (bytes is buffer). */
- offset -= fp->_IO_read_end - fp->_IO_read_ptr;
- if (fp->_offset == _IO_pos_BAD)
- goto dumb;
- /* Make offset absolute, assuming current pointer is file_ptr(). */
- offset += fp->_offset;
-
- dir = _IO_seek_set;
- break;
- case _IO_seek_set:
- break;
- case _IO_seek_end:
- {
- struct _G_stat64 st;
- if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
- {
- offset += st.st_size;
- dir = _IO_seek_set;
- }
- else
- goto dumb;
- }
- }
- /* At this point, dir==_IO_seek_set. */
-
- /* If we are only interested in the current position we've found it now. */
- if (mode == 0)
- return offset;
-
- /* If destination is within current buffer, optimize: */
- if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
- && !_IO_in_backup (fp))
- {
- /* Offset relative to start of main get area. */
- _IO_off64_t rel_offset = (offset - fp->_offset
- + (fp->_IO_read_end - fp->_IO_read_base));
- if (rel_offset >= 0)
- {
-#if 0
- if (_IO_in_backup (fp))
- _IO_switch_to_main_get_area (fp);
-#endif
- if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
- {
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
- fp->_IO_read_end);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- {
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
- }
-#ifdef TODO
- /* If we have streammarkers, seek forward by reading ahead. */
- if (_IO_have_markers (fp))
- {
- int to_skip = rel_offset
- - (fp->_IO_read_ptr - fp->_IO_read_base);
- if (ignore (to_skip) != to_skip)
- goto dumb;
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
-#endif
- }
-#ifdef TODO
- if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
- {
- if (!_IO_in_backup (fp))
- _IO_switch_to_backup_area (fp);
- gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
-#endif
- }
-
-#ifdef TODO
- _IO_unsave_markers (fp);
-#endif
-
- if (fp->_flags & _IO_NO_READS)
- goto dumb;
-
- /* Try to seek to a block boundary, to improve kernel page management. */
- new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1);
- delta = offset - new_offset;
- if (delta > fp->_IO_buf_end - fp->_IO_buf_base)
- {
- new_offset = offset;
- delta = 0;
- }
- result = _IO_SYSSEEK (fp, new_offset, 0);
- if (result < 0)
- return EOF;
- if (delta == 0)
- count = 0;
- else
- {
- count = _IO_SYSREAD (fp, fp->_IO_buf_base,
- (must_be_exact
- ? delta : fp->_IO_buf_end - fp->_IO_buf_base));
- if (count < delta)
- {
- /* We weren't allowed to read, but try to seek the remainder. */
- offset = count == EOF ? delta : delta-count;
- dir = _IO_seek_cur;
- goto dumb;
- }
- }
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
- fp->_IO_buf_base + count);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- fp->_offset = result + count;
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- return offset;
- dumb:
-
- _IO_unsave_markers (fp);
- result = _IO_SYSSEEK (fp, offset, dir);
- if (result != EOF)
- {
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- fp->_offset = result;
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- }
- return result;
-
-resync:
- /* We need to do it since it is possible that the file offset in
- the kernel may be changed behind our back. It may happen when
- we fopen a file and then do a fork. One process may access the
- the file and the kernel file offset will be changed. */
- if (fp->_offset >= 0)
- _IO_SYSSEEK (fp, fp->_offset, 0);
-
- return offset;
-}
-
-_IO_ssize_t
-_IO_file_read (fp, buf, size)
- _IO_FILE *fp;
- void *buf;
- _IO_ssize_t size;
-{
- return read (fp->_fileno, buf, size);
-}
-
-_IO_off64_t
-_IO_file_seek (fp, offset, dir)
- _IO_FILE *fp;
- _IO_off64_t offset;
- int dir;
-{
-#ifdef _G_LSEEK64
- return _G_LSEEK64 (fp->_fileno, offset, dir);
-#else
- return lseek (fp->_fileno, offset, dir);
-#endif
-}
-
-int
-_IO_file_stat (fp, st)
- _IO_FILE *fp;
- void *st;
-{
-#ifdef _G_FSTAT64
- return _G_FSTAT64 (fp->_fileno, (struct _G_stat64 *) st);
-#else
- return fstat (fp->_fileno, (struct stat *) st);
-#endif
-}
-
-int
-_IO_file_close (fp)
- _IO_FILE *fp;
-{
- return close (fp->_fileno);
-}
-
-_IO_ssize_t
-_IO_new_file_write (f, data, n)
- _IO_FILE *f;
- const void *data;
- _IO_ssize_t n;
-{
- _IO_ssize_t to_do = n;
- while (to_do > 0)
- {
- _IO_ssize_t count = write (f->_fileno, data, to_do);
- if (count < 0)
- {
- f->_flags |= _IO_ERR_SEEN;
- break;
- }
- to_do -= count;
- data = (void *) ((char *) data + count);
- }
- n -= to_do;
- if (f->_offset >= 0)
- f->_offset += n;
- return n;
-}
-
-_IO_size_t
-_IO_new_file_xsputn (f, data, n)
- _IO_FILE *f;
- const void *data;
- _IO_size_t n;
-{
- register const char *s = (const char *) data;
- _IO_size_t to_do = n;
- int must_flush = 0;
- _IO_size_t count;
-
- if (n <= 0)
- return 0;
- /* This is an optimized implementation.
- If the amount to be written straddles a block boundary
- (or the filebuf is unbuffered), use sys_write directly. */
-
- /* First figure out how much space is available in the buffer. */
- count = f->_IO_write_end - f->_IO_write_ptr; /* Space available. */
- if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
- {
- count = f->_IO_buf_end - f->_IO_write_ptr;
- if (count >= n)
- {
- register const char *p;
- for (p = s + n; p > s; )
- {
- if (*--p == '\n')
- {
- count = p - s + 1;
- must_flush = 1;
- break;
- }
- }
- }
- }
- /* Then fill the buffer. */
- if (count > 0)
- {
- if (count > to_do)
- count = to_do;
- if (count > 20)
- {
-#ifdef _LIBC
- f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
-#else
- memcpy (f->_IO_write_ptr, s, count);
- f->_IO_write_ptr += count;
-#endif
- s += count;
- }
- else
- {
- register char *p = f->_IO_write_ptr;
- register int i = (int) count;
- while (--i >= 0)
- *p++ = *s++;
- f->_IO_write_ptr = p;
- }
- to_do -= count;
- }
- if (to_do + must_flush > 0)
- {
- _IO_size_t block_size, do_write;
- /* Next flush the (full) buffer. */
- if (_IO_OVERFLOW (f, EOF) == EOF)
- return n - to_do;
-
- /* Try to maintain alignment: write a whole number of blocks.
- dont_write is what gets left over. */
- block_size = f->_IO_buf_end - f->_IO_buf_base;
- do_write = to_do - (block_size >= 128 ? to_do % block_size : 0);
-
- if (do_write)
- {
- count = new_do_write (f, s, do_write);
- to_do -= count;
- if (count < do_write)
- return n - to_do;
- }
-
- /* Now write out the remainder. Normally, this will fit in the
- buffer, but it's somewhat messier for line-buffered files,
- so we let _IO_default_xsputn handle the general case. */
- if (to_do)
- to_do -= _IO_default_xsputn (f, s+do_write, to_do);
- }
- return n - to_do;
-}
-
-_IO_size_t
-_IO_file_xsgetn (fp, data, n)
- _IO_FILE *fp;
- void *data;
- _IO_size_t n;
-{
- register _IO_size_t want, have;
- register _IO_ssize_t count;
- register char *s = data;
-
- want = n;
-
- if (fp->_IO_buf_base == NULL)
- {
- /* Maybe we already have a push back pointer. */
- if (fp->_IO_save_base != NULL)
- {
- free (fp->_IO_save_base);
- fp->_flags &= ~_IO_IN_BACKUP;
- }
- _IO_doallocbuf (fp);
- }
-
- while (want > 0)
- {
- have = fp->_IO_read_end - fp->_IO_read_ptr;
- if (want <= have)
- {
- memcpy (s, fp->_IO_read_ptr, want);
- fp->_IO_read_ptr += want;
- want = 0;
- }
- else
- {
- if (have > 0)
- {
-#ifdef _LIBC
- s = __mempcpy (s, fp->_IO_read_ptr, have);
-#else
- memcpy (s, fp->_IO_read_ptr, have);
- s += have;
-#endif
- want -= have;
- fp->_IO_read_ptr += have;
- }
-
- /* Check for backup and repeat */
- if (_IO_in_backup (fp))
- {
- _IO_switch_to_main_get_area (fp);
- continue;
- }
-
- /* If we now want less than a buffer, underflow and repeat
- the copy. Otherwise, _IO_SYSREAD directly to
- the user buffer. */
- if (fp->_IO_buf_base && want < fp->_IO_buf_end - fp->_IO_buf_base)
- {
- if (__underflow (fp) == EOF)
- break;
-
- continue;
- }
-
- /* These must be set before the sysread as we might longjmp out
- waiting for input. */
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
-
- /* Try to maintain alignment: read a whole number of blocks. */
- count = want;
- if (fp->_IO_buf_base)
- {
- _IO_size_t block_size = fp->_IO_buf_end - fp->_IO_buf_base;
- if (block_size >= 128)
- count -= want % block_size;
- }
-
- count = _IO_SYSREAD (fp, s, count);
- if (count <= 0)
- {
- if (count == 0)
- fp->_flags |= _IO_EOF_SEEN;
- else
- fp->_flags |= _IO_ERR_SEEN;
-
- break;
- }
-
- s += count;
- want -= count;
- if (fp->_offset != _IO_pos_BAD)
- _IO_pos_adjust (fp->_offset, count);
- }
- }
-
- return n - want;
-}
-
-struct _IO_jump_t _IO_file_jumps =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_new_file_finish),
- JUMP_INIT(overflow, _IO_new_file_overflow),
- JUMP_INIT(underflow, _IO_new_file_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_new_file_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn),
- JUMP_INIT(seekoff, _IO_new_file_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_new_file_setbuf),
- JUMP_INIT(sync, _IO_new_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-
-#ifdef _LIBC
-versioned_symbol (libc, _IO_new_do_write, _IO_do_write, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_attach, _IO_file_attach, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_close_it, _IO_file_close_it, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_finish, _IO_file_finish, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_fopen, _IO_file_fopen, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_init, _IO_file_init, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_setbuf, _IO_file_setbuf, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_sync, _IO_file_sync, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_overflow, _IO_file_overflow, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
-#endif
diff --git a/contrib/libstdc++/libio/genops.c b/contrib/libstdc++/libio/genops.c
deleted file mode 100644
index b1ae5af..0000000
--- a/contrib/libstdc++/libio/genops.c
+++ /dev/null
@@ -1,1123 +0,0 @@
-/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-/* Generic or default I/O operations. */
-
-#include "libioP.h"
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#include <string.h>
-
-#ifdef _IO_MTSAFE_IO
-static _IO_lock_t list_all_lock = _IO_lock_initializer;
-#endif
-
-void
-_IO_un_link (fp)
- struct _IO_FILE_plus *fp;
-{
- if (fp->file._flags & _IO_LINKED)
- {
- struct _IO_FILE_plus **f;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_lock (list_all_lock);
-#endif
- for (f = &_IO_list_all; *f; f = (struct _IO_FILE_plus **) &(*f)->file._chain)
- {
- if (*f == fp)
- {
- *f = (struct _IO_FILE_plus *) fp->file._chain;
- break;
- }
- }
-#ifdef _IO_MTSAFE_IO
- _IO_lock_unlock (list_all_lock);
-#endif
- fp->file._flags &= ~_IO_LINKED;
- }
-}
-
-void
-_IO_link_in (fp)
- struct _IO_FILE_plus *fp;
-{
- if ((fp->file._flags & _IO_LINKED) == 0)
- {
- fp->file._flags |= _IO_LINKED;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_lock (list_all_lock);
-#endif
- fp->file._chain = (_IO_FILE *) _IO_list_all;
- _IO_list_all = fp;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_unlock (list_all_lock);
-#endif
- }
-}
-
-/* Return minimum _pos markers
- Assumes the current get area is the main get area. */
-_IO_ssize_t _IO_least_marker __P ((_IO_FILE *fp, char *end_p));
-
-_IO_ssize_t
-_IO_least_marker (fp, end_p)
- _IO_FILE *fp;
- char *end_p;
-{
- _IO_ssize_t least_so_far = end_p - fp->_IO_read_base;
- struct _IO_marker *mark;
- for (mark = fp->_markers; mark != NULL; mark = mark->_next)
- if (mark->_pos < least_so_far)
- least_so_far = mark->_pos;
- return least_so_far;
-}
-
-/* Switch current get area from backup buffer to (start of) main get area. */
-
-void
-_IO_switch_to_main_get_area (fp)
- _IO_FILE *fp;
-{
- char *tmp;
- fp->_flags &= ~_IO_IN_BACKUP;
- /* Swap _IO_read_end and _IO_save_end. */
- tmp = fp->_IO_read_end;
- fp->_IO_read_end = fp->_IO_save_end;
- fp->_IO_save_end= tmp;
- /* Swap _IO_read_base and _IO_save_base. */
- tmp = fp->_IO_read_base;
- fp->_IO_read_base = fp->_IO_save_base;
- fp->_IO_save_base = tmp;
- /* Set _IO_read_ptr. */
- fp->_IO_read_ptr = fp->_IO_read_base;
-}
-
-/* Switch current get area from main get area to (end of) backup area. */
-
-void
-_IO_switch_to_backup_area (fp)
- _IO_FILE *fp;
-{
- char *tmp;
- fp->_flags |= _IO_IN_BACKUP;
- /* Swap _IO_read_end and _IO_save_end. */
- tmp = fp->_IO_read_end;
- fp->_IO_read_end = fp->_IO_save_end;
- fp->_IO_save_end = tmp;
- /* Swap _IO_read_base and _IO_save_base. */
- tmp = fp->_IO_read_base;
- fp->_IO_read_base = fp->_IO_save_base;
- fp->_IO_save_base = tmp;
- /* Set _IO_read_ptr. */
- fp->_IO_read_ptr = fp->_IO_read_end;
-}
-
-int
-_IO_switch_to_get_mode (fp)
- _IO_FILE *fp;
-{
- if (fp->_IO_write_ptr > fp->_IO_write_base)
- if (_IO_OVERFLOW (fp, EOF) == EOF)
- return EOF;
- if (_IO_in_backup (fp))
- fp->_IO_read_base = fp->_IO_backup_base;
- else
- {
- fp->_IO_read_base = fp->_IO_buf_base;
- if (fp->_IO_write_ptr > fp->_IO_read_end)
- fp->_IO_read_end = fp->_IO_write_ptr;
- }
- fp->_IO_read_ptr = fp->_IO_write_ptr;
-
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = fp->_IO_read_ptr;
-
- fp->_flags &= ~_IO_CURRENTLY_PUTTING;
- return 0;
-}
-
-void
-_IO_free_backup_area (fp)
- _IO_FILE *fp;
-{
- if (_IO_in_backup (fp))
- _IO_switch_to_main_get_area (fp); /* Just in case. */
- free (fp->_IO_save_base);
- fp->_IO_save_base = NULL;
- fp->_IO_save_end = NULL;
- fp->_IO_backup_base = NULL;
-}
-
-#if 0
-int
-_IO_switch_to_put_mode (fp)
- _IO_FILE *fp;
-{
- fp->_IO_write_base = fp->_IO_read_ptr;
- fp->_IO_write_ptr = fp->_IO_read_ptr;
- /* Following is wrong if line- or un-buffered? */
- fp->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
- ? fp->_IO_read_end : fp->_IO_buf_end);
-
- fp->_IO_read_ptr = fp->_IO_read_end;
- fp->_IO_read_base = fp->_IO_read_end;
-
- fp->_flags |= _IO_CURRENTLY_PUTTING;
- return 0;
-}
-#endif
-
-int
-__overflow (f, ch)
- _IO_FILE *f;
- int ch;
-{
- /* This is a single-byte stream. */
- if (f->_mode == 0)
- _IO_fwide (f, -1);
- return _IO_OVERFLOW (f, ch);
-}
-
-static int save_for_backup __P ((_IO_FILE *fp, char *end_p))
-#ifdef _LIBC
- internal_function
-#endif
- ;
-
-static int
-#ifdef _LIBC
-internal_function
-#endif
-save_for_backup (fp, end_p)
- _IO_FILE *fp;
- char *end_p;
-{
- /* Append [_IO_read_base..end_p] to backup area. */
- _IO_ssize_t least_mark = _IO_least_marker (fp, end_p);
- /* needed_size is how much space we need in the backup area. */
- _IO_size_t needed_size = (end_p - fp->_IO_read_base) - least_mark;
- /* FIXME: Dubious arithmetic if pointers are NULL */
- _IO_size_t current_Bsize = fp->_IO_save_end - fp->_IO_save_base;
- _IO_size_t avail; /* Extra space available for future expansion. */
- _IO_ssize_t delta;
- struct _IO_marker *mark;
- if (needed_size > current_Bsize)
- {
- char *new_buffer;
- avail = 100;
- new_buffer = (char *) malloc (avail + needed_size);
- if (new_buffer == NULL)
- return EOF; /* FIXME */
- if (least_mark < 0)
- {
-#ifdef _LIBC
- __mempcpy (__mempcpy (new_buffer + avail,
- fp->_IO_save_end + least_mark,
- -least_mark),
- fp->_IO_read_base,
- end_p - fp->_IO_read_base);
-#else
- memcpy (new_buffer + avail,
- fp->_IO_save_end + least_mark,
- -least_mark);
- memcpy (new_buffer + avail - least_mark,
- fp->_IO_read_base,
- end_p - fp->_IO_read_base);
-#endif
- }
- else
- memcpy (new_buffer + avail,
- fp->_IO_read_base + least_mark,
- needed_size);
- if (fp->_IO_save_base)
- free (fp->_IO_save_base);
- fp->_IO_save_base = new_buffer;
- fp->_IO_save_end = new_buffer + avail + needed_size;
- }
- else
- {
- avail = current_Bsize - needed_size;
- if (least_mark < 0)
- {
- memmove (fp->_IO_save_base + avail,
- fp->_IO_save_end + least_mark,
- -least_mark);
- memcpy (fp->_IO_save_base + avail - least_mark,
- fp->_IO_read_base,
- end_p - fp->_IO_read_base);
- }
- else if (needed_size > 0)
- memcpy (fp->_IO_save_base + avail,
- fp->_IO_read_base + least_mark,
- needed_size);
- }
- fp->_IO_backup_base = fp->_IO_save_base + avail;
- /* Adjust all the streammarkers. */
- delta = end_p - fp->_IO_read_base;
- for (mark = fp->_markers; mark != NULL; mark = mark->_next)
- mark->_pos -= delta;
- return 0;
-}
-
-int
-__underflow (fp)
- _IO_FILE *fp;
-{
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
- return EOF;
-#endif
-
- if (fp->_mode == 0)
- _IO_fwide (fp, -1);
- if (_IO_in_put_mode (fp))
- if (_IO_switch_to_get_mode (fp) == EOF)
- return EOF;
- if (fp->_IO_read_ptr < fp->_IO_read_end)
- return *(unsigned char *) fp->_IO_read_ptr;
- if (_IO_in_backup (fp))
- {
- _IO_switch_to_main_get_area (fp);
- if (fp->_IO_read_ptr < fp->_IO_read_end)
- return *(unsigned char *) fp->_IO_read_ptr;
- }
- if (_IO_have_markers (fp))
- {
- if (save_for_backup (fp, fp->_IO_read_end))
- return EOF;
- }
- else if (_IO_have_backup (fp))
- _IO_free_backup_area (fp);
- return _IO_UNDERFLOW (fp);
-}
-
-int
-__uflow (fp)
- _IO_FILE *fp;
-{
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
- return EOF;
-#endif
-
- if (fp->_mode == 0)
- _IO_fwide (fp, -11);
- if (_IO_in_put_mode (fp))
- if (_IO_switch_to_get_mode (fp) == EOF)
- return EOF;
- if (fp->_IO_read_ptr < fp->_IO_read_end)
- return *(unsigned char *) fp->_IO_read_ptr++;
- if (_IO_in_backup (fp))
- {
- _IO_switch_to_main_get_area (fp);
- if (fp->_IO_read_ptr < fp->_IO_read_end)
- return *(unsigned char *) fp->_IO_read_ptr++;
- }
- if (_IO_have_markers (fp))
- {
- if (save_for_backup (fp, fp->_IO_read_end))
- return EOF;
- }
- else if (_IO_have_backup (fp))
- _IO_free_backup_area (fp);
- return _IO_UFLOW (fp);
-}
-
-void
-_IO_setb (f, b, eb, a)
- _IO_FILE *f;
- char *b;
- char *eb;
- int a;
-{
- if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
- FREE_BUF (f->_IO_buf_base, _IO_blen (f));
- f->_IO_buf_base = b;
- f->_IO_buf_end = eb;
- if (a)
- f->_flags &= ~_IO_USER_BUF;
- else
- f->_flags |= _IO_USER_BUF;
-}
-
-void
-_IO_doallocbuf (fp)
- _IO_FILE *fp;
-{
- if (fp->_IO_buf_base)
- return;
- if (!(fp->_flags & _IO_UNBUFFERED))
- if (_IO_DOALLOCATE (fp) != EOF)
- return;
- _IO_setb (fp, fp->_shortbuf, fp->_shortbuf+1, 0);
-}
-
-int
-_IO_default_underflow (fp)
- _IO_FILE *fp;
-{
- return EOF;
-}
-
-int
-_IO_default_uflow (fp)
- _IO_FILE *fp;
-{
- int ch = _IO_UNDERFLOW (fp);
- if (ch == EOF)
- return EOF;
- return *(unsigned char *) fp->_IO_read_ptr++;
-}
-
-_IO_size_t
-_IO_default_xsputn (f, data, n)
- _IO_FILE *f;
- const void *data;
- _IO_size_t n;
-{
- const char *s = (char *) data;
- _IO_size_t more = n;
- if (more <= 0)
- return 0;
- for (;;)
- {
- /* Space available. */
- _IO_ssize_t count = f->_IO_write_end - f->_IO_write_ptr;
- if (count > 0)
- {
- if ((_IO_size_t) count > more)
- count = more;
- if (count > 20)
- {
-#ifdef _LIBC
- f->_IO_write_ptr = __mempcpy (f->_IO_write_ptr, s, count);
-#else
- memcpy (f->_IO_write_ptr, s, count);
- f->_IO_write_ptr += count;
-#endif
- s += count;
- }
- else if (count <= 0)
- count = 0;
- else
- {
- char *p = f->_IO_write_ptr;
- _IO_ssize_t i;
- for (i = count; --i >= 0; )
- *p++ = *s++;
- f->_IO_write_ptr = p;
- }
- more -= count;
- }
- if (more == 0 || _IO_OVERFLOW (f, (unsigned char) *s++) == EOF)
- break;
- more--;
- }
- return n - more;
-}
-
-_IO_size_t
-_IO_sgetn (fp, data, n)
- _IO_FILE *fp;
- void *data;
- _IO_size_t n;
-{
- /* FIXME handle putback buffer here! */
- return _IO_XSGETN (fp, data, n);
-}
-
-_IO_size_t
-_IO_default_xsgetn (fp, data, n)
- _IO_FILE *fp;
- void *data;
- _IO_size_t n;
-{
- _IO_size_t more = n;
- char *s = (char*) data;
- for (;;)
- {
- /* Data available. */
- _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr;
- if (count > 0)
- {
- if ((_IO_size_t) count > more)
- count = more;
- if (count > 20)
- {
-#ifdef _LIBC
- s = __mempcpy (s, fp->_IO_read_ptr, count);
-#else
- memcpy (s, fp->_IO_read_ptr, count);
- s += count;
-#endif
- fp->_IO_read_ptr += count;
- }
- else if (count <= 0)
- count = 0;
- else
- {
- char *p = fp->_IO_read_ptr;
- int i = (int) count;
- while (--i >= 0)
- *s++ = *p++;
- fp->_IO_read_ptr = p;
- }
- more -= count;
- }
- if (more == 0 || __underflow (fp) == EOF)
- break;
- }
- return n - more;
-}
-
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_sync (fp)
- _IO_FILE *fp;
-{
- return 0;
-}
-#endif
-
-_IO_FILE *
-_IO_default_setbuf (fp, p, len)
- _IO_FILE *fp;
- char *p;
- _IO_ssize_t len;
-{
- if (_IO_SYNC (fp) == EOF)
- return NULL;
- if (p == NULL || len == 0)
- {
- fp->_flags |= _IO_UNBUFFERED;
- _IO_setb (fp, fp->_shortbuf, fp->_shortbuf+1, 0);
- }
- else
- {
- fp->_flags &= ~_IO_UNBUFFERED;
- _IO_setb (fp, p, p+len, 0);
- }
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = 0;
- fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end = 0;
- return fp;
-}
-
-_IO_off64_t
-_IO_default_seekpos (fp, pos, mode)
- _IO_FILE *fp;
- _IO_off64_t pos;
- int mode;
-{
- return _IO_SEEKOFF (fp, pos, 0, mode);
-}
-
-int
-_IO_default_doallocate (fp)
- _IO_FILE *fp;
-{
- char *buf;
-
- ALLOC_BUF (buf, _IO_BUFSIZ, EOF);
- _IO_setb (fp, buf, buf+_IO_BUFSIZ, 1);
- return 1;
-}
-
-void
-_IO_init (fp, flags)
- _IO_FILE *fp;
- int flags;
-{
- _IO_no_init (fp, flags, -1, NULL, NULL);
-}
-
-void
-_IO_no_init (fp, flags, orientation, wd, jmp)
- _IO_FILE *fp;
- int flags;
- int orientation;
- struct _IO_wide_data *wd;
- struct _IO_jump_t *jmp;
-{
- fp->_flags = _IO_MAGIC|flags;
- fp->_IO_buf_base = NULL;
- fp->_IO_buf_end = NULL;
- fp->_IO_read_base = NULL;
- fp->_IO_read_ptr = NULL;
- fp->_IO_read_end = NULL;
- fp->_IO_write_base = NULL;
- fp->_IO_write_ptr = NULL;
- fp->_IO_write_end = NULL;
- fp->_chain = NULL; /* Not necessary. */
-
- fp->_IO_save_base = NULL;
- fp->_IO_backup_base = NULL;
- fp->_IO_save_end = NULL;
- fp->_markers = NULL;
- fp->_cur_column = 0;
-#if _IO_JUMPS_OFFSET
- fp->_vtable_offset = 0;
-#endif
-#ifdef _IO_MTSAFE_IO
- _IO_lock_init (*fp->_lock);
-#endif
- fp->_mode = orientation;
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- if (orientation >= 0)
- {
- fp->_wide_data = wd;
- fp->_wide_data->_IO_buf_base = NULL;
- fp->_wide_data->_IO_buf_end = NULL;
- fp->_wide_data->_IO_read_base = NULL;
- fp->_wide_data->_IO_read_ptr = NULL;
- fp->_wide_data->_IO_read_end = NULL;
- fp->_wide_data->_IO_write_base = NULL;
- fp->_wide_data->_IO_write_ptr = NULL;
- fp->_wide_data->_IO_write_end = NULL;
- fp->_wide_data->_IO_save_base = NULL;
- fp->_wide_data->_IO_backup_base = NULL;
- fp->_wide_data->_IO_save_end = NULL;
-
- fp->_wide_data->_wide_vtable = jmp;
- }
-#endif
-}
-
-int
-_IO_default_sync (fp)
- _IO_FILE *fp;
-{
- return 0;
-}
-
-/* The way the C++ classes are mapped into the C functions in the
- current implementation, this function can get called twice! */
-
-void
-_IO_default_finish (fp, dummy)
- _IO_FILE *fp;
- int dummy;
-{
- struct _IO_marker *mark;
- if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
- {
- FREE_BUF (fp->_IO_buf_base, _IO_blen (fp));
- fp->_IO_buf_base = fp->_IO_buf_end = NULL;
- }
-
- for (mark = fp->_markers; mark != NULL; mark = mark->_next)
- mark->_sbuf = NULL;
-
- if (fp->_IO_save_base)
- {
- free (fp->_IO_save_base);
- fp->_IO_save_base = NULL;
- }
-
-#ifdef _IO_MTSAFE_IO
- _IO_lock_fini (*fp->_lock);
-#endif
-
- _IO_un_link ((struct _IO_FILE_plus *) fp);
-}
-
-_IO_off64_t
-_IO_default_seekoff (fp, offset, dir, mode)
- _IO_FILE *fp;
- _IO_off64_t offset;
- int dir;
- int mode;
-{
- return _IO_pos_BAD;
-}
-
-int
-_IO_sputbackc (fp, c)
- _IO_FILE *fp;
- int c;
-{
- int result;
-
- if (fp->_IO_read_ptr > fp->_IO_read_base
- && (unsigned char)fp->_IO_read_ptr[-1] == (unsigned char)c)
- {
- fp->_IO_read_ptr--;
- result = (unsigned char) c;
- }
- else
- result = _IO_PBACKFAIL (fp, c);
-
- if (result != EOF)
- fp->_flags &= ~_IO_EOF_SEEN;
-
- return result;
-}
-
-int
-_IO_sungetc (fp)
- _IO_FILE *fp;
-{
- int result;
-
- if (fp->_IO_read_ptr > fp->_IO_read_base)
- {
- fp->_IO_read_ptr--;
- result = (unsigned char) *fp->_IO_read_ptr;
- }
- else
- result = _IO_PBACKFAIL (fp, EOF);
-
- if (result != EOF)
- fp->_flags &= ~_IO_EOF_SEEN;
-
- return result;
-}
-
-#if 0 /* Work in progress */
-/* Seems not to be needed. */
-#if 0
-void
-_IO_set_column (fp, c)
- _IO_FILE *fp;
- int c;
-{
- if (c == -1)
- fp->_column = -1;
- else
- fp->_column = c - (fp->_IO_write_ptr - fp->_IO_write_base);
-}
-#else
-int
-_IO_set_column (fp, i)
- _IO_FILE *fp;
- int i;
-{
- fp->_cur_column = i + 1;
- return 0;
-}
-#endif
-#endif
-
-
-unsigned
-_IO_adjust_column (start, line, count)
- unsigned start;
- const char *line;
- int count;
-{
- const char *ptr = line + count;
- while (ptr > line)
- if (*--ptr == '\n')
- return line + count - ptr - 1;
- return start + count;
-}
-
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_get_column (fp)
- _IO_FILE *fp;
-{
- if (fp->_cur_column)
- return _IO_adjust_column (fp->_cur_column - 1,
- fp->_IO_write_base,
- fp->_IO_write_ptr - fp->_IO_write_base);
- return -1;
-}
-#endif
-
-int
-_IO_flush_all ()
-{
- int result = 0;
- struct _IO_FILE *fp;
- for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
- if (((fp->_mode < 0 && fp->_IO_write_ptr > fp->_IO_write_base)
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- || (fp->_vtable_offset == 0
- && fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
- > fp->_wide_data->_IO_write_base))
-#endif
- )
- && _IO_OVERFLOW (fp, EOF) == EOF)
- result = EOF;
- return result;
-}
-
-void
-_IO_flush_all_linebuffered ()
-{
- struct _IO_FILE *fp;
- for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
- if ((fp->_flags & _IO_NO_WRITES) == 0 && fp->_flags & _IO_LINE_BUF)
- _IO_OVERFLOW (fp, EOF);
-}
-
-static void _IO_unbuffer_write __P ((void));
-
-static void
-_IO_unbuffer_write ()
-{
- struct _IO_FILE *fp;
- for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
- if (! (fp->_flags & _IO_UNBUFFERED)
- && (! (fp->_flags & _IO_NO_WRITES)
- || (fp->_flags & _IO_IS_APPENDING))
- /* Iff stream is un-orientated, it wasn't used. */
- && fp->_mode != 0)
- _IO_SETBUF (fp, NULL, 0);
-}
-
-int
-_IO_cleanup ()
-{
- int result = _IO_flush_all ();
-
- /* We currently don't have a reliable mechanism for making sure that
- C++ static destructors are executed in the correct order.
- So it is possible that other static destructors might want to
- write to cout - and they're supposed to be able to do so.
-
- The following will make the standard streambufs be unbuffered,
- which forces any output from late destructors to be written out. */
- _IO_unbuffer_write ();
-
- return result;
-}
-
-
-void
-_IO_init_marker (marker, fp)
- struct _IO_marker *marker;
- _IO_FILE *fp;
-{
- marker->_sbuf = fp;
- if (_IO_in_put_mode (fp))
- _IO_switch_to_get_mode (fp);
- if (_IO_in_backup (fp))
- marker->_pos = fp->_IO_read_ptr - fp->_IO_read_end;
- else
- marker->_pos = fp->_IO_read_ptr - fp->_IO_read_base;
-
- /* Should perhaps sort the chain? */
- marker->_next = fp->_markers;
- fp->_markers = marker;
-}
-
-void
-_IO_remove_marker (marker)
- struct _IO_marker *marker;
-{
- /* Unlink from sb's chain. */
- struct _IO_marker **ptr = &marker->_sbuf->_markers;
- for (; ; ptr = &(*ptr)->_next)
- {
- if (*ptr == NULL)
- break;
- else if (*ptr == marker)
- {
- *ptr = marker->_next;
- return;
- }
- }
-#if 0
- if _sbuf has a backup area that is no longer needed, should we delete
- it now, or wait until the next underflow?
-#endif
-}
-
-#define BAD_DELTA EOF
-
-int
-_IO_marker_difference (mark1, mark2)
- struct _IO_marker *mark1;
- struct _IO_marker *mark2;
-{
- return mark1->_pos - mark2->_pos;
-}
-
-/* Return difference between MARK and current position of MARK's stream. */
-int
-_IO_marker_delta (mark)
- struct _IO_marker *mark;
-{
- int cur_pos;
- if (mark->_sbuf == NULL)
- return BAD_DELTA;
- if (_IO_in_backup (mark->_sbuf))
- cur_pos = mark->_sbuf->_IO_read_ptr - mark->_sbuf->_IO_read_end;
- else
- cur_pos = mark->_sbuf->_IO_read_ptr - mark->_sbuf->_IO_read_base;
- return mark->_pos - cur_pos;
-}
-
-int
-_IO_seekmark (fp, mark, delta)
- _IO_FILE *fp;
- struct _IO_marker *mark;
- int delta;
-{
- if (mark->_sbuf != fp)
- return EOF;
- if (mark->_pos >= 0)
- {
- if (_IO_in_backup (fp))
- _IO_switch_to_main_get_area (fp);
- fp->_IO_read_ptr = fp->_IO_read_base + mark->_pos;
- }
- else
- {
- if (!_IO_in_backup (fp))
- _IO_switch_to_backup_area (fp);
- fp->_IO_read_ptr = fp->_IO_read_end + mark->_pos;
- }
- return 0;
-}
-
-void
-_IO_unsave_markers (fp)
- _IO_FILE *fp;
-{
- struct _IO_marker *mark = fp->_markers;
- if (mark)
- {
-#ifdef TODO
- streampos offset = seekoff (0, ios::cur, ios::in);
- if (offset != EOF)
- {
- offset += eGptr () - Gbase ();
- for ( ; mark != NULL; mark = mark->_next)
- mark->set_streampos (mark->_pos + offset);
- }
- else
- {
- for ( ; mark != NULL; mark = mark->_next)
- mark->set_streampos (EOF);
- }
-#endif
- fp->_markers = 0;
- }
-
- if (_IO_have_backup (fp))
- _IO_free_backup_area (fp);
-}
-
-#if 0
-/* Seems not to be needed. --drepper */
-int
-_IO_nobackup_pbackfail (fp, c)
- _IO_FILE *fp;
- int c;
-{
- if (fp->_IO_read_ptr > fp->_IO_read_base)
- fp->_IO_read_ptr--;
- if (c != EOF && *fp->_IO_read_ptr != c)
- *fp->_IO_read_ptr = c;
- return (unsigned char) c;
-}
-#endif
-
-int
-_IO_default_pbackfail (fp, c)
- _IO_FILE *fp;
- int c;
-{
- if (fp->_IO_read_ptr > fp->_IO_read_base && !_IO_in_backup (fp)
- && (unsigned char) fp->_IO_read_ptr[-1] == c)
- --fp->_IO_read_ptr;
- else
- {
- /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/
- if (!_IO_in_backup (fp))
- {
- /* We need to keep the invariant that the main get area
- logically follows the backup area. */
- if (fp->_IO_read_ptr > fp->_IO_read_base && _IO_have_backup (fp))
- {
- if (save_for_backup (fp, fp->_IO_read_ptr))
- return EOF;
- }
- else if (!_IO_have_backup (fp))
- {
- /* No backup buffer: allocate one. */
- /* Use nshort buffer, if unused? (probably not) FIXME */
- int backup_size = 128;
- char *bbuf = (char *) malloc (backup_size);
- if (bbuf == NULL)
- return EOF;
- fp->_IO_save_base = bbuf;
- fp->_IO_save_end = fp->_IO_save_base + backup_size;
- fp->_IO_backup_base = fp->_IO_save_end;
- }
- fp->_IO_read_base = fp->_IO_read_ptr;
- _IO_switch_to_backup_area (fp);
- }
- else if (fp->_IO_read_ptr <= fp->_IO_read_base)
- {
- /* Increase size of existing backup buffer. */
- _IO_size_t new_size;
- _IO_size_t old_size = fp->_IO_read_end - fp->_IO_read_base;
- char *new_buf;
- new_size = 2 * old_size;
- new_buf = (char *) malloc (new_size);
- if (new_buf == NULL)
- return EOF;
- memcpy (new_buf + (new_size - old_size), fp->_IO_read_base,
- old_size);
- free (fp->_IO_read_base);
- _IO_setg (fp, new_buf, new_buf + (new_size - old_size),
- new_buf + new_size);
- fp->_IO_backup_base = fp->_IO_read_ptr;
- }
-
- *--fp->_IO_read_ptr = c;
- }
- return (unsigned char) c;
-}
-
-_IO_off64_t
-_IO_default_seek (fp, offset, dir)
- _IO_FILE *fp;
- _IO_off64_t offset;
- int dir;
-{
- return _IO_pos_BAD;
-}
-
-int
-_IO_default_stat (fp, st)
- _IO_FILE *fp;
- void* st;
-{
- return EOF;
-}
-
-_IO_ssize_t
-_IO_default_read (fp, data, n)
- _IO_FILE* fp;
- void *data;
- _IO_ssize_t n;
-{
- return -1;
-}
-
-_IO_ssize_t
-_IO_default_write (fp, data, n)
- _IO_FILE *fp;
- const void *data;
- _IO_ssize_t n;
-{
- return 0;
-}
-
-int
-_IO_default_showmanyc (fp)
- _IO_FILE *fp;
-{
- return -1;
-}
-
-void
-_IO_default_imbue (fp, locale)
- _IO_FILE *fp;
- void *locale;
-{
-}
-
-_IO_ITER
-_IO_iter_begin()
-{
- return (_IO_ITER) _IO_list_all;
-}
-
-_IO_ITER
-_IO_iter_end()
-{
- return NULL;
-}
-
-_IO_ITER
-_IO_iter_next(iter)
- _IO_ITER iter;
-{
- return iter->_chain;
-}
-
-_IO_FILE *
-_IO_iter_file(iter)
- _IO_ITER iter;
-{
- return iter;
-}
-
-void
-_IO_list_lock()
-{
-#ifdef _IO_MTSAFE_IO
- _IO_lock_lock (list_all_lock);
-#endif
-}
-
-void
-_IO_list_unlock()
-{
-#ifdef _IO_MTSAFE_IO
- _IO_lock_unlock (list_all_lock);
-#endif
-}
-
-void
-_IO_list_resetlock()
-{
-#ifdef _IO_MTSAFE_IO
- _IO_lock_init (list_all_lock);
-#endif
-}
-
-
-#ifdef TODO
-#if defined(linux)
-#define IO_CLEANUP ;
-#endif
-
-#ifdef IO_CLEANUP
- IO_CLEANUP
-#else
-struct __io_defs {
- __io_defs() { }
- ~__io_defs() { _IO_cleanup (); }
-};
-__io_defs io_defs__;
-#endif
-
-#endif /* TODO */
-
-#ifdef weak_alias
-weak_alias (_IO_cleanup, _cleanup)
-#endif
-
-#ifdef text_set_element
-text_set_element(__libc_atexit, _cleanup);
-#endif
diff --git a/contrib/libstdc++/libio/iofclose.c b/contrib/libstdc++/libio/iofclose.c
deleted file mode 100644
index 43a3f58..0000000
--- a/contrib/libstdc++/libio/iofclose.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Copyright (C) 1993, 1995, 1997-1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-#include "libioP.h"
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#if _LIBC
-# include "../iconv/gconv_int.h"
-# include <shlib-compat.h>
-#else
-# define SHLIB_COMPAT(a, b, c) 0
-# define _IO_new_fclose fclose
-#endif
-
-int
-_IO_new_fclose (fp)
- _IO_FILE *fp;
-{
- int status;
-
- CHECK_FILE(fp, EOF);
-
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
- /* We desperately try to help programs which are using streams in a
- strange way and mix old and new functions. Detect old streams
- here. */
- if (fp->_vtable_offset != 0)
- return _IO_old_fclose (fp);
-#endif
-
- _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
- _IO_flockfile (fp);
- if (fp->_IO_file_flags & _IO_IS_FILEBUF)
- status = _IO_file_close_it (fp);
- else
- status = fp->_flags & _IO_ERR_SEEN ? -1 : 0;
- _IO_FINISH (fp);
- _IO_funlockfile (fp);
- if (fp->_mode > 0)
- {
-#if _LIBC
- /* This stream has a wide orientation. This means we have to free
- the conversion functions. */
- struct _IO_codecvt *cc = fp->_codecvt;
-
- if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL)
- {
- --cc->__cd_in.__cd.__steps->__counter;
- __gconv_close_transform (cc->__cd_in.__cd.__steps, 1);
- }
- if (cc->__cd_out.__cd.__steps->__shlib_handle != NULL)
- {
- --cc->__cd_out.__cd.__steps->__counter;
- __gconv_close_transform (cc->__cd_out.__cd.__steps, 1);
- }
-#endif
- }
- _IO_cleanup_region_end (0);
- if (_IO_have_backup (fp))
- _IO_free_backup_area (fp);
- if (fp != _IO_stdin && fp != _IO_stdout && fp != _IO_stderr)
- {
- fp->_IO_file_flags = 0;
- free(fp);
- }
-
- return status;
-}
-
-#ifdef _LIBC
-versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1);
-strong_alias (_IO_new_fclose, __new_fclose)
-versioned_symbol (libc, __new_fclose, fclose, GLIBC_2_1);
-#endif
diff --git a/contrib/libstdc++/libio/iofopen.c b/contrib/libstdc++/libio/iofopen.c
deleted file mode 100644
index 2dcdee0..0000000
--- a/contrib/libstdc++/libio/iofopen.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-#include "libioP.h"
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#ifdef _LIBC
-# include <shlib-compat.h>
-#else
-# define _IO_new_fopen fopen
-#endif
-
-_IO_FILE *
-_IO_new_fopen (filename, mode)
- const char *filename;
- const char *mode;
-{
- struct locked_FILE
- {
- struct _IO_FILE_plus fp;
-#ifdef _IO_MTSAFE_IO
- _IO_lock_t lock;
-#endif
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- struct _IO_wide_data wd;
-#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
- } *new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
-
- if (new_f == NULL)
- return NULL;
-#ifdef _IO_MTSAFE_IO
- new_f->fp.file._lock = &new_f->lock;
-#endif
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
-#else
- _IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL);
-#endif
- _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
- _IO_file_init (&new_f->fp);
-#if !_IO_UNIFIED_JUMPTABLES
- new_f->fp.vtable = NULL;
-#endif
- if (_IO_file_fopen ((_IO_FILE *) new_f, filename, mode, 1) != NULL)
- return (_IO_FILE *) &new_f->fp;
- _IO_un_link (&new_f->fp);
- free (new_f);
- return NULL;
-}
-
-#ifdef _LIBC
-strong_alias (_IO_new_fopen, __new_fopen)
-versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1);
-versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
-#endif
diff --git a/contrib/libstdc++/libio/iofwide.c b/contrib/libstdc++/libio/iofwide.c
deleted file mode 100644
index 76a20ce..0000000
--- a/contrib/libstdc++/libio/iofwide.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-#include <libioP.h>
-#ifdef _LIBC
-# include <dlfcn.h>
-# include <wchar.h>
-# include <locale/localeinfo.h>
-# include <wcsmbs/wcsmbsload.h>
-# include <iconv/gconv_int.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-
-#if defined(_LIBC) || defined(_GLIBCPP_USE_WCHAR_T)
-# include <langinfo.h>
-#endif
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-/* Prototypes of libio's codecvt functions. */
-static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
- __c_mbstate_t *statep,
- const wchar_t *from_start,
- const wchar_t *from_end,
- const wchar_t **from_stop, char *to_start,
- char *to_end, char **to_stop);
-static enum __codecvt_result do_unshift (struct _IO_codecvt *codecvt,
- __c_mbstate_t *statep, char *to_start,
- char *to_end, char **to_stop);
-static enum __codecvt_result do_in (struct _IO_codecvt *codecvt,
- __c_mbstate_t *statep,
- const char *from_start,
- const char *from_end,
- const char **from_stop, wchar_t *to_start,
- wchar_t *to_end, wchar_t **to_stop);
-static int do_encoding (struct _IO_codecvt *codecvt);
-static int do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const char *from_start,
- const char *from_end, _IO_size_t max);
-static int do_max_length (struct _IO_codecvt *codecvt);
-static int do_always_noconv (struct _IO_codecvt *codecvt);
-
-
-/* The functions used in `codecvt' for libio are always the same. */
-struct _IO_codecvt __libio_codecvt =
-{
- .__codecvt_destr = NULL, /* Destructor, never used. */
- .__codecvt_do_out = do_out,
- .__codecvt_do_unshift = do_unshift,
- .__codecvt_do_in = do_in,
- .__codecvt_do_encoding = do_encoding,
- .__codecvt_do_always_noconv = do_always_noconv,
- .__codecvt_do_length = do_length,
- .__codecvt_do_max_length = do_max_length
-};
-
-
-#ifdef _LIBC
-static struct __gconv_trans_data libio_translit =
-{
- .__trans_fct = __gconv_transliterate
-};
-#endif
-#endif /* defined(GLIBCPP_USE_WCHAR_T) */
-
-/* Return orientation of stream. If mode is nonzero try to change
- the orientation first. */
-#undef _IO_fwide
-int
-_IO_fwide (fp, mode)
- _IO_FILE *fp;
- int mode;
-{
- /* Normalize the value. */
- mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
-
- if (mode == 0 || fp->_mode != 0)
- /* The caller simply wants to know about the current orientation
- or the orientation already has been determined. */
- return fp->_mode;
-
- /* Set the orientation appropriately. */
- if (mode > 0)
- {
-#ifdef _GLIBCPP_USE_WCHAR_T
- struct _IO_codecvt *cc = fp->_codecvt;
-
- fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
- fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
-
-#ifdef _LIBC
- /* Get the character conversion functions based on the currently
- selected locale for LC_CTYPE. */
- {
- struct gconv_fcts fcts;
-
- /* Clear the state. We start all over again. */
- memset (&fp->_wide_data->_IO_state, '\0', sizeof (__c_mbstate_t));
- memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__c_mbstate_t));
-
- __wcsmbs_clone_conv (&fcts);
-
- /* The functions are always the same. */
- *cc = __libio_codecvt;
-
- cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */
- cc->__cd_in.__cd.__steps = fcts.towc;
-
- cc->__cd_in.__cd.__data[0].__invocation_counter = 0;
- cc->__cd_in.__cd.__data[0].__internal_use = 1;
- cc->__cd_in.__cd.__data[0].__flags = __GCONV_IS_LAST;
- cc->__cd_in.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
-
- /* XXX For now no transliteration. */
- cc->__cd_in.__cd.__data[0].__trans = NULL;
-
- cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */
- cc->__cd_out.__cd.__steps = fcts.tomb;
-
- cc->__cd_out.__cd.__data[0].__invocation_counter = 0;
- cc->__cd_out.__cd.__data[0].__internal_use = 1;
- cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
- cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
-
- /* And now the transliteration. */
- cc->__cd_out.__cd.__data[0].__trans = &libio_translit;
- }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
- {
- /* Determine internal and external character sets.
- XXX For now we make our life easy: we assume a fixed internal
- encoding (as most sane systems have; hi HP/UX!). If somebody
- cares about systems which changing internal charsets they
- should come up with a solution for the determination of the
- currently used internal character set. */
-#if 0
- const char *internal_ccs = _G_INTERNAL_CCS;
- const char *external_ccs = nl_langinfo(CODESET);
-
- if (external_ccs == NULL)
- external_ccs = "ISO-8859-1";
-
- cc->__cd_in = iconv_open (internal_ccs, external_ccs);
- if (cc->__cd_in != (iconv_t) -1)
- cc->__cd_out = iconv_open (external_ccs, internal_ccs);
-#endif
- }
-# else
-# error "somehow determine this from LC_CTYPE"
-# endif
-#endif
-
- /* From now on use the wide character callback functions. */
- ((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
-#else /* !defined(_GLIBCPP_USE_WCHAR_T) */
- mode = fp->_mode;
-#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
- }
-
- /* Set the mode now. */
- fp->_mode = mode;
-
- return mode;
-}
-
-#ifdef weak_alias
-weak_alias (_IO_fwide, fwide)
-#endif
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-
-static enum __codecvt_result
-do_out (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const wchar_t *from_start, const wchar_t *from_end,
- const wchar_t **from_stop, char *to_start, char *to_end,
- char **to_stop)
-{
- enum __codecvt_result result;
-
-#ifdef _LIBC
- struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
- int status;
- size_t dummy;
- const unsigned char *from_start_copy = (unsigned char *) from_start;
-
- codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
- codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
- codecvt->__cd_out.__cd.__data[0].__statep = statep;
-
- status = DL_CALL_FCT (gs->__fct,
- (gs, codecvt->__cd_out.__cd.__data, &from_start_copy,
- (const unsigned char *) from_end, NULL,
- &dummy, 0, 0));
-
- *from_stop = (wchar_t *) from_start_copy;
- *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
-
- switch (status)
- {
- case __GCONV_OK:
- case __GCONV_EMPTY_INPUT:
- result = __codecvt_ok;
- break;
-
- case __GCONV_FULL_OUTPUT:
- case __GCONV_INCOMPLETE_INPUT:
- result = __codecvt_partial;
- break;
-
- default:
- result = __codecvt_error;
- break;
- }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
- size_t res;
- const char *from_start_copy = (const char *) from_start;
- size_t from_len = from_end - from_start;
- char *to_start_copy = to_start;
- size_t to_len = to_end - to_start;
- res = iconv (codecvt->__cd_out, &from_start_copy, &from_len,
- &to_start_copy, &to_len);
-
- if (res == 0 || from_len == 0)
- result = __codecvt_ok;
- else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
- result = __codecvt_partial;
- else
- result = __codecvt_error;
-
-# else
- /* Decide what to do. */
- result = __codecvt_error;
-# endif
-#endif
-
- return result;
-}
-
-
-static enum __codecvt_result
-do_unshift (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- char *to_start, char *to_end, char **to_stop)
-{
- enum __codecvt_result result;
-
-#ifdef _LIBC
- struct __gconv_step *gs = codecvt->__cd_out.__cd.__steps;
- int status;
- size_t dummy;
-
- codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
- codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
- codecvt->__cd_out.__cd.__data[0].__statep = statep;
-
- status = DL_CALL_FCT (gs->__fct,
- (gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
- NULL, &dummy, 1, 0));
-
- *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
-
- switch (status)
- {
- case __GCONV_OK:
- case __GCONV_EMPTY_INPUT:
- result = __codecvt_ok;
- break;
-
- case __GCONV_FULL_OUTPUT:
- case __GCONV_INCOMPLETE_INPUT:
- result = __codecvt_partial;
- break;
-
- default:
- result = __codecvt_error;
- break;
- }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
- size_t res;
- char *to_start_copy = (char *) to_start;
- size_t to_len = to_end - to_start;
-
- res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);
-
- if (res == 0)
- result = __codecvt_ok;
- else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
- result = __codecvt_partial;
- else
- result = __codecvt_error;
-# else
- /* Decide what to do. */
- result = __codecvt_error;
-# endif
-#endif
-
- return result;
-}
-
-
-static enum __codecvt_result
-do_in (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const char *from_start, const char *from_end, const char **from_stop,
- wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
-{
- enum __codecvt_result result;
-
-#ifdef _LIBC
- struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
- int status;
- size_t dummy;
- const unsigned char *from_start_copy = (unsigned char *) from_start;
-
- codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start;
- codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end;
- codecvt->__cd_in.__cd.__data[0].__statep = statep;
-
- status = DL_CALL_FCT (gs->__fct,
- (gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
- from_end, NULL, &dummy, 0, 0));
-
- *from_stop = from_start_copy;
- *to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;
-
- switch (status)
- {
- case __GCONV_OK:
- case __GCONV_EMPTY_INPUT:
- result = __codecvt_ok;
- break;
-
- case __GCONV_FULL_OUTPUT:
- case __GCONV_INCOMPLETE_INPUT:
- result = __codecvt_partial;
- break;
-
- default:
- result = __codecvt_error;
- break;
- }
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
- size_t res;
- const char *from_start_copy = (const char *) from_start;
- size_t from_len = from_end - from_start;
- char *to_start_copy = (char *) from_start;
- size_t to_len = to_end - to_start;
-
- res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
- &to_start_copy, &to_len);
-
- if (res == 0)
- result = __codecvt_ok;
- else if (to_len == 0)
- result = __codecvt_partial;
- else if (from_len < codecvt->__codecvt_do_max_length (codecvt))
- result = __codecvt_partial;
- else
- result = __codecvt_error;
-# else
- /* Decide what to do. */
- result = __codecvt_error;
-# endif
-#endif
-
- return result;
-}
-
-
-static int
-do_encoding (struct _IO_codecvt *codecvt)
-{
-#ifdef _LIBC
- /* See whether the encoding is stateful. */
- if (codecvt->__cd_in.__cd.__steps[0].__stateful)
- return -1;
- /* Fortunately not. Now determine the input bytes for the conversion
- necessary for each wide character. */
- if (codecvt->__cd_in.__cd.__steps[0].__min_needed_from
- != codecvt->__cd_in.__cd.__steps[0].__max_needed_from)
- /* Not a constant value. */
- return 0;
-
- return codecvt->__cd_in.__cd.__steps[0].__min_needed_from;
-#else
- /* Worst case scenario. */
- return -1;
-#endif
-}
-
-
-static int
-do_always_noconv (struct _IO_codecvt *codecvt)
-{
- return 0;
-}
-
-
-static int
-do_length (struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
- const char *from_start, const char *from_end, _IO_size_t max)
-{
- int result;
-#ifdef _LIBC
- const unsigned char *cp = (const unsigned char *) from_start;
- wchar_t to_buf[max];
- struct __gconv_step *gs = codecvt->__cd_in.__cd.__steps;
- int status;
- size_t dummy;
-
- codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf;
- codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max];
- codecvt->__cd_in.__cd.__data[0].__statep = statep;
-
- status = DL_CALL_FCT (gs->__fct,
- (gs, codecvt->__cd_in.__cd.__data, &cp, from_end,
- NULL, &dummy, 0, 0));
-
- result = cp - (const unsigned char *) from_start;
-#else
-# ifdef _GLIBCPP_USE_WCHAR_T
- const char *from_start_copy = (const char *) from_start;
- size_t from_len = from_end - from_start;
- wchar_t to_buf[max];
- size_t res;
- char *to_start = (char *) to_buf;
-
- res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
- &to_start, &max);
-
- result = from_start_copy - (char *) from_start;
-# else
- /* Decide what to do. */
- result = 0;
-# endif
-#endif
-
- return result;
-}
-
-
-static int
-do_max_length (struct _IO_codecvt *codecvt)
-{
-#ifdef _LIBC
- return codecvt->__cd_in.__cd.__steps[0].__max_needed_from;
-#else
- return MB_CUR_MAX;
-#endif
-}
-
-#endif /* defined(_GLIBCPP_USE_WCHAR_T) */
diff --git a/contrib/libstdc++/libio/iolibio.h b/contrib/libstdc++/libio/iolibio.h
deleted file mode 100644
index 61be4b73..0000000
--- a/contrib/libstdc++/libio/iolibio.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "libio.h"
-
-/* These emulate stdio functionality, but with a different name
- (_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int _IO_fclose __P((_IO_FILE*));
-extern int _IO_new_fclose __P((_IO_FILE*));
-extern int _IO_old_fclose __P((_IO_FILE*));
-extern _IO_FILE *_IO_fdopen __P((int, const char*));
-extern _IO_FILE *_IO_old_fdopen __P((int, const char*));
-extern _IO_FILE *_IO_new_fdopen __P((int, const char*));
-extern int _IO_fflush __P((_IO_FILE*));
-extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
-extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
-extern char* _IO_fgets __P((char*, int, _IO_FILE*));
-extern _IO_FILE *_IO_fopen __P((const char*, const char*));
-extern _IO_FILE *_IO_old_fopen __P((const char*, const char*));
-extern _IO_FILE *_IO_new_fopen __P((const char*, const char*));
-extern _IO_FILE *_IO_fopen64 __P((const char*, const char*));
-extern int _IO_fprintf __P((_IO_FILE*, const char*, ...));
-extern int _IO_fputs __P((const char*, _IO_FILE*));
-extern int _IO_fsetpos __P((_IO_FILE*, const _IO_fpos_t *));
-extern int _IO_fsetpos64 __P((_IO_FILE*, const _IO_fpos64_t *));
-extern long int _IO_ftell __P((_IO_FILE*));
-extern _IO_size_t _IO_fread __P((void*, _IO_size_t, _IO_size_t, _IO_FILE*));
-extern _IO_size_t _IO_fwrite __P((const void*,
- _IO_size_t, _IO_size_t, _IO_FILE*));
-extern char* _IO_gets __P((char*));
-extern void _IO_perror __P((const char*));
-extern int _IO_printf __P((const char*, ...));
-extern int _IO_puts __P((const char*));
-extern int _IO_scanf __P((const char*, ...));
-extern void _IO_setbuffer __P((_IO_FILE *, char*, _IO_size_t));
-extern int _IO_setvbuf __P((_IO_FILE*, char*, int, _IO_size_t));
-extern int _IO_sscanf __P((const char*, const char*, ...));
-extern int _IO_sprintf __P((char *, const char*, ...));
-extern int _IO_ungetc __P((int, _IO_FILE*));
-extern int _IO_vsscanf __P((const char *, const char *, _IO_va_list));
-extern int _IO_vsprintf __P((char*, const char*, _IO_va_list));
-extern int _IO_vswprintf __P((wchar_t*, _IO_size_t, const wchar_t*,
- _IO_va_list));
-
-struct obstack;
-extern int _IO_obstack_vprintf __P ((struct obstack *, const char *,
- _IO_va_list));
-extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
-#ifndef _IO_pos_BAD
-#define _IO_pos_BAD ((_IO_off64_t)(-1))
-#endif
-#define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
-#define _IO_fseek(__fp, __offset, __whence) \
- (_IO_seekoff(__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD ? EOF : 0)
-#define _IO_rewind(FILE) (void)_IO_seekoff(FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
-#define _IO_vprintf(FORMAT, ARGS) _IO_vfprintf(_IO_stdout, FORMAT, ARGS)
-#define _IO_freopen(FILENAME, MODE, FP) \
- (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
-#define _IO_old_freopen(FILENAME, MODE, FP) \
- (_IO_old_file_close_it (FP), _IO_old_file_fopen(FP, FILENAME, MODE))
-#define _IO_freopen64(FILENAME, MODE, FP) \
- (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 1))
-#define _IO_fileno(FP) ((FP)->_fileno)
-extern _IO_FILE* _IO_popen __P((const char*, const char*));
-extern _IO_FILE* _IO_new_popen __P((const char*, const char*));
-extern _IO_FILE* _IO_old_popen __P((const char*, const char*));
-extern int __new_pclose __P((_IO_FILE *));
-extern int __old_pclose __P((_IO_FILE *));
-#define _IO_pclose _IO_fclose
-#define _IO_setbuf(_FP, _BUF) _IO_setbuffer(_FP, _BUF, _IO_BUFSIZ)
-#define _IO_setlinebuf(_FP) _IO_setvbuf(_FP, NULL, 1, 0)
-
-_IO_FILE *__new_freopen __P ((const char *, const char *, _IO_FILE *));
-_IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *));
-
-#ifdef __cplusplus
-}
-#endif
-
-
diff --git a/contrib/libstdc++/libio/libio.h b/contrib/libstdc++/libio/libio.h
deleted file mode 100644
index e2a2a15..0000000
--- a/contrib/libstdc++/libio/libio.h
+++ /dev/null
@@ -1,511 +0,0 @@
-/* Copyright (C) 1991,92,93,94,95,97,98,99,2000,2001 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
- Written by Per Bothner <bothner@cygnus.com>.
-
- 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 _IO_STDIO_H
-#define _IO_STDIO_H
-
-#include <_G_config.h>
-/* ALL of these should be defined in _G_config.h */
-#define _IO_pos_t _G_fpos_t /* obsolete */
-#define _IO_fpos_t _G_fpos_t
-#define _IO_fpos64_t _G_fpos64_t
-#define _IO_size_t _G_size_t
-#define _IO_ssize_t _G_ssize_t
-#define _IO_off_t _G_off_t
-#define _IO_off64_t _G_off64_t
-#define _IO_pid_t _G_pid_t
-#define _IO_uid_t _G_uid_t
-#define _IO_iconv_t _G_iconv_t
-#define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
-#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
-#define _IO_BUFSIZ _G_BUFSIZ
-#define _IO_va_list _G_va_list
-#define _IO_wint_t _G_wint_t
-
-#ifdef _G_NEED_STDARG_H
-/* This define avoids name pollution if we're using GNU stdarg.h */
-# define __need___va_list
-# include <stdarg.h>
-# ifdef __GNUC_VA_LIST
-# undef _IO_va_list
-# define _IO_va_list __gnuc_va_list
-# endif /* __GNUC_VA_LIST */
-#endif
-
-#ifndef __THROW
-# ifdef __cplusplus
-# define __THROW throw ()
-# else
-# define __THROW
-# endif
-#endif /* not __THROW */
-
-#ifndef __P
-# define __P(p) p __THROW
-#endif /* not __P */
-
-#ifndef __PMT
-# define __PMT(p) p
-#endif /* not __PMT */
-
-/* For backward compatibility */
-#ifndef _PARAMS
-# define _PARAMS(protos) __P(protos)
-#endif /*!_PARAMS*/
-
-#ifndef __STDC__
-# ifndef const
-# define const
-# endif
-#endif
-#define _IO_UNIFIED_JUMPTABLES 1
-#ifndef _G_HAVE_PRINTF_FP
-# define _IO_USE_DTOA 1
-#endif
-
-#ifndef EOF
-# define EOF (-1)
-#endif
-#ifndef NULL
-# if defined __GNUG__ && \
- (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
-# define NULL (__null)
-# else
-# if !defined(__cplusplus)
-# define NULL ((void*)0)
-# else
-# define NULL (0)
-# endif
-# endif
-#endif
-
-#define _IOS_INPUT 1
-#define _IOS_OUTPUT 2
-#define _IOS_ATEND 4
-#define _IOS_APPEND 8
-#define _IOS_TRUNC 16
-#define _IOS_NOCREATE 32
-#define _IOS_NOREPLACE 64
-#define _IOS_BIN 128
-
-/* Magic numbers and bits for the _flags field.
- The magic numbers use the high-order bits of _flags;
- the remaining bits are available for variable flags.
- Note: The magic numbers must all be negative if stdio
- emulation is desired. */
-
-#define _IO_MAGIC 0xFBAD0000 /* Magic number */
-#define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
-#define _IO_MAGIC_MASK 0xFFFF0000
-#define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
-#define _IO_UNBUFFERED 2
-#define _IO_NO_READS 4 /* Reading not allowed */
-#define _IO_NO_WRITES 8 /* Writing not allowd */
-#define _IO_EOF_SEEN 0x10
-#define _IO_ERR_SEEN 0x20
-#define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
-#define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
-#define _IO_IN_BACKUP 0x100
-#define _IO_LINE_BUF 0x200
-#define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
-#define _IO_CURRENTLY_PUTTING 0x800
-#define _IO_IS_APPENDING 0x1000
-#define _IO_IS_FILEBUF 0x2000
-#define _IO_BAD_SEEN 0x4000
-#define _IO_USER_LOCK 0x8000
-
-/* These are "formatting flags" matching the iostream fmtflags enum values. */
-#define _IO_SKIPWS 01
-#define _IO_LEFT 02
-#define _IO_RIGHT 04
-#define _IO_INTERNAL 010
-#define _IO_DEC 020
-#define _IO_OCT 040
-#define _IO_HEX 0100
-#define _IO_SHOWBASE 0200
-#define _IO_SHOWPOINT 0400
-#define _IO_UPPERCASE 01000
-#define _IO_SHOWPOS 02000
-#define _IO_SCIENTIFIC 04000
-#define _IO_FIXED 010000
-#define _IO_UNITBUF 020000
-#define _IO_STDIO 040000
-#define _IO_DONT_CLOSE 0100000
-#define _IO_BOOLALPHA 0200000
-
-
-struct _IO_jump_t; struct _IO_FILE;
-
-/* Handle lock. */
-#ifdef _IO_MTSAFE_IO
-# if defined __GLIBC__ && __GLIBC__ >= 2
-# if __GLIBC_MINOR__ == 0
-# include <stdio-lock.h>
-# else
-# include <bits/stdio-lock.h>
-# endif
-# else
-/*# include <comthread.h>*/
-# endif
-#else
-typedef void _IO_lock_t;
-#endif
-
-
-/* A streammarker remembers a position in a buffer. */
-
-struct _IO_marker {
- struct _IO_marker *_next;
- struct _IO_FILE *_sbuf;
- /* If _pos >= 0
- it points to _buf->Gbase()+_pos. FIXME comment */
- /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
- int _pos;
-#if 0
- void set_streampos(streampos sp) { _spos = sp; }
- void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
- public:
- streammarker(streambuf *sb);
- ~streammarker();
- int saving() { return _spos == -2; }
- int delta(streammarker&);
- int delta();
-#endif
-};
-
-/* This is the structure from the libstdc++ codecvt class. */
-enum __codecvt_result
-{
- __codecvt_ok,
- __codecvt_partial,
- __codecvt_error,
- __codecvt_noconv
-};
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-/* The order of the elements in the following struct must match the order
- of the virtual functions in the libstdc++ codecvt class. */
-struct _IO_codecvt
-{
- void (*__codecvt_destr) (struct _IO_codecvt *);
- enum __codecvt_result (*__codecvt_do_out) (struct _IO_codecvt *,
- __c_mbstate_t *,
- const wchar_t *,
- const wchar_t *,
- const wchar_t **, char *,
- char *, char **);
- enum __codecvt_result (*__codecvt_do_unshift) (struct _IO_codecvt *,
- __c_mbstate_t *, char *,
- char *, char **);
- enum __codecvt_result (*__codecvt_do_in) (struct _IO_codecvt *,
- __c_mbstate_t *,
- const char *, const char *,
- const char **, wchar_t *,
- wchar_t *, wchar_t **);
- int (*__codecvt_do_encoding) (struct _IO_codecvt *);
- int (*__codecvt_do_always_noconv) (struct _IO_codecvt *);
- int (*__codecvt_do_length) (struct _IO_codecvt *, __c_mbstate_t *,
- const char *, const char *, _IO_size_t);
- int (*__codecvt_do_max_length) (struct _IO_codecvt *);
-
- _IO_iconv_t __cd_in;
- _IO_iconv_t __cd_out;
-};
-
-/* Extra data for wide character streams. */
-struct _IO_wide_data
-{
- wchar_t *_IO_read_ptr; /* Current read pointer */
- wchar_t *_IO_read_end; /* End of get area. */
- wchar_t *_IO_read_base; /* Start of putback+get area. */
- wchar_t *_IO_write_base; /* Start of put area. */
- wchar_t *_IO_write_ptr; /* Current put pointer. */
- wchar_t *_IO_write_end; /* End of put area. */
- wchar_t *_IO_buf_base; /* Start of reserve area. */
- wchar_t *_IO_buf_end; /* End of reserve area. */
- /* The following fields are used to support backing up and undo. */
- wchar_t *_IO_save_base; /* Pointer to start of non-current get area. */
- wchar_t *_IO_backup_base; /* Pointer to first valid character of
- backup area */
- wchar_t *_IO_save_end; /* Pointer to end of non-current get area. */
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- __c_mbstate_t _IO_state;
- __c_mbstate_t _IO_last_state;
-#endif
- struct _IO_codecvt _codecvt;
-
- wchar_t _shortbuf[1];
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- struct _IO_jump_t *_wide_vtable;
-#endif
-};
-#else /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
-/* Because _IO_no_init unconditionally takes a `_IO_wide_data*' as its
- last parameter we must still define this type. We intentionally
- leave it incomplete to prevent any use of this type when we are not
- supporting wide characters. */
-struct _IO_wide_data;
-#endif /* !(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T) */
-
-struct _IO_FILE {
- int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
-#define _IO_file_flags _flags
-
- /* The following pointers correspond to the C++ streambuf protocol. */
- /* Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
- char* _IO_read_ptr; /* Current read pointer */
- char* _IO_read_end; /* End of get area. */
- char* _IO_read_base; /* Start of putback+get area. */
- char* _IO_write_base; /* Start of put area. */
- char* _IO_write_ptr; /* Current put pointer. */
- char* _IO_write_end; /* End of put area. */
- char* _IO_buf_base; /* Start of reserve area. */
- char* _IO_buf_end; /* End of reserve area. */
- /* The following fields are used to support backing up and undo. */
- char *_IO_save_base; /* Pointer to start of non-current get area. */
- char *_IO_backup_base; /* Pointer to first valid character of backup area */
- char *_IO_save_end; /* Pointer to end of non-current get area. */
-
- struct _IO_marker *_markers;
-
- struct _IO_FILE *_chain;
-
- int _fileno;
- int _blksize;
- _IO_off_t _old_offset; /* This used to be _offset but it's too small. */
-
-#define __HAVE_COLUMN /* temporary */
- /* 1+column number of pbase(); 0 is unknown. */
- unsigned short _cur_column;
- signed char _vtable_offset;
- char _shortbuf[1];
-
- /* char* _save_gptr; char* _save_egptr; */
-
- _IO_lock_t *_lock;
-#ifdef _IO_USE_OLD_IO_FILE
-};
-
-struct _IO_FILE_complete
-{
- struct _IO_FILE _file;
-#endif
-#if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
- _IO_off64_t _offset;
-# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
- /* Wide character stream stuff. */
- struct _IO_codecvt *_codecvt;
- struct _IO_wide_data *_wide_data;
-# else
- void *__pad1;
- void *__pad2;
-# endif
- int _mode;
- /* Make sure we don't get into trouble again. */
- char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
-#endif
-};
-
-#ifndef __cplusplus
-typedef struct _IO_FILE _IO_FILE;
-#endif
-
-struct _IO_FILE_plus;
-
-extern struct _IO_FILE_plus _IO_2_1_stdin_;
-extern struct _IO_FILE_plus _IO_2_1_stdout_;
-extern struct _IO_FILE_plus _IO_2_1_stderr_;
-#ifndef _LIBC
-#define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
-#define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
-#define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
-#else
-extern _IO_FILE *_IO_stdin;
-extern _IO_FILE *_IO_stdout;
-extern _IO_FILE *_IO_stderr;
-#endif
-
-
-/* Functions to do I/O and file management for a stream. */
-
-/* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF.
- Return number of bytes read. */
-typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
-
-/* Write N bytes pointed to by BUF to COOKIE. Write all N bytes
- unless there is an error. Return number of bytes written, or -1 if
- there is an error without writing anything. If the file has been
- opened for append (__mode.__append set), then set the file pointer
- to the end of the file and then do the write; if not, just write at
- the current file pointer. */
-typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
- size_t __n);
-
-/* Move COOKIE's file position to *POS bytes from the
- beginning of the file (if W is SEEK_SET),
- the current position (if W is SEEK_CUR),
- or the end of the file (if W is SEEK_END).
- Set *POS to the new file position.
- Returns zero if successful, nonzero if not. */
-typedef int __io_seek_fn (void *__cookie, _IO_off64_t *__pos, int __w);
-
-/* Close COOKIE. */
-typedef int __io_close_fn (void *__cookie);
-
-
-#ifdef _GNU_SOURCE
-/* User-visible names for the above. */
-typedef __io_read_fn cookie_read_function_t;
-typedef __io_write_fn cookie_write_function_t;
-typedef __io_seek_fn cookie_seek_function_t;
-typedef __io_close_fn cookie_close_function_t;
-
-/* The structure with the cookie function pointers. */
-typedef struct
-{
- __io_read_fn *read; /* Read bytes. */
- __io_write_fn *write; /* Write bytes. */
- __io_seek_fn *seek; /* Seek/tell file position. */
- __io_close_fn *close; /* Close file. */
-} _IO_cookie_io_functions_t;
-typedef _IO_cookie_io_functions_t cookie_io_functions_t;
-
-struct _IO_cookie_file;
-
-/* Initialize one of those. */
-extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
- void *__cookie, _IO_cookie_io_functions_t __fns);
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int __underflow (_IO_FILE *) __THROW;
-extern int __uflow (_IO_FILE *) __THROW;
-extern int __overflow (_IO_FILE *, int) __THROW;
-extern _IO_wint_t __wunderflow (_IO_FILE *) __THROW;
-extern _IO_wint_t __wuflow (_IO_FILE *) __THROW;
-extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t) __THROW;
-
-#define _IO_getc_unlocked(_fp) \
- ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) \
- : *(unsigned char *) (_fp)->_IO_read_ptr++)
-#define _IO_peekc_unlocked(_fp) \
- ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \
- && __underflow (_fp) == EOF ? EOF \
- : *(unsigned char *) (_fp)->_IO_read_ptr)
-#define _IO_putc_unlocked(_ch, _fp) \
- (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \
- ? __overflow (_fp, (unsigned char) (_ch)) \
- : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
-
-#define _IO_getwc_unlocked(_fp) \
- ((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end \
- ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
-#define _IO_putwc_unlocked(_wch, _fp) \
- ((_fp)->_wide_data->_IO_write_ptr >= (_fp)->_wide_data->_IO_write_end \
- ? __woverflow (_fp, _wch) \
- : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
-
-#define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
-#define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
-
-extern int _IO_getc (_IO_FILE *__fp) __THROW;
-extern int _IO_putc (int __c, _IO_FILE *__fp) __THROW;
-extern int _IO_feof (_IO_FILE *__fp) __THROW;
-extern int _IO_ferror (_IO_FILE *__fp) __THROW;
-
-extern int _IO_peekc_locked (_IO_FILE *__fp) __THROW;
-
-/* This one is for Emacs. */
-#define _IO_PENDING_OUTPUT_COUNT(_fp) \
- ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
-
-extern void _IO_flockfile (_IO_FILE *) __THROW;
-extern void _IO_funlockfile (_IO_FILE *) __THROW;
-extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
-
-#ifdef _IO_MTSAFE_IO
-# define _IO_peekc(_fp) _IO_peekc_locked (_fp)
-#else
-# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
-# define _IO_flockfile(_fp) /**/
-# define _IO_funlockfile(_fp) /**/
-# define _IO_ftrylockfile(_fp) /**/
-# define _IO_cleanup_region_start(_fct, _fp) /**/
-# define _IO_cleanup_region_end(_Doit) /**/
-#endif /* !_IO_MTSAFE_IO */
-
-extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
- _IO_va_list, int *__restrict) __THROW;
-extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
- _IO_va_list) __THROW;
-extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t) __THROW;
-extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t) __THROW;
-
-extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW;
-extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW;
-
-extern void _IO_free_backup_area (_IO_FILE *) __THROW;
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-extern _IO_wint_t _IO_getwc (_IO_FILE *__fp) __THROW;
-extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp) __THROW;
-extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
-# if __GNUC__ >= 2
-/* A special optimized version of the function above. It optimizes the
- case of initializing an unoriented byte stream. */
-# define _IO_fwide(__fp, __mode) \
- ({ int __result = (__mode); \
- if (__result < 0) \
- { \
- if ((__fp)->_mode == 0) \
- /* We know that all we have to do is to set the flag. */ \
- (__fp)->_mode = -1; \
- __result = (__fp)->_mode; \
- } \
- else \
- __result = _IO_fwide (__fp, __result); \
- __result; })
-# endif
-
-extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
- _IO_va_list, int *__restrict) __THROW;
-extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
- _IO_va_list) __THROW;
-extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t) __THROW;
-extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _IO_STDIO_H */
diff --git a/contrib/libstdc++/libio/libioP.h b/contrib/libstdc++/libio/libioP.h
deleted file mode 100644
index 4aecf4e..0000000
--- a/contrib/libstdc++/libio/libioP.h
+++ /dev/null
@@ -1,821 +0,0 @@
-/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-# include <errno.h>
-
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-#if defined __GLIBC__ && __GLIBC__ >= 2
-# include <bits/libc-lock.h>
-#else
-/*# include <comthread.h>*/
-#endif
-
-#include "iolibio.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define _IO_seek_set 0
-#define _IO_seek_cur 1
-#define _IO_seek_end 2
-
-/* THE JUMPTABLE FUNCTIONS.
-
- * The _IO_FILE type is used to implement the FILE type in GNU libc,
- * as well as the streambuf class in GNU iostreams for C++.
- * These are all the same, just used differently.
- * An _IO_FILE (or FILE) object is allows followed by a pointer to
- * a jump table (of pointers to functions). The pointer is accessed
- * with the _IO_JUMPS macro. The jump table has a eccentric format,
- * so as to be compatible with the layout of a C++ virtual function table.
- * (as implemented by g++). When a pointer to a streambuf object is
- * coerced to an (_IO_FILE*), then _IO_JUMPS on the result just
- * happens to point to the virtual function table of the streambuf.
- * Thus the _IO_JUMPS function table used for C stdio/libio does
- * double duty as the virtual function table for C++ streambuf.
- *
- * The entries in the _IO_JUMPS function table (and hence also the
- * virtual functions of a streambuf) are described below.
- * The first parameter of each function entry is the _IO_FILE/streambuf
- * object being acted on (i.e. the 'this' parameter).
- */
-
-#if (!defined _IO_USE_OLD_IO_FILE \
- && (!defined _G_IO_NO_BACKWARD_COMPAT || _G_IO_NO_BACKWARD_COMPAT == 0))
-# define _IO_JUMPS_OFFSET 1
-#endif
-
-#define _IO_JUMPS(THIS) (THIS)->vtable
-#define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
-#define _IO_CHECK_WIDE(THIS) (((struct _IO_FILE *) (THIS))->_wide_data != NULL)
-
-#if _IO_JUMPS_OFFSET
-# define _IO_JUMPS_FUNC(THIS) \
- (*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
- + (THIS)->_vtable_offset))
-#else
-# define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
-#endif
-#define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
-#if _G_USING_THUNKS
-# define JUMP_FIELD(TYPE, NAME) TYPE NAME
-# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC (THIS)
-# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
-# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
-# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
-# define JUMP_INIT(NAME, VALUE) VALUE
-# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0)
-
-# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS)
-# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
-# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1, X2)
-# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC (THIS, X1,X2, X3)
-#else
-/* These macros will change when we re-implement vtables to use "thunks"! */
-# define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME
-# define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
-# define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
-# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
-# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
-# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE}
-# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0)
-
-# define WJUMP0(FUNC, THIS) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS)
-# define WJUMP1(FUNC, THIS, X1) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1)
-# define WJUMP2(FUNC, THIS, X1, X2) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1, X2)
-# define WJUMP3(FUNC, THIS, X1,X2,X3) _IO_WIDE_JUMPS_FUNC(THIS)->FUNC.pfn (THIS, X1,X2,X3)
-#endif
-
-/* The 'finish' function does any final cleaning up of an _IO_FILE object.
- It does not delete (free) it, but does everything else to finalize it.
- It matches the streambuf::~streambuf virtual destructor. */
-typedef void (*_IO_finish_t) __PMT ((_IO_FILE *, int)); /* finalize */
-#define _IO_FINISH(FP) JUMP1 (__finish, FP, 0)
-#define _IO_WFINISH(FP) WJUMP1 (__finish, FP, 0)
-
-/* The 'overflow' hook flushes the buffer.
- The second argument is a character, or EOF.
- It matches the streambuf::overflow virtual function. */
-typedef int (*_IO_overflow_t) __PMT ((_IO_FILE *, int));
-#define _IO_OVERFLOW(FP, CH) JUMP1 (__overflow, FP, CH)
-#define _IO_WOVERFLOW(FP, CH) WJUMP1 (__overflow, FP, CH)
-
-/* The 'underflow' hook tries to fills the get buffer.
- It returns the next character (as an unsigned char) or EOF. The next
- character remains in the get buffer, and the get position is not changed.
- It matches the streambuf::underflow virtual function. */
-typedef int (*_IO_underflow_t) __PMT ((_IO_FILE *));
-#define _IO_UNDERFLOW(FP) JUMP0 (__underflow, FP)
-#define _IO_WUNDERFLOW(FP) WJUMP0 (__underflow, FP)
-
-/* The 'uflow' hook returns the next character in the input stream
- (cast to unsigned char), and increments the read position;
- EOF is returned on failure.
- It matches the streambuf::uflow virtual function, which is not in the
- cfront implementation, but was added to C++ by the ANSI/ISO committee. */
-#define _IO_UFLOW(FP) JUMP0 (__uflow, FP)
-#define _IO_WUFLOW(FP) WJUMP0 (__uflow, FP)
-
-/* The 'pbackfail' hook handles backing up.
- It matches the streambuf::pbackfail virtual function. */
-typedef int (*_IO_pbackfail_t) __PMT ((_IO_FILE *, int));
-#define _IO_PBACKFAIL(FP, CH) JUMP1 (__pbackfail, FP, CH)
-#define _IO_WPBACKFAIL(FP, CH) WJUMP1 (__pbackfail, FP, CH)
-
-/* The 'xsputn' hook writes upto N characters from buffer DATA.
- Returns the number of character actually written.
- It matches the streambuf::xsputn virtual function. */
-typedef _IO_size_t (*_IO_xsputn_t) __PMT ((_IO_FILE *FP, const void *DATA,
- _IO_size_t N));
-#define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N)
-#define _IO_WXSPUTN(FP, DATA, N) WJUMP2 (__xsputn, FP, DATA, N)
-
-/* The 'xsgetn' hook reads upto N characters into buffer DATA.
- Returns the number of character actually read.
- It matches the streambuf::xsgetn virtual function. */
-typedef _IO_size_t (*_IO_xsgetn_t) __PMT ((_IO_FILE *FP, void *DATA,
- _IO_size_t N));
-#define _IO_XSGETN(FP, DATA, N) JUMP2 (__xsgetn, FP, DATA, N)
-#define _IO_WXSGETN(FP, DATA, N) WJUMP2 (__xsgetn, FP, DATA, N)
-
-/* The 'seekoff' hook moves the stream position to a new position
- relative to the start of the file (if DIR==0), the current position
- (MODE==1), or the end of the file (MODE==2).
- It matches the streambuf::seekoff virtual function.
- It is also used for the ANSI fseek function. */
-typedef _IO_off64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF,
- int DIR, int MODE));
-#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
-#define _IO_WSEEKOFF(FP, OFF, DIR, MODE) WJUMP3 (__seekoff, FP, OFF, DIR, MODE)
-
-/* The 'seekpos' hook also moves the stream position,
- but to an absolute position given by a fpos64_t (seekpos).
- It matches the streambuf::seekpos virtual function.
- It is also used for the ANSI fgetpos and fsetpos functions. */
-/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
-typedef _IO_off64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
-#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
-#define _IO_WSEEKPOS(FP, POS, FLAGS) WJUMP2 (__seekpos, FP, POS, FLAGS)
-
-/* The 'setbuf' hook gives a buffer to the file.
- It matches the streambuf::setbuf virtual function. */
-typedef _IO_FILE* (*_IO_setbuf_t) __PMT ((_IO_FILE *, char *, _IO_ssize_t));
-#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2 (__setbuf, FP, BUFFER, LENGTH)
-#define _IO_WSETBUF(FP, BUFFER, LENGTH) WJUMP2 (__setbuf, FP, BUFFER, LENGTH)
-
-/* The 'sync' hook attempts to synchronize the internal data structures
- of the file with the external state.
- It matches the streambuf::sync virtual function. */
-typedef int (*_IO_sync_t) __PMT ((_IO_FILE *));
-#define _IO_SYNC(FP) JUMP0 (__sync, FP)
-#define _IO_WSYNC(FP) WJUMP0 (__sync, FP)
-
-/* The 'doallocate' hook is used to tell the file to allocate a buffer.
- It matches the streambuf::doallocate virtual function, which is not
- in the ANSI/ISO C++ standard, but is part traditional implementations. */
-typedef int (*_IO_doallocate_t) __PMT ((_IO_FILE *));
-#define _IO_DOALLOCATE(FP) JUMP0 (__doallocate, FP)
-#define _IO_WDOALLOCATE(FP) WJUMP0 (__doallocate, FP)
-
-/* The following four hooks (sysread, syswrite, sysclose, sysseek, and
- sysstat) are low-level hooks specific to this implementation.
- There is no correspondence in the ANSI/ISO C++ standard library.
- The hooks basically correspond to the Unix system functions
- (read, write, close, lseek, and stat) except that a _IO_FILE*
- parameter is used instead of a integer file descriptor; the default
- implementation used for normal files just calls those functions.
- The advantage of overriding these functions instead of the higher-level
- ones (underflow, overflow etc) is that you can leave all the buffering
- higher-level functions. */
-
-/* The 'sysread' hook is used to read data from the external file into
- an existing buffer. It generalizes the Unix read(2) function.
- It matches the streambuf::sys_read virtual function, which is
- specific to this implementation. */
-typedef _IO_ssize_t (*_IO_read_t) __PMT ((_IO_FILE *, void *, _IO_ssize_t));
-#define _IO_SYSREAD(FP, DATA, LEN) JUMP2 (__read, FP, DATA, LEN)
-#define _IO_WSYSREAD(FP, DATA, LEN) WJUMP2 (__read, FP, DATA, LEN)
-
-/* The 'syswrite' hook is used to write data from an existing buffer
- to an external file. It generalizes the Unix write(2) function.
- It matches the streambuf::sys_write virtual function, which is
- specific to this implementation. */
-typedef _IO_ssize_t (*_IO_write_t) __PMT ((_IO_FILE *, const void *,
- _IO_ssize_t));
-#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2 (__write, FP, DATA, LEN)
-#define _IO_WSYSWRITE(FP, DATA, LEN) WJUMP2 (__write, FP, DATA, LEN)
-
-/* The 'sysseek' hook is used to re-position an external file.
- It generalizes the Unix lseek(2) function.
- It matches the streambuf::sys_seek virtual function, which is
- specific to this implementation. */
-typedef _IO_off64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int));
-#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
-#define _IO_WSYSSEEK(FP, OFFSET, MODE) WJUMP2 (__seek, FP, OFFSET, MODE)
-
-/* The 'sysclose' hook is used to finalize (close, finish up) an
- external file. It generalizes the Unix close(2) function.
- It matches the streambuf::sys_close virtual function, which is
- specific to this implementation. */
-typedef int (*_IO_close_t) __PMT ((_IO_FILE *)); /* finalize */
-#define _IO_SYSCLOSE(FP) JUMP0 (__close, FP)
-#define _IO_WSYSCLOSE(FP) WJUMP0 (__close, FP)
-
-/* The 'sysstat' hook is used to get information about an external file
- into a struct stat buffer. It generalizes the Unix fstat(2) call.
- It matches the streambuf::sys_stat virtual function, which is
- specific to this implementation. */
-typedef int (*_IO_stat_t) __PMT ((_IO_FILE *, void *));
-#define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF)
-#define _IO_WSYSSTAT(FP, BUF) WJUMP1 (__stat, FP, BUF)
-
-/* The 'showmany' hook can be used to get an image how much input is
- available. In many cases the answer will be 0 which means unknown
- but some cases one can provide real information. */
-typedef int (*_IO_showmanyc_t) __PMT ((_IO_FILE *));
-#define _IO_SHOWMANYC(FP) JUMP0 (__showmanyc, FP)
-#define _IO_WSHOWMANYC(FP) WJUMP0 (__showmanyc, FP)
-
-/* The 'imbue' hook is used to get information about the currently
- installed locales. */
-typedef void (*_IO_imbue_t) __PMT ((_IO_FILE *, void *));
-#define _IO_IMBUE(FP, LOCALE) JUMP1 (__imbue, FP, LOCALE)
-#define _IO_WIMBUE(FP, LOCALE) WJUMP1 (__imbue, FP, LOCALE)
-
-
-#define _IO_CHAR_TYPE char /* unsigned char ? */
-#define _IO_INT_TYPE int
-
-struct _IO_jump_t
-{
- JUMP_FIELD(_G_size_t, __dummy);
-#if _G_USING_THUNKS
- JUMP_FIELD(_G_size_t, __dummy2);
-#endif
- JUMP_FIELD(_IO_finish_t, __finish);
- JUMP_FIELD(_IO_overflow_t, __overflow);
- JUMP_FIELD(_IO_underflow_t, __underflow);
- JUMP_FIELD(_IO_underflow_t, __uflow);
- JUMP_FIELD(_IO_pbackfail_t, __pbackfail);
- /* showmany */
- JUMP_FIELD(_IO_xsputn_t, __xsputn);
- JUMP_FIELD(_IO_xsgetn_t, __xsgetn);
- JUMP_FIELD(_IO_seekoff_t, __seekoff);
- JUMP_FIELD(_IO_seekpos_t, __seekpos);
- JUMP_FIELD(_IO_setbuf_t, __setbuf);
- JUMP_FIELD(_IO_sync_t, __sync);
- JUMP_FIELD(_IO_doallocate_t, __doallocate);
- JUMP_FIELD(_IO_read_t, __read);
- JUMP_FIELD(_IO_write_t, __write);
- JUMP_FIELD(_IO_seek_t, __seek);
- JUMP_FIELD(_IO_close_t, __close);
- JUMP_FIELD(_IO_stat_t, __stat);
- JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
- JUMP_FIELD(_IO_imbue_t, __imbue);
-#if 0
- get_column;
- set_column;
-#endif
-};
-
-/* We always allocate an extra word following an _IO_FILE.
- This contains a pointer to the function jump table used.
- This is for compatibility with C++ streambuf; the word can
- be used to smash to a pointer to a virtual function table. */
-
-struct _IO_FILE_plus
-{
- _IO_FILE file;
- const struct _IO_jump_t *vtable;
-};
-
-/* Special file type for fopencookie function. */
-struct _IO_cookie_file
-{
- struct _IO_FILE_plus __fp;
- void *__cookie;
- _IO_cookie_io_functions_t __io_functions;
-};
-
-/* Iterator type for walking global linked list of _IO_FILE objects. */
-
-typedef struct _IO_FILE *_IO_ITER;
-
-/* Generic functions */
-
-extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
-extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
-extern int _IO_switch_to_get_mode __P ((_IO_FILE *));
-extern void _IO_init __P ((_IO_FILE *, int));
-extern int _IO_sputbackc __P ((_IO_FILE *, int));
-extern int _IO_sungetc __P ((_IO_FILE *));
-extern void _IO_un_link __P ((struct _IO_FILE_plus *));
-extern void _IO_link_in __P ((struct _IO_FILE_plus *));
-extern void _IO_doallocbuf __P ((_IO_FILE *));
-extern void _IO_unsave_markers __P ((_IO_FILE *));
-extern void _IO_setb __P ((_IO_FILE *, char *, char *, int));
-extern unsigned _IO_adjust_column __P ((unsigned, const char *, int));
-#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n)
-
-extern void _IO_switch_to_main_wget_area __P ((_IO_FILE *));
-extern void _IO_switch_to_wbackup_area __P ((_IO_FILE *));
-extern int _IO_switch_to_wget_mode __P ((_IO_FILE *));
-extern void _IO_wsetb __P ((_IO_FILE *, wchar_t *, wchar_t *, int));
-extern wint_t _IO_sputbackwc __P ((_IO_FILE *, wint_t));
-extern wint_t _IO_sungetwc __P ((_IO_FILE *));
-extern void _IO_wdoallocbuf __P ((_IO_FILE *));
-extern void _IO_unsave_wmarkers __P ((_IO_FILE *));
-extern unsigned _IO_adjust_wcolumn __P ((unsigned, const wchar_t *, int));
-
-/* Marker-related function. */
-
-extern void _IO_init_marker __P ((struct _IO_marker *, _IO_FILE *));
-extern void _IO_init_wmarker __P ((struct _IO_marker *, _IO_FILE *));
-extern void _IO_remove_marker __P ((struct _IO_marker *));
-extern int _IO_marker_difference __P ((struct _IO_marker *,
- struct _IO_marker *));
-extern int _IO_marker_delta __P ((struct _IO_marker *));
-extern int _IO_wmarker_delta __P ((struct _IO_marker *));
-extern int _IO_seekmark __P ((_IO_FILE *, struct _IO_marker *, int));
-extern int _IO_seekwmark __P ((_IO_FILE *, struct _IO_marker *, int));
-
-/* Functions for iterating global list and dealing with
- its lock */
-
-extern _IO_ITER _IO_iter_begin __P ((void));
-extern _IO_ITER _IO_iter_end __P ((void));
-extern _IO_ITER _IO_iter_next __P ((_IO_ITER));
-extern _IO_FILE *_IO_iter_file __P ((_IO_ITER));
-extern void _IO_list_lock __P ((void));
-extern void _IO_list_unlock __P ((void));
-extern void _IO_list_resetlock __P ((void));
-
-/* Default jumptable functions. */
-
-extern int _IO_default_underflow __P ((_IO_FILE *));
-extern int _IO_default_uflow __P ((_IO_FILE *));
-extern wint_t _IO_wdefault_uflow __P ((_IO_FILE *));
-extern int _IO_default_doallocate __P ((_IO_FILE *));
-extern int _IO_wdefault_doallocate __P ((_IO_FILE *));
-extern void _IO_default_finish __P ((_IO_FILE *, int));
-extern void _IO_wdefault_finish __P ((_IO_FILE *, int));
-extern int _IO_default_pbackfail __P ((_IO_FILE *, int));
-extern wint_t _IO_wdefault_pbackfail __P ((_IO_FILE *, wint_t));
-extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
-extern _IO_FILE* _IO_wdefault_setbuf __P ((_IO_FILE *, wchar_t *,
- _IO_ssize_t));
-extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
- _IO_size_t));
-extern _IO_size_t _IO_wdefault_xsputn __P ((_IO_FILE *, const void *,
- _IO_size_t));
-extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
-extern _IO_size_t _IO_wdefault_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
-extern _IO_off64_t _IO_default_seekoff __P ((_IO_FILE *,
- _IO_off64_t, int, int));
-extern _IO_off64_t _IO_default_seekpos __P ((_IO_FILE *, _IO_off64_t, int));
-extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
- _IO_ssize_t));
-extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
-extern int _IO_default_stat __P ((_IO_FILE *, void *));
-extern _IO_off64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
-extern int _IO_default_sync __P ((_IO_FILE *));
-#define _IO_default_close ((_IO_close_t) _IO_default_sync)
-extern int _IO_default_showmanyc __P ((_IO_FILE *));
-extern void _IO_default_imbue __P ((_IO_FILE *, void *));
-
-extern struct _IO_jump_t _IO_file_jumps;
-extern struct _IO_jump_t _IO_wfile_jumps;
-extern struct _IO_jump_t _IO_old_file_jumps;
-extern struct _IO_jump_t _IO_streambuf_jumps;
-extern struct _IO_jump_t _IO_proc_jumps;
-extern struct _IO_jump_t _IO_old_proc_jumps;
-extern struct _IO_jump_t _IO_str_jumps;
-extern struct _IO_jump_t _IO_wstr_jumps;
-extern struct _IO_codecvt __libio_codecvt;
-extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
-extern int _IO_new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
-extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
-extern int _IO_wdo_write __P ((_IO_FILE *, const wchar_t *, _IO_size_t));
-extern int _IO_flush_all __P ((void));
-extern int _IO_cleanup __P ((void));
-extern void _IO_flush_all_linebuffered __P ((void));
-extern int _IO_new_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
-extern int _IO_old_fgetpos __P ((_IO_FILE *, _IO_fpos_t *));
-extern int _IO_new_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
-extern int _IO_old_fsetpos __P ((_IO_FILE *, const _IO_fpos_t *));
-extern int _IO_new_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
-extern int _IO_old_fgetpos64 __P ((_IO_FILE *, _IO_fpos64_t *));
-extern int _IO_new_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
-extern int _IO_old_fsetpos64 __P ((_IO_FILE *, const _IO_fpos64_t *));
-
-
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define _IO_do_flush(_f) \
- ((_f)->_mode <= 0 \
- ? _IO_do_write(_f, (_f)->_IO_write_base, \
- (_f)->_IO_write_ptr-(_f)->_IO_write_base) \
- : _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
- ((_f)->_wide_data->_IO_write_ptr \
- - (_f)->_wide_data->_IO_write_base)))
-#else
-# define _IO_do_flush(_f) \
- _IO_do_write(_f, (_f)->_IO_write_base, \
- (_f)->_IO_write_ptr-(_f)->_IO_write_base)
-#endif
-#define _IO_old_do_flush(_f) \
- _IO_old_do_write(_f, (_f)->_IO_write_base, \
- (_f)->_IO_write_ptr-(_f)->_IO_write_base)
-#define _IO_in_put_mode(_fp) ((_fp)->_flags & _IO_CURRENTLY_PUTTING)
-#define _IO_mask_flags(fp, f, mask) \
- ((fp)->_flags = ((fp)->_flags & ~(mask)) | ((f) & (mask)))
-#define _IO_setg(fp, eb, g, eg) ((fp)->_IO_read_base = (eb),\
- (fp)->_IO_read_ptr = (g), (fp)->_IO_read_end = (eg))
-#define _IO_wsetg(fp, eb, g, eg) ((fp)->_wide_data->_IO_read_base = (eb),\
- (fp)->_wide_data->_IO_read_ptr = (g), \
- (fp)->_wide_data->_IO_read_end = (eg))
-#define _IO_setp(__fp, __p, __ep) \
- ((__fp)->_IO_write_base = (__fp)->_IO_write_ptr \
- = __p, (__fp)->_IO_write_end = (__ep))
-#define _IO_wsetp(__fp, __p, __ep) \
- ((__fp)->_wide_data->_IO_write_base \
- = (__fp)->_wide_data->_IO_write_ptr = __p, \
- (__fp)->_wide_data->_IO_write_end = (__ep))
-#define _IO_have_backup(fp) ((fp)->_IO_save_base != NULL)
-#define _IO_have_wbackup(fp) ((fp)->_wide_data->_IO_save_base != NULL)
-#define _IO_in_backup(fp) ((fp)->_flags & _IO_IN_BACKUP)
-#define _IO_have_markers(fp) ((fp)->_markers != NULL)
-#define _IO_blen(fp) ((fp)->_IO_buf_end - (fp)->_IO_buf_base)
-#define _IO_wblen(fp) ((fp)->_wide_data->_IO_buf_end \
- - (fp)->_wide_data->_IO_buf_base)
-
-/* Jumptable functions for files. */
-
-extern int _IO_file_doallocate __P ((_IO_FILE *));
-extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
-extern _IO_off64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
-extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
-extern _IO_size_t _IO_file_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
-extern int _IO_file_stat __P ((_IO_FILE *, void *));
-extern int _IO_file_close __P ((_IO_FILE *));
-extern int _IO_file_underflow __P ((_IO_FILE *));
-extern int _IO_file_overflow __P ((_IO_FILE *, int));
-#define _IO_file_is_open(__fp) ((__fp)->_fileno != -1)
-extern void _IO_file_init __P ((struct _IO_FILE_plus *));
-extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
-extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int,
- int, int));
-extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *,
- int));
-extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
- _IO_ssize_t));
-extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
-extern int _IO_file_sync __P ((_IO_FILE *));
-extern int _IO_file_close_it __P ((_IO_FILE *));
-extern _IO_off64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
-extern void _IO_file_finish __P ((_IO_FILE *, int));
-
-extern _IO_FILE* _IO_new_file_attach __P ((_IO_FILE *, int));
-extern int _IO_new_file_close_it __P ((_IO_FILE *));
-extern void _IO_new_file_finish __P ((_IO_FILE *, int));
-extern _IO_FILE* _IO_new_file_fopen __P ((_IO_FILE *, const char *, const char *,
- int));
-extern void _IO_no_init __P ((_IO_FILE *, int, int, struct _IO_wide_data *,
- struct _IO_jump_t *));
-extern void _IO_new_file_init __P ((struct _IO_FILE_plus *));
-extern _IO_FILE* _IO_new_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
-extern int _IO_new_file_sync __P ((_IO_FILE *));
-extern int _IO_new_file_underflow __P ((_IO_FILE *));
-extern int _IO_new_file_overflow __P ((_IO_FILE *, int));
-extern _IO_off64_t _IO_new_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
-extern _IO_ssize_t _IO_new_file_write __P ((_IO_FILE *, const void *,
- _IO_ssize_t));
-extern _IO_size_t _IO_new_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
-
-extern _IO_FILE* _IO_old_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
-extern _IO_off64_t _IO_old_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int,
- int));
-extern _IO_size_t _IO_old_file_xsputn __P ((_IO_FILE *, const void *,
- _IO_size_t));
-extern int _IO_old_file_underflow __P ((_IO_FILE *));
-extern int _IO_old_file_overflow __P ((_IO_FILE *, int));
-extern void _IO_old_file_init __P ((struct _IO_FILE_plus *));
-extern _IO_FILE* _IO_old_file_attach __P ((_IO_FILE *, int));
-extern _IO_FILE* _IO_old_file_fopen __P ((_IO_FILE *, const char *,
- const char *));
-extern _IO_ssize_t _IO_old_file_write __P ((_IO_FILE *, const void *,
- _IO_ssize_t));
-extern int _IO_old_file_sync __P ((_IO_FILE *));
-extern int _IO_old_file_close_it __P ((_IO_FILE *));
-extern void _IO_old_file_finish __P ((_IO_FILE *, int));
-
-extern int _IO_wfile_doallocate __P ((_IO_FILE *));
-extern _IO_size_t _IO_wfile_xsputn __P ((_IO_FILE *, const void *,
- _IO_size_t));
-extern _IO_FILE* _IO_wfile_setbuf __P ((_IO_FILE *, wchar_t *, _IO_ssize_t));
-extern wint_t _IO_wfile_sync __P ((_IO_FILE *));
-extern wint_t _IO_wfile_underflow __P ((_IO_FILE *));
-extern wint_t _IO_wfile_overflow __P ((_IO_FILE *, wint_t));
-extern _IO_off64_t _IO_wfile_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
-
-/* Jumptable functions for proc_files. */
-extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *));
-extern _IO_FILE* _IO_new_proc_open __P ((_IO_FILE *, const char *, const char *));
-extern _IO_FILE* _IO_old_proc_open __P ((_IO_FILE *, const char *, const char *));
-extern int _IO_proc_close __P ((_IO_FILE *));
-extern int _IO_new_proc_close __P ((_IO_FILE *));
-extern int _IO_old_proc_close __P ((_IO_FILE *));
-
-/* Jumptable functions for strfiles. */
-extern int _IO_str_underflow __P ((_IO_FILE *));
-extern int _IO_str_overflow __P ((_IO_FILE *, int));
-extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
-extern _IO_off64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
-extern void _IO_str_finish __P ((_IO_FILE *, int));
-
-/* Other strfile functions */
-struct _IO_strfile_;
-extern void _IO_str_init_static __P ((struct _IO_strfile_ *, char *, int, char *));
-extern void _IO_str_init_readonly __P ((struct _IO_strfile_ *, const char *, int));
-extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *));
-
-/* And the wide character versions. */
-extern void _IO_wstr_init_static __P ((_IO_FILE *, wchar_t *, int, wchar_t *));
-extern void _IO_wstr_init_readonly __P ((_IO_FILE *, const char *, int));
-extern _IO_ssize_t _IO_wstr_count __P ((_IO_FILE *));
-extern _IO_wint_t _IO_wstr_overflow __P ((_IO_FILE *, _IO_wint_t));
-extern _IO_wint_t _IO_wstr_underflow __P ((_IO_FILE *));
-extern _IO_off64_t _IO_wstr_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
-extern _IO_wint_t _IO_wstr_pbackfail __P ((_IO_FILE *, _IO_wint_t));
-extern void _IO_wstr_finish __P ((_IO_FILE *, int));
-
-extern int _IO_vasprintf __P ((char **result_ptr, __const char *format,
- _IO_va_list args));
-extern int _IO_vdprintf __P ((int d, __const char *format, _IO_va_list arg));
-extern int _IO_vsnprintf __P ((char *string, _IO_size_t maxlen,
- __const char *format, _IO_va_list args));
-
-
-extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int));
-extern _IO_size_t _IO_getline_info __P ((_IO_FILE *,char *, _IO_size_t,
- int, int, int *));
-extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *));
-extern _IO_size_t _IO_getwline __P ((_IO_FILE *,wchar_t *, _IO_size_t, wint_t,
- int));
-extern _IO_size_t _IO_getwline_info __P ((_IO_FILE *,wchar_t *, _IO_size_t,
- wint_t, int, wint_t *));
-extern double _IO_strtod __P ((const char *, char **));
-extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits,
- int *__decpt, int *__sign, char **__rve));
-extern int _IO_outfloat __P ((double __value, _IO_FILE *__sb, int __type,
- int __width, int __precision, int __flags,
- int __sign_mode, int __fill));
-
-extern struct _IO_FILE_plus *_IO_list_all;
-extern void (*_IO_cleanup_registration_needed) __PMT ((void));
-
-#ifndef EOF
-# define EOF (-1)
-#endif
-#ifndef NULL
-# if defined __GNUG__ && \
- (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
-# define NULL (__null)
-# else
-# if !defined(__cplusplus)
-# define NULL ((void*)0)
-# else
-# define NULL (0)
-# endif
-# endif
-#endif
-
-#if _G_HAVE_MMAP
-
-#ifdef __cplusplus
-}
-#endif
-
-# include <unistd.h>
-# include <fcntl.h>
-# include <sys/mman.h>
-# include <sys/param.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
-# define MAP_ANONYMOUS MAP_ANON
-# endif
-
-# if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE)
-# undef _G_HAVE_MMAP
-# define _G_HAVE_MMAP 0
-# endif
-
-#endif /* _G_HAVE_MMAP */
-
-#if _G_HAVE_MMAP
-
-# ifdef _LIBC
-/* When using this code in the GNU libc we must not pollute the name space. */
-# define mmap __mmap
-# define munmap __munmap
-# define ftruncate __ftruncate
-# endif
-
-# define ROUND_TO_PAGE(_S) \
- (((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1))
-
-# define FREE_BUF(_B, _S) \
- munmap ((_B), ROUND_TO_PAGE (_S))
-# define ALLOC_BUF(_B, _S, _R) \
- do { \
- (_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \
- PROT_READ | PROT_WRITE, \
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
- if ((_B) == (char *) MAP_FAILED) \
- return (_R); \
- } while (0)
-# define ALLOC_WBUF(_B, _S, _R) \
- do { \
- (_B) = (wchar_t *) mmap (0, ROUND_TO_PAGE (_S), \
- PROT_READ | PROT_WRITE, \
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
- if ((_B) == (wchar_t *) MAP_FAILED) \
- return (_R); \
- } while (0)
-
-#else /* _G_HAVE_MMAP */
-
-# define FREE_BUF(_B, _S) \
- free(_B)
-# define ALLOC_BUF(_B, _S, _R) \
- do { \
- (_B) = (char*)malloc(_S); \
- if ((_B) == NULL) \
- return (_R); \
- } while (0)
-# define ALLOC_WBUF(_B, _S, _R) \
- do { \
- (_B) = (wchar_t *)malloc(_S); \
- if ((_B) == NULL) \
- return (_R); \
- } while (0)
-
-#endif /* _G_HAVE_MMAP */
-
-#ifndef OS_FSTAT
-# define OS_FSTAT fstat
-#endif
-struct stat;
-extern _IO_ssize_t _IO_read __P ((int, void *, _IO_size_t));
-extern _IO_ssize_t _IO_write __P ((int, const void *, _IO_size_t));
-extern _IO_off64_t _IO_lseek __P ((int, _IO_off64_t, int));
-extern int _IO_close __P ((int));
-extern int _IO_fstat __P ((int, struct stat *));
-extern int _IO_vscanf __P ((const char *, _IO_va_list));
-
-/* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */
-#ifndef _IO_pos_BAD
-# define _IO_pos_BAD ((_IO_off64_t) -1)
-#endif
-/* _IO_pos_adjust adjust an _IO_off64_t by some number of bytes. */
-#ifndef _IO_pos_adjust
-# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
-#endif
-/* _IO_pos_0 is an _IO_off64_t value indicating beginning of file. */
-#ifndef _IO_pos_0
-# define _IO_pos_0 ((_IO_off64_t) 0)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef _IO_MTSAFE_IO
-/* check following! */
-# ifdef _IO_USE_OLD_IO_FILE
-# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
- { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
- 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
-# else
-# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
- { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
- 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
- NULL, WDP, 0 }
-# else
-# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
- { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
- 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
- 0 }
-# endif
-# endif
-#else
-# ifdef _IO_USE_OLD_IO_FILE
-# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
- { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
- 0, _IO_pos_BAD }
-# else
-# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
- { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
- 0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
- NULL, WDP, 0 }
-# else
-# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
- { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
- 0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
- 0 }
-# endif
-# endif
-#endif
-
-/* VTABLE_LABEL defines NAME as of the CLASS class.
- CNLENGTH is strlen(#CLASS). */
-#ifdef __GNUC__
-# if _G_VTABLE_LABEL_HAS_LENGTH
-# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
- extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS);
-# else
-# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
- extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS);
-# endif
-#endif /* __GNUC__ */
-
-#if !defined(builtinbuf_vtable) && defined(__cplusplus)
-# ifdef __GNUC__
-VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10)
-# else
-# if _G_VTABLE_LABEL_HAS_LENGTH
-# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf
-# else
-# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf
-# endif
-# endif
-#endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */
-
-#if defined(__STDC__) || defined(__cplusplus)
-# define _IO_va_start(args, last) va_start(args, last)
-#else
-# define _IO_va_start(args, last) va_start(args)
-#endif
-
-extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
-
-#if 1
-# define COERCE_FILE(FILE) /* Nothing */
-#else
-/* This is part of the kludge for binary compatibility with old stdio. */
-# define COERCE_FILE(FILE) \
- (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
- && (FILE) = *(FILE**)&((int*)fp)[1])
-#endif
-
-#ifdef EINVAL
-# define MAYBE_SET_EINVAL __set_errno (EINVAL)
-#else
-# define MAYBE_SET_EINVAL /* nothing */
-#endif
-
-#ifdef IO_DEBUG
-# define CHECK_FILE(FILE, RET) \
- if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \
- else { COERCE_FILE(FILE); \
- if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
- { MAYBE_SET_EINVAL; return RET; }}
-#else
-# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE)
-#endif
diff --git a/contrib/libstdc++/libio/stdfiles.c b/contrib/libstdc++/libio/stdfiles.c
deleted file mode 100644
index b81fef8..0000000
--- a/contrib/libstdc++/libio/stdfiles.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 1993, 1994, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-
-/* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
- for C code. Compare stdstreams.cc.
- (The difference is that here the vtable field is set to 0,
- so the objects defined are not valid C++ objects. On the other
- hand, we don't need a C++ compiler to build this file.) */
-
-#include "libioP.h"
-
-#ifdef _IO_MTSAFE_IO
-# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
- static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
- static struct _IO_wide_data _IO_wide_data_##FD \
- = { ._wide_vtable = &_IO_wfile_jumps }; \
- struct _IO_FILE_plus NAME \
- = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
- &_IO_file_jumps};
-# else
-# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
- static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
- struct _IO_FILE_plus NAME \
- = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
- &_IO_file_jumps};
-# endif
-#else
-# if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
- static struct _IO_wide_data _IO_wide_data_##FD \
- = { ._wide_vtable = &_IO_wfile_jumps }; \
- struct _IO_FILE_plus NAME \
- = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
- &_IO_file_jumps};
-# else
-# define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
- struct _IO_FILE_plus NAME \
- = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
- &_IO_file_jumps};
-# endif
-#endif
-
-DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
-DEF_STDFILE(_IO_2_1_stdout_, 1, &_IO_2_1_stdin_, _IO_NO_READS);
-DEF_STDFILE(_IO_2_1_stderr_, 2, &_IO_2_1_stdout_, _IO_NO_READS+_IO_UNBUFFERED);
-
-struct _IO_FILE_plus *_IO_list_all = &_IO_2_1_stderr_;
diff --git a/contrib/libstdc++/libio/stdio.c b/contrib/libstdc++/libio/stdio.c
deleted file mode 100644
index 3b897ce..0000000
--- a/contrib/libstdc++/libio/stdio.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-#include "libioP.h"
-#include "stdio.h"
-
-#undef stdin
-#undef stdout
-#undef stderr
-_IO_FILE *stdin = (FILE *) &_IO_2_1_stdin_;
-_IO_FILE *stdout = (FILE *) &_IO_2_1_stdout_;
-_IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
-
-#undef _IO_stdin
-#undef _IO_stdout
-#undef _IO_stderr
-#ifdef _LIBC
-strong_alias (stdin, _IO_stdin);
-strong_alias (stdout, _IO_stdout);
-strong_alias (stderr, _IO_stderr);
-#endif
diff --git a/contrib/libstdc++/libio/wfiledoalloc.c b/contrib/libstdc++/libio/wfiledoalloc.c
deleted file mode 100644
index 9c05162..0000000
--- a/contrib/libstdc++/libio/wfiledoalloc.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright (C) 1993, 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this library; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
-
- As a special exception, if you link this library with files
- compiled with a GNU compiler to produce an executable, this does
- not cause the resulting executable to be covered by the GNU General
- Public License. This exception does not however invalidate any
- other reasons why the executable file might be covered by the GNU
- General Public License. */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/* Modified for GNU iostream by Per Bothner 1991, 1992. */
-
-#ifndef _POSIX_SOURCE
-# define _POSIX_SOURCE
-#endif
-#include "libioP.h"
-#ifdef _GLIBCPP_USE_WCHAR_T
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#include <unistd.h>
-#endif
-
-#ifdef _LIBC
-# undef isatty
-# define isatty(Fd) __isatty (Fd)
-#endif
-
-/*
- * Allocate a file buffer, or switch to unbuffered I/O.
- * Per the ANSI C standard, ALL tty devices default to line buffered.
- *
- * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
- * optimisation) right after the _fstat() that finds the buffer size.
- */
-
-int
-_IO_wfile_doallocate (fp)
- _IO_FILE *fp;
-{
- _IO_size_t size;
- int couldbetty;
- wchar_t *p;
- struct _G_stat64 st;
-
- /* Allocate room for the external buffer. */
- if (fp->_IO_buf_base == NULL)
- _IO_file_doallocate (fp);
-
- if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
- {
- couldbetty = 0;
- size = _IO_BUFSIZ;
-#if 0
- /* do not try to optimise fseek() */
- fp->_flags |= __SNPT;
-#endif
- }
- else
- {
- couldbetty = S_ISCHR (st.st_mode);
-#if _IO_HAVE_ST_BLKSIZE
- size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
-#else
- size = _IO_BUFSIZ;
-#endif
- }
- ALLOC_WBUF (p, size * sizeof (wchar_t), EOF);
- _IO_wsetb (fp, p, p + size, 1);
- if (couldbetty && isatty (fp->_fileno))
- fp->_flags |= _IO_LINE_BUF;
- return 1;
-}
-
-#endif /* _GLIBCPP_USE_WCHAR_T */
diff --git a/contrib/libstdc++/libio/wfileops.c b/contrib/libstdc++/libio/wfileops.c
deleted file mode 100644
index 1dd524a..0000000
--- a/contrib/libstdc++/libio/wfileops.c
+++ /dev/null
@@ -1,754 +0,0 @@
-/* Copyright (C) 1993, 95, 97, 98, 99, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
- Written by Ulrich Drepper <drepper@cygnus.com>.
- Based on the single byte version by Per Bothner <bothner@cygnus.com>.
-
- 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 <assert.h>
-#include <libioP.h>
-#ifdef _GLIBCPP_USE_WCHAR_T
-#include <wchar.h>
-#ifdef HAVE_GCONV_H
-# include <gconv.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-
-
-#ifndef _LIBC
-# define _IO_new_do_write _IO_do_write
-# define _IO_new_file_attach _IO_file_attach
-# define _IO_new_file_close_it _IO_file_close_it
-# define _IO_new_file_finish _IO_file_finish
-# define _IO_new_file_fopen _IO_file_fopen
-# define _IO_new_file_init _IO_file_init
-# define _IO_new_file_setbuf _IO_file_setbuf
-# define _IO_new_file_sync _IO_file_sync
-# define _IO_new_file_overflow _IO_file_overflow
-# define _IO_new_file_seekoff _IO_file_seekoff
-# define _IO_new_file_underflow _IO_file_underflow
-# define _IO_new_file_write _IO_file_write
-# define _IO_new_file_xsputn _IO_file_xsputn
-#endif
-
-
-_IO_FILE *
-_IO_wfile_setbuf (fp, p, len)
- _IO_FILE *fp;
- wchar_t *p;
- _IO_ssize_t len;
-{
- if (_IO_wdefault_setbuf (fp, p, len) == NULL)
- return NULL;
-
- fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
- fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
- _IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
- fp->_wide_data->_IO_buf_base);
-
- return fp;
-}
-
-
-/* Convert TO_DO wide character from DATA to FP.
- Then mark FP as having empty buffers. */
-int
-_IO_wdo_write (fp, data, to_do)
- _IO_FILE *fp;
- const wchar_t *data;
- _IO_size_t to_do;
-{
- struct _IO_codecvt *cc = fp->_codecvt;
-
- if (to_do > 0)
- {
- if (fp->_IO_write_end == fp->_IO_write_ptr
- && fp->_IO_write_end != fp->_IO_write_base)
- {
- if (_IO_new_do_write (fp, fp->_IO_write_base,
- fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
- return EOF;
- }
-
- do
- {
- enum __codecvt_result result;
- const wchar_t *new_data;
-
- /* Now convert from the internal format into the external buffer. */
- result = (*cc->__codecvt_do_out) (cc, &fp->_wide_data->_IO_state,
- data, data + to_do, &new_data,
- fp->_IO_write_ptr,
- fp->_IO_buf_end,
- &fp->_IO_write_ptr);
-
- /* Write out what we produced so far. */
- if (_IO_new_do_write (fp, fp->_IO_write_base,
- fp->_IO_write_ptr - fp->_IO_write_base) == EOF)
- /* Something went wrong. */
- return EOF;
-
- to_do -= new_data - data;
-
- /* Next see whether we had problems during the conversion. If yes,
- we cannot go on. */
- if (result != __codecvt_ok
- && (result != __codecvt_partial || new_data - data == 0))
- break;
-
- data = new_data;
- }
- while (to_do > 0);
- }
-
- _IO_wsetg (fp, fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base,
- fp->_wide_data->_IO_buf_base);
- fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
- = fp->_wide_data->_IO_buf_base;
- fp->_wide_data->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
- ? fp->_wide_data->_IO_buf_base
- : fp->_wide_data->_IO_buf_end);
-
- return to_do == 0 ? 0 : WEOF;
-}
-
-
-wint_t
-_IO_wfile_underflow (fp)
- _IO_FILE *fp;
-{
- struct _IO_codecvt *cd;
- enum __codecvt_result status;
- _IO_ssize_t count;
- int tries;
- const char *read_ptr_copy;
-
- if (fp->_flags & _IO_NO_READS)
- {
- fp->_flags |= _IO_ERR_SEEN;
- __set_errno (EBADF);
- return WEOF;
- }
- if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
- return *fp->_wide_data->_IO_read_ptr;
-
- cd = fp->_codecvt;
-
- /* Maybe there is something left in the external buffer. */
- if (fp->_IO_read_ptr < fp->_IO_read_end)
- {
- /* Convert it. */
- size_t avail_bytes = fp->_IO_read_end - fp->_IO_read_ptr;
-
- if (avail_bytes >= (*cd->__codecvt_do_max_length) (cd))
- {
- /* There is more in the external. */
- const char *read_stop = (const char *) fp->_IO_read_ptr;
-
- fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
- status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
- fp->_IO_read_ptr, fp->_IO_read_end,
- &read_stop,
- fp->_wide_data->_IO_read_end,
- fp->_wide_data->_IO_buf_end,
- &fp->_wide_data->_IO_read_end);
-
- fp->_IO_read_ptr = (char *) read_stop;
-
- /* If we managed to generate some text return the next character. */
- if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
- return *fp->_wide_data->_IO_read_ptr;
-
- if (status == __codecvt_error)
- {
- __set_errno (EILSEQ);
- fp->_flags |= _IO_ERR_SEEN;
- return WEOF;
- }
- }
-
- /* Move the remaining content of the read buffer to the beginning. */
- memmove (fp->_IO_buf_base, fp->_IO_read_ptr,
- fp->_IO_read_end - fp->_IO_read_ptr);
- fp->_IO_read_end = (fp->_IO_buf_base
- + (fp->_IO_read_end - fp->_IO_read_ptr));
- fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
- }
- else
- fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
- fp->_IO_buf_base;
-
- if (fp->_IO_buf_base == NULL)
- {
- /* Maybe we already have a push back pointer. */
- if (fp->_IO_save_base != NULL)
- {
- free (fp->_IO_save_base);
- fp->_flags &= ~_IO_IN_BACKUP;
- }
- _IO_doallocbuf (fp);
-
- fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
- fp->_IO_buf_base;
- }
-
- fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end =
- fp->_IO_buf_base;
-
- if (fp->_wide_data->_IO_buf_base == NULL)
- {
- /* Maybe we already have a push back pointer. */
- if (fp->_wide_data->_IO_save_base != NULL)
- {
- free (fp->_wide_data->_IO_save_base);
- fp->_flags &= ~_IO_IN_BACKUP;
- }
- _IO_wdoallocbuf (fp);
- }
-
- /* Flush all line buffered files before reading. */
- /* FIXME This can/should be moved to genops ?? */
- if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
- _IO_flush_all_linebuffered ();
-
- _IO_switch_to_get_mode (fp);
-
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr =
- fp->_wide_data->_IO_buf_base;
- fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_buf_base;
- fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr =
- fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_buf_base;
-
- tries = 0;
- again:
- count = _IO_SYSREAD (fp, fp->_IO_read_end,
- fp->_IO_buf_end - fp->_IO_read_end);
- if (count <= 0)
- {
- if (count == 0 && tries == 0)
- fp->_flags |= _IO_EOF_SEEN;
- else
- fp->_flags |= _IO_ERR_SEEN, count = 0;
- }
- fp->_IO_read_end += count;
- if (count == 0)
- {
- if (tries != 0)
- /* There are some bytes in the external buffer but they don't
- convert to anything. */
- __set_errno (EILSEQ);
- return WEOF;
- }
- if (fp->_offset != _IO_pos_BAD)
- _IO_pos_adjust (fp->_offset, count);
-
- /* Now convert the read input. */
- fp->_wide_data->_IO_last_state = fp->_wide_data->_IO_state;
- fp->_IO_read_base = fp->_IO_read_ptr;
- status = (*cd->__codecvt_do_in) (cd, &fp->_wide_data->_IO_state,
- fp->_IO_read_ptr, fp->_IO_read_end,
- &read_ptr_copy,
- fp->_wide_data->_IO_read_end,
- fp->_wide_data->_IO_buf_end,
- &fp->_wide_data->_IO_read_end);
-
- fp->_IO_read_ptr = (char *) read_ptr_copy;
- if (fp->_wide_data->_IO_read_end == fp->_wide_data->_IO_buf_base)
- {
- if (status == __codecvt_error || fp->_IO_read_end == fp->_IO_buf_end)
- {
- __set_errno (EILSEQ);
- fp->_flags |= _IO_ERR_SEEN;
- return WEOF;
- }
-
- /* The read bytes make no complete character. Try reading again. */
- assert (status == __codecvt_partial);
- ++tries;
- goto again;
- }
-
- return *fp->_wide_data->_IO_read_ptr;
-}
-
-
-wint_t
-_IO_wfile_overflow (f, wch)
- _IO_FILE *f;
- wint_t wch;
-{
- if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
- {
- f->_flags |= _IO_ERR_SEEN;
- __set_errno (EBADF);
- return WEOF;
- }
- /* If currently reading or no buffer allocated. */
- if ((f->_flags & _IO_CURRENTLY_PUTTING) == 0)
- {
- /* Allocate a buffer if needed. */
- if (f->_wide_data->_IO_write_base == 0)
- {
- _IO_wdoallocbuf (f);
- _IO_wsetg (f, f->_wide_data->_IO_buf_base,
- f->_wide_data->_IO_buf_base, f->_wide_data->_IO_buf_base);
-
- if (f->_IO_write_base == NULL)
- {
- _IO_doallocbuf (f);
- _IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
- }
- }
- else
- {
- /* Otherwise must be currently reading. If _IO_read_ptr
- (and hence also _IO_read_end) is at the buffer end,
- logically slide the buffer forwards one block (by setting
- the read pointers to all point at the beginning of the
- block). This makes room for subsequent output.
- Otherwise, set the read pointers to _IO_read_end (leaving
- that alone, so it can continue to correspond to the
- external position). */
- if (f->_wide_data->_IO_read_ptr == f->_wide_data->_IO_buf_end)
- {
- f->_IO_read_end = f->_IO_read_ptr = f->_IO_buf_base;
- f->_wide_data->_IO_read_end = f->_wide_data->_IO_read_ptr =
- f->_wide_data->_IO_buf_base;
- }
- }
- f->_wide_data->_IO_write_ptr = f->_wide_data->_IO_read_ptr;
- f->_wide_data->_IO_write_base = f->_wide_data->_IO_write_ptr;
- f->_wide_data->_IO_write_end = f->_wide_data->_IO_buf_end;
- f->_wide_data->_IO_read_base = f->_wide_data->_IO_read_ptr =
- f->_wide_data->_IO_read_end;
-
- f->_IO_write_ptr = f->_IO_read_ptr;
- f->_IO_write_base = f->_IO_write_ptr;
- f->_IO_write_end = f->_IO_buf_end;
- f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
-
- f->_flags |= _IO_CURRENTLY_PUTTING;
- if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
- f->_wide_data->_IO_write_end = f->_wide_data->_IO_write_ptr;
- }
- if (wch == WEOF)
- return _IO_do_flush (f);
- if (f->_wide_data->_IO_write_ptr == f->_wide_data->_IO_buf_end)
- /* Buffer is really full */
- if (_IO_do_flush (f) == WEOF)
- return WEOF;
- *f->_wide_data->_IO_write_ptr++ = wch;
- if ((f->_flags & _IO_UNBUFFERED)
- || ((f->_flags & _IO_LINE_BUF) && wch == L'\n'))
- if (_IO_do_flush (f) == WEOF)
- return WEOF;
- return wch;
-}
-
-wint_t
-_IO_wfile_sync (fp)
- _IO_FILE *fp;
-{
- _IO_ssize_t delta;
- wint_t retval = 0;
-
- /* char* ptr = cur_ptr(); */
- if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
- if (_IO_do_flush (fp))
- return WEOF;
- delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
- if (delta != 0)
- {
- /* We have to find out how many bytes we have to go back in the
- external buffer. */
- struct _IO_codecvt *cv = fp->_codecvt;
- _IO_off64_t new_pos;
-
- int clen = (*cv->__codecvt_do_encoding) (cv);
-
- if (clen > 0)
- /* It is easy, a fixed number of input bytes are used for each
- wide character. */
- delta *= clen;
- else
- {
- /* We have to find out the hard way how much to back off.
- To do this we determine how much input we needed to
- generate the wide characters up to the current reading
- position. */
- int nread;
-
- fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
- nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
- fp->_IO_read_base,
- fp->_IO_read_end, delta);
- fp->_IO_read_ptr = fp->_IO_read_base + nread;
- delta = -(fp->_IO_read_end - fp->_IO_read_base - nread);
- }
-
- new_pos = _IO_SYSSEEK (fp, delta, 1);
- if (new_pos != (_IO_off64_t) EOF)
- {
- fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_read_ptr;
- fp->_IO_read_end = fp->_IO_read_ptr;
- }
-#ifdef ESPIPE
- else if (errno == ESPIPE)
- ; /* Ignore error from unseekable devices. */
-#endif
- else
- retval = WEOF;
- }
- if (retval != WEOF)
- fp->_offset = _IO_pos_BAD;
- /* FIXME: Cleanup - can this be shared? */
- /* setg(base(), ptr, ptr); */
- return retval;
-}
-
-_IO_off64_t
-_IO_wfile_seekoff (fp, offset, dir, mode)
- _IO_FILE *fp;
- _IO_off64_t offset;
- int dir;
- int mode;
-{
- _IO_off64_t result;
- _IO_off64_t delta, new_offset;
- long int count;
- /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
- offset of the underlying file must be exact. */
- int must_be_exact = ((fp->_wide_data->_IO_read_base
- == fp->_wide_data->_IO_read_end)
- && (fp->_wide_data->_IO_write_base
- == fp->_wide_data->_IO_write_ptr));
-
- if (mode == 0)
- dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
-
- /* Flush unwritten characters.
- (This may do an unneeded write if we seek within the buffer.
- But to be able to switch to reading, we would need to set
- egptr to ptr. That can't be done in the current design,
- which assumes file_ptr() is eGptr. Anyway, since we probably
- end up flushing when we close(), it doesn't make much difference.)
- FIXME: simulate mem-papped files. */
-
- if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base
- || _IO_in_put_mode (fp))
- if (_IO_switch_to_wget_mode (fp))
- return WEOF;
-
- if (fp->_wide_data->_IO_buf_base == NULL)
- {
- /* It could be that we already have a pushback buffer. */
- if (fp->_wide_data->_IO_read_base != NULL)
- {
- free (fp->_wide_data->_IO_read_base);
- fp->_flags &= ~_IO_IN_BACKUP;
- }
- _IO_doallocbuf (fp);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
- _IO_wsetp (fp, fp->_wide_data->_IO_buf_base,
- fp->_wide_data->_IO_buf_base);
- _IO_wsetg (fp, fp->_wide_data->_IO_buf_base,
- fp->_wide_data->_IO_buf_base, fp->_wide_data->_IO_buf_base);
- }
-
- switch (dir)
- {
- struct _IO_codecvt *cv;
- int clen;
-
- case _IO_seek_cur:
- /* Adjust for read-ahead (bytes is buffer). To do this we must
- find out which position in the external buffer corresponds to
- the current position in the internal buffer. */
- cv = fp->_codecvt;
- clen = (*cv->__codecvt_do_encoding) (cv);
-
- if (clen > 0)
- offset -= (fp->_wide_data->_IO_read_end
- - fp->_wide_data->_IO_read_ptr) * clen;
- else
- {
- int nread;
-
- delta = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
- fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
- nread = (*cv->__codecvt_do_length) (cv, &fp->_wide_data->_IO_state,
- fp->_IO_read_base,
- fp->_IO_read_end, delta);
- fp->_IO_read_ptr = fp->_IO_read_base + nread;
- offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
- }
-
- if (fp->_offset == _IO_pos_BAD)
- goto dumb;
- /* Make offset absolute, assuming current pointer is file_ptr(). */
- offset += fp->_offset;
-
- dir = _IO_seek_set;
- break;
- case _IO_seek_set:
- break;
- case _IO_seek_end:
- {
- struct _G_stat64 st;
- if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode))
- {
- offset += st.st_size;
- dir = _IO_seek_set;
- }
- else
- goto dumb;
- }
- }
- /* At this point, dir==_IO_seek_set. */
-
- /* If we are only interested in the current position we've found it now. */
- if (mode == 0)
- return offset;
-
- /* If destination is within current buffer, optimize: */
- if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
- && !_IO_in_backup (fp))
- {
- /* Offset relative to start of main get area. */
- _IO_off64_t rel_offset = (offset - fp->_offset
- + (fp->_IO_read_end - fp->_IO_read_base));
- if (rel_offset >= 0)
- {
-#if 0
- if (_IO_in_backup (fp))
- _IO_switch_to_main_get_area (fp);
-#endif
- if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
- {
- fp->_IO_read_ptr = fp->_IO_read_base + rel_offset;
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
-
- /* Now set the pointer for the internal buffer. This
- might be an iterative process. Though the read
- pointer is somewhere in the current external buffer
- this does not mean we can convert this whole buffer
- at once fitting in the internal buffer. */
- do
- {
-
- }
- while (0);
-
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
-#ifdef TODO
- /* If we have streammarkers, seek forward by reading ahead. */
- if (_IO_have_markers (fp))
- {
- int to_skip = rel_offset
- - (fp->_IO_read_ptr - fp->_IO_read_base);
- if (ignore (to_skip) != to_skip)
- goto dumb;
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
-#endif
- }
-#ifdef TODO
- if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
- {
- if (!_IO_in_backup (fp))
- _IO_switch_to_backup_area (fp);
- gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
-#endif
- }
-
-#ifdef TODO
- _IO_unsave_markers (fp);
-#endif
-
- if (fp->_flags & _IO_NO_READS)
- goto dumb;
-
- /* Try to seek to a block boundary, to improve kernel page management. */
- new_offset = offset & ~(fp->_IO_buf_end - fp->_IO_buf_base - 1);
- delta = offset - new_offset;
- if (delta > fp->_IO_buf_end - fp->_IO_buf_base)
- {
- new_offset = offset;
- delta = 0;
- }
- result = _IO_SYSSEEK (fp, new_offset, 0);
- if (result < 0)
- return EOF;
- if (delta == 0)
- count = 0;
- else
- {
- count = _IO_SYSREAD (fp, fp->_IO_buf_base,
- (must_be_exact
- ? delta : fp->_IO_buf_end - fp->_IO_buf_base));
- if (count < delta)
- {
- /* We weren't allowed to read, but try to seek the remainder. */
- offset = count == EOF ? delta : delta-count;
- dir = _IO_seek_cur;
- goto dumb;
- }
- }
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta,
- fp->_IO_buf_base + count);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- fp->_offset = result + count;
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- return offset;
- dumb:
-
- _IO_unsave_markers (fp);
- result = _IO_SYSSEEK (fp, offset, dir);
- if (result != EOF)
- {
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- fp->_offset = result;
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- }
- return result;
-
-resync:
- /* We need to do it since it is possible that the file offset in
- the kernel may be changed behind our back. It may happen when
- we fopen a file and then do a fork. One process may access the
- the file and the kernel file offset will be changed. */
- if (fp->_offset >= 0)
- _IO_SYSSEEK (fp, fp->_offset, 0);
-
- return offset;
-}
-
-
-_IO_size_t
-_IO_wfile_xsputn (f, data, n)
- _IO_FILE *f;
- const void *data;
- _IO_size_t n;
-{
- register const wchar_t *s = (const wchar_t *) data;
- _IO_size_t to_do = n;
- int must_flush = 0;
- _IO_size_t count;
-
- if (n <= 0)
- return 0;
- /* This is an optimized implementation.
- If the amount to be written straddles a block boundary
- (or the filebuf is unbuffered), use sys_write directly. */
-
- /* First figure out how much space is available in the buffer. */
- count = f->_wide_data->_IO_write_end - f->_wide_data->_IO_write_ptr;
- if ((f->_flags & _IO_LINE_BUF) && (f->_flags & _IO_CURRENTLY_PUTTING))
- {
- count = f->_wide_data->_IO_buf_end - f->_wide_data->_IO_write_ptr;
- if (count >= n)
- {
- register const wchar_t *p;
- for (p = s + n; p > s; )
- {
- if (*--p == L'\n')
- {
- count = p - s + 1;
- must_flush = 1;
- break;
- }
- }
- }
- }
- /* Then fill the buffer. */
- if (count > 0)
- {
- if (count > to_do)
- count = to_do;
- if (count > 20)
- {
-#ifdef _LIBC
- f->_wide_data->_IO_write_ptr =
- __wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
-#else
- wmemcpy (f->_wide_data->_IO_write_ptr, s, count);
- f->_wide_data->_IO_write_ptr += count;
-#endif
- s += count;
- }
- else
- {
- register wchar_t *p = f->_wide_data->_IO_write_ptr;
- register int i = (int) count;
- while (--i >= 0)
- *p++ = *s++;
- f->_wide_data->_IO_write_ptr = p;
- }
- to_do -= count;
- }
- if (to_do > 0)
- to_do -= _IO_wdefault_xsputn (f, s, to_do);
- if (must_flush
- && f->_wide_data->_IO_write_ptr != f->_wide_data->_IO_write_base)
- _IO_wdo_write (f, f->_wide_data->_IO_write_base,
- f->_wide_data->_IO_write_ptr
- - f->_wide_data->_IO_write_base);
-
- return n - to_do;
-}
-
-
-struct _IO_jump_t _IO_wfile_jumps =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_new_file_finish),
- JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
- JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow),
- JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
- JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
- JUMP_INIT(xsputn, _IO_wfile_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn),
- JUMP_INIT(seekoff, _IO_wfile_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_new_file_setbuf),
- JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
- JUMP_INIT(doallocate, _IO_wfile_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-
-#endif /* _GLIBCPP_USE_WCHAR_T */
diff --git a/contrib/libstdc++/libio/wgenops.c b/contrib/libstdc++/libio/wgenops.c
deleted file mode 100644
index 7485452..0000000
--- a/contrib/libstdc++/libio/wgenops.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/* Copyright (C) 1993, 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU IO Library.
- Written by Ulrich Drepper <drepper@cygnus.com>.
- Based on the single byte version by Per Bothner <bothner@cygnus.com>.
-
- 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. */
-
-/* Generic or default I/O operations. */
-
-#include "libioP.h"
-#ifdef _GLIBCPP_USE_WCHAR_T
-#ifdef __STDC__
-#include <stdlib.h>
-#endif
-#include <string.h>
-#include <wchar.h>
-
-
-#ifndef _LIBC
-# define __wmemcpy(dst, src, n) wmemcpy (dst, src, n)
-#endif
-
-
-static int save_for_wbackup __P ((_IO_FILE *fp, wchar_t *end_p))
-#ifdef _LIBC
- internal_function
-#endif
- ;
-
-/* Return minimum _pos markers
- Assumes the current get area is the main get area. */
-_IO_ssize_t _IO_least_wmarker __P ((_IO_FILE *fp, wchar_t *end_p));
-
-_IO_ssize_t
-_IO_least_wmarker (fp, end_p)
- _IO_FILE *fp;
- wchar_t *end_p;
-{
- _IO_ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
- struct _IO_marker *mark;
- for (mark = fp->_markers; mark != NULL; mark = mark->_next)
- if (mark->_pos < least_so_far)
- least_so_far = mark->_pos;
- return least_so_far;
-}
-
-/* Switch current get area from backup buffer to (start of) main get area. */
-void
-_IO_switch_to_main_wget_area (fp)
- _IO_FILE *fp;
-{
- wchar_t *tmp;
- fp->_flags &= ~_IO_IN_BACKUP;
- /* Swap _IO_read_end and _IO_save_end. */
- tmp = fp->_wide_data->_IO_read_end;
- fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
- fp->_wide_data->_IO_save_end= tmp;
- /* Swap _IO_read_base and _IO_save_base. */
- tmp = fp->_wide_data->_IO_read_base;
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
- fp->_wide_data->_IO_save_base = tmp;
- /* Set _IO_read_ptr. */
- fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_base;
-}
-
-
-/* Switch current get area from main get area to (end of) backup area. */
-void
-_IO_switch_to_wbackup_area (fp)
- _IO_FILE *fp;
-{
- wchar_t *tmp;
- fp->_flags |= _IO_IN_BACKUP;
- /* Swap _IO_read_end and _IO_save_end. */
- tmp = fp->_wide_data->_IO_read_end;
- fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_save_end;
- fp->_wide_data->_IO_save_end = tmp;
- /* Swap _IO_read_base and _IO_save_base. */
- tmp = fp->_wide_data->_IO_read_base;
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_save_base;
- fp->_wide_data->_IO_save_base = tmp;
- /* Set _IO_read_ptr. */
- fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
-}
-
-
-void
-_IO_wsetb (f, b, eb, a)
- _IO_FILE *f;
- wchar_t *b;
- wchar_t *eb;
- int a;
-{
- if (f->_wide_data->_IO_buf_base && !(f->_flags & _IO_USER_BUF))
- FREE_BUF (f->_wide_data->_IO_buf_base, _IO_wblen (f));
- f->_wide_data->_IO_buf_base = b;
- f->_wide_data->_IO_buf_end = eb;
- if (a)
- f->_flags &= ~_IO_USER_BUF;
- else
- f->_flags |= _IO_USER_BUF;
-}
-
-
-wint_t
-_IO_wdefault_pbackfail (fp, c)
- _IO_FILE *fp;
- wint_t c;
-{
- if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
- && !_IO_in_backup (fp)
- && (wint_t) fp->_IO_read_ptr[-1] == c)
- --fp->_IO_read_ptr;
- else
- {
- /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/
- if (!_IO_in_backup (fp))
- {
- /* We need to keep the invariant that the main get area
- logically follows the backup area. */
- if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
- && _IO_have_wbackup (fp))
- {
- if (save_for_wbackup (fp, fp->_wide_data->_IO_read_ptr))
- return WEOF;
- }
- else if (!_IO_have_wbackup (fp))
- {
- /* No backup buffer: allocate one. */
- /* Use nshort buffer, if unused? (probably not) FIXME */
- int backup_size = 128;
- wchar_t *bbuf = (wchar_t *) malloc (backup_size
- * sizeof (wchar_t));
- if (bbuf == NULL)
- return WEOF;
- fp->_wide_data->_IO_save_base = bbuf;
- fp->_wide_data->_IO_save_end = (fp->_wide_data->_IO_save_base
- + backup_size);
- fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_end;
- }
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr;
- _IO_switch_to_wbackup_area (fp);
- }
- else if (fp->_wide_data->_IO_read_ptr <= fp->_wide_data->_IO_read_base)
- {
- /* Increase size of existing backup buffer. */
- _IO_size_t new_size;
- _IO_size_t old_size = (fp->_wide_data->_IO_read_end
- - fp->_wide_data->_IO_read_base);
- wchar_t *new_buf;
- new_size = 2 * old_size;
- new_buf = (wchar_t *) malloc (new_size * sizeof (wchar_t));
- if (new_buf == NULL)
- return WEOF;
- __wmemcpy (new_buf + (new_size - old_size),
- fp->_wide_data->_IO_read_base, old_size);
- free (fp->_wide_data->_IO_read_base);
- _IO_wsetg (fp, new_buf, new_buf + (new_size - old_size),
- new_buf + new_size);
- fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_read_ptr;
- }
-
- *--fp->_wide_data->_IO_read_ptr = c;
- }
- return c;
-}
-
-
-void
-_IO_wdefault_finish (fp, dummy)
- _IO_FILE *fp;
- int dummy;
-{
- struct _IO_marker *mark;
- if (fp->_wide_data->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
- {
- FREE_BUF (fp->_wide_data->_IO_buf_base,
- _IO_wblen (fp) * sizeof (wchar_t));
- fp->_wide_data->_IO_buf_base = fp->_wide_data->_IO_buf_end = NULL;
- }
-
- for (mark = fp->_markers; mark != NULL; mark = mark->_next)
- mark->_sbuf = NULL;
-
- if (fp->_IO_save_base)
- {
- free (fp->_wide_data->_IO_save_base);
- fp->_IO_save_base = NULL;
- }
-
-#ifdef _IO_MTSAFE_IO
- _IO_lock_fini (*fp->_lock);
-#endif
-
- _IO_un_link ((struct _IO_FILE_plus *) fp);
-}
-
-
-wint_t
-_IO_wdefault_uflow (fp)
- _IO_FILE *fp;
-{
- wint_t wch;
- wch = _IO_UNDERFLOW (fp);
- if (wch == WEOF)
- return WEOF;
- return *fp->_wide_data->_IO_read_ptr++;
-}
-
-
-wint_t
-__woverflow (f, wch)
- _IO_FILE *f;
- wint_t wch;
-{
- if (f->_mode == 0)
- _IO_fwide (f, 1);
- return _IO_OVERFLOW (f, wch);
-}
-
-
-wint_t
-__wuflow (fp)
- _IO_FILE *fp;
-{
- if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
- return WEOF;
-
- if (fp->_mode == 0)
- _IO_fwide (fp, 1);
- if (_IO_in_put_mode (fp))
- if (_IO_switch_to_wget_mode (fp) == EOF)
- return WEOF;
- if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
- return *fp->_wide_data->_IO_read_ptr++;
- if (_IO_in_backup (fp))
- {
- _IO_switch_to_main_wget_area (fp);
- if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
- return *fp->_wide_data->_IO_read_ptr++;
- }
- if (_IO_have_markers (fp))
- {
- if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
- return WEOF;
- }
- else if (_IO_have_wbackup (fp))
- _IO_free_wbackup_area (fp);
- return _IO_UFLOW (fp);
-}
-
-
-wint_t
-__wunderflow (fp)
- _IO_FILE *fp;
-{
- if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
- return WEOF;
-
- if (fp->_mode == 0)
- _IO_fwide (fp, 1);
- if (_IO_in_put_mode (fp))
- if (_IO_switch_to_wget_mode (fp) == EOF)
- return WEOF;
- if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
- return *fp->_wide_data->_IO_read_ptr;
- if (_IO_in_backup (fp))
- {
- _IO_switch_to_main_wget_area (fp);
- if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
- return *fp->_wide_data->_IO_read_ptr;
- }
- if (_IO_have_markers (fp))
- {
- if (save_for_wbackup (fp, fp->_wide_data->_IO_read_end))
- return WEOF;
- }
- else if (_IO_have_backup (fp))
- _IO_free_wbackup_area (fp);
- return _IO_UNDERFLOW (fp);
-}
-
-
-_IO_size_t
-_IO_wdefault_xsputn (f, data, n)
- _IO_FILE *f;
- const void *data;
- _IO_size_t n;
-{
- const wchar_t *s = (const wchar_t *) data;
- _IO_size_t more = n;
- if (more <= 0)
- return 0;
- for (;;)
- {
- /* Space available. */
- _IO_ssize_t count = (f->_wide_data->_IO_write_end
- - f->_wide_data->_IO_write_ptr);
- if (count > 0)
- {
- if ((_IO_size_t) count > more)
- count = more;
- if (count > 20)
- {
-#ifdef _LIBC
- f->_wide_data->_IO_write_ptr =
- __wmempcpy (f->_wide_data->_IO_write_ptr, s, count);
-#else
- memcpy (f->_wide_data->_IO_write_ptr, s, count);
- f->_wide_data->_IO_write_ptr += count;
-#endif
- s += count;
- }
- else if (count <= 0)
- count = 0;
- else
- {
- wchar_t *p = f->_wide_data->_IO_write_ptr;
- _IO_ssize_t i;
- for (i = count; --i >= 0; )
- *p++ = *s++;
- f->_wide_data->_IO_write_ptr = p;
- }
- more -= count;
- }
- if (more == 0 || __woverflow (f, *s++) == WEOF)
- break;
- more--;
- }
- return n - more;
-}
-
-
-_IO_size_t
-_IO_wdefault_xsgetn (fp, data, n)
- _IO_FILE *fp;
- void *data;
- _IO_size_t n;
-{
- _IO_size_t more = n;
- wchar_t *s = (wchar_t*) data;
- for (;;)
- {
- /* Data available. */
- _IO_ssize_t count = (fp->_wide_data->_IO_read_end
- - fp->_wide_data->_IO_read_ptr);
- if (count > 0)
- {
- if ((_IO_size_t) count > more)
- count = more;
- if (count > 20)
- {
-#ifdef _LIBC
- s = __wmempcpy (s, fp->_wide_data->_IO_read_ptr, count);
-#else
- memcpy (s, fp->_wide_data->_IO_read_ptr, count);
- s += count;
-#endif
- fp->_wide_data->_IO_read_ptr += count;
- }
- else if (count <= 0)
- count = 0;
- else
- {
- wchar_t *p = fp->_wide_data->_IO_read_ptr;
- int i = (int) count;
- while (--i >= 0)
- *s++ = *p++;
- fp->_wide_data->_IO_read_ptr = p;
- }
- more -= count;
- }
- if (more == 0 || __wunderflow (fp) == WEOF)
- break;
- }
- return n - more;
-}
-
-
-void
-_IO_wdoallocbuf (fp)
- _IO_FILE *fp;
-{
- if (fp->_wide_data->_IO_buf_base)
- return;
- if (!(fp->_flags & _IO_UNBUFFERED))
- if (_IO_DOALLOCATE (fp) != WEOF)
- return;
- _IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1, 0);
-}
-
-
-_IO_FILE *
-_IO_wdefault_setbuf (fp, p, len)
- _IO_FILE *fp;
- wchar_t *p;
- _IO_ssize_t len;
-{
- if (_IO_SYNC (fp) == EOF)
- return NULL;
- if (p == NULL || len == 0)
- {
- fp->_flags |= _IO_UNBUFFERED;
- _IO_wsetb (fp, fp->_wide_data->_shortbuf, fp->_wide_data->_shortbuf + 1,
- 0);
- }
- else
- {
- fp->_flags &= ~_IO_UNBUFFERED;
- _IO_wsetb (fp, p, p + len, 0);
- }
- fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
- = fp->_wide_data->_IO_write_end = 0;
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr
- = fp->_wide_data->_IO_read_end = 0;
- return fp;
-}
-
-
-int
-_IO_wdefault_doallocate (fp)
- _IO_FILE *fp;
-{
- wchar_t *buf;
-
- ALLOC_WBUF (buf, _IO_BUFSIZ, EOF);
- _IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1);
- return 1;
-}
-
-
-int
-_IO_switch_to_wget_mode (fp)
- _IO_FILE *fp;
-{
- if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
- if (_IO_OVERFLOW (fp, WEOF) == WEOF)
- return EOF;
- if (_IO_in_backup (fp))
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_backup_base;
- else
- {
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_buf_base;
- if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_read_end)
- fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_write_ptr;
- }
- fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_write_ptr;
-
- fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_write_ptr
- = fp->_wide_data->_IO_write_end = fp->_wide_data->_IO_read_ptr;
-
- fp->_flags &= ~_IO_CURRENTLY_PUTTING;
- return 0;
-}
-
-void
-_IO_free_wbackup_area (fp)
- _IO_FILE *fp;
-{
- if (_IO_in_backup (fp))
- _IO_switch_to_main_wget_area (fp); /* Just in case. */
- free (fp->_wide_data->_IO_save_base);
- fp->_wide_data->_IO_save_base = NULL;
- fp->_wide_data->_IO_save_end = NULL;
- fp->_wide_data->_IO_backup_base = NULL;
-}
-
-#if 0
-int
-_IO_switch_to_wput_mode (fp)
- _IO_FILE *fp;
-{
- fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
- fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
- /* Following is wrong if line- or un-buffered? */
- fp->_wide_data->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
- ? fp->_wide_data->_IO_read_end
- : fp->_wide_data->_IO_buf_end);
-
- fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
- fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_end;
-
- fp->_flags |= _IO_CURRENTLY_PUTTING;
- return 0;
-}
-#endif
-
-
-static int
-#ifdef _LIBC
-internal_function
-#endif
-save_for_wbackup (fp, end_p)
- _IO_FILE *fp;
- wchar_t *end_p;
-{
- /* Append [_IO_read_base..end_p] to backup area. */
- _IO_ssize_t least_mark = _IO_least_wmarker (fp, end_p);
- /* needed_size is how much space we need in the backup area. */
- _IO_size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
- - least_mark);
- /* FIXME: Dubious arithmetic if pointers are NULL */
- _IO_size_t current_Bsize = (fp->_wide_data->_IO_save_end
- - fp->_wide_data->_IO_save_base);
- _IO_size_t avail; /* Extra space available for future expansion. */
- _IO_ssize_t delta;
- struct _IO_marker *mark;
- if (needed_size > current_Bsize)
- {
- wchar_t *new_buffer;
- avail = 100;
- new_buffer = (wchar_t *) malloc ((avail + needed_size)
- * sizeof (wchar_t));
- if (new_buffer == NULL)
- return EOF; /* FIXME */
- if (least_mark < 0)
- {
-#ifdef _LIBC
- __wmempcpy (__wmempcpy (new_buffer + avail,
- fp->_wide_data->_IO_save_end + least_mark,
- -least_mark),
- fp->_wide_data->_IO_read_base,
- end_p - fp->_wide_data->_IO_read_base);
-#else
- memcpy (new_buffer + avail,
- fp->_wide_data->_IO_save_end + least_mark,
- -least_mark * sizeof (wchar_t));
- memcpy (new_buffer + avail - least_mark,
- fp->_wide_data->_IO_read_base,
- (end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
-#endif
- }
- else
- {
-#ifdef _LIBC
- __wmemcpy (new_buffer + avail,
- fp->_wide_data->_IO_read_base + least_mark,
- needed_size);
-#else
- memcpy (new_buffer + avail,
- fp->_wide_data->_IO_read_base + least_mark,
- needed_size * sizeof (wchar_t));
-#endif
- }
- if (fp->_wide_data->_IO_save_base)
- free (fp->_wide_data->_IO_save_base);
- fp->_wide_data->_IO_save_base = new_buffer;
- fp->_wide_data->_IO_save_end = new_buffer + avail + needed_size;
- }
- else
- {
- avail = current_Bsize - needed_size;
- if (least_mark < 0)
- {
-#ifdef _LIBC
- __wmemmove (fp->_wide_data->_IO_save_base + avail,
- fp->_wide_data->_IO_save_end + least_mark,
- -least_mark);
- __wmemcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
- fp->_wide_data->_IO_read_base,
- end_p - fp->_wide_data->_IO_read_base);
-#else
- memmove (fp->_wide_data->_IO_save_base + avail,
- fp->_wide_data->_IO_save_end + least_mark,
- -least_mark * sizeof (wchar_t));
- memcpy (fp->_wide_data->_IO_save_base + avail - least_mark,
- fp->_wide_data->_IO_read_base,
- (end_p - fp->_wide_data->_IO_read_base) * sizeof (wchar_t));
-#endif
- }
- else if (needed_size > 0)
-#ifdef _LIBC
- __wmemcpy (fp->_wide_data->_IO_save_base + avail,
- fp->_wide_data->_IO_read_base + least_mark,
- needed_size);
-#else
- memcpy (fp->_wide_data->_IO_save_base + avail,
- fp->_wide_data->_IO_read_base + least_mark,
- needed_size * sizeof (wchar_t));
-#endif
- }
- fp->_wide_data->_IO_backup_base = fp->_wide_data->_IO_save_base + avail;
- /* Adjust all the streammarkers. */
- delta = end_p - fp->_wide_data->_IO_read_base;
- for (mark = fp->_markers; mark != NULL; mark = mark->_next)
- mark->_pos -= delta;
- return 0;
-}
-
-wint_t
-_IO_sputbackwc (fp, c)
- _IO_FILE *fp;
- wint_t c;
-{
- wint_t result;
-
- if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
- && (wchar_t)fp->_wide_data->_IO_read_ptr[-1] == (wchar_t) c)
- {
- fp->_wide_data->_IO_read_ptr--;
- result = c;
- }
- else
- result = _IO_PBACKFAIL (fp, c);
-
- if (result != EOF)
- fp->_flags &= ~_IO_EOF_SEEN;
-
- return result;
-}
-
-wint_t
-_IO_sungetwc (fp)
- _IO_FILE *fp;
-{
- int result;
-
- if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base)
- {
- fp->_wide_data->_IO_read_ptr--;
- result = *fp->_wide_data->_IO_read_ptr;
- }
- else
- result = _IO_PBACKFAIL (fp, EOF);
-
- if (result != WEOF)
- fp->_flags &= ~_IO_EOF_SEEN;
-
- return result;
-}
-
-
-unsigned
-_IO_adjust_wcolumn (start, line, count)
- unsigned start;
- const wchar_t *line;
- int count;
-{
- const wchar_t *ptr = line + count;
- while (ptr > line)
- if (*--ptr == L'\n')
- return line + count - ptr - 1;
- return start + count;
-}
-
-void
-_IO_init_wmarker (marker, fp)
- struct _IO_marker *marker;
- _IO_FILE *fp;
-{
- marker->_sbuf = fp;
- if (_IO_in_put_mode (fp))
- _IO_switch_to_wget_mode (fp);
- if (_IO_in_backup (fp))
- marker->_pos = fp->_wide_data->_IO_read_ptr - fp->_wide_data->_IO_read_end;
- else
- marker->_pos = (fp->_wide_data->_IO_read_ptr
- - fp->_wide_data->_IO_read_base);
-
- /* Should perhaps sort the chain? */
- marker->_next = fp->_markers;
- fp->_markers = marker;
-}
-
-#define BAD_DELTA EOF
-
-/* Return difference between MARK and current position of MARK's stream. */
-int
-_IO_wmarker_delta (mark)
- struct _IO_marker *mark;
-{
- int cur_pos;
- if (mark->_sbuf == NULL)
- return BAD_DELTA;
- if (_IO_in_backup (mark->_sbuf))
- cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
- - mark->_sbuf->_wide_data->_IO_read_end);
- else
- cur_pos = (mark->_sbuf->_wide_data->_IO_read_ptr
- - mark->_sbuf->_wide_data->_IO_read_base);
- return mark->_pos - cur_pos;
-}
-
-int
-_IO_seekwmark (fp, mark, delta)
- _IO_FILE *fp;
- struct _IO_marker *mark;
- int delta;
-{
- if (mark->_sbuf != fp)
- return EOF;
- if (mark->_pos >= 0)
- {
- if (_IO_in_backup (fp))
- _IO_switch_to_main_wget_area (fp);
- fp->_wide_data->_IO_read_ptr = (fp->_wide_data->_IO_read_base
- + mark->_pos);
- }
- else
- {
- if (!_IO_in_backup (fp))
- _IO_switch_to_wbackup_area (fp);
- fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end + mark->_pos;
- }
- return 0;
-}
-
-void
-_IO_unsave_wmarkers (fp)
- _IO_FILE *fp;
-{
- struct _IO_marker *mark = fp->_markers;
- if (mark)
- {
-#ifdef TODO
- streampos offset = seekoff (0, ios::cur, ios::in);
- if (offset != EOF)
- {
- offset += eGptr () - Gbase ();
- for ( ; mark != NULL; mark = mark->_next)
- mark->set_streampos (mark->_pos + offset);
- }
- else
- {
- for ( ; mark != NULL; mark = mark->_next)
- mark->set_streampos (EOF);
- }
-#endif
- fp->_markers = 0;
- }
-
- if (_IO_have_backup (fp))
- _IO_free_wbackup_area (fp);
-}
-
-#endif /* _GLIBCPP_USE_WCHAR_T */
diff --git a/contrib/libstdc++/libmath/nan.c b/contrib/libstdc++/libmath/nan.c
deleted file mode 100644
index 1814b5d..0000000
--- a/contrib/libstdc++/libmath/nan.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Return quiet nan. */
-
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
-
- This file is part of the GNU ISO C++ Library. This library is free
- software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this library; see the file COPYING. If not, write to the Free
- Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA.
-
- As a special exception, you may use this file as part of a free software
- library without restriction. Specifically, if other files instantiate
- templates or use macros or inline functions from this file, or you compile
- this file and link it with other files to produce an executable, this
- file does not by itself cause the resulting executable to be covered by
- the GNU General Public License. This exception does not however
- invalidate any other reasons why the executable file might be covered by
- the GNU General Public License. */
-
-
-#include <stdlib.h>
-#include <string.h>
-
-double
-nan ()
-{ return strtod ("nan", NULL); }
diff --git a/contrib/libstdc++/mkcheck.in b/contrib/libstdc++/mkcheck.in
deleted file mode 100755
index c856b05..0000000
--- a/contrib/libstdc++/mkcheck.in
+++ /dev/null
@@ -1,448 +0,0 @@
-#!/usr/bin/env bash
-
-# Script to do automated testing and data collection for various test
-# files, so that we don't have to do this by hand on every test file.
-# It attempts to collect some diagnostic info about size and speed that
-# should be useful in the future as the library gets tuned for size
-# and speed. In addition, it tests static and shared linkage, iff each
-# has been enabled.
-
-# Invocation
-# mkcheck [01]
-
-# 1: variables
-#
-# WHICH determines if you are
-# (0) testing the build binary and headers, or
-# (1) testing the installed binary and headers, or
-WHICH=$1
-if [ "$WHICH"x = 0x ]; then
- echo "running mkcheck"
- echo "$0: testing the build directory"
-elif [ "$WHICH"x = 1x ]; then
- echo "running mkcheck"
- echo "$0: testing the install directory"
-else
- echo 'Usage: mkcheck 0 /* test the build directory */'
- echo ' mkcheck 1 /* test the install directory */'
- exit 1;
-fi
-
-# Now that we've successfully translated the numerical option into
-# a symbolic one, we can safely ignore it.
-shift
-
-# This has been true all along. Found out about it the hard way...
-case $BASH_VERSION in
- 1*) echo 'You need bash 2.x to run mkcheck. Exiting.'; exit 1 ;;
- *) ;; # ??
-esac
-
-BUILD_DIR=@glibcpp_builddir@
-SRC_DIR=@glibcpp_srcdir@
-PREFIX_DIR=@glibcpp_prefixdir@
-if [ "$WHICH"x = 0x ]; then
- CXX=`$BUILD_DIR/testsuite_flags --build-cxx`
- INCLUDES=`$BUILD_DIR/testsuite_flags --build-includes`
-else
- CXX=`$BUILD_DIR/testsuite_flags --install-cxx`
- INCLUDES=`$BUILD_DIR/testsuite_flags --install-includes`
-fi
-CXXFLAGS=`$BUILD_DIR/testsuite_flags --cxxflags`
-LIBTOOL="$BUILD_DIR/libtool"
-LTEXE="$LIBTOOL --mode=execute"
-#LTCXX="$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $INCLUDES"
-LTCXX="$CXX $CXXFLAGS $INCLUDES"
-
-# specific libtool flag(s) to use shared libraries, if any
-SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc -Wl,--rpath -Wl,$BUILD_DIR/src/.libs"
-
-# specific libtool flag(s) to use static libraries, if any
-ST_FLAG="-static"
-#ST_FLAG="-all-static"
-
-# Set up the testing directory, which should be in a directory called
-# "testsuite" in the root level of the build directory.
-TEST_DIR="$BUILD_DIR/testsuite"
-# help libtool keep quiet
-if [ ! -d ${TEST_DIR}/.libs ]; then
- mkdir $TEST_DIR/.libs
-fi
-
-# the name of the file that will collect and hold all this useful data:
-RESULTS_FILE="$TEST_DIR/$(date +%Y%m%d)-mkcheck.txt"
-
-# the name of the log file that will append compiler diagnostics:
-LOG_FILE="$TEST_DIR/$(date +%Y%m%d)-mkchecklog.txt"
-
-# the names of the specific test files to be run
-TESTS_FILE="$TEST_DIR/$(date +%Y%m%d)-mkcheckfiles.txt"
-
-
-#
-# 2: clean, make files, append general test info
-#
-
-# Remove old executables.
-rm -rf "$TEST_DIR"/*exe
-rm -rf "$TEST_DIR"/compile.out
-
-# Remove old core files (which now get left in cwd, not $TEST_DIR).
-rm -rf ./*core*
-
-if [ -f $RESULTS_FILE ]; then
- rm $RESULTS_FILE
-fi
-if [ -f $LOG_FILE ]; then
- rm $LOG_FILE
-fi
-
-# Make a list of the files we're going to run, or use an old one if it exists.
-if [ ! -f "$TESTS_FILE" ]; then
- echo "making file $TESTS_FILE"
- for LONG_NAME in $SRC_DIR/testsuite/*/*.cc
- do
- DIR_NAME=$(dirname $LONG_NAME)
- SHORT_NAME="`basename $DIR_NAME`/`basename $LONG_NAME`"
- echo "$SHORT_NAME" >> $TESTS_FILE
- done
-fi
-
-# Nasty solution to replace GNU date(1)'s %s time_t output function.
-TIMER_COMMAND=$TEST_DIR/printnow.exe
-if [ ! -x "$TIMER_COMMAND" ]; then
- echo "making utility $TIMER_COMMAND"
- gcc -o "$TIMER_COMMAND" "$SRC_DIR/testsuite/printnow.c"
- strip "$TIMER_COMMAND"
-fi
-
-# Copy over the data files for filebufs
-cp $SRC_DIR/testsuite/27_io/*.txt $TEST_DIR
-cp $SRC_DIR/testsuite/27_io/*.tst $TEST_DIR
-chmod u+w $TEST_DIR/*.txt
-chmod u+w $TEST_DIR/*.tst
-
-# Emit useful info about compiler and platform
-echo "host: $(uname -mrsv)" >> $RESULTS_FILE
-echo "compiler: $($CXX -v 2>&1)" >> $RESULTS_FILE
-echo "compiler flags: $CXXFLAGS" >> $RESULTS_FILE
-echo "date: $(date +%Y%m%d)" >> $RESULTS_FILE
-echo "" >> $RESULTS_FILE
-
-explanation='+: pass, -b: build failure, -r: run failure, x: disabled'
-printf "%s\n %s\n" 'p == pass/fail execution test' "$explanation" \
- >> $RESULTS_FILE
-echo "ctime == time to compile and link" >> $RESULTS_FILE
-echo "etime == time for executable to run" >> $RESULTS_FILE
-echo "text == size of the executable text section" >> $RESULTS_FILE
-echo "data == size of the executable data section" >> $RESULTS_FILE
-echo "total == size of the executable" >> $RESULTS_FILE
-echo "" >> $RESULTS_FILE
-
-echo "p" | awk '{printf("%s ", $1)}' >> $RESULTS_FILE
-echo "ctime" "etime" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE
-echo "text" "data" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE
-echo "total" "name" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE
-echo "" >> $RESULTS_FILE
-
-# Counters. These could be members of an array, but they'd all have to
-# become individuals anyhow if we ever change this script to super-portable sh.
-shared_pass=0
-shared_fail=0
-static_pass=0
-static_fail=0
-
-
-#
-# 2.5: support functions
-#
-
-# Figure out how to extract size information from binaries. We take
-# the text of the value we want as an argument, and leave the size in
-# the appropriate variable.
-#
-# We discover what kind of size(1) we are using *once* and build a shell
-# function named 'size_command' to wrap it. (The "function" keyword is
-# redundant here, but helps me read it, so there.) Previously we were
-# re-discovering the size(1) arguments three times for each test; sloooow.
-#
-# It is VERY IMPORTANT not to compare these numbers across platforms.
-# Different size(1)'s extract section information differently. For
-# example, using the native Sun size(1) and GNU size(1) built for Suns
-# on the exact same binary will give very different numbers, due to all
-# the variance in command-line options and arbitrary names of ELF sections.
-#
-# and suddenly we go to 2-space indentations...
-setup_size_command()
-{
- if size --version 2> /dev/null | grep -c GNU > /dev/null;
- then # Then we're using a GNU size(1) built for this platform.
- # We lose .rodata and .data1 and who knows what else... kludge.
- function size_command()
- {
- case $1 in
- TEXT) TEXT=$(size -B $EXENAME | tail -1 | awk '{print $1}') ;;
- DATA) DATA=$(size -B $EXENAME | tail -1 | awk '{print $2}') ;;
- SIZE) SIZE=$(size -B $EXENAME | tail -1 | awk '{print $4}') ;;
- esac
- }
- else
- # Not using GNU size; check for platform. These numbers seem to match
- # up to text/data/total, although their meanings seem to be different.
- # THIS TABLE IS SORTED. KEEP IT THAT WAY.
- case @host_os@ in
- *aix*)
- function size_command()
- {
- case $1 in
- TEXT) TEXT=$(size -X32_64 $EXENAME | awk '{print $2}') ;;
- DATA) DATA=$(size -X32_64 $EXENAME | awk '{print $4}') ;;
- SIZE) SIZE=$(size -X32_64 $EXENAME | awk '{print $12}') ;;
- esac
- }
- ;;
- *hpux*)
- function size_command()
- {
- case $1 in
- TEXT) TEXT=$(size $EXENAME | awk '{print $1}') ;;
- DATA) DATA=$(size $EXENAME | awk '{print $3}') ;;
- SIZE) SIZE=$(size $EXENAME | awk '{print $7}') ;;
- esac
- }
- ;;
- *irix*)
- function size_command()
- {
- case $1 in
- TEXT) TEXT=$(size -4 $EXENAME | awk '{print $1}') ;;
- DATA) DATA=$(size -4 $EXENAME | awk '{print $3}') ;;
- SIZE) SIZE=$(size -4 $EXENAME | awk '{print $7}') ;;
- esac
- }
- ;;
- *solaris*)
- function size_command()
- {
- case $1 in
- TEXT) TEXT=$(size $EXENAME | awk '{print $1}') ;;
- DATA) DATA=$(size $EXENAME | awk '{print $3}') ;;
- SIZE) SIZE=$(size $EXENAME | awk '{print $7}') ;;
- esac
- }
- ;;
- *)
- echo ' * Warning! Skipping section sizes!' 1>&2
- function size_command()
- {
- case $1 in
- TEXT) TEXT=0 ;;
- DATA) DATA=0 ;;
- SIZE) SIZE=0 ;;
- esac
- }
- ;;
- esac
- fi
-}
-
-# Test for file output
-test_for_output()
-{
- # This checks for emitted output files, which is useful when
- # testing file-related output. The rules for this working are as
- # follows: the emitted file must have the ".txt" extension, and be
- # based on the actual *.cc file's name. For example, 27/filbuf.cc
- # currently outputs files named 27/filebuf-2.txt and 27/filebuf-3.txt.
- # Also, the first emitted file must be in the form $NAME-1.txt.
- # The control file must follow the same constraints, but have a
- # ".tst" extension. Thus, you have 27/filebuf-2.tst, etc.
-
- # NAME contains the source name, like 27/filebuf.cc
- # From that NAME, we want to generate some possible names, using
- # ls on MATCH, a pattern description generated with sed.
-
- # this is the name of the resulting diff file, if any
- DIFF_FILE="`echo $TEST_NAME | sed 's/cc$/diff/'`"
- # construct wildcard names, ie for $NAME=filebuf.cc, makes "filebuf*.tst"
- DATA_FILES="`echo $TEST_NAME | sed 's/\.cc/\*\.tst/g'`"
- # make sure there is at least one, then go
- ST_E="`echo $TEST_NAME | sed 's/\.cc/\-1\.tst/g'`"
- if [ -f $ST_E ]; then
- # list of actual files that match the wildcard above, ie
- # "filebuf-1.tst"
- ST_MATCH_LIST="`ls $DATA_FILES`"
- for i in $ST_MATCH_LIST; do
- # ST_OUT_FILE is generated in the build directory.
- PRE_NAME2="$TEST_DIR/`basename $i`"
- ST_OUT_FILE="`echo $PRE_NAME2 | sed 's/tst$/txt/'`"
- diff $ST_OUT_FILE $i > $DIFF_FILE
- if [ -s $DIFF_FILE ]; then
- RESULT="-r"
- else
- RESULT="+"
- fi
- rm $DIFF_FILE
- done
- else
- # the file does no output, and didn't abnormally
- # terminate, so assume passed.
- RESULT="+"
- fi
-}
-
-
-#
-# 3: compile, link, execute, time
-#
-# Abstract out the common code for compiling, linking, executing and printing.
-test_file()
-{
- # NB: S_FLAG has to be last argument because it may be null, and
- # error checking hasn't been invented yet.
- NAME=$1
- EXENAME=$2
- S_FLAG=$3
-
- SRC_NAME="$SRC_DIR/testsuite/$1"
- TEST_NAME="$TEST_DIR/`basename $NAME`"
-
- # This would be deliciously easy if GNU date's %s were always around.
- # There are three ways to do this: 1) use the builtin 'time' like we
- # do later; then getting compiler errors into LOG_FILE is a nightmare.
- # 2) Grab the output of a formatted date(1) and do the math; harder
- # and harder as we try compiling at, say, top of the hour; we would
- # eventually have to calculate time_t anyhow. Or 3) just grab two
- # time_t's (no more overhead than grabbing two date(1)'s).
- our_libs="-L$TEST_DIR -lv3test"
- compiler_invocation="$LTCXX $S_FLAG $SRC_NAME -o $EXENAME $our_libs"
- echo $compiler_invocation >> compile.out 2>&1
- COMP_TIME_START=$($TIMER_COMMAND)
- $compiler_invocation >> compile.out 2>&1
- COMP_TIME_END=$($TIMER_COMMAND)
-
- if [ $COMP_TIME_START -lt $COMP_TIME_END ]; then
- C_TIME=$[ $COMP_TIME_END - $COMP_TIME_START ]
- else
- C_TIME="0"
- fi
-
- if [ -f $EXENAME ]; then
-# rm compile.out
- size_command TEXT
- size_command DATA
- size_command SIZE
-
- # Actually run the executable and time it. Note that output
- # printed by the executable will be lost and cannot be redirected,
- # because we need to capture the output of 'time'. Bummer.
- TIMEFORMAT='timemark %R'
- E_TIME_TEXT="$(exec 2>&1; time $LTEXE $EXENAME)"
- E_ABNORMAL_TERMINATION=$?
-
- if [ "$E_ABNORMAL_TERMINATION" -ne 0 ]; then
- RESULT='-r'
- E_TIME="0"
- rm -f ./*core
- # sometimes you want to save all core files for review:
- #mv ./core $EXENAME.core
- # sometimes the OS allows you to name core files yourself:
- #mv ./*core $EXENAME.core
- #mv ./core* $EXENAME.core
- else
- test_for_output
- # XXX This doesn't always result in a number.
- # E_TIME="$(echo $E_TIME_TEXT | awk '{print $2}')"
- E_TIME="0"
- fi
-
- # sometimes you want to save all failing exe files for review:
- if [ "$RESULT" = '+' ]; then
- rm "$EXENAME"
- fi
- else
- # the file did not compile/link.
- printf "\n" >> $LOG_FILE
- `cat compile.out >> $LOG_FILE`
- rm compile.out
- RESULT="-b"
- TEXT="0"
- DATA="0"
- SIZE="0"
- fi
-
- # update the counters
- if test "$RESULT" = "+" ; then
- if test x"$S_FLAG" = x"$ST_FLAG"; then
- static_pass=`expr $static_pass + 1`
- else
- shared_pass=`expr $shared_pass + 1`
- fi
- else
- if test x"$S_FLAG" = x"$ST_FLAG"; then
- static_fail=`expr $static_fail + 1`
- else
- shared_fail=`expr $shared_fail + 1`
- fi
- fi
-
- printf "%s\t" "$RESULT"
- printf "%-2s %d\t%.3f\t%s\t%s\t%s\t%s %s\n" \
- "$RESULT" $C_TIME $E_TIME $TEXT $DATA $SIZE $NAME >> $RESULTS_FILE
-}
-
-setup_size_command
-echo ""
-echo "Detailed test results in .${RESULTS_FILE/$BUILD_DIR}"
-echo $explanation
-echo "------------------------------------------------------------------------"
-printf "static\tshared\ttest\n"
-echo "------------------------------------------------------------------------"
-
-TEST_TIME_START=$($TIMER_COMMAND)
-for NAME in `cat $TESTS_FILE`
-do
- PRE_NAME="$TEST_DIR/`basename $NAME`"
- ST_NAME="`echo $PRE_NAME | sed 's/cc$/st-exe/'`"
- SH_NAME="`echo $PRE_NAME | sed 's/cc$/sh-exe/'`"
-
- if test @enable_static@ = yes; then
- test_file $NAME $ST_NAME "$ST_FLAG"
- else
- printf "x\t"
- printf "static skipped\n" >> $RESULTS_FILE
- fi
- if test @enable_shared@ = yes; then
- test_file $NAME $SH_NAME "$SH_FLAG"
- else
- printf "x\t"
- printf "shared skipped\n" >> $RESULTS_FILE
- fi
- printf "%s\n" "$NAME"
-
- echo "" >> $RESULTS_FILE
-done
-TEST_TIME_END=$($TIMER_COMMAND)
-
-
-#
-# 4: summary
-#
-# grep can count faster than we can...
-total_failures=`expr ${shared_fail} + ${static_fail}`
-total_successes=`expr ${shared_pass} + ${static_pass}`
-resultstext="pass/fail results: ${static_pass}/${static_fail} static + ${shared_pass}/${shared_fail} shared = ${total_successes}/${total_failures} total"
-if [ $total_failures -eq 0 ]; then
- resultstext="${resultstext}, WIN WIN"
-fi
-sed -e "/^date:/a\\
-$resultstext" $RESULTS_FILE > ${RESULTS_FILE}.tmp
-mv ${RESULTS_FILE}.tmp $RESULTS_FILE
-
-if [ $TEST_TIME_START -lt $TEST_TIME_END ]; then
- TEST_TIME=$[ $TEST_TIME_END - $TEST_TIME_START ]
- echo "testrun == $TEST_TIME seconds"
- echo "testrun == $TEST_TIME seconds" >> $RESULTS_FILE
-fi
-
-exit 0
diff --git a/contrib/libstdc++/sinst.cc b/contrib/libstdc++/sinst.cc
deleted file mode 100644
index 0b3617e..0000000
--- a/contrib/libstdc++/sinst.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-// Instantiation file for the -*- C++ -*- string classes.
-// Copyright (C) 1994 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files
-// compiled with a GNU compiler to produce an executable, this does not cause
-// the resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why
-// the executable file might be covered by the GNU General Public License.
-
-// Written by Jason Merrill based upon the specification by Takanori Adachi
-// in ANSI X3J16/94-0013R2.
-
-#ifdef __GNUG__
-#ifdef TRAITS
-#ifdef C
-#pragma implementation "std/straits.h"
-#endif
-#endif
-#endif
-
-#include <string>
-
-#ifdef C
-typedef char c;
-#endif
-#ifdef W
-typedef wchar_t c;
-#endif
-
-#if defined(TRAITS) && !defined(C)
-template class string_char_traits <c>;
-#else
-/* string_char_traits<char> is already explicitly specialized in
- std/straits.h. */
-#endif
-
-typedef basic_string <c> s;
-
-#ifdef MAIN
-template class basic_string <c>;
-#endif
-
-#ifdef ADDSS
-template s operator+ (const s&, const s&);
-#endif
-#ifdef ADDPS
-template s operator+ (const c*, const s&);
-#endif
-#ifdef ADDCS
-template s operator+ (c, const s&);
-#endif
-#ifdef ADDSP
-template s operator+ (const s&, const c*);
-#endif
-#ifdef ADDSC
-template s operator+ (const s&, c);
-#endif
-#ifdef EQSS
-template bool operator== (const s&, const s&);
-#endif
-#ifdef EQPS
-template bool operator== (const c*, const s&);
-#endif
-#ifdef EQSP
-template bool operator== (const s&, const c*);
-#endif
-#ifdef NESS
-template bool operator!= (const s&, const s&);
-#endif
-#ifdef NEPS
-template bool operator!= (const c*, const s&);
-#endif
-#ifdef NESP
-template bool operator!= (const s&, const c*);
-#endif
-#ifdef LTSS
-template bool operator< (const s&, const s&);
-#endif
-#ifdef LTPS
-template bool operator< (const c*, const s&);
-#endif
-#ifdef LTSP
-template bool operator< (const s&, const c*);
-#endif
-#ifdef GTSS
-template bool operator> (const s&, const s&);
-#endif
-#ifdef GTPS
-template bool operator> (const c*, const s&);
-#endif
-#ifdef GTSP
-template bool operator> (const s&, const c*);
-#endif
-#ifdef LESS
-template bool operator<= (const s&, const s&);
-#endif
-#ifdef LEPS
-template bool operator<= (const c*, const s&);
-#endif
-#ifdef LESP
-template bool operator<= (const s&, const c*);
-#endif
-#ifdef GESS
-template bool operator>= (const s&, const s&);
-#endif
-#ifdef GEPS
-template bool operator>= (const c*, const s&);
-#endif
-#ifdef GESP
-template bool operator>= (const s&, const c*);
-#endif
-#ifdef EXTRACT
-template istream& operator>> (istream&, s&);
-#endif // EXTRACT
-#ifdef INSERT
-template ostream& operator<< (ostream&, const s&);
-#endif // INSERT
-#ifdef GETLINE
-template istream& getline (istream&, s&, c);
-#endif
diff --git a/contrib/libstdc++/src/bitset.cc b/contrib/libstdc++/src/bitset.cc
deleted file mode 100644
index 4849a6a..0000000
--- a/contrib/libstdc++/src/bitset.cc
+++ /dev/null
@@ -1,219 +0,0 @@
-// Bitset definitions -*- C++ -*-
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * Copyright (c) 1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#include <bitset>
-
-//
-// Definitions of non-inline functions from the single-word version of
-// _Base_bitset.
-//
-
-std::size_t
-std::_Base_bitset<1>::_M_do_find_first(std::size_t __not_found) const
-{
- _WordT __thisword = _M_w;
-
- if ( __thisword != static_cast<_WordT>(0) ) {
- // find byte within word
- for (std::size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
- unsigned char __this_byte
- = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
- if ( __this_byte )
- return __j * CHAR_BIT + _S_first_one[__this_byte];
-
- __thisword >>= CHAR_BIT;
- }
- }
- // not found, so return a value that indicates failure.
- return __not_found;
-}
-
-std::size_t
-std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev,
- std::size_t __not_found) const
-{
- // make bound inclusive
- ++__prev;
-
- // check out of bounds
- if ( __prev >= _GLIBCPP_BITSET_BITS_PER_WORD )
- return __not_found;
-
- // search first (and only) word
- _WordT __thisword = _M_w;
-
- // mask off bits below bound
- __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);
-
- if ( __thisword != static_cast<_WordT>(0) ) {
- // find byte within word
- // get first byte into place
- __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
- for ( std::size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) {
- unsigned char __this_byte
- = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
- if ( __this_byte )
- return __j * CHAR_BIT + _S_first_one[__this_byte];
-
- __thisword >>= CHAR_BIT;
- }
- }
-
- // not found, so return a value that indicates failure.
- return __not_found;
-} // end _M_do_find_next
-
-
-// Lookup tables for find and count operations. In _S_bit_count, the value
-// *at* an index is the number of bits set *in* that index.
-unsigned char std::_S_bit_count[256] =
-{
- 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */
- 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */
- 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */
- 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */
- 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */
- 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */
- 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */
- 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */
- 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */
- 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */
- 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */
- 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */
- 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */
- 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */
- 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */
- 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */
- 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */
- 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */
- 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */
- 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */
- 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */
- 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */
- 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */
- 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */
- 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */
- 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */
- 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */
- 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */
- 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */
- 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */
- 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */
- 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */
- 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */
- 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */
- 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */
- 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */
- 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */
- 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */
- 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */
- 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */
- 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */
- 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */
- 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */
- 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */
- 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */
- 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */
- 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */
- 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */
- 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */
- 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */
- 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */
- 8 /* 255 */
-}; // end _S_bit_count
-
-unsigned char std::_S_first_one[256] =
-{
- 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */
- 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */
- 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */
- 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */
- 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */
- 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */
- 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */
- 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */
- 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */
- 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */
- 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */
- 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */
- 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */
- 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */
- 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */
- 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */
- 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */
- 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */
- 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */
- 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */
- 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */
- 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */
- 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */
- 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */
- 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */
- 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */
- 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */
- 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */
- 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */
- 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */
- 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */
- 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */
- 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */
- 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */
- 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */
- 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */
- 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */
- 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */
- 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */
- 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */
- 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */
- 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */
- 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */
- 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */
- 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */
- 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */
- 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */
- 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */
- 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */
- 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */
- 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */
- 0, /* 255 */
-}; // end _S_first_one
-
diff --git a/contrib/libstdc++/src/cmath.cc b/contrib/libstdc++/src/cmath.cc
deleted file mode 100644
index 7a7433a..0000000
--- a/contrib/libstdc++/src/cmath.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Explicit instantiation file for -*- C++ -*- math library.
-
-// Copyright (C) 2001 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-
-// These are explicit instantiations of the behind-the-scenes internal
-// helper functions used in the math routines of libstdc++.
-
-
-#include <cmath>
-
-namespace std
-{
- // This function is only declared/used in the cheaders=c_std case.
- template float
- __cmath_power<float>(float, unsigned int);
- template double
- __cmath_power<double>(double, unsigned int);
- template long double
- __cmath_power<long double>(long double, unsigned int);
-
-} // namespace std
diff --git a/contrib/libstdc++/src/fstream.cc b/contrib/libstdc++/src/fstream.cc
deleted file mode 100644
index 2a099d6..0000000
--- a/contrib/libstdc++/src/fstream.cc
+++ /dev/null
@@ -1,202 +0,0 @@
-// File based streams -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 27.8 File-based streams
-//
-
-#include <fstream>
-
-namespace std
-{
- template<>
- basic_filebuf<char>::int_type
- basic_filebuf<char>::_M_underflow_common(bool __bump)
- {
- int_type __ret = traits_type::eof();
- bool __testin = _M_mode & ios_base::in;
- bool __testout = _M_mode & ios_base::out;
-
- if (__testin)
- {
- // Check for pback madness, and if so swich back to the
- // normal buffers and jet outta here before expensive
- // fileops happen...
- if (_M_pback_init)
- _M_pback_destroy();
-
- if (_M_in_cur && _M_in_cur < _M_in_end)
- {
- __ret = traits_type::to_int_type(*_M_in_cur);
- if (__bump)
- _M_in_cur_move(1);
- return __ret;
- }
-
- // Sync internal and external buffers.
- // NB: __testget -> __testput as _M_buf_unified here.
- bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
- bool __testinit = _M_is_indeterminate();
- if (__testget)
- {
- if (__testout)
- _M_really_overflow();
- else if (_M_in_cur != _M_filepos)
- _M_file.seekoff(_M_in_cur - _M_filepos,
- ios_base::cur, ios_base::in);
- }
-
- if (__testinit || __testget)
- {
- streamsize __elen = 0;
- streamsize __ilen = 0;
- __elen = _M_file.xsgetn(reinterpret_cast<char*>(_M_in_beg),
- _M_buf_size);
- __ilen = __elen;
-
- if (0 < __ilen)
- {
- _M_set_determinate(__ilen);
- if (__testout)
- _M_out_cur = _M_in_cur;
- __ret = traits_type::to_int_type(*_M_in_cur);
- if (__bump)
- _M_in_cur_move(1);
- else if (_M_buf_size == 1)
- {
- // If we are synced with stdio, we have to unget the
- // character we just read so that the file pointer
- // doesn't move.
- _M_file.sys_ungetc(traits_type::to_int_type(*_M_in_cur));
- _M_set_indeterminate();
- }
- }
- }
- }
- _M_last_overflowed = false;
- return __ret;
- }
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- template<>
- basic_filebuf<wchar_t>::int_type
- basic_filebuf<wchar_t>::_M_underflow_common(bool __bump)
- {
- int_type __ret = traits_type::eof();
- bool __testin = _M_mode & ios_base::in;
- bool __testout = _M_mode & ios_base::out;
-
- if (__testin)
- {
- // Check for pback madness, and if so swich back to the
- // normal buffers and jet outta here before expensive
- // fileops happen...
- if (_M_pback_init)
- _M_pback_destroy();
-
- if (_M_in_cur && _M_in_cur < _M_in_end)
- {
- __ret = traits_type::to_int_type(*_M_in_cur);
- if (__bump)
- _M_in_cur_move(1);
- return __ret;
- }
-
- // Sync internal and external buffers.
- // NB: __testget -> __testput as _M_buf_unified here.
- bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
- bool __testinit = _M_is_indeterminate();
- if (__testget)
- {
- if (__testout)
- _M_really_overflow();
- else if (_M_in_cur != _M_filepos)
- _M_file.seekoff(_M_in_cur - _M_filepos,
- ios_base::cur, ios_base::in);
- }
-
- if (__testinit || __testget)
- {
- const locale __loc = this->getloc();
- const __codecvt_type& __cvt = use_facet<__codecvt_type>(__loc);
-
- streamsize __elen = 0;
- streamsize __ilen = 0;
- if (__cvt.always_noconv())
- {
- __elen = _M_file.xsgetn(reinterpret_cast<char*>(_M_in_beg),
- _M_buf_size);
- __ilen = __elen;
- }
- else
- {
- char* __buf = static_cast<char*>(__builtin_alloca(_M_buf_size));
- __elen = _M_file.xsgetn(__buf, _M_buf_size);
-
- const char* __eend;
- char_type* __iend;
- codecvt_base::result __r;
- __r = __cvt.in(_M_state_cur, __buf,
- __buf + __elen, __eend, _M_in_beg,
- _M_in_beg + _M_buf_size, __iend);
- if (__r == codecvt_base::ok)
- __ilen = __iend - _M_in_beg;
- else
- {
- // Unwind.
- __ilen = 0;
- _M_file.seekoff(-__elen, ios_base::cur, ios_base::in);
- }
- }
-
- if (0 < __ilen)
- {
- _M_set_determinate(__ilen);
- if (__testout)
- _M_out_cur = _M_in_cur;
- __ret = traits_type::to_int_type(*_M_in_cur);
- if (__bump)
- _M_in_cur_move(1);
- else if (_M_buf_size == 1)
- {
- // If we are synced with stdio, we have to unget the
- // character we just read so that the file pointer
- // doesn't move.
- _M_file.sys_ungetc(traits_type::to_int_type(*_M_in_cur));
- _M_set_indeterminate();
- }
- }
- }
- }
- _M_last_overflowed = false;
- return __ret;
- }
-#endif
-} // namespace std
diff --git a/contrib/libstdc++/src/globals.cc b/contrib/libstdc++/src/globals.cc
deleted file mode 100644
index efbfdbe..0000000
--- a/contrib/libstdc++/src/globals.cc
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include "bits/c++config.h"
-#include "bits/gthr.h"
-#include <fstream>
-#include <istream>
-#include <ostream>
-#include <locale>
-#include <ext/stdio_filebuf.h>
-
-// On AIX, and perhaps other systems, library initialization order is
-// not guaranteed. For example, the static initializers for the main
-// program might run before the static initializers for this library.
-// That means that we cannot rely on static initialization in the
-// library; there is no guarantee that things will get initialized in
-// time. This file contains definitions of all global variables that
-// require initialization as arrays of characters.
-
-// Because <iostream> declares the standard streams to be [io]stream
-// types instead of say [io]fstream types, it is also necessary to
-// allocate the actual file buffers in this file.
-namespace __gnu_cxx
-{
- using namespace std;
-
- typedef char fake_facet_name[sizeof(char*)]
- __attribute__ ((aligned(__alignof__(char*))));
- fake_facet_name facet_name[6 + _GLIBCPP_NUM_CATEGORIES];
-
- typedef char fake_locale_Impl[sizeof(locale::_Impl)]
- __attribute__ ((aligned(__alignof__(locale::_Impl))));
- fake_locale_Impl c_locale_impl;
-
-
- // NB: The asm directives renames these non-exported, namespace
- // __gnu_cxx symbols into the mistakenly exported, namespace std
- // symbols in GLIBCPP_3.2.
- // The rename syntax is
- // asm (".symver currentname,oldname@@GLIBCPP_3.2")
- // At the same time, these new __gnu_cxx symbols are not exported.
- // In the future, GLIBCXX_ABI > 5 should remove all uses of
- // _GLIBCPP_ASM_SYMVER in this file.
- typedef char fake_locale[sizeof(locale)]
- __attribute__ ((aligned(__alignof__(locale))));
- fake_locale c_locale;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8c_localeE, _ZSt8c_locale, GLIBCPP_3.2)
-
- // GLIBCXX_ABI > 5 will not need this symbol at all.
- // It's here just as a placeholder, as the size of this exported
- // object changed. The new symbol is not exported.
- const int o = sizeof(locale::_Impl) - sizeof(char*[_GLIBCPP_NUM_CATEGORIES]);
- typedef char fake_locale_Impl_compat[o]
- __attribute__ ((aligned(__alignof__(o))));
- fake_locale_Impl_compat c_locale_impl_compat;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx20c_locale_impl_compatE, _ZSt13c_locale_impl, GLIBCPP_3.2)
-
- typedef char fake_facet_vec[sizeof(locale::facet*)]
- __attribute__ ((aligned(__alignof__(locale::facet*))));
- fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS];
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9facet_vecE, _ZSt9facet_vec, GLIBCPP_3.2)
-
- // To support combined facets and caches in facet array
- typedef char fake_facet_cache_vec[sizeof(locale::facet*)]
- __attribute__ ((aligned(__alignof__(locale::facet*))));
- fake_facet_cache_vec facet_cache_vec[2 * _GLIBCPP_NUM_FACETS];
-
- typedef char fake_ctype_c[sizeof(std::ctype<char>)]
- __attribute__ ((aligned(__alignof__(std::ctype<char>))));
- fake_ctype_c ctype_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7ctype_cE, _ZSt7ctype_c, GLIBCPP_3.2)
-
- typedef char fake_collate_c[sizeof(std::collate<char>)]
- __attribute__ ((aligned(__alignof__(std::collate<char>))));
- fake_collate_c collate_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9collate_cE, _ZSt9collate_c, GLIBCPP_3.2)
-
- typedef char fake_numpunct_c[sizeof(numpunct<char>)]
- __attribute__ ((aligned(__alignof__(numpunct<char>))));
- fake_numpunct_c numpunct_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10numpunct_cE, _ZSt10numpunct_c, GLIBCPP_3.2)
-
- typedef char fake_num_get_c[sizeof(num_get<char>)]
- __attribute__ ((aligned(__alignof__(num_get<char>))));
- fake_num_get_c num_get_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_get_cE, _ZSt9num_get_c, GLIBCPP_3.2)
-
- typedef char fake_num_put_c[sizeof(num_put<char>)]
- __attribute__ ((aligned(__alignof__(num_put<char>))));
- fake_num_put_c num_put_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_put_cE, _ZSt9num_put_c, GLIBCPP_3.2)
-
- typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)]
- __attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>))));
- fake_codecvt_c codecvt_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9codecvt_cE, _ZSt9codecvt_c, GLIBCPP_3.2)
-
- typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
- __attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
- fake_moneypunct_c moneypunct_tc;
- fake_moneypunct_c moneypunct_fc;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_tcE,\
- _ZSt13moneypunct_tc, GLIBCPP_3.2)
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_fcE,\
- _ZSt13moneypunct_fc, GLIBCPP_3.2)
-
- typedef char fake_money_get_c[sizeof(money_get<char>)]
- __attribute__ ((aligned(__alignof__(money_get<char>))));
- fake_money_get_c money_get_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_get_cE, _ZSt11money_get_c, GLIBCPP_3.2)
-
- typedef char fake_money_put_c[sizeof(money_put<char>)]
- __attribute__ ((aligned(__alignof__(money_put<char>))));
- fake_money_put_c money_put_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_put_cE, _ZSt11money_put_c, GLIBCPP_3.2)
-
- typedef char fake_timepunct_c[sizeof(__timepunct<char>)]
- __attribute__ ((aligned(__alignof__(__timepunct<char>))));
- fake_timepunct_c timepunct_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11timepunct_cE, _ZSt11timepunct_c, GLIBCPP_3.2)
-
- typedef char fake_time_get_c[sizeof(time_get<char>)]
- __attribute__ ((aligned(__alignof__(time_get<char>))));
- fake_time_get_c time_get_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_get_cE, _ZSt10time_get_c, GLIBCPP_3.2)
-
- typedef char fake_time_put_c[sizeof(time_put<char>)]
- __attribute__ ((aligned(__alignof__(time_put<char>))));
- fake_time_put_c time_put_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_put_cE, _ZSt10time_put_c, GLIBCPP_3.2)
-
- typedef char fake_messages_c[sizeof(messages<char>)]
- __attribute__ ((aligned(__alignof__(messages<char>))));
- fake_messages_c messages_c;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10messages_cE, _ZSt10messages_c, GLIBCPP_3.2)
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)]
- __attribute__ ((aligned(__alignof__(std::ctype<wchar_t>))));
- fake_wtype_w ctype_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7ctype_wE, _ZSt7ctype_w, GLIBCPP_3.2)
-
- typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
- __attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
- fake_wollate_w collate_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9collate_wE, _ZSt9collate_w, GLIBCPP_3.2)
-
- typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
- __attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
- fake_numpunct_w numpunct_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10numpunct_wE, _ZSt10numpunct_w, GLIBCPP_3.2)
-
- typedef char fake_num_get_w[sizeof(num_get<wchar_t>)]
- __attribute__ ((aligned(__alignof__(num_get<wchar_t>))));
- fake_num_get_w num_get_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_get_wE, _ZSt9num_get_w, GLIBCPP_3.2)
-
- typedef char fake_num_put_w[sizeof(num_put<wchar_t>)]
- __attribute__ ((aligned(__alignof__(num_put<wchar_t>))));
- fake_num_put_w num_put_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_put_wE, _ZSt9num_put_w, GLIBCPP_3.2)
-
- typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)]
- __attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>))));
- fake_wodecvt_w codecvt_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9codecvt_wE, _ZSt9codecvt_w, GLIBCPP_3.2)
-
- typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
- __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
- fake_moneypunct_w moneypunct_tw;
- fake_moneypunct_w moneypunct_fw;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_twE,\
- _ZSt13moneypunct_tw, GLIBCPP_3.2)
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_fwE,\
- _ZSt13moneypunct_fw, GLIBCPP_3.2)
-
- typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
- __attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
- fake_money_get_w money_get_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_get_wE, _ZSt11money_get_w, GLIBCPP_3.2)
-
- typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
- __attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
- fake_money_put_w money_put_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_put_wE, _ZSt11money_put_w, GLIBCPP_3.2)
-
- typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)]
- __attribute__ ((aligned(__alignof__(__timepunct<wchar_t>))));
- fake_timepunct_w timepunct_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11timepunct_wE, _ZSt11timepunct_w, GLIBCPP_3.2)
-
- typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
- __attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
- fake_time_get_w time_get_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_get_wE, _ZSt10time_get_w, GLIBCPP_3.2)
-
- typedef char fake_time_put_w[sizeof(time_put<wchar_t>)]
- __attribute__ ((aligned(__alignof__(time_put<wchar_t>))));
- fake_time_put_w time_put_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_put_wE, _ZSt10time_put_w, GLIBCPP_3.2)
-
- typedef char fake_messages_w[sizeof(messages<wchar_t>)]
- __attribute__ ((aligned(__alignof__(messages<wchar_t>))));
- fake_messages_w messages_w;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10messages_wE, _ZSt10messages_w, GLIBCPP_3.2)
-#endif
-
- // Storage for static C locale caches
- typedef char fake_locale_cache_np_c[sizeof(std::__locale_cache<numpunct<char> >)]
- __attribute__ ((aligned(__alignof__(std::__locale_cache<numpunct<char> >))));
- fake_locale_cache_np_c locale_cache_np_c;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- typedef char fake_locale_cache_np_w[sizeof(std::__locale_cache<numpunct<wchar_t> >)]
- __attribute__ ((aligned(__alignof__(std::__locale_cache<numpunct<wchar_t> >))));
- fake_locale_cache_np_w locale_cache_np_w;
-#endif
-
- typedef char fake_filebuf[sizeof(stdio_filebuf<char>)]
- __attribute__ ((aligned(__alignof__(stdio_filebuf<char>))));
- fake_filebuf buf_cout;
- fake_filebuf buf_cin;
- fake_filebuf buf_cerr;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_coutE, _ZSt8buf_cout, GLIBCPP_3.2)
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7buf_cinE, _ZSt7buf_cin, GLIBCPP_3.2)
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_cerrE, _ZSt8buf_cerr, GLIBCPP_3.2)
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)]
- __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>))));
- fake_wfilebuf buf_wcout;
- fake_wfilebuf buf_wcin;
- fake_wfilebuf buf_wcerr;
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9buf_wcoutE, _ZSt9buf_wcout, GLIBCPP_3.2)
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_wcinE, _ZSt8buf_wcin, GLIBCPP_3.2)
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9buf_wcerrE, _ZSt9buf_wcerr, GLIBCPP_3.2)
-#endif
-
- // Globals for once-only runtime initialization of mutex objects. This
- // allows static initialization of these objects on systems that need a
- // function call to initialize a mutex. For example, see stl_threads.h.
-#ifdef __GTHREAD_MUTEX_INIT
- // Need to provide explicit instantiations of static data for
- // systems with broken weak linkage support.
- template __gthread_mutex_t _Swap_lock_struct<0>::_S_swap_lock;
-#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
- __gthread_once_t _GLIBCPP_once = __GTHREAD_ONCE_INIT;
- __gthread_mutex_t _GLIBCPP_mutex;
- __gthread_mutex_t *_GLIBCPP_mutex_address;
-
- // Once-only initializer function for _GLIBCPP_mutex.
- void
- _GLIBCPP_mutex_init ()
- { __GTHREAD_MUTEX_INIT_FUNCTION (&_GLIBCPP_mutex); }
-
- // Once-only initializer function for _GLIBCPP_mutex_address.
- void
- _GLIBCPP_mutex_address_init ()
- { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address); }
-#endif
-
- // GLIBCXX_ABI.
- struct __compat
- {
- static const char _S_atoms[];
- };
- const char __compat::_S_atoms[] = "0123456789eEabcdfABCDF";
- _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8__compat8_S_atomsE, _ZNSt10__num_base8_S_atomsE, GLIBCPP_3.2)
-} // namespace __gnu_cxx
-
-namespace std
-{
- // Standard stream objects.
- typedef char fake_istream[sizeof(istream)]
- __attribute__ ((aligned(__alignof__(istream))));
- typedef char fake_ostream[sizeof(ostream)]
- __attribute__ ((aligned(__alignof__(ostream))));
- fake_istream cin;
- fake_ostream cout;
- fake_ostream cerr;
- fake_ostream clog;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
- typedef char fake_wistream[sizeof(wistream)]
- __attribute__ ((aligned(__alignof__(wistream))));
- typedef char fake_wostream[sizeof(wostream)]
- __attribute__ ((aligned(__alignof__(wostream))));
- fake_wistream wcin;
- fake_wostream wcout;
- fake_wostream wcerr;
- fake_wostream wclog;
-#endif
-} // namespace std
diff --git a/contrib/libstdc++/src/stl-inst.cc b/contrib/libstdc++/src/stl-inst.cc
deleted file mode 100644
index d80a718..0000000
--- a/contrib/libstdc++/src/stl-inst.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Explicit instantiation file.
-
-// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882:
-//
-
-#include <bits/c++config.h>
-#include <memory>
-
-namespace std
-{
- template class allocator<char>;
- template class allocator<wchar_t>;
-
- template class __default_alloc_template<true, 0>;
-} // namespace std
diff --git a/contrib/libstdc++/src/vterminate.cc b/contrib/libstdc++/src/vterminate.cc
deleted file mode 100644
index 26e09d1..0000000
--- a/contrib/libstdc++/src/vterminate.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Verbose terminate_handler -*- C++ -*-
-
-// Copyright (C) 2001, 2002 Free Software Foundation
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <cstdlib>
-#include <cstdio>
-#include <exception>
-#include <exception_defines.h>
-#include <cxxabi.h>
-
-using namespace std;
-using namespace abi;
-
-namespace __gnu_cxx
-{
- /* A replacement for the standard terminate_handler which prints
- more information about the terminating exception (if any) on
- stderr. */
- void __verbose_terminate_handler()
- {
- // Make sure there was an exception; terminate is also called for an
- // attempt to rethrow when there is no suitable exception.
- type_info *t = __cxa_current_exception_type();
- if (t)
- {
- char const *name = t->name();
- // Note that "name" is the mangled name.
-
- {
- int status = -1;
- char *dem = 0;
-
- // Disabled until __cxa_demangle gets the runtime GPL exception.
- dem = __cxa_demangle(name, 0, 0, &status);
-
- printf("terminate called after throwing a `%s'\n",
- status == 0 ? dem : name);
-
- if (status == 0)
- free(dem);
- }
-
- // If the exception is derived from std::exception, we can give more
- // information.
- try { __throw_exception_again; }
-#ifdef __EXCEPTIONS
- catch (exception &exc)
- { fprintf(stderr, " what(): %s\n", exc.what()); }
-#endif
- catch (...) { }
- }
- else
- fprintf(stderr, "terminate called without an active exception\n");
-
- abort();
- }
-} // namespace __gnu_cxx
diff --git a/contrib/libstdc++/sstream b/contrib/libstdc++/sstream
deleted file mode 100644
index 45393b1..0000000
--- a/contrib/libstdc++/sstream
+++ /dev/null
@@ -1,343 +0,0 @@
-/* This is part of libio/iostream, providing -*- C++ -*- input/output.
-Copyright (C) 2000 Free Software Foundation
-
-This file is part of the GNU IO Library. This library is free
-software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this library; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-As a special exception, if you link this library with files
-compiled with a GNU compiler to produce an executable, this does not cause
-the resulting executable to be covered by the GNU General Public License.
-This exception does not however invalidate any other reasons why
-the executable file might be covered by the GNU General Public License. */
-
-/* Written by Magnus Fromreide (magfr@lysator.liu.se). */
-/* seekoff and ideas for overflow is largely borrowed from libstdc++-v3 */
-
-#ifndef __SSTREAM__
-#define __SSTREAM__
-
-#include <iostream.h>
-#include <streambuf.h>
-#include <string>
-
-namespace std
-{
- class stringbuf : public streambuf
- {
- public:
- typedef char char_type;
- typedef int int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
-
- explicit
- stringbuf(int which=ios::in|ios::out)
- : streambuf(), mode(static_cast<ios::open_mode>(which)),
- stream(NULL), stream_len(0)
- {
- stringbuf_init();
- }
-
- explicit
- stringbuf(const string &str, int which=ios::in|ios::out)
- : streambuf(), mode(static_cast<ios::open_mode>(which)),
- stream(NULL), stream_len(0)
- {
- if (mode & (ios::in|ios::out))
- {
- stream_len = str.size();
- stream = new char_type[stream_len];
- str.copy(stream, stream_len);
- }
- stringbuf_init();
- }
-
- virtual
- ~stringbuf()
- {
- delete[] stream;
- }
-
- string
- str() const
- {
- if (pbase() != 0)
- return string(stream, pptr()-pbase());
- else
- return string();
- }
-
- void
- str(const string& str)
- {
- delete[] stream;
- stream_len = str.size();
- stream = new char_type[stream_len];
- str.copy(stream, stream_len);
- stringbuf_init();
- }
-
- protected:
- // The buffer is already in gptr, so if it ends then it is out of data.
- virtual int
- underflow()
- {
- return EOF;
- }
-
- virtual int
- overflow(int c = EOF)
- {
- int res;
- if (mode & ios::out)
- {
- if (c != EOF)
- {
- streamsize old_stream_len = stream_len;
- stream_len += 1;
- char_type* new_stream = new char_type[stream_len];
- memcpy(new_stream, stream, old_stream_len);
- delete[] stream;
- stream = new_stream;
- stringbuf_sync(gptr()-eback(), pptr()-pbase());
- sputc(c);
- res = c;
- }
- else
- res = EOF;
- }
- else
- res = 0;
- return res;
- }
-
- virtual streambuf*
- setbuf(char_type* s, streamsize n)
- {
- if (n != 0)
- {
- delete[] stream;
- stream = new char_type[n];
- memcpy(stream, s, n);
- stream_len = n;
- stringbuf_sync(0, 0);
- }
- return this;
- }
-
- virtual pos_type
- seekoff(off_type off, ios::seek_dir way, int which = ios::in | ios::out)
- {
- pos_type ret = pos_type(off_type(-1));
- bool testin = which & ios::in && mode & ios::in;
- bool testout = which & ios::out && mode & ios::out;
- bool testboth = testin && testout && way != ios::cur;
-
- if (stream_len && ((testin != testout) || testboth))
- {
- char_type* beg = stream;
- char_type* curi = NULL;
- char_type* curo = NULL;
- char_type* endi = NULL;
- char_type* endo = NULL;
-
- if (testin)
- {
- curi = gptr();
- endi = egptr();
- }
- if (testout)
- {
- curo = pptr();
- endo = epptr();
- }
-
- off_type newoffi = 0;
- off_type newoffo = 0;
- if (way == ios::beg)
- {
- newoffi = beg - curi;
- newoffo = beg - curo;
- }
- else if (way == ios::end)
- {
- newoffi = endi - curi;
- newoffo = endo - curo;
- }
-
- if (testin && newoffi + off + curi - beg >= 0 &&
- endi - beg >= newoffi + off + curi - beg)
- {
- gbump(newoffi + off);
- ret = pos_type(newoffi + off + curi);
- }
- if (testout && newoffo + off + curo - beg >= 0 &&
- endo - beg >= newoffo + off + curo - beg)
- {
- pbump(newoffo + off);
- ret = pos_type(newoffo + off + curo);
- }
- }
- return ret;
- }
-
- virtual pos_type
- seekpos(pos_type sp, int which = ios::in | ios::out)
- {
- pos_type ret = seekoff(sp, ios::beg, which);
- return ret;
- }
-
- private:
- void
- stringbuf_sync(streamsize i, streamsize o)
- {
- if (mode & ios::in)
- setg(stream, stream + i, stream + stream_len);
- if (mode & ios::out)
- {
- setp(stream, stream + stream_len);
- pbump(o);
- }
- }
- void
- stringbuf_init()
- {
- if (mode & ios::ate)
- stringbuf_sync(0, stream_len);
- else
- stringbuf_sync(0, 0);
- }
-
- private:
- ios::open_mode mode;
- char_type* stream;
- streamsize stream_len;
- };
-
- class istringstream : public istream {
- public:
- typedef char char_type;
- typedef int int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
-
- explicit
- istringstream(int which=ios::in)
- : istream(&sb), sb(which | ios::in)
- { }
-
- explicit
- istringstream(const string& str, int which=ios::in)
- : istream(&sb), sb(str, which | ios::in)
- { }
-
- stringbuf*
- rdbuf() const
- {
- return const_cast<stringbuf*>(&sb);
- }
-
- string
- str() const
- {
- return rdbuf()->str();
- }
- void
- str(const string& s)
- {
- rdbuf()->str(s);
- }
- private:
- stringbuf sb;
- };
-
- class ostringstream : public ostream {
- public:
- typedef char char_type;
- typedef int int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
-
- explicit
- ostringstream(int which=ios::out)
- : ostream(&sb), sb(which | ios::out)
- { }
-
- explicit
- ostringstream(const string& str, int which=ios::out)
- : ostream(&sb), sb(str, which | ios::out)
- { }
-
- stringbuf*
- rdbuf() const
- {
- return const_cast<stringbuf*>(&sb);
- }
-
- string
- str() const
- {
- return rdbuf()->str();
- }
-
- void str(const string& s)
- {
- rdbuf()->str(s);
- }
- private:
- stringbuf sb;
- };
-
- class stringstream : public iostream {
- public:
- typedef char char_type;
- typedef int int_type;
- typedef streampos pos_type;
- typedef streamoff off_type;
-
- explicit
- stringstream(int which=ios::out|ios::in)
- : iostream(&sb), sb(which)
- { }
-
- explicit
- stringstream(const string& str, int which=ios::out|ios::in)
- : iostream(&sb), sb(str, which)
- { }
-
- stringbuf*
- rdbuf() const
- {
- return const_cast<stringbuf*>(&sb);
- }
-
- string
- str() const
- {
- return rdbuf()->str();
- }
-
- void
- str(const string& s)
- {
- rdbuf()->str(s);
- }
- private:
- stringbuf sb;
- };
-};
-
-#endif /* not __STRSTREAM__ */
diff --git a/contrib/libstdc++/std/bastring.cc b/contrib/libstdc++/std/bastring.cc
deleted file mode 100644
index f86f6d3..0000000
--- a/contrib/libstdc++/std/bastring.cc
+++ /dev/null
@@ -1,524 +0,0 @@
-// Member templates for the -*- C++ -*- string classes.
-// Copyright (C) 1994, 1999 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files
-// compiled with a GNU compiler to produce an executable, this does not cause
-// the resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why
-// the executable file might be covered by the GNU General Public License.
-
-// Written by Jason Merrill based upon the specification by Takanori Adachi
-// in ANSI X3J16/94-0013R2.
-
-extern "C++" {
-template <class charT, class traits, class Allocator>
-inline void * basic_string <charT, traits, Allocator>::Rep::
-operator new (size_t s, size_t extra)
-{
- return Allocator::allocate(s + extra * sizeof (charT));
-}
-
-template <class charT, class traits, class Allocator>
-inline void basic_string <charT, traits, Allocator>::Rep::
-operator delete (void * ptr)
-{
- Allocator::deallocate(ptr, sizeof(Rep) +
- reinterpret_cast<Rep *>(ptr)->res *
- sizeof (charT));
-}
-
-template <class charT, class traits, class Allocator>
-inline size_t basic_string <charT, traits, Allocator>::Rep::
-frob_size (size_t s)
-{
- size_t i = 16;
- while (i < s) i *= 2;
- return i;
-}
-
-template <class charT, class traits, class Allocator>
-inline basic_string <charT, traits, Allocator>::Rep *
-basic_string <charT, traits, Allocator>::Rep::
-create (size_t extra)
-{
- extra = frob_size (extra + 1);
- Rep *p = new (extra) Rep;
- p->res = extra;
- p->ref = 1;
- p->selfish = false;
- return p;
-}
-
-template <class charT, class traits, class Allocator>
-charT * basic_string <charT, traits, Allocator>::Rep::
-clone ()
-{
- Rep *p = Rep::create (len);
- p->copy (0, data (), len);
- p->len = len;
- return p->data ();
-}
-
-template <class charT, class traits, class Allocator>
-inline bool basic_string <charT, traits, Allocator>::Rep::
-excess_slop (size_t s, size_t r)
-{
- return 2 * (s <= 16 ? 16 : s) < r;
-}
-
-template <class charT, class traits, class Allocator>
-inline bool basic_string <charT, traits, Allocator>::
-check_realloc (basic_string::size_type s) const
-{
- s += sizeof (charT);
- rep ()->selfish = false;
- return (rep ()->ref > 1
- || s > capacity ()
- || Rep::excess_slop (s, capacity ()));
-}
-
-template <class charT, class traits, class Allocator>
-void basic_string <charT, traits, Allocator>::
-alloc (basic_string::size_type __size, bool __save)
-{
- if (! check_realloc (__size))
- return;
-
- Rep *p = Rep::create (__size);
-
- if (__save)
- {
- p->copy (0, data (), length ());
- p->len = length ();
- }
- else
- p->len = 0;
-
- repup (p);
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>&
-basic_string <charT, traits, Allocator>::
-replace (size_type pos1, size_type n1,
- const basic_string& str, size_type pos2, size_type n2)
-{
- const size_t len2 = str.length ();
-
- if (pos1 == 0 && n1 >= length () && pos2 == 0 && n2 >= len2)
- return operator= (str);
-
- OUTOFRANGE (pos2 > len2);
-
- if (n2 > len2 - pos2)
- n2 = len2 - pos2;
-
- return replace (pos1, n1, str.data () + pos2, n2);
-}
-
-template <class charT, class traits, class Allocator>
-inline void basic_string <charT, traits, Allocator>::Rep::
-copy (size_t pos, const charT *s, size_t n)
-{
- if (n)
- traits::copy (data () + pos, s, n);
-}
-
-template <class charT, class traits, class Allocator>
-inline void basic_string <charT, traits, Allocator>::Rep::
-move (size_t pos, const charT *s, size_t n)
-{
- if (n)
- traits::move (data () + pos, s, n);
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>&
-basic_string <charT, traits, Allocator>::
-replace (size_type pos, size_type n1, const charT* s, size_type n2)
-{
- const size_type len = length ();
- OUTOFRANGE (pos > len);
- if (n1 > len - pos)
- n1 = len - pos;
- LENGTHERROR (len - n1 > max_size () - n2);
- size_t newlen = len - n1 + n2;
-
- if (check_realloc (newlen))
- {
- Rep *p = Rep::create (newlen);
- p->copy (0, data (), pos);
- p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
- p->copy (pos, s, n2);
- repup (p);
- }
- else
- {
- rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
- rep ()->copy (pos, s, n2);
- }
- rep ()->len = newlen;
-
- return *this;
-}
-
-template <class charT, class traits, class Allocator>
-inline void basic_string <charT, traits, Allocator>::Rep::
-set (size_t pos, const charT c, size_t n)
-{
- traits::set (data () + pos, c, n);
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
-replace (size_type pos, size_type n1, size_type n2, charT c)
-{
- const size_t len = length ();
- OUTOFRANGE (pos > len);
- if (n1 > len - pos)
- n1 = len - pos;
- LENGTHERROR (len - n1 > max_size () - n2);
- size_t newlen = len - n1 + n2;
-
- if (check_realloc (newlen))
- {
- Rep *p = Rep::create (newlen);
- p->copy (0, data (), pos);
- p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
- p->set (pos, c, n2);
- repup (p);
- }
- else
- {
- rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
- rep ()->set (pos, c, n2);
- }
- rep ()->len = newlen;
-
- return *this;
-}
-
-template <class charT, class traits, class Allocator>
-void basic_string <charT, traits, Allocator>::
-resize (size_type n, charT c)
-{
- LENGTHERROR (n > max_size ());
-
- if (n > length ())
- append (n - length (), c);
- else
- erase (n);
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-copy (charT* s, size_type n, size_type pos) const
-{
- OUTOFRANGE (pos > length ());
-
- if (n > length () - pos)
- n = length () - pos;
-
- traits::copy (s, data () + pos, n);
- return n;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find (const charT* s, size_type pos, size_type n) const
-{
- size_t xpos = pos;
- for (; xpos + n <= length (); ++xpos)
- if (traits::eq (data () [xpos], *s)
- && traits::compare (data () + xpos, s, n) == 0)
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-inline basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-_find (const charT* ptr, charT c, size_type xpos, size_type len)
-{
- for (; xpos < len; ++xpos)
- if (traits::eq (ptr [xpos], c))
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find (charT c, size_type pos) const
-{
- return _find (data (), c, pos, length ());
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-rfind (const charT* s, size_type pos, size_type n) const
-{
- if (n > length ())
- return npos;
-
- size_t xpos = length () - n;
- if (xpos > pos)
- xpos = pos;
-
- for (++xpos; xpos-- > 0; )
- if (traits::eq (data () [xpos], *s)
- && traits::compare (data () + xpos, s, n) == 0)
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-rfind (charT c, size_type pos) const
-{
- if (1 > length ())
- return npos;
-
- size_t xpos = length () - 1;
- if (xpos > pos)
- xpos = pos;
-
- for (++xpos; xpos-- > 0; )
- if (traits::eq (data () [xpos], c))
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find_first_of (const charT* s, size_type pos, size_type n) const
-{
- size_t xpos = pos;
- for (; xpos < length (); ++xpos)
- if (_find (s, data () [xpos], 0, n) != npos)
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find_last_of (const charT* s, size_type pos, size_type n) const
-{
- if (length() == 0)
- return npos;
- size_t xpos = length () - 1;
- if (xpos > pos)
- xpos = pos;
- for (++xpos; xpos-- > 0;)
- if (_find (s, data () [xpos], 0, n) != npos)
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find_first_not_of (const charT* s, size_type pos, size_type n) const
-{
- size_t xpos = pos;
- for (; xpos < length (); ++xpos)
- if (_find (s, data () [xpos], 0, n) == npos)
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find_first_not_of (charT c, size_type pos) const
-{
- size_t xpos = pos;
- for (; xpos < length (); ++xpos)
- if (traits::ne (data () [xpos], c))
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find_last_not_of (const charT* s, size_type pos, size_type n) const
-{
- if (length() == 0)
- return npos;
- size_t xpos = length () - 1;
- if (xpos > pos)
- xpos = pos;
- for (++xpos; xpos-- > 0;)
- if (_find (s, data () [xpos], 0, n) == npos)
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::
-find_last_not_of (charT c, size_type pos) const
-{
- if (length() == 0)
- return npos;
- size_t xpos = length () - 1;
- if (xpos > pos)
- xpos = pos;
- for (++xpos; xpos-- > 0;)
- if (traits::ne (data () [xpos], c))
- return xpos;
- return npos;
-}
-
-template <class charT, class traits, class Allocator>
-int basic_string <charT, traits, Allocator>::
-compare (const basic_string& str, size_type pos, size_type n) const
-{
- OUTOFRANGE (pos > length ());
-
- size_t rlen = length () - pos;
- if (rlen > n)
- rlen = n;
- if (rlen > str.length ())
- rlen = str.length ();
- int r = traits::compare (data () + pos, str.data (), rlen);
- if (r != 0)
- return r;
- if (rlen == n)
- return 0;
- return (length () - pos) - str.length ();
-}
-
-template <class charT, class traits, class Allocator>
-int basic_string <charT, traits, Allocator>::
-compare (const charT* s, size_type pos, size_type n) const
-{
- OUTOFRANGE (pos > length ());
-
- size_t rlen = length () - pos;
- if (rlen > n)
- rlen = n;
- int r = traits::compare (data () + pos, s, rlen);
- if (r != 0)
- return r;
- return (length () - pos) - n;
-}
-
-#include <iostream.h>
-
-template <class charT, class traits, class Allocator>
-istream &
-operator>> (istream &is, basic_string <charT, traits, Allocator> &s)
-{
- int w = is.width (0);
- if (is.ipfx0 ())
- {
- register streambuf *sb = is.rdbuf ();
- s.resize (0);
- while (1)
- {
- int ch = sb->sbumpc ();
- if (ch == EOF)
- {
- is.setstate (ios::eofbit);
- break;
- }
- else if (traits::is_del (ch))
- {
- sb->sungetc ();
- break;
- }
- s += static_cast<charT> (ch);
- if (--w == 1)
- break;
- }
- }
-
- is.isfx ();
- if (s.length () == 0)
- is.setstate (ios::failbit);
-
- return is;
-}
-
-template <class charT, class traits, class Allocator>
-ostream &
-operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
-{
- return o.write (s.data (), s.length ());
-}
-
-template <class charT, class traits, class Allocator>
-istream&
-getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim)
-{
- if (is.ipfx1 ())
- {
- _IO_size_t count = 0;
- streambuf *sb = is.rdbuf ();
- s.resize (0);
-
- while (1)
- {
- int ch = sb->sbumpc ();
- if (ch == EOF)
- {
- is.setstate (count == 0
- ? (ios::failbit|ios::eofbit)
- : ios::eofbit);
- break;
- }
-
- ++count;
-
- if (ch == delim)
- break;
-
- s += static_cast<charT> (ch);
-
- if (s.length () == s.npos - 1)
- {
- is.setstate (ios::failbit);
- break;
- }
- }
- }
-
- // We need to be friends with istream to do this.
- // is._gcount = count;
- is.isfx ();
-
- return is;
-}
-
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>::Rep
-basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1, false };
-
-template <class charT, class traits, class Allocator>
-const basic_string <charT, traits, Allocator>::size_type
-basic_string <charT, traits, Allocator>::npos;
-
-} // extern "C++"
diff --git a/contrib/libstdc++/std/bastring.h b/contrib/libstdc++/std/bastring.h
deleted file mode 100644
index bbe8730..0000000
--- a/contrib/libstdc++/std/bastring.h
+++ /dev/null
@@ -1,657 +0,0 @@
-// Main templates for the -*- C++ -*- string classes.
-// Copyright (C) 1994, 1995, 1999 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files
-// compiled with a GNU compiler to produce an executable, this does not cause
-// the resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why
-// the executable file might be covered by the GNU General Public License.
-
-// Written by Jason Merrill based upon the specification by Takanori Adachi
-// in ANSI X3J16/94-0013R2.
-
-#ifndef __BASTRING__
-#define __BASTRING__
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include <cstddef>
-#include <std/straits.h>
-
-// NOTE : This does NOT conform to the draft standard and is likely to change
-#include <alloc.h>
-
-extern "C++" {
-class istream; class ostream;
-
-#include <iterator>
-
-#ifdef __STL_USE_EXCEPTIONS
-
-extern void __out_of_range (const char *);
-extern void __length_error (const char *);
-
-#define OUTOFRANGE(cond) \
- do { if (cond) __out_of_range (#cond); } while (0)
-#define LENGTHERROR(cond) \
- do { if (cond) __length_error (#cond); } while (0)
-
-#else
-
-#include <cassert>
-#define OUTOFRANGE(cond) assert (!(cond))
-#define LENGTHERROR(cond) assert (!(cond))
-
-#endif
-
-template <class charT, class traits = string_char_traits<charT>,
- class Allocator = alloc >
-class basic_string
-{
-private:
- struct Rep {
- size_t len, res, ref;
- bool selfish;
-
- charT* data () { return reinterpret_cast<charT *>(this + 1); }
- charT& operator[] (size_t s) { return data () [s]; }
- charT* grab () { if (selfish) return clone (); ++ref; return data (); }
-#if defined __i486__ || defined __i586__ || defined __i686__
- void release ()
- {
- size_t __val;
- // This opcode exists as a .byte instead of as a mnemonic for the
- // benefit of SCO OpenServer 5. The system assembler (which is
- // essentially required on this target) can't assemble xaddl in
- //COFF mode.
- asm (".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx)
- : "=a" (__val)
- : "0" (-1), "m" (ref), "d" (&ref)
- : "memory");
-
- if (__val == 1)
- delete this;
- }
-#elif defined __sparcv9__
- void release ()
- {
- size_t __newval, __oldval = ref;
- do
- {
- __newval = __oldval - 1;
- __asm__ ("cas [%4], %2, %0"
- : "=r" (__oldval), "=m" (ref)
- : "r" (__oldval), "m" (ref), "r"(&(ref)), "0" (__newval));
- }
- while (__newval != __oldval);
-
- if (__oldval == 0)
- delete this;
- }
-#else
- void release () { if (--ref == 0) delete this; }
-#endif
-
- inline static void * operator new (size_t, size_t);
- inline static void operator delete (void *);
- inline static Rep* create (size_t);
- charT* clone ();
-
- inline void copy (size_t, const charT *, size_t);
- inline void move (size_t, const charT *, size_t);
- inline void set (size_t, const charT, size_t);
-
- inline static bool excess_slop (size_t, size_t);
- inline static size_t frob_size (size_t);
-
- private:
- Rep &operator= (const Rep &);
- };
-
-public:
-// types:
- typedef traits traits_type;
- typedef typename traits::char_type value_type;
- typedef Allocator allocator_type;
-
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef charT& reference;
- typedef const charT& const_reference;
- typedef charT* pointer;
- typedef const charT* const_pointer;
- typedef pointer iterator;
- typedef const_pointer const_iterator;
- typedef ::reverse_iterator<iterator> reverse_iterator;
- typedef ::reverse_iterator<const_iterator> const_reverse_iterator;
- static const size_type npos = static_cast<size_type>(-1);
-
-private:
- Rep *rep () const { return reinterpret_cast<Rep *>(dat) - 1; }
- void repup (Rep *p) { rep ()->release (); dat = p->data (); }
-
-public:
- const charT* data () const
- { return rep ()->data(); }
- size_type length () const
- { return rep ()->len; }
- size_type size () const
- { return rep ()->len; }
- size_type capacity () const
- { return rep ()->res; }
- size_type max_size () const
- { return (npos - 1)/sizeof (charT); } // XXX
- bool empty () const
- { return size () == 0; }
-
-// _lib.string.cons_ construct/copy/destroy:
- basic_string& operator= (const basic_string& str)
- {
- if (&str != this) { rep ()->release (); dat = str.rep ()->grab (); }
- return *this;
- }
-
- explicit basic_string (): dat (nilRep.grab ()) { }
- basic_string (const basic_string& str): dat (str.rep ()->grab ()) { }
- basic_string (const basic_string& str, size_type pos, size_type n = npos)
- : dat (nilRep.grab ()) { assign (str, pos, n); }
- basic_string (const charT* s, size_type n)
- : dat (nilRep.grab ()) { assign (s, n); }
- basic_string (const charT* s)
- : dat (nilRep.grab ()) { assign (s); }
- basic_string (size_type n, charT c)
- : dat (nilRep.grab ()) { assign (n, c); }
-#ifdef __STL_MEMBER_TEMPLATES
- template<class InputIterator>
- basic_string(InputIterator __begin, InputIterator __end)
-#else
- basic_string(const_iterator __begin, const_iterator __end)
-#endif
- : dat (nilRep.grab ()) { assign (__begin, __end); }
-
- ~basic_string ()
- { rep ()->release (); }
-
- void swap (basic_string &s) { charT *d = dat; dat = s.dat; s.dat = d; }
-
- basic_string& append (const basic_string& str, size_type pos = 0,
- size_type n = npos)
- { return replace (length (), 0, str, pos, n); }
- basic_string& append (const charT* s, size_type n)
- { return replace (length (), 0, s, n); }
- basic_string& append (const charT* s)
- { return append (s, traits::length (s)); }
- basic_string& append (size_type n, charT c)
- { return replace (length (), 0, n, c); }
-#ifdef __STL_MEMBER_TEMPLATES
- template<class InputIterator>
- basic_string& append(InputIterator first, InputIterator last)
-#else
- basic_string& append(const_iterator first, const_iterator last)
-#endif
- { return replace (iend (), iend (), first, last); }
-
- void push_back(charT __c)
- { append(1, __c); }
-
- basic_string& assign (const basic_string& str, size_type pos = 0,
- size_type n = npos)
- { return replace (0, npos, str, pos, n); }
- basic_string& assign (const charT* s, size_type n)
- { return replace (0, npos, s, n); }
- basic_string& assign (const charT* s)
- { return assign (s, traits::length (s)); }
- basic_string& assign (size_type n, charT c)
- { return replace (0, npos, n, c); }
-#ifdef __STL_MEMBER_TEMPLATES
- template<class InputIterator>
- basic_string& assign(InputIterator first, InputIterator last)
-#else
- basic_string& assign(const_iterator first, const_iterator last)
-#endif
- { return replace (ibegin (), iend (), first, last); }
-
- basic_string& operator= (const charT* s)
- { return assign (s); }
- basic_string& operator= (charT c)
- { return assign (1, c); }
-
- basic_string& operator+= (const basic_string& rhs)
- { return append (rhs); }
- basic_string& operator+= (const charT* s)
- { return append (s); }
- basic_string& operator+= (charT c)
- { return append (1, c); }
-
- basic_string& insert (size_type pos1, const basic_string& str,
- size_type pos2 = 0, size_type n = npos)
- { return replace (pos1, 0, str, pos2, n); }
- basic_string& insert (size_type pos, const charT* s, size_type n)
- { return replace (pos, 0, s, n); }
- basic_string& insert (size_type pos, const charT* s)
- { return insert (pos, s, traits::length (s)); }
- basic_string& insert (size_type pos, size_type n, charT c)
- { return replace (pos, 0, n, c); }
- iterator insert(iterator p, charT c)
- { size_type __o = p - ibegin ();
- insert (p - ibegin (), 1, c); selfish ();
- return ibegin () + __o; }
- iterator insert(iterator p, size_type n, charT c)
- { size_type __o = p - ibegin ();
- insert (p - ibegin (), n, c); selfish ();
- return ibegin () + __o; }
-#ifdef __STL_MEMBER_TEMPLATES
- template<class InputIterator>
- void insert(iterator p, InputIterator first, InputIterator last)
-#else
- void insert(iterator p, const_iterator first, const_iterator last)
-#endif
- { replace (p, p, first, last); }
-
- basic_string& erase (size_type pos = 0, size_type n = npos)
- { return replace (pos, n, (size_type)0, (charT)0); }
- iterator erase(iterator p)
- { size_type __o = p - begin();
- replace (__o, 1, (size_type)0, (charT)0); selfish ();
- return ibegin() + __o; }
- iterator erase(iterator f, iterator l)
- { size_type __o = f - ibegin();
- replace (__o, l-f, (size_type)0, (charT)0);selfish ();
- return ibegin() + __o; }
-
- basic_string& replace (size_type pos1, size_type n1, const basic_string& str,
- size_type pos2 = 0, size_type n2 = npos);
- basic_string& replace (size_type pos, size_type n1, const charT* s,
- size_type n2);
- basic_string& replace (size_type pos, size_type n1, const charT* s)
- { return replace (pos, n1, s, traits::length (s)); }
- basic_string& replace (size_type pos, size_type n1, size_type n2, charT c);
- basic_string& replace (size_type pos, size_type n, charT c)
- { return replace (pos, n, 1, c); }
- basic_string& replace (iterator i1, iterator i2, const basic_string& str)
- { return replace (i1 - ibegin (), i2 - i1, str); }
- basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n)
- { return replace (i1 - ibegin (), i2 - i1, s, n); }
- basic_string& replace (iterator i1, iterator i2, const charT* s)
- { return replace (i1 - ibegin (), i2 - i1, s); }
- basic_string& replace (iterator i1, iterator i2, size_type n, charT c)
- { return replace (i1 - ibegin (), i2 - i1, n, c); }
-#ifdef __STL_MEMBER_TEMPLATES
- template<class InputIterator>
- basic_string& replace(iterator i1, iterator i2,
- InputIterator j1, InputIterator j2);
-#else
- basic_string& replace(iterator i1, iterator i2,
- const_iterator j1, const_iterator j2);
-#endif
-
-private:
- static charT eos () { return traits::eos (); }
- void unique () { if (rep ()->ref > 1) alloc (length (), true); }
- void selfish () { unique (); rep ()->selfish = true; }
-
-public:
- charT operator[] (size_type pos) const
- {
- if (pos == length ())
- return eos ();
- return data ()[pos];
- }
-
- reference operator[] (size_type pos)
- { selfish (); return (*rep ())[pos]; }
-
- reference at (size_type pos)
- {
- OUTOFRANGE (pos >= length ());
- return (*this)[pos];
- }
- const_reference at (size_type pos) const
- {
- OUTOFRANGE (pos >= length ());
- return data ()[pos];
- }
-
-private:
- void terminate () const
- { traits::assign ((*rep ())[length ()], eos ()); }
-
-public:
- const charT* c_str () const
- { if (length () == 0) return ""; terminate (); return data (); }
- void resize (size_type n, charT c);
- void resize (size_type n)
- { resize (n, eos ()); }
- void reserve (size_type) { }
-
- size_type copy (charT* s, size_type n, size_type pos = 0) const;
-
- size_type find (const basic_string& str, size_type pos = 0) const
- { return find (str.data(), pos, str.length()); }
- size_type find (const charT* s, size_type pos, size_type n) const;
- size_type find (const charT* s, size_type pos = 0) const
- { return find (s, pos, traits::length (s)); }
- size_type find (charT c, size_type pos = 0) const;
-
- size_type rfind (const basic_string& str, size_type pos = npos) const
- { return rfind (str.data(), pos, str.length()); }
- size_type rfind (const charT* s, size_type pos, size_type n) const;
- size_type rfind (const charT* s, size_type pos = npos) const
- { return rfind (s, pos, traits::length (s)); }
- size_type rfind (charT c, size_type pos = npos) const;
-
- size_type find_first_of (const basic_string& str, size_type pos = 0) const
- { return find_first_of (str.data(), pos, str.length()); }
- size_type find_first_of (const charT* s, size_type pos, size_type n) const;
- size_type find_first_of (const charT* s, size_type pos = 0) const
- { return find_first_of (s, pos, traits::length (s)); }
- size_type find_first_of (charT c, size_type pos = 0) const
- { return find (c, pos); }
-
- size_type find_last_of (const basic_string& str, size_type pos = npos) const
- { return find_last_of (str.data(), pos, str.length()); }
- size_type find_last_of (const charT* s, size_type pos, size_type n) const;
- size_type find_last_of (const charT* s, size_type pos = npos) const
- { return find_last_of (s, pos, traits::length (s)); }
- size_type find_last_of (charT c, size_type pos = npos) const
- { return rfind (c, pos); }
-
- size_type find_first_not_of (const basic_string& str, size_type pos = 0) const
- { return find_first_not_of (str.data(), pos, str.length()); }
- size_type find_first_not_of (const charT* s, size_type pos, size_type n) const;
- size_type find_first_not_of (const charT* s, size_type pos = 0) const
- { return find_first_not_of (s, pos, traits::length (s)); }
- size_type find_first_not_of (charT c, size_type pos = 0) const;
-
- size_type find_last_not_of (const basic_string& str, size_type pos = npos) const
- { return find_last_not_of (str.data(), pos, str.length()); }
- size_type find_last_not_of (const charT* s, size_type pos, size_type n) const;
- size_type find_last_not_of (const charT* s, size_type pos = npos) const
- { return find_last_not_of (s, pos, traits::length (s)); }
- size_type find_last_not_of (charT c, size_type pos = npos) const;
-
- basic_string substr (size_type pos = 0, size_type n = npos) const
- { return basic_string (*this, pos, n); }
-
- int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const;
- // There is no 'strncmp' equivalent for charT pointers.
- int compare (const charT* s, size_type pos, size_type n) const;
- int compare (const charT* s, size_type pos = 0) const
- { return compare (s, pos, traits::length (s)); }
-
- iterator begin () { selfish (); return &(*this)[0]; }
- iterator end () { selfish (); return &(*this)[length ()]; }
-
-private:
- iterator ibegin () const { return &(*rep ())[0]; }
- iterator iend () const { return &(*rep ())[length ()]; }
-
-public:
- const_iterator begin () const { return ibegin (); }
- const_iterator end () const { return iend (); }
-
- reverse_iterator rbegin() { return reverse_iterator (end ()); }
- const_reverse_iterator rbegin() const
- { return const_reverse_iterator (end ()); }
- reverse_iterator rend() { return reverse_iterator (begin ()); }
- const_reverse_iterator rend() const
- { return const_reverse_iterator (begin ()); }
-
-private:
- void alloc (size_type size, bool save);
- static size_type _find (const charT* ptr, charT c, size_type xpos, size_type len);
- inline bool check_realloc (size_type s) const;
-
- static Rep nilRep;
- charT *dat;
-};
-
-#ifdef __STL_MEMBER_TEMPLATES
-template <class charT, class traits, class Allocator> template <class InputIterator>
-basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
-replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2)
-#else
-template <class charT, class traits, class Allocator>
-basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
-replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2)
-#endif
-{
- const size_type len = length ();
- size_type pos = i1 - ibegin ();
- size_type n1 = i2 - i1;
- size_type n2 = j2 - j1;
-
- OUTOFRANGE (pos > len);
- if (n1 > len - pos)
- n1 = len - pos;
- LENGTHERROR (len - n1 > max_size () - n2);
- size_t newlen = len - n1 + n2;
-
- if (check_realloc (newlen))
- {
- Rep *p = Rep::create (newlen);
- p->copy (0, data (), pos);
- p->copy (pos + n2, data () + pos + n1, len - (pos + n1));
- for (; j1 != j2; ++j1, ++pos)
- traits::assign ((*p)[pos], *j1);
- repup (p);
- }
- else
- {
- rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1));
- for (; j1 != j2; ++j1, ++pos)
- traits::assign ((*rep ())[pos], *j1);
- }
- rep ()->len = newlen;
-
- return *this;
-}
-
-template <class charT, class traits, class Allocator>
-inline basic_string <charT, traits, Allocator>
-operator+ (const basic_string <charT, traits, Allocator>& lhs,
- const basic_string <charT, traits, Allocator>& rhs)
-{
- basic_string <charT, traits, Allocator> str (lhs);
- str.append (rhs);
- return str;
-}
-
-template <class charT, class traits, class Allocator>
-inline basic_string <charT, traits, Allocator>
-operator+ (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- basic_string <charT, traits, Allocator> str (lhs);
- str.append (rhs);
- return str;
-}
-
-template <class charT, class traits, class Allocator>
-inline basic_string <charT, traits, Allocator>
-operator+ (charT lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- basic_string <charT, traits, Allocator> str (1, lhs);
- str.append (rhs);
- return str;
-}
-
-template <class charT, class traits, class Allocator>
-inline basic_string <charT, traits, Allocator>
-operator+ (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
-{
- basic_string <charT, traits, Allocator> str (lhs);
- str.append (rhs);
- return str;
-}
-
-template <class charT, class traits, class Allocator>
-inline basic_string <charT, traits, Allocator>
-operator+ (const basic_string <charT, traits, Allocator>& lhs, charT rhs)
-{
- basic_string <charT, traits, Allocator> str (lhs);
- str.append (1, rhs);
- return str;
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator== (const basic_string <charT, traits, Allocator>& lhs,
- const basic_string <charT, traits, Allocator>& rhs)
-{
- return (lhs.compare (rhs) == 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator== (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- return (rhs.compare (lhs) == 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator== (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
-{
- return (lhs.compare (rhs) == 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator!= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- return (rhs.compare (lhs) != 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator!= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
-{
- return (lhs.compare (rhs) != 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator< (const basic_string <charT, traits, Allocator>& lhs,
- const basic_string <charT, traits, Allocator>& rhs)
-{
- return (lhs.compare (rhs) < 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator< (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- return (rhs.compare (lhs) > 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator< (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
-{
- return (lhs.compare (rhs) < 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator> (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- return (rhs.compare (lhs) < 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator> (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
-{
- return (lhs.compare (rhs) > 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator<= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- return (rhs.compare (lhs) >= 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator<= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
-{
- return (lhs.compare (rhs) <= 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator>= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
-{
- return (rhs.compare (lhs) <= 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator>= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
-{
- return (lhs.compare (rhs) >= 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator!= (const basic_string <charT, traits, Allocator>& lhs,
- const basic_string <charT, traits, Allocator>& rhs)
-{
- return (lhs.compare (rhs) != 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator> (const basic_string <charT, traits, Allocator>& lhs,
- const basic_string <charT, traits, Allocator>& rhs)
-{
- return (lhs.compare (rhs) > 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator<= (const basic_string <charT, traits, Allocator>& lhs,
- const basic_string <charT, traits, Allocator>& rhs)
-{
- return (lhs.compare (rhs) <= 0);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool
-operator>= (const basic_string <charT, traits, Allocator>& lhs,
- const basic_string <charT, traits, Allocator>& rhs)
-{
- return (lhs.compare (rhs) >= 0);
-}
-
-class istream; class ostream;
-template <class charT, class traits, class Allocator> istream&
-operator>> (istream&, basic_string <charT, traits, Allocator>&);
-template <class charT, class traits, class Allocator> ostream&
-operator<< (ostream&, const basic_string <charT, traits, Allocator>&);
-template <class charT, class traits, class Allocator> istream&
-getline (istream&, basic_string <charT, traits, Allocator>&, charT delim = '\n');
-
-} // extern "C++"
-
-#include <std/bastring.cc>
-
-#endif
diff --git a/contrib/libstdc++/std/complext.cc b/contrib/libstdc++/std/complext.cc
deleted file mode 100644
index 60227f2..0000000
--- a/contrib/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 <complex>
-
-extern "C++" {
-template <class FLOAT> complex<FLOAT>
-cos (const complex<FLOAT>& x)
-{
- return complex<FLOAT> (cos (real (x)) * cosh (imag (x)),
- - sin (real (x)) * sinh (imag (x)));
-}
-
-template <class FLOAT> complex<FLOAT>
-cosh (const complex<FLOAT>& x)
-{
- return complex<FLOAT> (cosh (real (x)) * cos (imag (x)),
- sinh (real (x)) * sin (imag (x)));
-}
-
-template <class FLOAT> complex<FLOAT>
-exp (const complex<FLOAT>& x)
-{
- return polar (FLOAT (exp (real (x))), imag (x));
-}
-
-template <class FLOAT> complex<FLOAT>
-log (const complex<FLOAT>& x)
-{
- return complex<FLOAT> (log (abs (x)), arg (x));
-}
-
-template <class FLOAT> complex<FLOAT>
-pow (const complex<FLOAT>& x, const complex<FLOAT>& y)
-{
- FLOAT logr = log (abs (x));
- FLOAT t = arg (x);
-
- return polar (FLOAT (exp (logr * real (y) - imag (y) * t)),
- FLOAT (imag (y) * logr + real (y) * t));
-}
-
-template <class FLOAT> complex<FLOAT>
-pow (const complex<FLOAT>& x, FLOAT y)
-{
- return exp (FLOAT (y) * log (x));
-}
-
-template <class FLOAT> complex<FLOAT>
-pow (FLOAT x, const complex<FLOAT>& y)
-{
- return exp (y * FLOAT (log (x)));
-}
-
-template <class FLOAT> complex<FLOAT>
-sin (const complex<FLOAT>& x)
-{
- return complex<FLOAT> (sin (real (x)) * cosh (imag (x)),
- cos (real (x)) * sinh (imag (x)));
-}
-
-template <class FLOAT> complex<FLOAT>
-sinh (const complex<FLOAT>& x)
-{
- return complex<FLOAT> (sinh (real (x)) * cos (imag (x)),
- cosh (real (x)) * sin (imag (x)));
-}
-
-#include <iostream.h>
-
-template <class FLOAT> istream&
-operator >> (istream& is, complex<FLOAT>& x)
-{
- FLOAT re, im = 0;
- char ch = 0;
-
- if (is.ipfx0 ())
- {
- if (is.peek () == '(')
- is >> ch;
- is >> re;
- if (ch == '(')
- {
- is >> ch;
- if (ch == ',')
- is >> im >> ch;
- }
- }
- is.isfx ();
-
- if (ch != 0 && ch != ')')
- is.setstate (ios::failbit);
- else if (is.good ())
- x = complex<FLOAT> (re, im);
-
- return is;
-}
-
-template <class FLOAT> ostream&
-operator << (ostream& os, const complex<FLOAT>& x)
-{
- return os << '(' << real (x) << ',' << imag (x) << ')';
-}
-
-// The code below is adapted from f2c's libF77, and is subject to this
-// copyright:
-
-/****************************************************************
-Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore.
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the names of AT&T Bell Laboratories or
-Bellcore or any of their entities not be used in advertising or
-publicity pertaining to distribution of the software without
-specific, written prior permission.
-
-AT&T and Bellcore disclaim all warranties with regard to this
-software, including all implied warranties of merchantability
-and fitness. In no event shall AT&T or Bellcore be liable for
-any special, indirect or consequential damages or any damages
-whatsoever resulting from loss of use, data or profits, whether
-in an action of contract, negligence or other tortious action,
-arising out of or in connection with the use or performance of
-this software.
-****************************************************************/
-
-template <class FLOAT> complex<FLOAT>&
-__doadv (complex<FLOAT>* ths, const complex<FLOAT>& y)
-{
- FLOAT ar = abs (y.re);
- FLOAT ai = abs (y.im);
- FLOAT nr, ni;
- FLOAT t, d;
- if (ar <= ai)
- {
- t = y.re / y.im;
- d = y.im * (1 + t*t);
- nr = (ths->re * t + ths->im) / d;
- ni = (ths->im * t - ths->re) / d;
- }
- else
- {
- t = y.im / y.re;
- d = y.re * (1 + t*t);
- nr = (ths->re + ths->im * t) / d;
- ni = (ths->im - ths->re * t) / d;
- }
- ths->re = nr;
- ths->im = ni;
- return *ths;
-}
-
-template <class FLOAT> complex<FLOAT>
-operator / (const complex<FLOAT>& x, const complex<FLOAT>& y)
-{
- FLOAT ar = abs (real (y));
- FLOAT ai = abs (imag (y));
- FLOAT nr, ni;
- FLOAT t, d;
- if (ar <= ai)
- {
- t = real (y) / imag (y);
- d = imag (y) * (1 + t*t);
- nr = (real (x) * t + imag (x)) / d;
- ni = (imag (x) * t - real (x)) / d;
- }
- else
- {
- t = imag (y) / real (y);
- d = real (y) * (1 + t*t);
- nr = (real (x) + imag (x) * t) / d;
- ni = (imag (x) - real (x) * t) / d;
- }
- return complex<FLOAT> (nr, ni);
-}
-
-template <class FLOAT> complex<FLOAT>
-operator / (FLOAT x, const complex<FLOAT>& y)
-{
- FLOAT ar = abs (real (y));
- FLOAT ai = abs (imag (y));
- FLOAT nr, ni;
- FLOAT t, d;
- if (ar <= ai)
- {
- t = real (y) / imag (y);
- d = imag (y) * (1 + t*t);
- nr = x * t / d;
- ni = -x / d;
- }
- else
- {
- t = imag (y) / real (y);
- d = real (y) * (1 + t*t);
- nr = x / d;
- ni = -x * t / d;
- }
- return complex<FLOAT> (nr, ni);
-}
-
-template <class FLOAT> complex<FLOAT>
-pow (const complex<FLOAT>& xin, int y)
-{
- if (y == 0)
- return complex<FLOAT> (1.0);
- complex<FLOAT> r (1.0);
- complex<FLOAT> x (xin);
- if (y < 0)
- {
- y = -y;
- x = FLOAT(1)/x;
- }
- for (;;)
- {
- if (y & 1)
- r *= x;
- if (y >>= 1)
- x *= x;
- else
- return r;
- }
-}
-
-template <class FLOAT> complex<FLOAT>
-sqrt (const complex<FLOAT>& x)
-{
- FLOAT r = abs (x);
- FLOAT nr, ni;
- if (r == 0.0)
- nr = ni = r;
- else if (real (x) > 0)
- {
- nr = sqrt (0.5 * (r + real (x)));
- ni = imag (x) / nr / 2;
- }
- else
- {
- ni = sqrt (0.5 * (r - real (x)));
- if (imag (x) < 0)
- ni = - ni;
- nr = imag (x) / ni / 2;
- }
- return complex<FLOAT> (nr, ni);
-}
-} // extern "C++"
diff --git a/contrib/libstdc++/std/complext.h b/contrib/libstdc++/std/complext.h
deleted file mode 100644
index 6c55037..0000000
--- a/contrib/libstdc++/std/complext.h
+++ /dev/null
@@ -1,400 +0,0 @@
-// The template and inlines for the -*- C++ -*- complex number classes.
-// Copyright (C) 1994 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the terms of
-// the GNU General Public License as published by the Free Software
-// Foundation; either version 2, or (at your option) any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files compiled
-// with a GNU compiler to produce an executable, this does not cause the
-// resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-// Written by Jason Merrill based upon the specification in the 27 May 1994
-// C++ working paper, ANSI document X3J16/94-0098.
-
-#ifndef __COMPLEXT__
-#define __COMPLEXT__
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include <cmath>
-
-#if ! defined (__GNUG__) && ! defined (__attribute__)
-#define __attribute__(foo) /* Ignore. */
-#endif
-
-class istream;
-class ostream;
-
-extern "C++" {
-template <class _FLT> class complex;
-template <class _FLT> complex<_FLT>&
- __doapl (complex<_FLT>* ths, const complex<_FLT>& r);
-template <class _FLT> complex<_FLT>&
- __doami (complex<_FLT>* ths, const complex<_FLT>& r);
-template <class _FLT> complex<_FLT>&
- __doaml (complex<_FLT>* ths, const complex<_FLT>& r);
-template <class _FLT> complex<_FLT>&
- __doadv (complex<_FLT>* ths, const complex<_FLT>& r);
-
-template <class _FLT>
-class complex
-{
-public:
- complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { }
- complex& operator += (const complex&);
- complex& operator -= (const complex&);
- complex& operator *= (const complex&);
- complex& operator /= (const complex&);
- _FLT real () const { return re; }
- _FLT imag () const { return im; }
-private:
- _FLT re, im;
-
- friend complex& __doapl<> (complex *, const complex&);
- friend complex& __doami<> (complex *, const complex&);
- friend complex& __doaml<> (complex *, const complex&);
- friend complex& __doadv<> (complex *, const complex&);
-};
-
-// Declare specializations.
-class complex<float>;
-class complex<double>;
-class complex<long double>;
-
-template <class _FLT>
-inline complex<_FLT>&
-__doapl (complex<_FLT>* ths, const complex<_FLT>& r)
-{
- ths->re += r.re;
- ths->im += r.im;
- return *ths;
-}
-template <class _FLT>
-inline complex<_FLT>&
-complex<_FLT>::operator += (const complex<_FLT>& r)
-{
- return __doapl (this, r);
-}
-
-template <class _FLT>
-inline complex<_FLT>&
-__doami (complex<_FLT>* ths, const complex<_FLT>& r)
-{
- ths->re -= r.re;
- ths->im -= r.im;
- return *ths;
-}
-template <class _FLT>
-inline complex<_FLT>&
-complex<_FLT>::operator -= (const complex<_FLT>& r)
-{
- return __doami (this, r);
-}
-
-template <class _FLT>
-inline complex<_FLT>&
-__doaml (complex<_FLT>* ths, const complex<_FLT>& r)
-{
- _FLT f = ths->re * r.re - ths->im * r.im;
- ths->im = ths->re * r.im + ths->im * r.re;
- ths->re = f;
- return *ths;
-}
-template <class _FLT>
-inline complex<_FLT>&
-complex<_FLT>::operator *= (const complex<_FLT>& r)
-{
- return __doaml (this, r);
-}
-
-template <class _FLT>
-inline complex<_FLT>&
-complex<_FLT>::operator /= (const complex<_FLT>& r)
-{
- return __doadv (this, r);
-}
-
-template <class _FLT> inline _FLT
-imag (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline _FLT
-imag (const complex<_FLT>& x)
-{
- return x.imag ();
-}
-
-template <class _FLT> inline _FLT
-real (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline _FLT
-real (const complex<_FLT>& x)
-{
- return x.real ();
-}
-
-template <class _FLT> inline complex<_FLT>
-operator + (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator + (const complex<_FLT>& x, const complex<_FLT>& y)
-{
- return complex<_FLT> (real (x) + real (y), imag (x) + imag (y));
-}
-
-template <class _FLT> inline complex<_FLT>
-operator + (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator + (const complex<_FLT>& x, _FLT y)
-{
- return complex<_FLT> (real (x) + y, imag (x));
-}
-
-template <class _FLT> inline complex<_FLT>
-operator + (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator + (_FLT x, const complex<_FLT>& y)
-{
- return complex<_FLT> (x + real (y), imag (y));
-}
-
-template <class _FLT> inline complex<_FLT>
-operator - (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator - (const complex<_FLT>& x, const complex<_FLT>& y)
-{
- return complex<_FLT> (real (x) - real (y), imag (x) - imag (y));
-}
-
-template <class _FLT> inline complex<_FLT>
-operator - (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator - (const complex<_FLT>& x, _FLT y)
-{
- return complex<_FLT> (real (x) - y, imag (x));
-}
-
-template <class _FLT> inline complex<_FLT>
-operator - (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator - (_FLT x, const complex<_FLT>& y)
-{
- return complex<_FLT> (x - real (y), - imag (y));
-}
-
-template <class _FLT> inline complex<_FLT>
-operator * (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator * (const complex<_FLT>& x, const complex<_FLT>& y)
-{
- return complex<_FLT> (real (x) * real (y) - imag (x) * imag (y),
- real (x) * imag (y) + imag (x) * real (y));
-}
-
-template <class _FLT> inline complex<_FLT>
-operator * (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator * (const complex<_FLT>& x, _FLT y)
-{
- return complex<_FLT> (real (x) * y, imag (x) * y);
-}
-
-template <class _FLT> inline complex<_FLT>
-operator * (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator * (_FLT x, const complex<_FLT>& y)
-{
- return complex<_FLT> (x * real (y), x * imag (y));
-}
-
-template <class _FLT> complex<_FLT>
-operator / (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
-
-template <class _FLT> complex<_FLT>
-operator / (const complex<_FLT>& x, _FLT y)
-{
- return complex<_FLT> (real (x) / y, imag (x) / y);
-}
-
-template <class _FLT> inline complex<_FLT>
-operator + (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator + (const complex<_FLT>& x)
-{
- return x;
-}
-
-template <class _FLT> inline complex<_FLT>
-operator - (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-operator - (const complex<_FLT>& x)
-{
- return complex<_FLT> (-real (x), -imag (x));
-}
-
-template <class _FLT> inline bool
-operator == (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline bool
-operator == (const complex<_FLT>& x, const complex<_FLT>& y)
-{
- return real (x) == real (y) && imag (x) == imag (y);
-}
-
-template <class _FLT> inline bool
-operator == (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
-
-template <class _FLT> inline bool
-operator == (const complex<_FLT>& x, _FLT y)
-{
- return real (x) == y && imag (x) == 0;
-}
-
-template <class _FLT> inline bool
-operator == (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline bool
-operator == (_FLT x, const complex<_FLT>& y)
-{
- return x == real (y) && imag (y) == 0;
-}
-
-template <class _FLT> inline bool
-operator != (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline bool
-operator != (const complex<_FLT>& x, const complex<_FLT>& y)
-{
- return real (x) != real (y) || imag (x) != imag (y);
-}
-
-template <class _FLT> inline bool
-operator != (const complex<_FLT>& x, _FLT y) __attribute__ ((const));
-
-template <class _FLT> inline bool
-operator != (const complex<_FLT>& x, _FLT y)
-{
- return real (x) != y || imag (x) != 0;
-}
-
-template <class _FLT> inline bool
-operator != (_FLT x, const complex<_FLT>& y) __attribute__ ((const));
-
-template <class _FLT> inline bool
-operator != (_FLT x, const complex<_FLT>& y)
-{
- return x != real (y) || imag (y) != 0;
-}
-
-// Some targets don't provide a prototype for hypot when -ansi.
-extern "C" double hypot (double, double) __attribute__ ((const));
-
-template <class _FLT> inline _FLT
-abs (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline _FLT
-abs (const complex<_FLT>& x)
-{
- return hypot (real (x), imag (x));
-}
-
-template <class _FLT> inline _FLT
-arg (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline _FLT
-arg (const complex<_FLT>& x)
-{
- return atan2 (imag (x), real (x));
-}
-
-template <class _FLT> inline complex<_FLT>
-polar (_FLT r, _FLT t) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-polar (_FLT r, _FLT t)
-{
- return complex<_FLT> (r * cos (t), r * sin (t));
-}
-
-template <class _FLT> inline complex<_FLT>
-conj (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline complex<_FLT>
-conj (const complex<_FLT>& x)
-{
- return complex<_FLT> (real (x), -imag (x));
-}
-
-template <class _FLT> inline _FLT
-norm (const complex<_FLT>& x) __attribute__ ((const));
-
-template <class _FLT> inline _FLT
-norm (const complex<_FLT>& x)
-{
- return real (x) * real (x) + imag (x) * imag (x);
-}
-
-// Declarations of templates in complext.ccI
-
-template <class _FLT> complex<_FLT>
- operator / (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- operator / (_FLT, const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- cos (const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- cosh (const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- exp (const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- log (const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- pow (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- pow (const complex<_FLT>&, _FLT) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- pow (const complex<_FLT>&, int) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- pow (_FLT, const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- sin (const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- sinh (const complex<_FLT>&) __attribute__ ((const));
-template <class _FLT> complex<_FLT>
- sqrt (const complex<_FLT>&) __attribute__ ((const));
-
-template <class _FLT> istream& operator >> (istream&, complex<_FLT>&);
-template <class _FLT> ostream& operator << (ostream&, const complex<_FLT>&);
-} // extern "C++"
-
-// Specializations and such
-
-#include <std/fcomplex.h>
-#include <std/dcomplex.h>
-#include <std/ldcomplex.h>
-
-#endif
diff --git a/contrib/libstdc++/std/dcomplex.h b/contrib/libstdc++/std/dcomplex.h
deleted file mode 100644
index 5812d9f..0000000
--- a/contrib/libstdc++/std/dcomplex.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// The -*- C++ -*- double_complex class.
-// Copyright (C) 1994 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files
-// compiled with a GNU compiler to produce an executable, this does not cause
-// the resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why
-// the executable file might be covered by the GNU General Public License.
-
-// Written by Jason Merrill based upon the specification in the 27 May 1994
-// C++ working paper, ANSI document X3J16/94-0098.
-
-#ifndef __DCOMPLEX__
-#define __DCOMPLEX__
-
-#ifdef __GNUG__
-#pragma interface "dcomplex"
-#endif
-
-extern "C++" {
-class complex<double>
-{
-public:
- complex (double r = 0, double i = 0): re (r), im (i) { }
- complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { }
- explicit complex (const complex<long double>& r);
-
- complex& operator+= (const complex& r) { return __doapl (this, r); }
- complex& operator-= (const complex& r) { return __doami (this, r); }
- complex& operator*= (const complex& r) { return __doaml (this, r); }
- complex& operator/= (const complex& r) { return __doadv (this, r); }
-
- double real () const { return re; }
- double imag () const { return im; }
-private:
- double re, im;
-
- friend complex& __doapl<> (complex *, const complex&);
- friend complex& __doami<> (complex *, const complex&);
- friend complex& __doaml<> (complex *, const complex&);
- friend complex& __doadv<> (complex *, const complex&);
-
-#ifndef __STRICT_ANSI__
- friend inline complex operator + (const complex& x, double y)
- { return operator+<> (x, y); }
- friend inline complex operator + (double x, const complex& y)
- { return operator+<> (x, y); }
- friend inline complex operator - (const complex& x, double y)
- { return operator-<> (x, y); }
- friend inline complex operator - (double x, const complex& y)
- { return operator-<> (x, y); }
- friend inline complex operator * (const complex& x, double y)
- { return operator*<> (x, y); }
- friend inline complex operator * (double x, const complex& y)
- { return operator*<> (x, y); }
- friend inline complex operator / (const complex& x, double y)
- { return operator/<> (x, y); }
- friend inline complex operator / (double x, const complex& y)
- { return operator/<> (x, y); }
- friend inline bool operator == (const complex& x, double y)
- { return operator==<> (x, y); }
- friend inline bool operator == (double x, const complex& y)
- { return operator==<> (x, y); }
- friend inline bool operator != (const complex& x, double y)
- { return operator!=<> (x, y); }
- friend inline bool operator != (double x, const complex& y)
- { return operator!=<> (x, y); }
-#endif /* __STRICT_ANSI__ */
-};
-
-inline complex<float>::complex (const complex<double>& r)
-: re (r.real ()), im (r.imag ())
-{ }
-} // extern "C++"
-
-#endif
diff --git a/contrib/libstdc++/std/fcomplex.h b/contrib/libstdc++/std/fcomplex.h
deleted file mode 100644
index cd9af1a..0000000
--- a/contrib/libstdc++/std/fcomplex.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// The -*- C++ -*- float_complex class.
-// Copyright (C) 1994 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files
-// compiled with a GNU compiler to produce an executable, this does not cause
-// the resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why
-// the executable file might be covered by the GNU General Public License.
-
-// Written by Jason Merrill based upon the specification in the 27 May 1994
-// C++ working paper, ANSI document X3J16/94-0098.
-
-#ifndef __FCOMPLEX__
-#define __FCOMPLEX__
-
-#ifdef __GNUG__
-#pragma interface "fcomplex"
-#endif
-
-extern "C++" {
-class complex<float>
-{
-public:
- complex (float r = 0, float i = 0): re (r), im (i) { }
- explicit complex (const complex<double>& r);
- explicit complex (const complex<long double>& r);
-
- complex& operator+= (const complex& r) { return __doapl (this, r); }
- complex& operator-= (const complex& r) { return __doami (this, r); }
- complex& operator*= (const complex& r) { return __doaml (this, r); }
- complex& operator/= (const complex& r) { return __doadv (this, r); }
-
- float real () const { return re; }
- float imag () const { return im; }
-private:
- float re, im;
-
- friend complex& __doapl<> (complex *, const complex&);
- friend complex& __doami<> (complex *, const complex&);
- friend complex& __doaml<> (complex *, const complex&);
- friend complex& __doadv<> (complex *, const complex&);
-
-#ifndef __STRICT_ANSI__
- friend inline complex operator + (const complex& x, float y)
- { return operator+<> (x, y); }
- friend inline complex operator + (float x, const complex& y)
- { return operator+<> (x, y); }
- friend inline complex operator - (const complex& x, float y)
- { return operator-<> (x, y); }
- friend inline complex operator - (float x, const complex& y)
- { return operator-<> (x, y); }
- friend inline complex operator * (const complex& x, float y)
- { return operator*<> (x, y); }
- friend inline complex operator * (float x, const complex& y)
- { return operator*<> (x, y); }
- friend inline complex operator / (const complex& x, float y)
- { return operator/<> (x, y); }
- friend inline complex operator / (float x, const complex& y)
- { return operator/<> (x, y); }
- friend inline bool operator == (const complex& x, float y)
- { return operator==<> (x, y); }
- friend inline bool operator == (float x, const complex& y)
- { return operator==<> (x, y); }
- friend inline bool operator != (const complex& x, float y)
- { return operator!=<> (x, y); }
- friend inline bool operator != (float x, const complex& y)
- { return operator!=<> (x, y); }
-#endif /* __STRICT_ANSI__ */
-};
-} // extern "C++"
-
-#endif
diff --git a/contrib/libstdc++/std/gslice.h b/contrib/libstdc++/std/gslice.h
deleted file mode 100644
index 4f6e854..0000000
--- a/contrib/libstdc++/std/gslice.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// The template and inlines for the -*- C++ -*- gslice class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __GSLICE__
-#define __GSLICE__
-
-extern "C++" {
-
-struct _Indexer {
- size_t _M_count;
- size_t _M_start;
- valarray<size_t> _M_size;
- valarray<size_t> _M_stride;
- valarray<size_t> _M_index;
- _Indexer(size_t, const valarray<size_t>&, const valarray<size_t>&);
- void _M_increment_use() { ++_M_count; }
- size_t _M_decrement_use() { return --_M_count; }
-};
-
-
-class gslice
-{
-public:
- gslice ();
- gslice (size_t, const valarray<size_t>&, const valarray<size_t>&);
- gslice(const gslice&);
- ~gslice();
-
- gslice& operator= (const gslice&);
- size_t start () const;
- valarray<size_t> size () const;
- valarray<size_t> stride () const;
-
-private:
- _Indexer* _M_index;
-
- template<typename _Tp> friend class valarray;
-};
-
-inline size_t
-gslice::start () const
-{ return _M_index ? _M_index->_M_start : 0; }
-
-inline valarray<size_t>
-gslice::size () const
-{ return _M_index ? _M_index->_M_size : valarray<size_t>(); }
-
-inline valarray<size_t>
-gslice::stride () const
-{ return _M_index ? _M_index->_M_stride : valarray<size_t>(); }
-
-inline gslice::gslice () : _M_index(0) {}
-
-inline
-gslice::gslice(size_t __o, const valarray<size_t>& __l,
- const valarray<size_t>& __s)
- : _M_index(new _Indexer(__o, __l, __s)) {}
-
-inline
-gslice::gslice(const gslice& __g) : _M_index(__g._M_index)
-{ if (_M_index) _M_index->_M_increment_use(); }
-
-inline
-gslice::~gslice()
-{ if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; }
-
-inline gslice&
-gslice::operator= (const gslice& __g)
-{
- if (__g._M_index) __g._M_index->_M_increment_use();
- if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index;
- _M_index = __g._M_index;
- return *this;
-}
-
-
-} // extern "C++"
-
-#endif // __GSLICE__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/gslice_array.h b/contrib/libstdc++/std/gslice_array.h
deleted file mode 100644
index 8a67cac..0000000
--- a/contrib/libstdc++/std/gslice_array.h
+++ /dev/null
@@ -1,170 +0,0 @@
-// The template and inlines for the -*- C++ -*- gslice_array class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __GSLICE_ARRAY__
-#define __GSLICE_ARRAY__
-
-extern "C++" {
-
-template<typename _Tp> class gslice_array
-{
-public:
- typedef _Tp value_type;
-
- void operator= (const valarray<_Tp>&) const;
- void operator*= (const valarray<_Tp>&) const;
- void operator/= (const valarray<_Tp>&) const;
- void operator%= (const valarray<_Tp>&) const;
- void operator+= (const valarray<_Tp>&) const;
- void operator-= (const valarray<_Tp>&) const;
- void operator^= (const valarray<_Tp>&) const;
- void operator&= (const valarray<_Tp>&) const;
- void operator|= (const valarray<_Tp>&) const;
- void operator<<=(const valarray<_Tp>&) const;
- void operator>>=(const valarray<_Tp>&) const;
- void operator=(const _Tp&);
-
- template<class _Dom>
- void operator= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator*= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator/= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator%= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator+= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator-= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator^= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator&= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator|= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator<<= (const _Expr<_Dom,_Tp>&) const;
- template<class _Dom>
- void operator>>= (const _Expr<_Dom,_Tp>&) const;
-
-private:
- _Array<_Tp> _M_array;
- const valarray<size_t>& _M_index;
-
- friend class valarray<_Tp>;
-
- gslice_array (_Array<_Tp>, const valarray<size_t>&);
-
- // this constructor needs to be implemented.
- gslice_array (const gslice_array&);
-
- // not implemented
- gslice_array();
- gslice_array& operator= (const gslice_array&);
-};
-
-template<typename _Tp>
-inline
-gslice_array<_Tp>::gslice_array (_Array<_Tp> __a,
- const valarray<size_t>& __i)
- : _M_array (__a), _M_index (__i) {}
-
-
-template<typename _Tp>
-inline
-gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a)
- : _M_array (__a._M_array), _M_index (__a._M_index) {}
-
-
-template<typename _Tp>
-inline void
-gslice_array<_Tp>::operator= (const _Tp& __t)
-{
- __valarray_fill (_M_array, _Array<size_t>(_M_index),
- _M_index.size(), __t);
-}
-
-template<typename _Tp>
-inline void
-gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const
-{
- __valarray_copy (_Array<_Tp> (__v), __v.size (),
- _M_array, _Array<size_t>(_M_index));
-}
-
-template<typename _Tp>
-template<class E>
-inline void
-gslice_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const
-{
- __valarray_copy (__e, _M_index.size(), _M_array,
- _Array<size_t>(_M_index));
-}
-
-#undef _DEFINE_VALARRAY_OPERATOR
-#define _DEFINE_VALARRAY_OPERATOR(op, name) \
-template<typename _Tp> \
-inline void \
-gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
-{ \
- _Array_augmented_##name (_M_array, _Array<size_t>(_M_index), \
- _Array<_Tp> (__v), __v.size ()); \
-} \
- \
-template<typename _Tp> template<class E> \
-inline void \
-gslice_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const \
-{ \
- _Array_augmented_##name (_M_array, _Array<size_t>(_M_index), __e, \
- _M_index.size()); \
-}
-
-_DEFINE_VALARRAY_OPERATOR(*, multiplies)
-_DEFINE_VALARRAY_OPERATOR(/, divides)
-_DEFINE_VALARRAY_OPERATOR(%, modulus)
-_DEFINE_VALARRAY_OPERATOR(+, plus)
-_DEFINE_VALARRAY_OPERATOR(-, minus)
-_DEFINE_VALARRAY_OPERATOR(^, xor)
-_DEFINE_VALARRAY_OPERATOR(&, and)
-_DEFINE_VALARRAY_OPERATOR(|, or)
-_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
-_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
-
-#undef _DEFINE_VALARRAY_OPERATOR
-
-} // extern "C++"
-
-
-#endif // __GSLICE_ARRAY__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/indirect_array.h b/contrib/libstdc++/std/indirect_array.h
deleted file mode 100644
index bb5b79f..0000000
--- a/contrib/libstdc++/std/indirect_array.h
+++ /dev/null
@@ -1,157 +0,0 @@
-// The template and inlines for the -*- C++ -*- indirect_array class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __INDIRECT_ARRAY__
-#define __INDIRECT_ARRAY__
-
-extern "C++" {
-
-template <class _Tp> class indirect_array
-{
-public:
- typedef _Tp value_type;
-
- void operator= (const valarray<_Tp>&) const;
- void operator*= (const valarray<_Tp>&) const;
- void operator/= (const valarray<_Tp>&) const;
- void operator%= (const valarray<_Tp>&) const;
- void operator+= (const valarray<_Tp>&) const;
- void operator-= (const valarray<_Tp>&) const;
- void operator^= (const valarray<_Tp>&) const;
- void operator&= (const valarray<_Tp>&) const;
- void operator|= (const valarray<_Tp>&) const;
- void operator<<= (const valarray<_Tp>&) const;
- void operator>>= (const valarray<_Tp>&) const;
- void operator= (const _Tp&);
-
- template<class _Dom>
- void operator= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator*= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator/= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator%= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator+= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator-= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator^= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator&= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator|= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator<<= (const _Expr<_Dom, _Tp>&) const;
- template<class _Dom>
- void operator>>= (const _Expr<_Dom, _Tp>&) const;
-
-private:
- indirect_array (const indirect_array&);
- indirect_array (_Array<_Tp>, size_t, _Array<size_t>);
-
- friend class valarray<_Tp>;
- friend class gslice_array<_Tp>;
-
- const size_t _M_sz;
- const _Array<size_t> _M_index;
- const _Array<_Tp> _M_array;
-
- // not implemented
- indirect_array ();
- indirect_array& operator= (const indirect_array&);
-};
-
-template<typename _Tp>
-inline indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)
- : _M_sz (__a._M_sz), _M_index (__a._M_index),
- _M_array (__a._M_array) {}
-
-template<typename _Tp>
-inline
-indirect_array<_Tp>::indirect_array (_Array<_Tp> __a, size_t __s,
- _Array<size_t> __i)
- : _M_sz (__s), _M_index (__i), _M_array (__a) {}
-
-
-template<typename _Tp>
-inline void
-indirect_array<_Tp>::operator= (const _Tp& __t)
-{ __valarray_fill(_M_array, _M_index, _M_sz, __t); }
-
-template<typename _Tp>
-inline void
-indirect_array<_Tp>::operator= (const valarray<_Tp>& __v) const
-{ __valarray_copy (_Array<_Tp> (__v), _M_sz, _M_array, _M_index); }
-
-template<typename _Tp>
-template<class _Dom>
-inline void
-indirect_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const
-{ __valarray_copy (__e, _M_sz, _M_array, _M_index); }
-
-#undef _DEFINE_VALARRAY_OPERATOR
-#define _DEFINE_VALARRAY_OPERATOR(op, name) \
-template<typename _Tp> \
-inline void \
-indirect_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \
-{ \
- _Array_augmented_##name (_M_array, _M_index, _Array<_Tp> (__v), _M_sz); \
-} \
- \
-template<typename _Tp> template<class _Dom> \
-inline void \
-indirect_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \
-{ \
- _Array_augmented_##name (_M_array, _M_index, __e, _M_sz); \
-}
-
-_DEFINE_VALARRAY_OPERATOR(*, multiplies)
-_DEFINE_VALARRAY_OPERATOR(/, divides)
-_DEFINE_VALARRAY_OPERATOR(%, modulus)
-_DEFINE_VALARRAY_OPERATOR(+, plus)
-_DEFINE_VALARRAY_OPERATOR(-, minus)
-_DEFINE_VALARRAY_OPERATOR(^, xor)
-_DEFINE_VALARRAY_OPERATOR(&, and)
-_DEFINE_VALARRAY_OPERATOR(|, or)
-_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
-_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
-
-#undef _DEFINE_VALARRAY_OPERATOR
-
-} // extern "C++"
-
-#endif // __INDIRECT_ARRAY__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/ldcomplex.h b/contrib/libstdc++/std/ldcomplex.h
deleted file mode 100644
index bc91fa4..0000000
--- a/contrib/libstdc++/std/ldcomplex.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// The -*- C++ -*- long_double_complex class.
-// Copyright (C) 1994 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files
-// compiled with a GNU compiler to produce an executable, this does not cause
-// the resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why
-// the executable file might be covered by the GNU General Public License.
-
-// Written by Jason Merrill based upon the specification in the 27 May 1994
-// C++ working paper, ANSI document X3J16/94-0098.
-
-#ifndef __LDCOMPLEX__
-#define __LDCOMPLEX__
-
-#ifdef __GNUG__
-#pragma interface "ldcomplex"
-#endif
-
-extern "C++" {
-class complex<long double>
-{
-public:
- complex (long double r = 0, long double i = 0): re (r), im (i) { }
- complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { }
- complex (const complex<double>& r): re (r.real ()), im (r.imag ()) { }
-
- complex& operator+= (const complex& r) { return __doapl (this, r); }
- complex& operator-= (const complex& r) { return __doami (this, r); }
- complex& operator*= (const complex& r) { return __doaml (this, r); }
- complex& operator/= (const complex& r) { return __doadv (this, r); }
-
- long double real () const { return re; }
- long double imag () const { return im; }
-private:
- long double re, im;
-
- friend complex& __doapl<> (complex *, const complex&);
- friend complex& __doami<> (complex *, const complex&);
- friend complex& __doaml<> (complex *, const complex&);
- friend complex& __doadv<> (complex *, const complex&);
-
-#ifndef __STRICT_ANSI__
- friend inline complex operator + (const complex& x, long double y)
- { return operator+<> (x, y); }
- friend inline complex operator + (long double x, const complex& y)
- { return operator+<> (x, y); }
- friend inline complex operator - (const complex& x, long double y)
- { return operator-<> (x, y); }
- friend inline complex operator - (long double x, const complex& y)
- { return operator-<> (x, y); }
- friend inline complex operator * (const complex& x, long double y)
- { return operator*<> (x, y); }
- friend inline complex operator * (long double x, const complex& y)
- { return operator*<> (x, y); }
- friend inline complex operator / (const complex& x, long double y)
- { return operator/<> (x, y); }
- friend inline complex operator / (long double x, const complex& y)
- { return operator/<> (x, y); }
- friend inline bool operator == (const complex& x, long double y)
- { return operator==<> (x, y); }
- friend inline bool operator == (long double x, const complex& y)
- { return operator==<> (x, y); }
- friend inline bool operator != (const complex& x, long double y)
- { return operator!=<> (x, y); }
- friend inline bool operator != (long double x, const complex& y)
- { return operator!=<> (x, y); }
-#endif /* __STRICT_ANSI__ */
-};
-
-inline complex<float>::complex (const complex<long double>& r)
-: re (r.real ()), im (r.imag ())
-{ }
-
-inline complex<double>::complex (const complex<long double>& r)
-: re (r.real ()), im (r.imag ())
-{ }
-} // extern "C++"
-
-#endif
diff --git a/contrib/libstdc++/std/mask_array.h b/contrib/libstdc++/std/mask_array.h
deleted file mode 100644
index d431be4..0000000
--- a/contrib/libstdc++/std/mask_array.h
+++ /dev/null
@@ -1,154 +0,0 @@
-// The template and inlines for the -*- C++ -*- mask_array class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __MASK_ARRAY__
-#define __MASK_ARRAY__
-
-extern "C++" {
-
-template <class _T> class mask_array
-{
-public:
- typedef _T value_type;
-
- void operator= (const valarray<_T>&) const;
- void operator*= (const valarray<_T>&) const;
- void operator/= (const valarray<_T>&) const;
- void operator%= (const valarray<_T>&) const;
- void operator+= (const valarray<_T>&) const;
- void operator-= (const valarray<_T>&) const;
- void operator^= (const valarray<_T>&) const;
- void operator&= (const valarray<_T>&) const;
- void operator|= (const valarray<_T>&) const;
- void operator<<=(const valarray<_T>&) const;
- void operator>>=(const valarray<_T>&) const;
- void operator= (const _T&);
-
- template<class _Dom>
- void operator= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator*= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator/= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator%= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator+= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator-= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator^= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator&= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator|= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator<<=(const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator>>=(const _Expr<_Dom,_T>&) const;
-
-private:
- mask_array (_Array<_T>, size_t, _Array<bool>);
- friend class valarray<_T>;
-
- const size_t _M_sz;
- const _Array<bool> _M_mask;
- const _Array<_T> _M_array;
-
- mask_array (const mask_array&);
-
- // not implemented
- mask_array ();
- mask_array& operator= (const mask_array&);
-};
-
-template<typename _Tp>
-inline mask_array<_Tp>::mask_array (const mask_array<_Tp>& a)
- : _M_sz (a._M_sz), _M_mask (a._M_mask), _M_array (a._M_array) {}
-
-template<typename _T>
-inline
-mask_array<_T>::mask_array (_Array<_T> __a, size_t __s, _Array<bool> __m)
- : _M_sz (__s), _M_mask (__m), _M_array (__a) {}
-
-template<typename _T>
-inline void
-mask_array<_T>::operator= (const _T& __t)
-{ __valarray_fill (_M_array, _M_sz, _M_mask, __t); }
-
-template<typename _T>
-inline void
-mask_array<_T>::operator= (const valarray<_T>& __v) const
-{ __valarray_copy (_Array<_T> (__v), __v.size (), _M_array, _M_mask); }
-
-template<typename _T>
-template<class E>
-inline void
-mask_array<_T>::operator= (const _Expr<E, _T>& __e) const
-{ __valarray_copy (__e, __e.size (), _M_array, _M_mask); }
-
-#undef _DEFINE_VALARRAY_OPERATOR
-#define _DEFINE_VALARRAY_OPERATOR(op, name) \
-template<typename _T> \
-inline void \
-mask_array<_T>::operator##op##= (const valarray<_T>& __v) const \
-{ \
- _Array_augmented_##name (_M_array, _M_mask, \
- _Array<_T> (__v), __v.size ()); \
-} \
- \
-template<typename _T> template<class E> \
-inline void \
-mask_array<_T>::operator##op##= (const _Expr<E, _T>& __e) const \
-{ \
- _Array_augmented_##name (_M_array, _M_mask, __e, __e.size ()); \
-}
-
-_DEFINE_VALARRAY_OPERATOR(*, multiplies)
-_DEFINE_VALARRAY_OPERATOR(/, divides)
-_DEFINE_VALARRAY_OPERATOR(%, modulus)
-_DEFINE_VALARRAY_OPERATOR(+, plus)
-_DEFINE_VALARRAY_OPERATOR(-, minus)
-_DEFINE_VALARRAY_OPERATOR(^, xor)
-_DEFINE_VALARRAY_OPERATOR(&, and)
-_DEFINE_VALARRAY_OPERATOR(|, or)
-_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
-_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
-
-#undef _DEFINE_VALARRAY_OPERATOR
-
-} // extern "C++"
-
-#endif // __MASK_ARRAY__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/slice.h b/contrib/libstdc++/std/slice.h
deleted file mode 100644
index cf2fb28..0000000
--- a/contrib/libstdc++/std/slice.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// The template and inlines for the -*- C++ -*- slice class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __SLICE__
-#define __SLICE__
-
-extern "C++" {
-
-class slice
-{
-public:
- slice ();
- slice (size_t, size_t, size_t);
-
- size_t start () const;
- size_t size () const;
- size_t stride () const;
-
-private:
- size_t _M_off; // offset
- size_t _M_sz; // size
- size_t _M_st; // stride unit
-};
-
-inline slice::slice () {}
-
-inline slice::slice (size_t __o, size_t __d, size_t __s)
- : _M_off (__o), _M_sz (__d), _M_st (__s) {}
-
-inline size_t
-slice::start () const
- { return _M_off; }
-
-inline size_t
-slice::size () const
- { return _M_sz; }
-
-inline size_t
-slice::stride () const
- { return _M_st; }
-
-} // extern "C++"
-
-#endif // __SLICE__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/slice_array.h b/contrib/libstdc++/std/slice_array.h
deleted file mode 100644
index dc1aa34..0000000
--- a/contrib/libstdc++/std/slice_array.h
+++ /dev/null
@@ -1,156 +0,0 @@
-// The template and inlines for the -*- C++ -*- slice_array class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __SLICE_ARRAY__
-#define __SLICE_ARRAY__
-
-extern "C++" {
-
-template<typename _T>
-class slice_array
-{
-public:
- typedef _T value_type;
-
- void operator= (const valarray<_T>&) const;
- void operator*= (const valarray<_T>&) const;
- void operator/= (const valarray<_T>&) const;
- void operator%= (const valarray<_T>&) const;
- void operator+= (const valarray<_T>&) const;
- void operator-= (const valarray<_T>&) const;
- void operator^= (const valarray<_T>&) const;
- void operator&= (const valarray<_T>&) const;
- void operator|= (const valarray<_T>&) const;
- void operator<<= (const valarray<_T>&) const;
- void operator>>= (const valarray<_T>&) const;
- void operator= (const _T &);
-
- template<class _Dom>
- void operator= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator*= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator/= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator%= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator+= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator-= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator^= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator&= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator|= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator<<= (const _Expr<_Dom,_T>&) const;
- template<class _Dom>
- void operator>>= (const _Expr<_Dom,_T>&) const;
-
-private:
- friend class valarray<_T>;
- slice_array(_Array<_T>, const slice&);
-
- const size_t _M_sz;
- const size_t _M_stride;
- const _Array<_T> _M_array;
-
- // this constructor is implemented since we need to return a value.
- slice_array (const slice_array&);
-
- // not implemented
- slice_array ();
- slice_array& operator= (const slice_array&);
-};
-
-template<typename _T>
-inline slice_array<_T>::slice_array (_Array<_T> __a, const slice& __s)
- : _M_sz (__s.size ()), _M_stride (__s.stride ()),
- _M_array (__a.begin () + __s.start ()) {}
-
-template<typename _Tp>
-inline slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)
- : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}
-
-template<typename _T>
-inline void
-slice_array<_T>::operator= (const _T& __t)
-{ __valarray_fill (_M_array, _M_sz, _M_stride, __t); }
-
-template<typename _T>
-inline void
-slice_array<_T>::operator= (const valarray<_T>& __v) const
-{ __valarray_copy (_Array<_T> (__v), _M_array, _M_sz, _M_stride); }
-
-template<typename _T>
-template<class _Dom>
-inline void
-slice_array<_T>::operator= (const _Expr<_Dom,_T>& __e) const
-{ __valarray_copy (__e, _M_sz, _M_array, _M_stride); }
-
-#undef _DEFINE_VALARRAY_OPERATOR
-#define _DEFINE_VALARRAY_OPERATOR(op, name) \
-template<typename _T> \
-inline void \
-slice_array<_T>::operator##op##= (const valarray<_T>& __v) const \
-{ \
- _Array_augmented_##name (_M_array, _M_sz, _M_stride, _Array<_T> (__v));\
-} \
- \
-template<typename _T> template<class _Dom> \
-inline void \
-slice_array<_T>::operator##op##= (const _Expr<_Dom,_T>& __e) const \
-{ \
- _Array_augmented_##name (_M_array, _M_stride, __e, _M_sz); \
-}
-
-
-_DEFINE_VALARRAY_OPERATOR(*, multiplies)
-_DEFINE_VALARRAY_OPERATOR(/, divides)
-_DEFINE_VALARRAY_OPERATOR(%, modulus)
-_DEFINE_VALARRAY_OPERATOR(+, plus)
-_DEFINE_VALARRAY_OPERATOR(-, minus)
-_DEFINE_VALARRAY_OPERATOR(^, xor)
-_DEFINE_VALARRAY_OPERATOR(&, and)
-_DEFINE_VALARRAY_OPERATOR(|, or)
-_DEFINE_VALARRAY_OPERATOR(<<, shift_left)
-_DEFINE_VALARRAY_OPERATOR(>>, shift_right)
-
-#undef _DEFINE_VALARRAY_OPERATOR
-
-} // extern "C++"
-
-#endif // __SLICE_ARRAY__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/std_valarray.h b/contrib/libstdc++/std/std_valarray.h
deleted file mode 100644
index b300655..0000000
--- a/contrib/libstdc++/std/std_valarray.h
+++ /dev/null
@@ -1,728 +0,0 @@
-// The template and inlines for the -*- C++ -*- valarray class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __STD_VALARRAY__
-#define __STD_VALARRAY__
-#define _G_NO_VALARRAY_TEMPLATE_EXPORT 1
-
-#include <cstddef>
-#include <cmath>
-#include <cstdlib>
-#include <numeric>
-#include <functional>
-#include <algorithm>
-
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
-#include <alloca.h>
-#else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
-#include <malloc.h>
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-#include <malloc.h>
- #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#endif /* __hpux */
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc. */
-#endif /* not GNU C. */
-#endif /* alloca not defined. */
-
-extern "C" {
- void* alloca(size_t);
-}
-
-
-extern "C++" {
-
-template<class _Clos, typename _Tp> class _Expr;
-
-template<typename _Tp1, typename _Tp2> class _ValArray;
-
-template<template<class> class _Oper,
- template<class, class> class _Meta, class _Dom> struct _UnClos;
-
-template<template<class> class _Oper,
- template<class, class> class _Meta1,
- template<class, class> class _Meta2,
- class _Dom1, class _Dom2> class _BinClos;
-
-template<template<class, class> class _Meta, class _Dom> class _SClos;
-
-template<template<class, class> class _Meta, class _Dom> class _GClos;
-
-template<template<class, class> class _Meta, class _Dom> class _IClos;
-
-template<template<class, class> class _Meta, class _Dom> class _ValFunClos;
-
-template<template<class, class> class _Meta, class _Dom> class _RefFunClos;
-
-template<class _Tp> struct _Unary_plus;
-template<class _Tp> struct _Bitwise_and;
-template<class _Tp> struct _Bitwise_or;
-template<class _Tp> struct _Bitwise_xor;
-template<class _Tp> struct _Bitwise_not;
-template<class _Tp> struct _Shift_left;
-template<class _Tp> struct _Shift_right;
-
-template<class _Tp> class valarray; // An array of type _Tp
-class slice; // BLAS-like slice out of an array
-template<class _Tp> class slice_array;
-class gslice; // generalized slice out of an array
-template<class _Tp> class gslice_array;
-template<class _Tp> class mask_array; // masked array
-template<class _Tp> class indirect_array; // indirected array
-
-} // extern "C++"
-
-#include <std/valarray_array.h>
-#include <std/valarray_meta.h>
-
-extern "C++" {
-
-template<class _Tp> class valarray
-{
-public:
- typedef _Tp value_type;
-
- // _lib.valarray.cons_ construct/destroy:
- valarray();
- explicit valarray(size_t);
- valarray(const _Tp&, size_t);
- valarray(const _Tp* __restrict__, size_t);
- valarray(const valarray&);
- valarray(const slice_array<_Tp>&);
- valarray(const gslice_array<_Tp>&);
- valarray(const mask_array<_Tp>&);
- valarray(const indirect_array<_Tp>&);
- template<class _Dom>
- valarray(const _Expr<_Dom,_Tp>& __e);
- ~valarray();
-
- // _lib.valarray.assign_ assignment:
- valarray<_Tp>& operator=(const valarray<_Tp>&);
- valarray<_Tp>& operator=(const _Tp&);
- valarray<_Tp>& operator=(const slice_array<_Tp>&);
- valarray<_Tp>& operator=(const gslice_array<_Tp>&);
- valarray<_Tp>& operator=(const mask_array<_Tp>&);
- valarray<_Tp>& operator=(const indirect_array<_Tp>&);
-
- template<class _Dom> valarray<_Tp>&
- operator= (const _Expr<_Dom,_Tp>&);
-
- // _lib.valarray.access_ element access:
- _Tp operator[](size_t) const;
- _Tp& operator[](size_t);
- // _lib.valarray.sub_ subset operations:
- _Expr<_SClos<_ValArray,_Tp>, _Tp> operator[](slice) const;
- slice_array<_Tp> operator[](slice);
- _Expr<_GClos<_ValArray,_Tp>, _Tp> operator[](const gslice&) const;
- gslice_array<_Tp> operator[](const gslice&);
- valarray<_Tp> operator[](const valarray<bool>&) const;
- mask_array<_Tp> operator[](const valarray<bool>&);
- _Expr<_IClos<_ValArray, _Tp>, _Tp>
- operator[](const valarray<size_t>&) const;
- indirect_array<_Tp> operator[](const valarray<size_t>&);
-
- // _lib.valarray.unary_ unary operators:
- _Expr<_UnClos<_Unary_plus,_ValArray,_Tp>,_Tp> operator+ () const;
- _Expr<_UnClos<negate,_ValArray,_Tp>,_Tp> operator- () const;
- _Expr<_UnClos<_Bitwise_not,_ValArray,_Tp>,_Tp> operator~ () const;
- _Expr<_UnClos<logical_not,_ValArray,_Tp>,bool> operator! () const;
-
- // _lib.valarray.cassign_ computed assignment:
- valarray<_Tp>& operator*= (const _Tp&);
- valarray<_Tp>& operator/= (const _Tp&);
- valarray<_Tp>& operator%= (const _Tp&);
- valarray<_Tp>& operator+= (const _Tp&);
- valarray<_Tp>& operator-= (const _Tp&);
- valarray<_Tp>& operator^= (const _Tp&);
- valarray<_Tp>& operator&= (const _Tp&);
- valarray<_Tp>& operator|= (const _Tp&);
- valarray<_Tp>& operator<<=(const _Tp&);
- valarray<_Tp>& operator>>=(const _Tp&);
- valarray<_Tp>& operator*= (const valarray<_Tp>&);
- valarray<_Tp>& operator/= (const valarray<_Tp>&);
- valarray<_Tp>& operator%= (const valarray<_Tp>&);
- valarray<_Tp>& operator+= (const valarray<_Tp>&);
- valarray<_Tp>& operator-= (const valarray<_Tp>&);
- valarray<_Tp>& operator^= (const valarray<_Tp>&);
- valarray<_Tp>& operator|= (const valarray<_Tp>&);
- valarray<_Tp>& operator&= (const valarray<_Tp>&);
- valarray<_Tp>& operator<<=(const valarray<_Tp>&);
- valarray<_Tp>& operator>>=(const valarray<_Tp>&);
-
- template<class _Dom>
- valarray<_Tp>& operator*= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator/= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator%= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator+= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator-= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator^= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator|= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator&= (const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator<<=(const _Expr<_Dom,_Tp>&);
- template<class _Dom>
- valarray<_Tp>& operator>>=(const _Expr<_Dom,_Tp>&);
-
-
- // _lib.valarray.members_ member functions:
- size_t size() const;
- _Tp sum() const;
- _Tp min() const;
- _Tp max() const;
-
- // FIXME: Extension
- _Tp product () const;
-
- valarray<_Tp> shift (int) const;
- valarray<_Tp> cshift(int) const;
- _Expr<_ValFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(_Tp)) const;
- _Expr<_RefFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(const _Tp&)) const;
- void resize(size_t __size, _Tp __c = _Tp());
-
-private:
- size_t _M_size;
- _Tp* __restrict__ _M_data;
-
- friend class _Array<_Tp>;
-};
-
-
-template<typename _Tp> struct _Unary_plus : unary_function<_Tp,_Tp> {
- _Tp operator() (const _Tp& __t) const { return __t; }
-};
-
-template<typename _Tp> struct _Bitwise_and : binary_function<_Tp,_Tp,_Tp> {
- _Tp operator() (_Tp __x, _Tp __y) const { return __x & __y; }
-};
-
-template<typename _Tp> struct _Bitwise_or : binary_function<_Tp,_Tp,_Tp> {
- _Tp operator() (_Tp __x, _Tp __y) const { return __x | __y; }
-};
-
-template<typename _Tp> struct _Bitwise_xor : binary_function<_Tp,_Tp,_Tp> {
- _Tp operator() (_Tp __x, _Tp __y) const { return __x ^ __y; }
-};
-
-template<typename _Tp> struct _Bitwise_not : unary_function<_Tp,_Tp> {
- _Tp operator() (_Tp __t) const { return ~__t; }
-};
-
-template<typename _Tp> struct _Shift_left : unary_function<_Tp,_Tp> {
- _Tp operator() (_Tp __x, _Tp __y) const { return __x << __y; }
-};
-
-template<typename _Tp> struct _Shift_right : unary_function<_Tp,_Tp> {
- _Tp operator() (_Tp __x, _Tp __y) const { return __x >> __y; }
-};
-
-
-template<typename _Tp>
-inline _Tp
-valarray<_Tp>::operator[] (size_t __i) const
-{ return _M_data[__i]; }
-
-template<typename _Tp>
-inline _Tp&
-valarray<_Tp>::operator[] (size_t __i)
-{ return _M_data[__i]; }
-
-} // extern "C++"
-
-#include <std/slice.h>
-#include <std/slice_array.h>
-#include <std/gslice.h>
-#include <std/gslice_array.h>
-#include <std/mask_array.h>
-#include <std/indirect_array.h>
-
-extern "C++" {
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray () : _M_size (0), _M_data (0) {}
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (size_t __n)
- : _M_size (__n), _M_data (new _Tp[__n]) {}
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (const _Tp& __t, size_t __n)
- : _M_size (__n), _M_data (new _Tp[__n])
-{ __valarray_fill (_M_data, _M_size, __t); }
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (const _Tp* __restrict__ __pT, size_t __n)
- : _M_size (__n), _M_data (new _Tp[__n])
-{ __valarray_copy (__pT, __n, _M_data); }
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (const valarray<_Tp>& __v)
- : _M_size (__v._M_size), _M_data (new _Tp[__v._M_size])
-{ __valarray_copy (__v._M_data, _M_size, _M_data); }
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (const slice_array<_Tp>& __sa)
- : _M_size (__sa._M_sz), _M_data (new _Tp[__sa._M_sz])
-{ __valarray_copy (__sa._M_array, __sa._M_sz, __sa._M_stride,
- _Array<_Tp>(_M_data)); }
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (const gslice_array<_Tp>& __ga)
- : _M_size (__ga._M_index.size()), _M_data (new _Tp[_M_size])
-{ __valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index),
- _Array<_Tp>(_M_data), _M_size); }
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (const mask_array<_Tp>& __ma)
- : _M_size (__ma._M_sz), _M_data (new _Tp[__ma._M_sz])
-{ __valarray_copy (__ma._M_array, __ma._M_mask,
- _Array<_Tp>(_M_data), _M_size); }
-
-template<typename _Tp>
-inline valarray<_Tp>::valarray (const indirect_array<_Tp>& __ia)
- : _M_size (__ia._M_sz), _M_data (new _Tp[__ia._M_sz])
-{ __valarray_copy (__ia._M_array, __ia._M_index,
- _Array<_Tp>(_M_data), _M_size); }
-
-template<typename _Tp> template<class _Dom>
-inline valarray<_Tp>::valarray (const _Expr<_Dom, _Tp>& __e)
- : _M_size (__e.size ()), _M_data (new _Tp[_M_size])
-{ __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data)); }
-
-template<typename _Tp>
-inline valarray<_Tp>::~valarray () { delete[] _M_data; }
-
-template<typename _Tp>
-inline valarray<_Tp>&
-valarray<_Tp>::operator= (const valarray<_Tp>& __v)
-{
- __valarray_copy(__v._M_data, _M_size, _M_data);
- return *this;
-}
-
-template<typename _Tp>
-inline valarray<_Tp>&
-valarray<_Tp>::operator= (const _Tp& __t)
-{
- __valarray_fill (_M_data, _M_size, __t);
- return *this;
-}
-
-template<typename _Tp>
-inline valarray<_Tp>&
-valarray<_Tp>::operator= (const slice_array<_Tp>& __sa)
-{
- __valarray_copy (__sa._M_array, __sa._M_sz,
- __sa._M_stride, _Array<_Tp>(_M_data));
- return *this;
-}
-
-template<typename _Tp>
-inline valarray<_Tp>&
-valarray<_Tp>::operator= (const gslice_array<_Tp>& __ga)
-{
- __valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index),
- _Array<_Tp>(_M_data), _M_size);
- return *this;
-}
-
-template<typename _Tp>
-inline valarray<_Tp>&
-valarray<_Tp>::operator= (const mask_array<_Tp>& __ma)
-{
- __valarray_copy (__ma._M_array, __ma._M_mask,
- _Array<_Tp>(_M_data), _M_size);
- return *this;
-}
-
-template<typename _Tp>
-inline valarray<_Tp>&
-valarray<_Tp>::operator= (const indirect_array<_Tp>& __ia)
-{
- __valarray_copy (__ia._M_array, __ia._M_index,
- _Array<_Tp>(_M_data), _M_size);
- return *this;
-}
-
-template<typename _Tp> template<class _Dom>
-inline valarray<_Tp>&
-valarray<_Tp>::operator= (const _Expr<_Dom, _Tp>& __e)
-{
- __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data));
- return *this;
-}
-
-template<typename _Tp>
-inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
-valarray<_Tp>::operator[] (slice __s) const
-{
- typedef _SClos<_ValArray,_Tp> _Closure;
- return _Expr<_Closure, _Tp> (_Closure (_Array<_Tp>(_M_data), __s));
-}
-
-template<typename _Tp>
-inline slice_array<_Tp>
-valarray<_Tp>::operator[] (slice __s)
-{
- return slice_array<_Tp> (_Array<_Tp>(_M_data), __s);
-}
-
-template<typename _Tp>
-inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
-valarray<_Tp>::operator[] (const gslice& __gs) const
-{
- typedef _GClos<_ValArray,_Tp> _Closure;
- return _Expr<_Closure, _Tp>
- (_Closure (_Array<_Tp>(_M_data), __gs._M_index->_M_index));
-}
-
-template<typename _Tp>
-inline gslice_array<_Tp>
-valarray<_Tp>::operator[] (const gslice& __gs)
-{
- return gslice_array<_Tp>
- (_Array<_Tp>(_M_data), __gs._M_index->_M_index);
-}
-
-template<typename _Tp>
-inline valarray<_Tp>
-valarray<_Tp>::operator[] (const valarray<bool>& __m) const
-{
- size_t __s (0);
- size_t __e (__m.size ());
- for (size_t __i=0; __i<__e; ++__i)
- if (__m[__i]) ++__s;
- return valarray<_Tp> (mask_array<_Tp> (_Array<_Tp>(_M_data), __s,
- _Array<bool> (__m)));
-}
-
-template<typename _Tp>
-inline mask_array<_Tp>
-valarray<_Tp>::operator[] (const valarray<bool>& __m)
-{
- size_t __s (0);
- size_t __e (__m.size ());
- for (size_t __i=0; __i<__e; ++__i)
- if (__m[__i]) ++__s;
- return mask_array<_Tp> (_Array<_Tp>(_M_data), __s, _Array<bool> (__m));
-}
-
-template<typename _Tp>
-inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
-valarray<_Tp>::operator[] (const valarray<size_t>& __i) const
-{
- typedef _IClos<_ValArray,_Tp> _Closure;
- return _Expr<_Closure, _Tp> (_Closure (*this, __i));
-}
-
-template<typename _Tp>
-inline indirect_array<_Tp>
-valarray<_Tp>::operator[] (const valarray<size_t>& __i)
-{
- return indirect_array<_Tp> (_Array<_Tp>(_M_data), __i.size(),
- _Array<size_t> (__i));
-}
-
-template<class _Tp>
-inline size_t valarray<_Tp>::size () const { return _M_size; }
-
-template<class _Tp>
-inline _Tp
-valarray<_Tp>::sum () const
-{
- return accumulate (_M_data, _M_data + _M_size, _Tp ());
-}
-
-template<typename _Tp>
-inline _Tp
-valarray<_Tp>::product () const
-{
- return accumulate (_M_data, _M_data+_M_size, _Tp(1), multiplies<_Tp> ());
-}
-
-template <class _Tp>
-inline valarray<_Tp>
-valarray<_Tp>::shift (int __n) const
-{
- _Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size));
- if (! __n) // __n == 0: no shift
- __valarray_copy (_M_data, _M_size, __a);
- else if (__n > 0) { // __n > 0: shift left
- if (__n > _M_size)
- __valarray_fill(__a, __n, _Tp());
- else {
- __valarray_copy (_M_data+__n, _M_size-__n, __a);
- __valarray_fill (__a+_M_size-__n, __n, _Tp());
- }
- }
- else { // __n < 0: shift right
- __valarray_copy (_M_data, _M_size+__n, __a-__n);
- __valarray_fill(__a, -__n, _Tp());
- }
- return valarray<_Tp> (__a, _M_size);
-}
-
-template <class _Tp>
-inline valarray<_Tp>
-valarray<_Tp>::cshift (int __n) const
-{
- _Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size));
- if (! __n) // __n == 0: no cshift
- __valarray_copy(_M_data, _M_size, __a);
- else if (__n > 0) { // __n > 0: cshift left
- __valarray_copy (_M_data, __n, __a + _M_size-__n);
- __valarray_copy (_M_data + __n, _M_size-__n, __a);
- }
- else { // __n < 0: cshift right
- __valarray_copy (_M_data + _M_size + __n, -__n, __a);
- __valarray_copy (_M_data, _M_size + __n, __a - __n);
- }
- return valarray<_Tp> (__a, _M_size);
-}
-
-template <class _Tp>
-inline void
-valarray<_Tp>::resize (size_t __n, _Tp __c)
-{
- if (_M_size != __n) {
- delete[] _M_data;
- _M_size = __n;
- _M_data = new _Tp[_M_size];
- }
- __valarray_fill (_M_data, _M_size, __c);
-}
-
-template<typename _Tp>
-inline _Tp
-valarray<_Tp>::min() const
-{
- return *min_element (_M_data, _M_data+_M_size);
-}
-
-template<typename _Tp>
-inline _Tp
-valarray<_Tp>::max() const
-{
- return *max_element (_M_data, _M_data+_M_size);
-}
-
-template<class _Tp>
-inline _Expr<_ValFunClos<_ValArray,_Tp>,_Tp>
-valarray<_Tp>::apply (_Tp func (_Tp)) const
-{
- typedef _ValFunClos<_ValArray,_Tp> _Closure;
- return _Expr<_Closure,_Tp> (_Closure (*this, func));
-}
-
-template<class _Tp>
-inline _Expr<_RefFunClos<_ValArray,_Tp>,_Tp>
-valarray<_Tp>::apply (_Tp func (const _Tp &)) const
-{
- typedef _RefFunClos<_ValArray,_Tp> _Closure;
- return _Expr<_Closure,_Tp> (_Closure (*this, func));
-}
-
-#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
- template<typename _Tp> \
- inline _Expr<_UnClos<_Name,_ValArray,_Tp>, _Tp> \
- valarray<_Tp>::operator##_Op() const \
- { \
- typedef _UnClos<_Name,_ValArray,_Tp> _Closure; \
- return _Expr<_Closure, _Tp> (_Closure (*this)); \
- }
-
- _DEFINE_VALARRAY_UNARY_OPERATOR(+, _Unary_plus)
- _DEFINE_VALARRAY_UNARY_OPERATOR(-, negate)
- _DEFINE_VALARRAY_UNARY_OPERATOR(~, _Bitwise_not)
-
-#undef _DEFINE_VALARRAY_UNARY_OPERATOR
-
- template<typename _Tp>
- inline _Expr<_UnClos<logical_not,_ValArray,_Tp>, bool>
- valarray<_Tp>::operator!() const
- {
- typedef _UnClos<logical_not,_ValArray,_Tp> _Closure;
- return _Expr<_Closure, bool> (_Closure (*this));
- }
-
-#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
- template<class _Tp> \
- inline valarray<_Tp> & \
- valarray<_Tp>::operator##_Op##= (const _Tp &__t) \
- { \
- _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t); \
- return *this; \
- } \
- \
- template<class _Tp> \
- inline valarray<_Tp> & \
- valarray<_Tp>::operator##_Op##= (const valarray<_Tp> &__v) \
- { \
- _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, \
- _Array<_Tp>(__v._M_data)); \
- return *this; \
- }
-
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, plus)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, minus)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, multiplies)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, divides)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, modulus)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, xor)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, and)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, or)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, shift_left)
-_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, shift_right)
-
-#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
-
-
-#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
- template<class _Tp> template<class _Dom> \
- inline valarray<_Tp> & \
- valarray<_Tp>::operator##_Op##= (const _Expr<_Dom,_Tp> &__e) \
- { \
- _Array_augmented_##_Name (_Array<_Tp>(_M_data), __e, _M_size); \
- return *this; \
- }
-
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, plus)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, minus)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, multiplies)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, divides)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, modulus)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, xor)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, and)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, or)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, shift_left)
-_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, shift_right)
-
-#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
-
-
-#define _DEFINE_BINARY_OPERATOR(_Op, _Name) \
- template<typename _Tp> \
- inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>, _Tp> \
- operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \
- { \
- typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure, _Tp> (_Closure (__v, __w)); \
- } \
- \
- template<typename _Tp> \
- inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,_Tp> \
- operator##_Op (const valarray<_Tp> &__v, const _Tp &__t) \
- { \
- typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \
- return _Expr<_Closure, _Tp> (_Closure (__v, __t)); \
- } \
- \
- template<typename _Tp> \
- inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,_Tp> \
- operator##_Op (const _Tp &__t, const valarray<_Tp> &__v) \
- { \
- typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure, _Tp> (_Closure (__t, __v)); \
- }
-
-_DEFINE_BINARY_OPERATOR(+, plus)
-_DEFINE_BINARY_OPERATOR(-, minus)
-_DEFINE_BINARY_OPERATOR(*, multiplies)
-_DEFINE_BINARY_OPERATOR(/, divides)
-_DEFINE_BINARY_OPERATOR(%, modulus)
-_DEFINE_BINARY_OPERATOR(^, _Bitwise_xor)
-_DEFINE_BINARY_OPERATOR(&, _Bitwise_and)
-_DEFINE_BINARY_OPERATOR(|, _Bitwise_or)
-_DEFINE_BINARY_OPERATOR(<<, _Shift_left)
-_DEFINE_BINARY_OPERATOR(>>, _Shift_right)
-
-#undef _DEFINE_BINARY_OPERATOR
-
-#define _DEFINE_LOGICAL_OPERATOR(_Op, _Name) \
- template<typename _Tp> \
- inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,bool> \
- operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \
- { \
- typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure, bool> (_Closure (__v, __w)); \
- } \
- \
- template<class _Tp> \
- inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,bool> \
- operator##_Op (const valarray<_Tp> &__v, const _Tp &__t) \
- { \
- typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \
- return _Expr<_Closure, bool> (_Closure (__v, __t)); \
- } \
- \
- template<class _Tp> \
- inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool> \
- operator##_Op (const _Tp &__t, const valarray<_Tp> &__v) \
- { \
- typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure, bool> (_Closure (__t, __v)); \
- }
-
-_DEFINE_LOGICAL_OPERATOR(&&, logical_and)
-_DEFINE_LOGICAL_OPERATOR(||, logical_or)
-_DEFINE_LOGICAL_OPERATOR(==, equal_to)
-_DEFINE_LOGICAL_OPERATOR(!=, not_equal_to)
-_DEFINE_LOGICAL_OPERATOR(<, less)
-_DEFINE_LOGICAL_OPERATOR(>, greater)
-_DEFINE_LOGICAL_OPERATOR(<=, less_equal)
-_DEFINE_LOGICAL_OPERATOR(>=, greater_equal)
-
-#undef _DEFINE_VALARRAY_OPERATOR
-
-#undef _G_NO_VALARRAY_TEMPLATE_EXPORT
-
-} // extern "C++"
-
-#endif // __STD_VALARRAY__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/straits.h b/contrib/libstdc++/std/straits.h
deleted file mode 100644
index c80e7ab..0000000
--- a/contrib/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 <cstddef>
-
-extern "C++" {
-template <class charT>
-struct string_char_traits {
- typedef charT char_type; // for users to acquire the basic character type
-
- // constraints
-
- static void assign (char_type& c1, const char_type& c2)
- { c1 = c2; }
- static bool eq (const char_type& c1, const char_type& c2)
- { return (c1 == c2); }
- static bool ne (const char_type& c1, const char_type& c2)
- { return !(c1 == c2); }
- static bool lt (const char_type& c1, const char_type& c2)
- { return (c1 < c2); }
- static char_type eos () { return char_type(); } // the null character
- static bool is_del(char_type a) { return 0; }
- // characteristic function for delimiters of charT
-
- // speed-up functions
-
- static int compare (const char_type* s1, const char_type* s2, size_t n)
- {
- size_t i;
- for (i = 0; i < n; ++i)
- if (ne (s1[i], s2[i]))
- return lt (s1[i], s2[i]) ? -1 : 1;
-
- return 0;
- }
-
- static size_t length (const char_type* s)
- {
- size_t l = 0;
- while (ne (*s++, eos ()))
- ++l;
- return l;
- }
-
- static char_type* copy (char_type* s1, const char_type* s2, size_t n)
- {
- for (; n--; )
- assign (s1[n], s2[n]);
- return s1;
- }
-
- static char_type* move (char_type* s1, const char_type* s2, size_t n)
- {
- char_type a[n];
- size_t i;
- for (i = 0; i < n; ++i)
- assign (a[i], s2[i]);
- for (i = 0; i < n; ++i)
- assign (s1[i], a[i]);
- return s1;
- }
-
- static char_type* set (char_type* s1, const char_type& c, size_t n)
- {
- for (; n--; )
- assign (s1[n], c);
- return s1;
- }
-};
-
-class istream;
-class ostream;
-#include <cctype>
-#include <cstring>
-
-struct string_char_traits <char> {
- typedef char char_type;
-
- static void assign (char_type& c1, const char_type& c2)
- { c1 = c2; }
- static bool eq (const char_type & c1, const char_type& c2)
- { return (c1 == c2); }
- static bool ne (const char_type& c1, const char_type& c2)
- { return (c1 != c2); }
- static bool lt (const char_type& c1, const char_type& c2)
- { return (c1 < c2); }
- static char_type eos () { return 0; }
- static bool is_del(char_type a) { return isspace(a); }
-
- static int compare (const char_type* s1, const char_type* s2, size_t n)
- { return memcmp (s1, s2, n); }
- static size_t length (const char_type* s)
- { return strlen (s); }
- static char_type* copy (char_type* s1, const char_type* s2, size_t n)
- { return (char_type*) memcpy (s1, s2, n); }
- static char_type* move (char_type* s1, const char_type* s2, size_t n)
- { return (char_type*) memmove (s1, s2, n); }
- static char_type* set (char_type* s1, const char_type& c, size_t n)
- { return (char_type*) memset (s1, c, n); }
-};
-
-#if 0
-#include <cwctype>
-struct string_char_traits <wchar_t> {
- typedef wchar_t char_type;
-
- static void assign (char_type& c1, const char_type& c2)
- { c1 = c2; }
- static bool eq (const char_type & c1, const char_type& c2)
- { return (c1 == c2); }
- static bool ne (const char_type& c1, const char_type& c2)
- { return (c1 != c2); }
- static bool lt (const char_type& c1, const char_type& c2)
- { return (c1 < c2); }
- static char_type eos () { return 0; }
- static bool is_del(char_type a) { return iswspace(a); }
-
- static int compare (const char_type* s1, const char_type* s2, size_t n)
- { return wmemcmp (s1, s2, n); }
- static size_t length (const char_type* s)
- { return wcslen (s); }
- static char_type* copy (char_type* s1, const char_type* s2, size_t n)
- { return wmemcpy (s1, s2, n); }
- static char_type* set (char_type* s1, const char_type& c, size_t n)
- { return wmemset (s1, c, n); }
-};
-#endif
-} // extern "C++"
-#endif
diff --git a/contrib/libstdc++/std/valarray_array.h b/contrib/libstdc++/std/valarray_array.h
deleted file mode 100644
index a0b5818..0000000
--- a/contrib/libstdc++/std/valarray_array.h
+++ /dev/null
@@ -1,346 +0,0 @@
-// The template and inlines for the -*- C++ -*- internal _Array helper class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __VALARRAY_ARRAY__
-#define __VALARRAY_ARRAY__
-
-#include <cstdlib>
-#include <cstring>
-
-extern "C++" {
-
-//
-// Helper functions on raw pointers
-//
-
-// fill plain array __a[<__n>] with __t
-template<typename _Tp>
-inline void
-__valarray_fill (_Tp* __restrict__ __a, size_t __n, const _Tp& __t)
-{ while (__n--) *__a++ = __t; }
-
-// fill strided array __a[<__n-1 : __s>] with __t
-template<typename _Tp>
-inline void
-__valarray_fill (_Tp* __restrict__ __a, size_t __n,
- size_t __s, const _Tp& __t)
-{ for (size_t __i=0; __i<__n; ++__i, __a+=__s) *__a = __t; }
-
-// fill indirect array __a[__i[<__n>]] with __i
-template<typename _Tp>
-inline void
-__valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i,
- size_t __n, const _Tp& __t)
-{ for (size_t __j=0; __j<__n; ++__j, ++__i) __a[*__i] = __t; }
-
-// copy plain array __a[<__n>] in __b[<__n>]
-template<typename _Tp>
-inline void
-__valarray_copy (const _Tp* __restrict__ __a, size_t __n,
- _Tp* __restrict__ __b)
-{ memcpy (__b, __a, __n * sizeof(_Tp)); }
-
-// copy strided array __a[<__n : __s>] in plain __b[<__n>]
-template<typename _Tp>
-inline void
-__valarray_copy (const _Tp* __restrict__ __a, size_t __n, size_t __s,
- _Tp* __restrict__ __b)
-{ for (size_t __i=0; __i<__n; ++__i, ++__b, __a += __s) *__b = *__a; }
-
-// copy plain __a[<__n>] in strided __b[<__n : __s>]
-template<typename _Tp>
-inline void
-__valarray_copy (const _Tp* __restrict__ __a, _Tp* __restrict__ __b,
- size_t __n, size_t __s)
-{ for (size_t __i=0; __i<__n; ++__i, ++__a, __b+=__s) *__b = *__a; }
-
-// copy indexed __a[__i[<__n>]] in plain __b[<__n>]
-template<typename _Tp>
-inline void
-__valarray_copy (const _Tp* __restrict__ __a,
- const size_t* __restrict__ __i,
- _Tp* __restrict__ __b, size_t __n)
-{ for (size_t __j=0; __j<__n; ++__j, ++__b, ++__i) *__b = __a[*__i]; }
-
-// copy plain __a[<__n>] in indexed __b[__i[<__n>]]
-template<typename _Tp>
-inline void
-__valarray_copy (const _Tp* __restrict__ __a, size_t __n,
- _Tp* __restrict__ __b, const size_t* __restrict__ __i)
-{ for (size_t __j=0; __j<__n; ++__j, ++__a, ++__i) __b[*__i] = *__a; }
-
-//
-// Helper class _Array, first layer of valarray abstraction.
-// All operations on valarray should be forwarded to this class
-// whenever possible. -- gdr
-//
-
-template<typename _Tp> struct _Array {
-
- explicit _Array (size_t);
- explicit _Array (_Tp* const __restrict__);
- explicit _Array (const valarray<_Tp>&);
- _Array (const _Tp* __restrict__, size_t);
-
- void free_data() const;
- _Tp* begin () const;
-
- _Tp* const __restrict__ _M_data;
-};
-
-template<typename _Tp>
-inline void
-__valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t)
-{ __valarray_fill (__a._M_data, __n, __t); }
-
-template<typename _Tp>
-inline void
-__valarray_fill (_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t)
-{ __valarray_fill (__a._M_data, __n, __s, __t); }
-
-template<typename _Tp>
-inline void
-__valarray_fill (_Array<_Tp> __a, _Array<size_t> __i,
- size_t __n, const _Tp& __t)
-{ __valarray_fill (__a._M_data, __i._M_data, __n, __t); }
-
-template<typename _Tp>
-inline void
-__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b)
-{ __valarray_copy (__a._M_data, __n, __b._M_data); }
-
-template<typename _Tp>
-inline void
-__valarray_copy (_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b)
-{ __valarray_copy(__a._M_data, __n, __s, __b._M_data); }
-
-template<typename _Tp>
-inline void
-__valarray_copy (_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s)
-{ __valarray_copy (__a._M_data, __b._M_data, __n, __s); }
-
-template<typename _Tp>
-inline void
-__valarray_copy (_Array<_Tp> __a, _Array<size_t> __i,
- _Array<_Tp> __b, size_t __n)
-{ __valarray_copy (__a._M_data, __i._M_data, __b._M_data, __n); }
-
-template<typename _Tp>
-inline void
-__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,
- _Array<size_t> __i)
-{ __valarray_copy (__a._M_data, __n, __b._M_data, __i._M_data); }
-
-template<typename _Tp>
-inline
-_Array<_Tp>::_Array (size_t __n) : _M_data (new _Tp[__n]) {}
-
-template<typename _Tp>
-inline
-_Array<_Tp>::_Array (_Tp* const __restrict__ __p) : _M_data (__p) {}
-
-template<typename _Tp>
-inline _Array<_Tp>::_Array (const valarray<_Tp>& __v)
- : _M_data (__v._M_data) {}
-
-template<typename _Tp>
-inline
-_Array<_Tp>::_Array (const _Tp* __restrict__ __b, size_t __s)
- : _M_data (new _Tp[__s]) { __valarray_copy (__b, __s, _M_data); }
-
-template<typename _Tp>
-inline void
-_Array<_Tp>::free_data() const { delete[] _M_data; }
-
-template<typename _Tp>
-inline _Tp*
-_Array<_Tp>::begin () const
-{ return _M_data; }
-
-#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \
-template<typename _Tp> \
-inline void \
-_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, const _Tp& __t) \
-{ \
- for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p) \
- *__p _Op##= __t; \
-} \
- \
-template<typename _Tp> \
-inline void \
-_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \
-{ \
- _Tp* __p (__a._M_data); \
- for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__p, ++__q) \
- *__p _Op##= *__q; \
-} \
- \
-template<typename _Tp, class _Dom> \
-void \
-_Array_augmented_##_Name (_Array<_Tp> __a, \
- const _Expr<_Dom,_Tp>& __e, size_t __n) \
-{ \
- _Tp* __p (__a._M_data); \
- for (size_t __i=0; __i<__n; ++__i, ++__p) *__p _Op##= __e[__i]; \
-} \
- \
-template<typename _Tp> \
-inline void \
-_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, size_t __s, \
- _Array<_Tp> __b) \
-{ \
- _Tp* __q (__b._M_data); \
- for (_Tp* __p=__a._M_data; __p<__a._M_data+__s*__n; __p+=__s, ++__q) \
- *__p _Op##= *__q; \
-} \
- \
-template<typename _Tp> \
-inline void \
-_Array_augmented_##_Name (_Array<_Tp> __a, _Array<_Tp> __b, \
- size_t __n, size_t __s) \
-{ \
- _Tp* __q (__b._M_data); \
- for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, __q+=__s) \
- *__p _Op##= *__q; \
-} \
- \
-template<typename _Tp, class _Dom> \
-void \
-_Array_augmented_##_Name (_Array<_Tp> __a, size_t __s, \
- const _Expr<_Dom,_Tp>& __e, size_t __n) \
-{ \
- _Tp* __p (__a._M_data); \
- for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p _Op##= __e[__i]; \
-} \
- \
-template<typename _Tp> \
-inline void \
-_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
- _Array<_Tp> __b, size_t __n) \
-{ \
- _Tp* __q (__b._M_data); \
- for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__q) \
- __a._M_data[*__j] _Op##= *__q; \
-} \
- \
-template<typename _Tp> \
-inline void \
-_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
- _Array<_Tp> __b, _Array<size_t> __i) \
-{ \
- _Tp* __p (__a._M_data); \
- for (size_t* __j=__i._M_data; __j<__i._M_data+__n; ++__j, ++__p) \
- *__p _Op##= __b._M_data[*__j]; \
-} \
- \
-template<typename _Tp, class _Dom> \
-void \
-_Array_augmented_##_Name (_Array<_Tp> __a, _Array<size_t> __i, \
- const _Expr<_Dom, _Tp>& __e, size_t __n) \
-{ \
- size_t* __j (__i._M_data); \
- for (size_t __k=0; __k<__n; ++__k, ++__j) \
- __a._M_data[*__j] _Op##= __e[__k]; \
-} \
- \
-template<typename _Tp> \
-void \
-_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
- _Array<_Tp> __b, size_t __n) \
-{ \
- bool* ok (__m._M_data); \
- _Tp* __p (__a._M_data); \
- for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++ok, ++__p) { \
- while (! *ok) { \
- ++ok; \
- ++__p; \
- } \
- *__p _Op##= *__q; \
- } \
-} \
- \
-template<typename _Tp> \
-void \
-_Array_augmented_##_Name (_Array<_Tp> __a, size_t __n, \
- _Array<_Tp> __b, _Array<bool> __m) \
-{ \
- bool* ok (__m._M_data); \
- _Tp* __q (__b._M_data); \
- for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++ok, ++__q) { \
- while (! *ok) { \
- ++ok; \
- ++__q; \
- } \
- *__p _Op##= *__q; \
- } \
-} \
- \
-template<typename _Tp, class _Dom> \
-void \
-_Array_augmented_##_Name (_Array<_Tp> __a, _Array<bool> __m, \
- const _Expr<_Dom, _Tp>& __e, size_t __n) \
-{ \
- bool* ok(__m._M_data); \
- _Tp* __p (__a._M_data); \
- for (size_t __i=0; __i<__n; ++__i, ++ok, ++__p) { \
- while (! *ok) { \
- ++ok; \
- ++__p; \
- } \
- *__p _Op##= __e[__i]; \
- } \
-}
-
-_DEFINE_ARRAY_FUNCTION(+, plus)
-_DEFINE_ARRAY_FUNCTION(-, minus)
-_DEFINE_ARRAY_FUNCTION(*, multiplies)
-_DEFINE_ARRAY_FUNCTION(/, divides)
-_DEFINE_ARRAY_FUNCTION(%, modulus)
-_DEFINE_ARRAY_FUNCTION(^, xor)
-_DEFINE_ARRAY_FUNCTION(|, or)
-_DEFINE_ARRAY_FUNCTION(&, and)
-_DEFINE_ARRAY_FUNCTION(<<, shift_left)
-_DEFINE_ARRAY_FUNCTION(>>, shift_right)
-
-#undef _DEFINE_ARRAY_FUNCTION
-
-} // extern "C++"
-
-#ifdef _G_NO_VALARRAY_TEMPLATE_EXPORT
-# define export
-# include <std/valarray_array.tcc>
-#endif
-
-#endif // __VALARRAY_ARRAY__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/valarray_array.tcc b/contrib/libstdc++/std/valarray_array.tcc
deleted file mode 100644
index bd66925..0000000
--- a/contrib/libstdc++/std/valarray_array.tcc
+++ /dev/null
@@ -1,130 +0,0 @@
-// The template and inlines for the -*- C++ -*- internal _Array helper class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>
-
-#ifndef __VALARRAY_ARRAY_TCC__
-#define __VALARRAY_ARRAY_TCC__
-
-extern "C++" {
-
-export template<typename _Tp>
-void
-__valarray_fill (_Array<_Tp> __a, size_t __n, _Array<bool> __m, const _Tp& __t)
-{
- _Tp* __p = __a._M_data;
- bool* __ok (__m._M_data);
- for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
- while (! *__ok) {
- ++__ok;
- ++__p;
- }
- *__p = __t;
- }
-}
-
-export template<typename _Tp>
-void
-__valarray_copy (_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b, size_t __n)
-{
- _Tp* __p (__a._M_data);
- bool* __ok (__m._M_data);
- for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++__ok, ++__p) {
- while (! *__ok) {
- ++__ok;
- ++__p;
- }
- *__q = *__p;
- }
-}
-
-export template<typename _Tp>
-void
-__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array<bool> __m)
-{
- _Tp* __q (__b._M_data);
- bool* __ok (__m._M_data);
- for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++__ok, ++__q) {
- while (! *__ok) {
- ++__ok;
- ++__q;
- }
- *__q = *__p;
- }
-}
-
-export template<typename _Tp, class _Dom>
-void
-__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a)
-{
- _Tp* __p (__a._M_data);
- for (size_t __i=0; __i<__n; ++__i, ++__p) *__p = __e[__i];
-}
-
-export template<typename _Tp, class _Dom>
-void
-__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
- _Array<_Tp> __a, size_t __s)
-{
- _Tp* __p (__a._M_data);
- for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p = __e[__i];
-}
-
-export template<typename _Tp, class _Dom>
-void
-__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
- _Array<_Tp> __a, _Array<size_t> __i)
-{
- size_t* __j (__i._M_data);
- for (size_t __k=0; __k<__n; ++__k, ++__j) __a._M_data[*__j] = __e[__k];
-}
-
-export template<typename _Tp, class _Dom>
-void
-__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n,
- _Array<_Tp> __a, _Array<bool> __m)
-{
- bool* __ok (__m._M_data);
- _Tp* __p (__a._M_data);
- for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) {
- while (! *__ok) {
- ++__ok;
- ++__p;
- }
- *__p = __e[__i];
- }
-}
-
-} // extern "C++"
-
-#endif // __VALARRAY_ARRAY_TCC__
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/std/valarray_meta.h b/contrib/libstdc++/std/valarray_meta.h
deleted file mode 100644
index 48fb213..0000000
--- a/contrib/libstdc++/std/valarray_meta.h
+++ /dev/null
@@ -1,1046 +0,0 @@
-// The template and inlines for the -*- C++ -*- internal _Meta class.
-
-// Copyright (C) 1997-1999 Cygnus Solutions
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
-
-#ifndef _CPP_VALARRAY_META_H
-#define _CPP_VALARRAY_META_H 1
-
-//
-// Implementing a loosened valarray return value is tricky.
-// First we need to meet 26.3.1/3: we should not add more than
-// two levels of template nesting. Therefore we resort to template
-// template to "flatten" loosened return value types.
-// At some point we use partial specialization to remove one level
-// template nesting due to _Expr<>
-//
-
-
-// This class is NOT defined. It doesn't need to.
-template<typename _Tp1, typename _Tp2> class _Constant;
-
-//
-// Unary function application closure.
-//
-template<class _Dom> class _UnFunBase {
-public:
- typedef typename _Dom::value_type value_type;
- typedef value_type _Vt;
-
- _UnFunBase (const _Dom& __e, _Vt __f(_Vt))
- : _M_expr(__e), _M_func(__f) {}
-
- _Vt operator[] (size_t __i) const { return _M_func(_M_expr[__i]); }
- size_t size () const { return _M_expr.size(); }
-
-private:
- const _Dom& _M_expr;
- _Vt (*_M_func)(_Vt);
-};
-
-template<template<class, class> class _Meta, class _Dom> class _UnFunClos;
-
-template<class _Dom>
-struct _UnFunClos<_Expr,_Dom> : _UnFunBase<_Dom> {
- typedef _UnFunBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _UnFunClos (const _Dom& __e, value_type __f(value_type))
- : _Base (__e, __f) {}
-};
-
-template<typename _Tp>
-struct _UnFunClos<_ValArray,_Tp> : _UnFunBase<valarray<_Tp> > {
- typedef _UnFunBase<valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _UnFunClos (const valarray<_Tp>& __v, _Tp __f(_Tp))
- : _Base (__v, __f) {}
-};
-
-//
-// Binary function application closure.
-//
-template<template<class, class> class _Meta1,
- template<class, class> class Meta2,
- class _Dom1, class _Dom2> class _BinFunClos;
-
-template<class _Dom1, class _Dom2> class _BinFunBase {
-public:
- typedef typename _Dom1::value_type value_type;
- typedef value_type _Vt;
-
- _BinFunBase (const _Dom1& __e1, const _Dom2& __e2,
- _Vt __f (_Vt, _Vt))
- : _M_expr1 (__e1), _M_expr2 (__e2), _M_func (__f) {}
-
- value_type operator[] (size_t __i) const
- { return _M_func (_M_expr1[__i], _M_expr2[__i]); }
- size_t size () const { return _M_expr1.size (); }
-
-private:
- const _Dom1& _M_expr1;
- const _Dom2& _M_expr2;
- _Vt (*_M_func)(_Vt, _Vt);
-};
-
-template<class _Dom> class _BinFunBase1 {
-public:
- typedef typename _Dom::value_type value_type ;
- typedef value_type _Vt;
-
- _BinFunBase1 (const _Vt& __c, const _Dom& __e, _Vt __f(_Vt, _Vt))
- : _M_expr1 (__c), _M_expr2 (__e), _M_func (__f) {}
-
- value_type operator[] (size_t __i) const
- { return _M_func (_M_expr1, _M_expr2[__i]); }
- size_t size () const { return _M_expr2.size (); }
-
-private:
- const _Vt& _M_expr1;
- const _Dom& _M_expr2;
- _Vt (*_M_func)(_Vt, _Vt);
-};
-
-template<class _Dom> class _BinFunBase2 {
-public:
- typedef typename _Dom::value_type value_type;
- typedef value_type _Vt;
-
- _BinFunBase2 (const _Dom& __e, const _Vt& __c, _Vt __f(_Vt, _Vt))
- : _M_expr1 (__e), _M_expr2 (__c), _M_func (__f) {}
-
- value_type operator[] (size_t __i) const
- { return _M_func (_M_expr1[__i], _M_expr2); }
- size_t size () const { return _M_expr1.size (); }
-
-private:
- const _Dom& _M_expr1;
- const _Vt& _M_expr2;
- _Vt (*_M_func)(_Vt, _Vt);
-};
-
-template<class _Dom1, class _Dom2>
-struct _BinFunClos<_Expr,_Expr,_Dom1,_Dom2> : _BinFunBase<_Dom1,_Dom2> {
- typedef _BinFunBase<_Dom1,_Dom2> _Base;
- typedef typename _Base::value_type value_type;
- typedef value_type _Tp;
-
- _BinFunClos (const _Dom1& __e1, const _Dom2& __e2,
- _Tp __f(_Tp, _Tp))
- : _Base (__e1, __e2, __f) {}
-};
-
-template<typename _Tp>
-struct _BinFunClos<_ValArray,_ValArray,_Tp,_Tp>
- : _BinFunBase<valarray<_Tp>, valarray<_Tp> > {
- typedef _BinFunBase<valarray<_Tp>, valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinFunClos (const valarray<_Tp>& __v, const valarray<_Tp>& __w,
- _Tp __f(_Tp, _Tp))
- : _Base (__v, __w, __f) {}
-};
-
-template<class _Dom>
-struct _BinFunClos<_Expr,_ValArray,_Dom,typename _Dom::value_type>
- : _BinFunBase<_Dom,valarray<typename _Dom::value_type> > {
- typedef typename _Dom::value_type _Tp;
- typedef _BinFunBase<_Dom,valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinFunClos (const _Dom& __e, const valarray<_Tp>& __v,
- _Tp __f(_Tp, _Tp))
- : _Base (__e, __v, __f) {}
-};
-
-template<class _Dom>
-struct _BinFunClos<_ValArray,_Expr,typename _Dom::value_type,_Dom>
- : _BinFunBase<valarray<typename _Dom::value_type>,_Dom> {
- typedef typename _Dom::value_type _Tp;
- typedef _BinFunBase<_Dom,valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinFunClos (const valarray<_Tp>& __v, const _Dom& __e,
- _Tp __f(_Tp, _Tp))
- : _Base (__v, __e, __f) {}
-};
-
-template<class _Dom>
-struct _BinFunClos<_Expr,_Constant,_Dom,typename _Dom::value_type>
- : _BinFunBase2<_Dom> {
- typedef typename _Dom::value_type _Tp;
- typedef _Tp value_type;
- typedef _BinFunBase2<_Dom> _Base;
-
- _BinFunClos (const _Dom& __e, const _Tp& __t, _Tp __f (_Tp, _Tp))
- : _Base (__e, __t, __f) {}
-};
-
-template<class _Dom>
-struct _BinFunClos<_Constant,_Expr,_Dom,typename _Dom::value_type>
- : _BinFunBase1<_Dom> {
- typedef typename _Dom::value_type _Tp;
- typedef _Tp value_type;
- typedef _BinFunBase1<_Dom> _Base;
-
- _BinFunClos (const _Tp& __t, const _Dom& __e, _Tp __f (_Tp, _Tp))
- : _Base (__t, __e, __f) {}
-};
-
-template<typename _Tp>
-struct _BinFunClos<_ValArray,_Constant,_Tp,_Tp>
- : _BinFunBase2<valarray<_Tp> > {
- typedef _BinFunBase2<valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinFunClos (const valarray<_Tp>& __v, const _Tp& __t,
- _Tp __f(_Tp, _Tp))
- : _Base (__v, __t, __f) {}
-};
-
-template<typename _Tp>
-struct _BinFunClos<_Constant,_ValArray,_Tp,_Tp>
- : _BinFunBase1<valarray<_Tp> > {
- typedef _BinFunBase1<valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinFunClos (const _Tp& __t, const valarray<_Tp>& __v,
- _Tp __f (_Tp, _Tp))
- : _Base (__t, __v, __f) {}
-};
-
-//
-// Apply function taking a value/const reference closure
-//
-
-template<typename _Dom, typename _Arg> class _FunBase {
-public:
- typedef typename _Dom::value_type value_type;
-
- _FunBase (const _Dom& __e, value_type __f(_Arg))
- : _M_expr (__e), _M_func (__f) {}
-
- value_type operator[] (size_t __i) const
- { return _M_func (_M_expr[__i]); }
- size_t size() const { return _M_expr.size ();}
-
-private:
- const _Dom& _M_expr;
- value_type (*_M_func)(_Arg);
-};
-
-template<class _Dom>
-struct _ValFunClos<_Expr,_Dom>
- : _FunBase<_Dom, typename _Dom::value_type> {
- typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
- typedef typename _Base::value_type value_type;
- typedef value_type _Tp;
-
- _ValFunClos (const _Dom& __e, _Tp __f (_Tp)) : _Base (__e, __f) {}
-};
-
-template<typename _Tp>
-struct _ValFunClos<_ValArray,_Tp>
- : _FunBase<valarray<_Tp>, _Tp> {
- typedef _FunBase<valarray<_Tp>, _Tp> _Base;
- typedef _Tp value_type;
-
- _ValFunClos (const valarray<_Tp>& __v, _Tp __f(_Tp))
- : _Base (__v, __f) {}
-};
-
-template<class _Dom>
-struct _RefFunClos<_Expr,_Dom> :
- _FunBase<_Dom, const typename _Dom::value_type&> {
- typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
- typedef typename _Base::value_type value_type;
- typedef value_type _Tp;
-
- _RefFunClos (const _Dom& __e, _Tp __f (const _Tp&))
- : _Base (__e, __f) {}
-};
-
-template<typename _Tp>
-struct _RefFunClos<_ValArray,_Tp>
- : _FunBase<valarray<_Tp>, const _Tp&> {
- typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
- typedef _Tp value_type;
-
- _RefFunClos (const valarray<_Tp>& __v, _Tp __f(const _Tp&))
- : _Base (__v, __f) {}
-};
-
-//
-// Unary expression closure.
-//
-
-template<template<class> class _Oper, typename _Arg>
-class _UnBase {
-public:
- typedef _Oper<typename _Arg::value_type> _Op;
- typedef typename _Op::result_type value_type;
-
- _UnBase (const _Arg& __e) : _M_expr(__e) {}
- value_type operator[] (size_t) const;
- size_t size () const { return _M_expr.size (); }
-
-private:
- const _Arg& _M_expr;
-};
-
-template<template<class> class _Oper, typename _Arg>
-inline typename _UnBase<_Oper, _Arg>::value_type
-_UnBase<_Oper, _Arg>::operator[] (size_t __i) const
-{ return _Op() (_M_expr[__i]); }
-
-template<template<class> class _Oper, class _Dom>
-struct _UnClos<_Oper, _Expr, _Dom> : _UnBase<_Oper, _Dom> {
- typedef _Dom _Arg;
- typedef _UnBase<_Oper, _Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _UnClos (const _Arg& __e) : _Base(__e) {}
-};
-
-template<template<class> class _Oper, typename _Tp>
-struct _UnClos<_Oper, _ValArray, _Tp> : _UnBase<_Oper, valarray<_Tp> > {
- typedef valarray<_Tp> _Arg;
- typedef _UnBase<_Oper, valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _UnClos (const _Arg& __e) : _Base(__e) {}
-};
-
-
-//
-// Binary expression closure.
-//
-
-template<template<class> class _Oper, typename _FirstArg, typename _SecondArg>
-class _BinBase {
-public:
- typedef _Oper<typename _FirstArg::value_type> _Op;
- typedef typename _Op::result_type value_type;
-
- _BinBase (const _FirstArg& __e1, const _SecondArg& __e2)
- : _M_expr1 (__e1), _M_expr2 (__e2) {}
- value_type operator[] (size_t) const;
- size_t size () const { return _M_expr1.size (); }
-
-private:
- const _FirstArg& _M_expr1;
- const _SecondArg& _M_expr2;
-};
-
-template<template<class> class _Oper, typename _FirstArg, typename _SecondArg>
-inline typename _BinBase<_Oper,_FirstArg,_SecondArg>::value_type
-_BinBase<_Oper,_FirstArg,_SecondArg>::operator[] (size_t __i) const
-{ return _Op() (_M_expr1[__i], _M_expr2[__i]); }
-
-
-template<template<class> class _Oper, class _Clos>
-class _BinBase2 {
-public:
- typedef typename _Clos::value_type _Vt;
- typedef _Oper<_Vt> _Op;
- typedef typename _Op::result_type value_type;
-
- _BinBase2 (const _Clos& __e, const _Vt& __t)
- : _M_expr1 (__e), _M_expr2 (__t) {}
- value_type operator[] (size_t) const;
- size_t size () const { return _M_expr1.size (); }
-
-private:
- const _Clos& _M_expr1;
- const _Vt& _M_expr2;
-};
-
-template<template<class> class _Oper, class _Clos>
-inline typename _BinBase2<_Oper,_Clos>::value_type
-_BinBase2<_Oper,_Clos>::operator[] (size_t __i) const
-{ return _Op() (_M_expr1[__i], _M_expr2); }
-
-
-template<template<class> class _Oper, class _Clos>
-class _BinBase1 {
-public:
- typedef typename _Clos::value_type _Vt;
- typedef _Oper<_Vt> _Op;
- typedef typename _Op::result_type value_type;
-
- _BinBase1 (const _Vt& __t, const _Clos& __e)
- : _M_expr1 (__t), _M_expr2 (__e) {}
- value_type operator[] (size_t) const;
- size_t size () const { return _M_expr2.size (); }
-
-private:
- const _Vt& _M_expr1;
- const _Clos& _M_expr2;
-};
-
-template<template<class> class _Oper, class _Clos>
-inline typename
-_BinBase1<_Oper,_Clos>::value_type
-_BinBase1<_Oper,_Clos>:: operator[] (size_t __i) const
-{ return _Op() (_M_expr1, _M_expr2[__i]); }
-
-
-template<template<class> class _Oper, class _Dom1, class _Dom2>
-struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
- : _BinBase<_Oper,_Dom1,_Dom2> {
- typedef _BinBase<_Oper,_Dom1,_Dom2> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
-};
-
-template<template<class> class _Oper, typename _Tp>
-struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp>
- : _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > {
- typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinClos (const valarray<_Tp>& __v, const valarray<_Tp>& __w)
- : _Base (__v, __w) {}
-};
-
-template<template<class> class _Oper, class _Dom>
-struct _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type>
- : _BinBase<_Oper,_Dom,valarray<typename _Dom::value_type> > {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
- : _Base (__e1, __e2) {}
-};
-
-template<template<class> class _Oper, class _Dom>
-struct _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom>
- : _BinBase<_Oper,valarray<typename _Dom::value_type>,_Dom> {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos (const valarray<_Tp>& __e1, const _Dom& __e2)
- : _Base (__e1, __e2) {}
-};
-
-template<template<class> class _Oper, class _Dom>
-struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type>
- : _BinBase2<_Oper,_Dom> {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase2<_Oper,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos (const _Dom& __e1, const _Tp& __e2) : _Base (__e1, __e2) {}
-};
-
-template<template<class> class _Oper, class _Dom>
-struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom>
- : _BinBase1<_Oper,_Dom> {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase1<_Oper,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos (const _Tp& __e1, const _Dom& __e2) : _Base (__e1, __e2) {}
-};
-
-template<template<class> class _Oper, typename _Tp>
-struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp>
- : _BinBase2<_Oper,valarray<_Tp> > {
- typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos (const valarray<_Tp>& __v, const _Tp& __t)
- : _Base (__v, __t) {}
-};
-
-template<template<class> class _Oper, typename _Tp>
-struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp>
- : _BinBase1<_Oper,valarray<_Tp> > {
- typedef _BinBase1<_Oper,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos (const _Tp& __t, const valarray<_Tp>& __v)
- : _Base (__t, __v) {}
-};
-
-
-//
-// slice_array closure.
-//
-template<typename _Dom> class _SBase {
-public:
- typedef typename _Dom::value_type value_type;
-
- _SBase (const _Dom& __e, const slice& __s)
- : _M_expr (__e), _M_slice (__s) {}
- value_type operator[] (size_t __i) const
- { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; }
- size_t size() const { return _M_slice.size (); }
-
-private:
- const _Dom& _M_expr;
- const slice& _M_slice;
-};
-
-template<typename _Tp> class _SBase<_Array<_Tp> > {
-public:
- typedef _Tp value_type;
-
- _SBase (_Array<_Tp> __a, const slice& __s)
- : _M_array (__a._M_data+__s.start()), _M_size (__s.size()),
- _M_stride (__s.stride()) {}
- value_type operator[] (size_t __i) const
- { return _M_array._M_data[__i * _M_stride]; }
- size_t size() const { return _M_size; }
-
-private:
- const _Array<_Tp> _M_array;
- const size_t _M_size;
- const size_t _M_stride;
-};
-
-template<class _Dom> struct _SClos<_Expr,_Dom> : _SBase<_Dom> {
- typedef _SBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {}
-};
-
-template<typename _Tp>
-struct _SClos<_ValArray,_Tp> : _SBase<_Array<_Tp> > {
- typedef _SBase<_Array<_Tp> > _Base;
- typedef _Tp value_type;
-
- _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {}
-};
-
-//
-// gslice_array closure.
-//
-template<class _Dom> class _GBase {
-public:
- typedef typename _Dom::value_type value_type;
-
- _GBase (const _Dom& __e, const valarray<size_t>& __i)
- : _M_expr (__e), _M_index(__i) {}
- value_type operator[] (size_t __i) const
- { return _M_expr[_M_index[__i]]; }
- size_t size () const { return _M_index.size(); }
-
-private:
- const _Dom& _M_expr;
- const valarray<size_t>& _M_index;
-};
-
-template<typename _Tp> class _GBase<_Array<_Tp> > {
-public:
- typedef _Tp value_type;
-
- _GBase (_Array<_Tp> __a, const valarray<size_t>& __i)
- : _M_array (__a), _M_index(__i) {}
- value_type operator[] (size_t __i) const
- { return _M_array._M_data[_M_index[__i]]; }
- size_t size () const { return _M_index.size(); }
-
-private:
- const _Array<_Tp> _M_array;
- const valarray<size_t>& _M_index;
-};
-
-template<class _Dom> struct _GClos<_Expr,_Dom> : _GBase<_Dom> {
- typedef _GBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _GClos (const _Dom& __e, const valarray<size_t>& __i)
- : _Base (__e, __i) {}
-};
-
-template<typename _Tp>
-struct _GClos<_ValArray,_Tp> : _GBase<_Array<_Tp> > {
- typedef _GBase<_Array<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _GClos (_Array<_Tp> __a, const valarray<size_t>& __i)
- : _Base (__a, __i) {}
-};
-
-//
-// indirect_array closure
-//
-
-template<class _Dom> class _IBase {
-public:
- typedef typename _Dom::value_type value_type;
-
- _IBase (const _Dom& __e, const valarray<size_t>& __i)
- : _M_expr (__e), _M_index (__i) {}
- value_type operator[] (size_t __i) const
- { return _M_expr[_M_index[__i]]; }
- size_t size() const { return _M_index.size(); }
-
-private:
- const _Dom& _M_expr;
- const valarray<size_t>& _M_index;
-};
-
-template<class _Dom> struct _IClos<_Expr,_Dom> : _IBase<_Dom> {
- typedef _IBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _IClos (const _Dom& __e, const valarray<size_t>& __i)
- : _Base (__e, __i) {}
-};
-
-template<typename _Tp>
-struct _IClos<_ValArray,_Tp> : _IBase<valarray<_Tp> > {
- typedef _IBase<valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i)
- : _Base (__a, __i) {}
-};
-
-//
-// class _Expr
-//
-template<class _Clos, typename _Tp> class _Expr {
-public:
- typedef _Tp value_type;
-
- _Expr (const _Clos&);
-
- const _Clos& operator() () const;
-
- value_type operator[] (size_t) const;
- valarray<value_type> operator[] (slice) const;
- valarray<value_type> operator[] (const gslice&) const;
- valarray<value_type> operator[] (const valarray<bool>&) const;
- valarray<value_type> operator[] (const valarray<size_t>&) const;
-
- _Expr<_UnClos<_Unary_plus,_Expr,_Clos>, value_type>
- operator+ () const;
-
- _Expr<_UnClos<negate,_Expr,_Clos>, value_type>
- operator- () const;
-
- _Expr<_UnClos<_Bitwise_not,_Expr,_Clos>, value_type>
- operator~ () const;
-
- _Expr<_UnClos<logical_not,_Expr,_Clos>, bool>
- operator! () const;
-
- size_t size () const;
- value_type sum () const;
-
- valarray<value_type> shift (int) const;
- valarray<value_type> cshift (int) const;
-// _Meta<_ApplyFunctionWithValue<_Expr>, value_type>
-// apply (value_type _M_func (value_type)) const;
-// _Meta<_ApplyFunctionWithConstRef<_Expr>, value_type>
-// apply (value_type _M_func (const value_type&)) const;
-
-private:
- const _Clos _M_closure;
-};
-
-template<class _Clos, typename _Tp>
-inline
-_Expr<_Clos,_Tp>::_Expr (const _Clos& __c) : _M_closure(__c) {}
-
-template<class _Clos, typename _Tp>
-inline const _Clos&
-_Expr<_Clos,_Tp>::operator() () const
-{ return _M_closure; }
-
-template<class _Clos, typename _Tp>
-inline _Tp
-_Expr<_Clos,_Tp>::operator[] (size_t __i) const
-{ return _M_closure[__i]; }
-
-template<class _Clos, typename _Tp>
-inline valarray<_Tp>
-_Expr<_Clos,_Tp>::operator[] (slice __s) const
-{ return _M_closure[__s]; }
-
-template<class _Clos, typename _Tp>
-inline valarray<_Tp>
-_Expr<_Clos,_Tp>::operator[] (const gslice& __gs) const
-{ return _M_closure[__gs]; }
-
-template<class _Clos, typename _Tp>
-inline valarray<_Tp>
-_Expr<_Clos,_Tp>::operator[] (const valarray<bool>& __m) const
-{ return _M_closure[__m]; }
-
-template<class _Clos, typename _Tp>
-inline valarray<_Tp>
-_Expr<_Clos,_Tp>::operator[] (const valarray<size_t>& __i) const
-{ return _M_closure[__i]; }
-
-template<class _Clos, typename _Tp>
-inline size_t
-_Expr<_Clos,_Tp>::size () const { return _M_closure.size (); }
-
-// XXX: replace this with a more robust summation algorithm.
-template<class _Clos, typename _Tp>
-inline _Tp
-_Expr<_Clos,_Tp>::sum () const
-{
- _Tp __s(_Tp());
- size_t __n (_M_closure.size ());
- for (size_t __i=0; __i<__n; ++__i) __s += _M_closure[__i];
- return __s;
-}
-
-template<class _Dom, typename _Tp>
-inline _Tp
-min (const _Expr<_Dom,_Tp>& __e)
-{
- size_t __s (__e.size ());
- _Tp __m (__e[0]);
- for (size_t __i=1; __i<__s; ++__i)
- if (__m > __e[__i]) __m = __e[__i];
- return __m;
-}
-
-template<class _Dom, typename _Tp>
-inline _Tp
-max (const _Expr<_Dom,_Tp>& __e)
-{
- size_t __s (__e.size());
- _Tp __m (__e[0]);
- for (size_t __i=1; __i<__s; ++__i)
- if (__m < __e[__i]) __m = __e[__i];
- return __m;
-}
-
-template<class _Dom, typename _Tp>
-inline _Expr<_UnClos<logical_not,_Expr,_Dom>, bool>
-_Expr<_Dom,_Tp>::operator! () const
-{
- typedef _UnClos<logical_not,_Expr,_Dom> _Closure;
- return _Expr<_Closure,_Tp> (_Closure(this->_M_closure));
-}
-
-#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \
-template<class _Dom, typename _Tp> \
-inline _Expr<_UnClos<_Name,_Expr,_Dom>,_Tp> \
-_Expr<_Dom,_Tp>::operator##_Op () const \
-{ \
- typedef _UnClos<_Name,_Expr,_Dom> _Closure; \
- return _Expr<_Closure,_Tp> (_Closure (this->_M_closure)); \
-}
-
- _DEFINE_EXPR_UNARY_OPERATOR(+, _Unary_plus)
- _DEFINE_EXPR_UNARY_OPERATOR(-, negate)
- _DEFINE_EXPR_UNARY_OPERATOR(~, _Bitwise_not)
-
-#undef _DEFINE_EXPR_UNARY_OPERATOR
-
-
-#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \
-template<class _Dom1, class _Dom2> \
-inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, \
- typename _Name<typename _Dom1::value_type>::result_type> \
-operator##_Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v, \
- const _Expr<_Dom2,typename _Dom2::value_type>& __w) \
-{ \
- typedef typename _Dom1::value_type _Arg; \
- typedef typename _Name<_Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure; \
- return _Expr<_Closure,_Value> (_Closure (__v (), __w ())); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
- typename _Name<typename _Dom::value_type>::result_type> \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __v, \
- const typename _Dom::value_type& __t) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef typename _Name<_Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure; \
- return _Expr<_Closure,_Value> (_Closure (__v (), __t)); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
- typename _Name<typename _Dom::value_type>::result_type> \
-operator##_Op (const typename _Dom::value_type& __t, \
- const _Expr<_Dom,typename _Dom::value_type>& __v) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef typename _Name<_Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure; \
- return _Expr<_Closure,_Value> (_Closure (__t, __v ())); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
- typename _Name<typename _Dom::value_type>::result_type> \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e, \
- const valarray<typename _Dom::value_type>& __v) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef typename _Name<_Arg>::result_type _Value; \
- typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Arg> _Closure; \
- return _Expr<_Closure,_Value> (_Closure (__e (), __v)); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
- typename _Name<typename _Dom::value_type>::result_type> \
-operator##_Op (const valarray<typename _Dom::value_type>& __v, \
- const _Expr<_Dom,typename _Dom::value_type>& __e) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef typename _Name<_Tp>::result_type _Value; \
- typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure; \
- return _Expr<_Closure,_Value> (_Closure (__v, __e ())); \
-}
-
- _DEFINE_EXPR_BINARY_OPERATOR(+, plus)
- _DEFINE_EXPR_BINARY_OPERATOR(-, minus)
- _DEFINE_EXPR_BINARY_OPERATOR(*, multiplies)
- _DEFINE_EXPR_BINARY_OPERATOR(/, divides)
- _DEFINE_EXPR_BINARY_OPERATOR(%, modulus)
- _DEFINE_EXPR_BINARY_OPERATOR(^, _Bitwise_xor)
- _DEFINE_EXPR_BINARY_OPERATOR(&, _Bitwise_and)
- _DEFINE_EXPR_BINARY_OPERATOR(|, _Bitwise_or)
- _DEFINE_EXPR_BINARY_OPERATOR(<<, _Shift_left)
- _DEFINE_EXPR_BINARY_OPERATOR(>>, _Shift_right)
-
-#undef _DEFINE_EXPR_BINARY_OPERATOR
-
-#define _DEFINE_EXPR_RELATIONAL_OPERATOR(_Op, _Name) \
-template<class _Dom1, class _Dom2> \
-inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, bool> \
-operator##_Op (const _Expr<_Dom1,typename _Dom1::value_type>& __v, \
- const _Expr<_Dom2,typename _Dom2::value_type>& __w) \
-{ \
- typedef typename _Dom1::value_type _Arg; \
- typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure; \
- return _Expr<_Closure,bool> (_Closure (__v (), __w ())); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>, \
- bool> \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __v, \
- const typename _Dom::value_type& __t) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure; \
- return _Expr<_Closure,bool> (_Closure (__v (), __t)); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>, \
- bool> \
-operator##_Op (const typename _Dom::value_type& __t, \
- const _Expr<_Dom,typename _Dom::value_type>& __v) \
-{ \
- typedef typename _Dom::value_type _Arg; \
- typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure; \
- return _Expr<_Closure,bool> (_Closure (__t, __v ())); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
- bool> \
-operator##_Op (const _Expr<_Dom,typename _Dom::value_type>& __e, \
- const valarray<typename _Dom::value_type>& __v) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Tp> _Closure; \
- return _Expr<_Closure,bool> (_Closure (__e (), __v)); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
- bool> \
-operator##_Op (const valarray<typename _Dom::value_type>& __v, \
- const _Expr<_Dom,typename _Dom::value_type>& __e) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure; \
- return _Expr<_Closure,bool> (_Closure (__v, __e ())); \
-}
-
- _DEFINE_EXPR_RELATIONAL_OPERATOR(&&, logical_and)
- _DEFINE_EXPR_RELATIONAL_OPERATOR(||, logical_or)
- _DEFINE_EXPR_RELATIONAL_OPERATOR(==, equal_to)
- _DEFINE_EXPR_RELATIONAL_OPERATOR(!=, not_equal_to)
- _DEFINE_EXPR_RELATIONAL_OPERATOR(<, less)
- _DEFINE_EXPR_RELATIONAL_OPERATOR(>, greater)
- _DEFINE_EXPR_RELATIONAL_OPERATOR(<=, less_equal)
- _DEFINE_EXPR_RELATIONAL_OPERATOR(>=, greater_equal)
-
-#undef _DEFINE_EXPR_RELATIONAL_OPERATOR
-
-
-
-#define _DEFINE_EXPR_UNARY_FUNCTION(_Name) \
-template<class _Dom> \
-inline _Expr<_UnFunClos<_Expr,_Dom>,typename _Dom::value_type> \
-_Name(const _Expr<_Dom,typename _Dom::value_type>& __e) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef _UnFunClos<_Expr,_Dom> _Closure; \
- return _Expr<_Closure,_Tp>(_Closure(__e(), (_Tp(*)(_Tp))(&_Name))); \
-} \
- \
-template<typename _Tp> \
-inline _Expr<_UnFunClos<_ValArray,_Tp>,_Tp> \
-_Name(const valarray<_Tp>& __v) \
-{ \
- typedef _UnFunClos<_ValArray,_Tp> _Closure; \
- return _Expr<_Closure,_Tp> (_Closure (__v, (_Tp(*)(_Tp))(&_Name))); \
-}
-
-
- _DEFINE_EXPR_UNARY_FUNCTION(abs)
- _DEFINE_EXPR_UNARY_FUNCTION(cos)
- _DEFINE_EXPR_UNARY_FUNCTION(acos)
- _DEFINE_EXPR_UNARY_FUNCTION(cosh)
- _DEFINE_EXPR_UNARY_FUNCTION(sin)
- _DEFINE_EXPR_UNARY_FUNCTION(asin)
- _DEFINE_EXPR_UNARY_FUNCTION(sinh)
- _DEFINE_EXPR_UNARY_FUNCTION(tan)
- _DEFINE_EXPR_UNARY_FUNCTION(tanh)
- _DEFINE_EXPR_UNARY_FUNCTION(atan)
- _DEFINE_EXPR_UNARY_FUNCTION(exp)
- _DEFINE_EXPR_UNARY_FUNCTION(log)
- _DEFINE_EXPR_UNARY_FUNCTION(log10)
- _DEFINE_EXPR_UNARY_FUNCTION(sqrt)
-
-#undef _DEFINE_EXPR_UNARY_FUNCTION
-
-
-#define _DEFINE_EXPR_BINARY_FUNCTION(_Name) \
-template<class _Dom1, class _Dom2> \
-inline _Expr<_BinFunClos<_Expr,_Expr,_Dom1,_Dom2>,typename _Dom1::value_type>\
-_Name (const _Expr<_Dom1,typename _Dom1::value_type>& __e1, \
- const _Expr<_Dom2,typename _Dom2::value_type>& __e2) \
-{ \
- typedef typename _Dom1::value_type _Tp; \
- typedef _BinFunClos<_Expr,_Expr,_Dom1,_Dom2> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__e1 (), __e2 (), (_Tp(*)(_Tp, _Tp))(&_Name))); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinFunClos<_Expr,_ValArray,_Dom,typename _Dom::value_type>, \
- typename _Dom::value_type> \
-_Name (const _Expr<_Dom,typename _Dom::value_type>& __e, \
- const valarray<typename _Dom::value_type>& __v) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinFunClos<_Expr,_ValArray,_Dom,_Tp> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__e (), __v, (_Tp(*)(_Tp, _Tp))(&_Name))); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinFunClos<_ValArray,_Expr,typename _Dom::value_type,_Dom>, \
- typename _Dom::value_type> \
-_Name (const valarray<typename _Dom::valarray>& __v, \
- const _Expr<_Dom,typename _Dom::value_type>& __e) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinFunClos<_ValArray,_Expr,_Tp,_Dom> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__v, __e (), (_Tp(*)(_Tp, _Tp))(&_Name))); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinFunClos<_Expr,_Constant,_Dom,typename _Dom::value_type>, \
- typename _Dom::value_type> \
-_Name (const _Expr<_Dom, typename _Dom::value_type>& __e, \
- const typename _Dom::value_type& __t) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinFunClos<_Expr,_Constant,_Dom,_Tp> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__e (), __t, (_Tp(*)(_Tp, _Tp))(&_Name))); \
-} \
- \
-template<class _Dom> \
-inline _Expr<_BinFunClos<_Constant,_Expr,typename _Dom::value_type,_Dom>, \
- typename _Dom::value_type> \
-_Name (const typename _Dom::value_type& __t, \
- const _Expr<_Dom,typename _Dom::value_type>& __e) \
-{ \
- typedef typename _Dom::value_type _Tp; \
- typedef _BinFunClos<_Constant,_Expr,_Tp,_Dom> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__t, __e (), (_Tp(*)(_Tp, _Tp))(&_Name))); \
-} \
- \
-template<typename _Tp> \
-inline _Expr<_BinFunClos<_ValArray,_ValArray,_Tp,_Tp>, _Tp> \
-_Name (const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
-{ \
- typedef _BinFunClos<_ValArray,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__v, __w, (_Tp(*)(_Tp,_Tp))(&_Name))); \
-} \
- \
-template<typename _Tp> \
-inline _Expr<_BinFunClos<_ValArray,_Constant,_Tp,_Tp>,_Tp> \
-_Name (const valarray<_Tp>& __v, const _Tp& __t) \
-{ \
- typedef _BinFunClos<_ValArray,_Constant,_Tp,_Tp> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__v, __t, (_Tp(*)(_Tp,_Tp))(&_Name))); \
-} \
- \
-template<typename _Tp> \
-inline _Expr<_BinFunClos<_Constant,_ValArray,_Tp,_Tp>,_Tp> \
-_Name (const _Tp& __t, const valarray<_Tp>& __v) \
-{ \
- typedef _BinFunClos<_Constant,_ValArray,_Tp,_Tp> _Closure; \
- return _Expr<_Closure,_Tp> \
- (_Closure (__t, __v, (_Tp(*)(_Tp,_Tp))(&_Name))); \
-}
-
-_DEFINE_EXPR_BINARY_FUNCTION(atan2)
-_DEFINE_EXPR_BINARY_FUNCTION(pow)
-
-#undef _DEFINE_EXPR_BINARY_FUNCTION
-
-#endif // _CPP_VALARRAY_META_H
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/contrib/libstdc++/stdexcept b/contrib/libstdc++/stdexcept
deleted file mode 100644
index 69e9627..0000000
--- a/contrib/libstdc++/stdexcept
+++ /dev/null
@@ -1,97 +0,0 @@
-// Methods for Exception Support for -*- C++ -*-
-// Copyright (C) 1994, 1995, 1997 Free Software Foundation
-
-// This file is part of the GNU ANSI C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// As a special exception, if you link this library with files
-// compiled with a GNU compiler to produce an executable, this does not cause
-// the resulting executable to be covered by the GNU General Public License.
-// This exception does not however invalidate any other reasons why
-// the executable file might be covered by the GNU General Public License.
-
-// Written by Mike Stump based upon the specification in the 20 September 1994
-// C++ working paper, ANSI document X3J16/94-0158.
-
-#ifndef __STDEXCEPT__
-#define __STDEXCEPT__
-
-#ifdef __GNUG__
-#pragma interface "stdexcept"
-#endif
-
-#include <exception>
-#include <string>
-
-extern "C++" {
-
-namespace std {
-
-class logic_error : public exception {
- string _what;
-public:
- logic_error(const string& what_arg): _what (what_arg) { }
- virtual const char* what () const { return _what.c_str (); }
-};
-
-class domain_error : public logic_error {
-public:
- domain_error (const string& what_arg): logic_error (what_arg) { }
-};
-
-class invalid_argument : public logic_error {
-public:
- invalid_argument (const string& what_arg): logic_error (what_arg) { }
-};
-
-class length_error : public logic_error {
-public:
- length_error (const string& what_arg): logic_error (what_arg) { }
-};
-
-class out_of_range : public logic_error {
-public:
- out_of_range (const string& what_arg): logic_error (what_arg) { }
-};
-
-class runtime_error : public exception {
- string _what;
-public:
- runtime_error(const string& what_arg): _what (what_arg) { }
- virtual const char* what () const { return _what.c_str (); }
-protected:
- runtime_error(): exception () { }
-};
-
-class range_error : public runtime_error {
-public:
- range_error (const string& what_arg): runtime_error (what_arg) { }
-};
-
-class overflow_error : public runtime_error {
-public:
- overflow_error (const string& what_arg): runtime_error (what_arg) { }
-};
-
-class underflow_error : public runtime_error {
-public:
- underflow_error (const string& what_arg): runtime_error (what_arg) { }
-};
-
-} // namespace std
-
-} // extern "C++"
-
-#endif
diff --git a/contrib/libstdc++/stdexcepti.cc b/contrib/libstdc++/stdexcepti.cc
deleted file mode 100644
index 9c02c71..0000000
--- a/contrib/libstdc++/stdexcepti.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Implementation file for Exception Support for -*- C++ -*-
-// This file is part of the GNU ANSI C++ Library.
-
-#ifdef __GNUG__
-#pragma implementation "stdexcept"
-#endif
-
-#include <stdexcept>
-
-// Entry points for string.
-
-void
-__out_of_range (const char *s)
-{
- throw std::out_of_range (s);
-}
-
-void __length_error (const char *s)
-{
- throw std::length_error (s);
-}
diff --git a/contrib/libstdc++/stl.h b/contrib/libstdc++/stl.h
deleted file mode 100644
index 4b27074..0000000
--- a/contrib/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/libstdc++/stl/ChangeLog b/contrib/libstdc++/stl/ChangeLog
deleted file mode 100644
index 14d56ac..0000000
--- a/contrib/libstdc++/stl/ChangeLog
+++ /dev/null
@@ -1,381 +0,0 @@
-Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com)
-
- * gcc-2.95.3 Released.
-
-1999-11-06 Martin v. Löwis <loewis@informatik.hu-berlin.de>
-
- * bitset (class bitset): Declare reference as our friend.
- * bitset: Include limits.h.
-
-Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.2 Released.
-
-Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.1 Released.
-
-Sun Aug 8 21:06:16 1999 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * pthread_alloc: Solaris' ctype.h defines _U to 01; use _Up as
- template parameter instead.
-
-Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-1999-07-11 Martin v. Löwis (loewis@informatik.hu-berlin.de)
-
- * stl_function.h (bind1st, bind2nd): Rename __opr to __oper,
- as __opr is used internally by egcs.
- * stl_numeric.h (__power, power): Likewise.
-
-1999-06-18 Martin von Löwis <loewis@informatik.hu-berlin.de>
-
- * stl_queue.h: Rename _M_c to c, and _M_comp to comp.
-
-1999-06-17 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * stl_algo.h (transform): Rename __opr to __oper, as __opr is used
- internally by egcs.
- Reported by Harri Porten <porten@tu-harburg.de>
-
-1999-05-17 Mark Kettenis <kettenis@gnu.org>
-
- * stl_config.h: Only define __STL_PTHREADS with GLIBC >= 2 for
- Linux.
-
-Mon May 17 03:33:47 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * stl_config.h (__CYGWIN__): Cygwin newlib RTL lacks drand48.
-
-1999-05-07 Ulrich Drepper <drepper@cygnus.com>
-
- * stl_alloc.h: Make it possible to compile with __USE_MALLOC.
-
-Tue Apr 13 00:32:57 1999 Mumit Khan <khan@xraylith.wisc.edu>
-
- * stl_config.h (__MINGW32__): Mingw32 RTL lacks drand48.
-
-Sun Apr 11 23:48:30 1999 Jeffrey A Law (law@cygnus.com)
-
- * bitset: Re-install Alexandre's lost patch from 1998-11-27.
-
-1999-01-20 Ulrich Drepper <drepper@cygnus.com>
-
- * stl_construct.h (__destroy_aux): Use != instead of < for
- ForwardIterator comparison.
- Patch by jmaurer@menuett.rhein-main.de (Jens Maurer).
-
-1999-01-20 Mark Mitchell <mark@markmitchell.com>
-
- * stl_config.h (__STL_USE_NAMESPACES): Define.
-
-1998-11-27 Alexandre Oliva <oliva@dcc.unicamp.br>
-
- * bitset: Explicitly convert basic_string<...>::npos to size_t in
- default argument to constructor, to avoid parse error at `>'.
- (__STL_EXPLICIT_FUNCTION_TMPL_ARGS): Replace #if with #ifdef.
-
-1998-11-01 Mark Mitchell <mark@markmitchell.com>
-
- * stl_alloc.h (default_alloc_template::_S_free_list): Don't
- qualify _NFREELISTS.
-
-1998-10-11 Mark Mitchell <mark@markmitchell.com>
-
- * stl_config.h (__SGI_STL_USE_AUTO_PTR_CONVERSIONS): Define.
- * memory (auto_ptr::operator auto_ptr_ref<_Tp1>): Fix typo.
- (auto_ptr::operator auto_ptr<_Tp1>): Add missing
- semicolon.
-
-1998-09-03 Jason Merrill <jason@yorick.cygnus.com>
-
- * stl_config.h: Define __STL_HAS_WCHAR_T,
- __STL_MEMBER_TEMPLATE_CLASSES, __STL_HAS_NAMESPACES,
- __STL_NO_NAMESPACES and __STL_LONG_LONG.
-
-1998-09-02 Jason Merrill <jason@yorick.cygnus.com>
-
- * algorithm alloc.h defalloc.h hash_map.h hash_set.h iterator
- memory pthread_alloc pthread_alloc.h rope ropeimpl.h stl_algo.h
- stl_algobase.h stl_alloc.h stl_bvector.h stl_config.h
- stl_construct.h stl_deque.h stl_function.h stl_hash_fun.h
- stl_hash_map.h stl_hash_set.h stl_hashtable.h stl_heap.h
- stl_iterator.h stl_list.h stl_map.h stl_multimap.h stl_multiset.h
- stl_numeric.h stl_pair.h stl_queue.h stl_raw_storage_iter.h
- stl_relops.h stl_rope.h stl_set.h stl_slist.h stl_stack.h
- stl_tempbuf.h stl_tree.h stl_uninitialized.h stl_vector.h
- tempbuf.h type_traits.h: Update to SGI STL 3.11.
-
-Fri Jul 10 15:20:09 1998 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
-
- * stl_tempbuf.h (temporary_buffer): Add missing typename.
- * type_traits.h: update comments.
-
-Sun Jun 28 00:49:42 1998 Jeffrey A Law (law@cygnus.com)
-
- * stl_config.h (__STL_PTHREADS): Don't define for glibc 2 if
- _G_USING_THUNKS is not defined.
-
-1998-04-07 18:32 Ulrich Drepper <drepper@cygnus.com>
-
- * stl_hashtable.h (__stl_prime_list): Mark last two numbers as
- unsigned long since they are otherwise too large for long int on
- 32bit machines.
-
-Fri Feb 20 16:15:05 1998 H.J. Lu (hjl@gnu.org)
- Jason Merrill <jason@yorick.cygnus.com>
-
- * ropeimpl.h: Check __STL_PTHREADS instead of _PTHREADS.
- * stl_alloc.h: Ditto.
- * stl_config.h: Ditto.
- * stl_rope.h: Ditto.
-
- * stl_config.h: include <_G_config.h> if __GNUG__ is defined.
- (__STL_PTHREADS): Defined if _PTHREADS is defined or
- __GLIBC__ >= 2.
-
-Tue Jan 27 12:01:25 1998 Jason Merrill <jason@yorick.cygnus.com>
-
- * stl_algo.h (__lg): Fix for n == 0.
-
-Sat Nov 8 00:45:17 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * stl_hash_set.h (swap): Fix typo.
-
-Fri Nov 7 10:27:40 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * stl_hashtable.h: Fix typo.
-
-Thu Nov 6 11:19:09 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * stl_algo.h, stl_algobase.h, stl_bvector.h,
- stl_deque.h: Update to October 28 SGI release.
-
-Sun Nov 2 12:14:56 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * algo.h, algobase.h, alloc.h, bvector.h, defalloc.h, deque.h,
- function.h, hash_map.h, hash_set.h, hashtable.h, heap.h, iterator.h,
- list.h, map.h, multimap.h, multiset.h, pair.h, pthread_alloc.h,
- rope.h, ropeimpl.h, set.h, slist.h, stack.h, stl_config.h, tempbuf.h,
- tree.h, type_traits.h, vector.h: Update to October 27 SGI snapshot.
- * algorithm, deque, functional, hash_map, hash_set, iterator, list,
- map, memory, numeric, pthread_alloc, queue, rope, set, slist, stack,
- stl_algo.h, stl_algobase.h, stl_alloc.h, stl_bvector.h,
- stl_construct.h, stl_deque.h, stl_function.h, stl_hash_fun.h,
- stl_hash_map.h, stl_hash_set.h, stl_hashtable.h, stl_heap.h,
- stl_iterator.h, stl_list.h, stl_map.h, stl_multimap.h, stl_multiset.h,
- stl_numeric.h, stl_pair.h, stl_queue.h, stl_raw_storage_iter.h,
- stl_relops.h, stl_rope.h, stl_set.h, stl_slist.h, stl_stack.h,
- stl_tempbuf.h, stl_tree.h, stl_uninitialized.h, stl_vector.h,
- utility, vector: New files in October 27 SGI snapshot.
-
-Fri Oct 17 19:07:42 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tree.h, vector.h: Fix accidental divergence from SGI release.
-
-Tue Sep 9 19:47:28 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * algo.h, algobase.h, alloc.h, bvector.h, deque.h, hashtable.h,
- iterator.h, list.h, rope.h, ropeimpl.h, slist.h, stl_config.h,
- tree.h, vector.h: Update To September 8 SGI release.
-
-Tue Sep 9 17:38:47 1997 Mark Mitchell <mmitchell@usa.net>
-
- * stl_config.h (__STL_MEMBER_TEMPLATES): Enable.
-
-Tue Aug 5 17:06:01 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * deque.h, function.h, hashtable.h, list.h, rope.h, ropeimpl.h,
- tree.h: Update to July 31 SGI release.
-
-Fri Jul 18 10:06:56 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * algo.h, defalloc.h, hashtable.h, rope.h, ropeimpl.h, slist.h:
- Update to June 30 SGI release.
-
-Fri Jul 04 02:17:15 1997 Ulrich Drepper <drepper@cygnus.com>
-
- * tree.h (rb_tree): Reverse order of member initializations
- to prevent warnings.
-
-Sun Jun 15 18:17:21 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * *.h: Update to 6/13 SGI release.
-
-Fri May 23 10:56:18 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * stl_config.h: Add support for exceptions with g++.
-
- * *.h: Update to 5/8 SGI release.
-
-Thu Apr 24 19:00:23 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * *.h: Update to 3/24 SGI release.
-
-Wed Feb 19 18:19:18 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * *.h: Update to 2/18 SGI release.
-
- * bool.h: Lose.
-
-Mon Feb 10 16:33:23 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * alloc.h: Don't define __USE_MALLOC for g++.
- * bool.h: Lose g++ case.
-
- * *.h: Update to 2/4 SGI release.
-
-Mon Jan 13 14:39:16 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * *.h: Update to 1/8 SGI release.
-
-Mon Sep 30 17:56:43 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * alloc.h (__unlock): Never use __lock_release.
-
-Fri Sep 27 19:03:06 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * alloc.h (__default_alloc_template): lock is a friend.
-
-Thu Sep 19 20:10:37 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- Propagate these changes to new STL code:
- * tree.h: Rearrange member initializers in rb_tree constructors.
- * vector.h (insert): Cast iterator difference to size_type to
- avoid warning.
-
- * *.h: Update to SGI snapshot (fixed).
- * *.c, Makefile.in, configure.in: Removed.
-
-Sat Sep 14 09:43:06 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * deque.h, list.h, tree.h: Remove kludge obsoleted by new
- overloading code.
-
-Sat Aug 10 14:59:50 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tempbuf.cc (__stl_temp_buffer): Align like a pointer.
-
-Wed Jun 26 13:00:44 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * iterator.h: Add default template parameters.
-
-Wed Apr 24 10:45:22 1996 Doug Evans <dje@blues.cygnus.com>
-
- * Makefile.in (tempbuf.o,random.o): Add rules for SunOS VPATH.
-
-Fri Apr 5 17:52:31 1996 Per Bothner <bothner@kalessin.cygnus.com>
-
- * configure.in (EXTRA_MOSTLYCLEAN): New, to remove stl.list.
-
-Fri Mar 22 14:58:30 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- Propagate these changes to new STL code:
- * tree.h: Rearrange member initializers in rb_tree constructors.
- * vector.h (insert): Cast iterator difference to size_type to
- avoid warning.
-
-Sun Mar 10 07:49:03 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * deque.h (distance_type): Add overload for g++.
- From Joe Buck.
-
-Thu Feb 22 14:07:12 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * bool.h: Revert.
- * algo.h bvector.h deque.h function.h iterator.h list.h
- pair.h stack.h tree.h vector.h: Wrap #include <bool.h> with
- #ifndef __GNUG__.
- * defalloc.h list.h deque.h tree.h: Use __GNUG__ to control
- workarounds.
-
-Wed Feb 21 17:13:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * bool.h (TRUE, FALSE): Define for people expecting the bool.h
- from libg++. Is this a good idea?
-
-Tue Feb 20 18:40:02 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * algo.h bool.h bvector.h defalloc.h deque.h function.h heap.h
- iterator.h list.h map.h pair.h random.cc stack.h tree.c tree.h
- vector.h: Revert to HP release with workarounds for missing
- overloading functionality.
- * Makefile.in (STL_OBJECTS): Remove tree.o.
-
-Thu Nov 9 17:05:23 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * algo.h algobase.h bvector.h defalloc.h deque.h function.h heap.h
- iterator.h list.h map.h multimap.h multiset.h pair.h projectn.h
- set.h stack.h tempbuf.h tree.h vector.h: Wrap #include <bool.h>
- with #ifndef __GNUG__.
-
-Thu Nov 2 17:05:44 1995 Jason Merrill <jason@yorick.cygnus.com>
-
- * deque.h (deque<T>::insert): Fix merge typo.
- * vector.h (value_type): Lose.
-
-Thu Nov 2 14:33:47 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * algo.h, algobase.h, deque.h, function.h, list.h, pair.h, random.cc:
- Merge in Oct 31 1995 release from HP.
-
-Fri Aug 11 17:11:12 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * list.h: Avoid duplicate construction and destruction of list_nodes.
- Patch from Klamer Schutte <klamer@ph.tn.tudelft.nl>.
-
-Fri Aug 11 16:45:18 1995 Per Bothner <bothner@kalessin.cygnus.com>
-
- * algo.h, algobase.h, deque.h: Merged in Jul 12 1995 release from HP.
-
-Mon Jun 5 18:38:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * Makefile.in (stl.list): Depend on stamp-picdir.
-
-Wed May 17 02:30:47 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * tree.h: Rearrange member initializers in rb_tree constructors.
-
- * Update to HP's February 7, 1995 release.
-
-Fri May 5 10:45:31 1995 Mike Stump <mrs@cygnus.com>
-
- * random.cc (seed): Move `for' decl out of `for' statement.
-
-Wed Apr 26 13:09:16 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * configure.in (XCXXINCLUDES): Rename.
-
-Wed Mar 29 19:24:56 1995 Jason Merrill <jason@phydeaux.cygnus.com>
-
- * tree.h (insert): Return a value.
-
- * vector.h (insert): Cast iterator difference to size_type to
- avoid warning.
-
-Sun Feb 12 09:12:17 1995 Mike Stump <mrs@cygnus.com>
-
- * tree.h (rb_tree::max_size): Add definition when using GNU
- workaround.
-
-Thu Jan 12 01:37:42 1995 deanm@medulla.LABS.TEK.COM (Dean Messing)
-
- * configure.in (LIBDIR): Set to yes.
-
-Fri Dec 30 18:26:20 1994 Mike Stump <mrs@cygnus.com>
-
- * iterator.h: Add default template parameters where possible.
-
-Fri Dec 30 16:29:39 1994 Mike Stump <mrs@cygnus.com>
-
- * algo.h: Change rand to __rand to fix make check on linux systems.
-
-Tue Nov 29 15:30:30 1994 Per Bothner <bothner@kalessin.cygnus.com>
-
- * Initial check-in, based on HP's October 21, 1994.
diff --git a/contrib/libstdc++/stl/README b/contrib/libstdc++/stl/README
deleted file mode 100644
index c319c08..0000000
--- a/contrib/libstdc++/stl/README
+++ /dev/null
@@ -1,13 +0,0 @@
-This directory contains an SGI release of the C++ Standard Template
-Library, slightly modified to work with g++.
-
-Note that this is based on a pre-Draft Standard for C++.
-Things are likely to change. For example, the header file names
-are very likely to change. The Allocator interface will change. Etc, etc.
-CYGNUS MAKES NO COMMITTMENT (yet) TO SUPPORT BACKWARD COMPATIBILITY FOR STL.
-
-For examples of things that should work, look in the ../tests directory.
-
-DOCUMENTATION:
-See http://www.sgi.com/Technology/STL/ or http://www.dinkumware.com/
-on the World-Wide Web.
diff --git a/contrib/libstdc++/stl/algo.h b/contrib/libstdc++/stl/algo.h
deleted file mode 100644
index 1707868..0000000
--- a/contrib/libstdc++/stl/algo.h
+++ /dev/null
@@ -1,114 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ALGO_H
-#define __SGI_STL_ALGO_H
-
-#include <algobase.h>
-#include <tempbuf.h>
-#include <stl_algo.h>
-#include <stl_numeric.h>
-
-#ifdef __STL_USE_NAMESPACES
-
-// Names from <stl_algo.h>
-using __STD::for_each;
-using __STD::find;
-using __STD::find_if;
-using __STD::adjacent_find;
-using __STD::count;
-using __STD::count_if;
-using __STD::search;
-using __STD::search_n;
-using __STD::swap_ranges;
-using __STD::transform;
-using __STD::replace;
-using __STD::replace_if;
-using __STD::replace_copy;
-using __STD::replace_copy_if;
-using __STD::generate;
-using __STD::generate_n;
-using __STD::remove;
-using __STD::remove_if;
-using __STD::remove_copy;
-using __STD::remove_copy_if;
-using __STD::unique;
-using __STD::unique_copy;
-using __STD::reverse;
-using __STD::reverse_copy;
-using __STD::rotate;
-using __STD::rotate_copy;
-using __STD::random_shuffle;
-using __STD::random_sample;
-using __STD::random_sample_n;
-using __STD::partition;
-using __STD::stable_partition;
-using __STD::sort;
-using __STD::stable_sort;
-using __STD::partial_sort;
-using __STD::partial_sort_copy;
-using __STD::nth_element;
-using __STD::lower_bound;
-using __STD::upper_bound;
-using __STD::equal_range;
-using __STD::binary_search;
-using __STD::merge;
-using __STD::inplace_merge;
-using __STD::includes;
-using __STD::set_union;
-using __STD::set_intersection;
-using __STD::set_difference;
-using __STD::set_symmetric_difference;
-using __STD::min_element;
-using __STD::max_element;
-using __STD::next_permutation;
-using __STD::prev_permutation;
-using __STD::find_first_of;
-using __STD::find_end;
-using __STD::is_sorted;
-using __STD::is_heap;
-
-// Names from stl_heap.h
-using __STD::push_heap;
-using __STD::pop_heap;
-using __STD::make_heap;
-using __STD::sort_heap;
-
-// Names from <stl_numeric.h>
-using __STD::accumulate;
-using __STD::inner_product;
-using __STD::partial_sum;
-using __STD::adjacent_difference;
-using __STD::power;
-using __STD::iota;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_ALGO_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/algobase.h b/contrib/libstdc++/stl/algobase.h
deleted file mode 100644
index f35e7af..0000000
--- a/contrib/libstdc++/stl/algobase.h
+++ /dev/null
@@ -1,71 +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.
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ALGOBASE_H
-#define __SGI_STL_ALGOBASE_H
-
-#ifndef __SGI_STL_PAIR_H
-#include <pair.h>
-#endif
-#ifndef __SGI_STL_ITERATOR_H
-#include <iterator.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_ALGOBASE_H
-#include <stl_algobase.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H
-#include <stl_uninitialized.h>
-#endif
-
-#ifdef __STL_USE_NAMESPACES
-
-// Names from stl_algobase.h
-using __STD::iter_swap;
-using __STD::swap;
-using __STD::min;
-using __STD::max;
-using __STD::copy;
-using __STD::copy_backward;
-using __STD::copy_n;
-using __STD::fill;
-using __STD::fill_n;
-using __STD::mismatch;
-using __STD::equal;
-using __STD::lexicographical_compare;
-using __STD::lexicographical_compare_3way;
-
-// Names from stl_uninitialized.h
-using __STD::uninitialized_copy;
-using __STD::uninitialized_copy_n;
-using __STD::uninitialized_fill;
-using __STD::uninitialized_fill_n;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_ALGOBASE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/algorithm b/contrib/libstdc++/stl/algorithm
deleted file mode 100644
index 1ba584f..0000000
--- a/contrib/libstdc++/stl/algorithm
+++ /dev/null
@@ -1,40 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ALGORITHM
-#define __SGI_STL_ALGORITHM
-
-#include <stl_algobase.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_tempbuf.h>
-#include <stl_algo.h>
-
-#endif /* __SGI_STL_ALGORITHM */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/alloc.h b/contrib/libstdc++/stl/alloc.h
deleted file mode 100644
index f99a862..0000000
--- a/contrib/libstdc++/stl/alloc.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1996-1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ALLOC_H
-#define __SGI_STL_ALLOC_H
-
-#ifndef __STL_CONFIG_H
-#include <stl_config.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_ALLOC_H
-#include <stl_alloc.h>
-#endif
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::__malloc_alloc_template;
-using __STD::malloc_alloc;
-using __STD::simple_alloc;
-using __STD::debug_alloc;
-using __STD::__default_alloc_template;
-using __STD::alloc;
-using __STD::single_client_alloc;
-#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
-using __STD::__malloc_alloc_oom_handler;
-#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */
-#ifdef __STL_USE_STD_ALLOCATORS
-using __STD::allocator;
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_ALLOC_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/bitset b/contrib/libstdc++/stl/bitset
deleted file mode 100644
index 8b4f8b1..0000000
--- a/contrib/libstdc++/stl/bitset
+++ /dev/null
@@ -1,1066 +0,0 @@
-/*
- * Copyright (c) 1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_BITSET
-#define __SGI_STL_BITSET
-
-// This implementation of bitset<> has a second template parameter,
-// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
-// THIS FEATURE*. It is experimental, and it may be removed in
-// future releases.
-
-// A bitset of size N, using words of type _WordT, will have
-// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
-// order bits in the highest word.) It is a class invariant
-// of class bitset<> that those unused bits are always zero.
-
-// Most of the actual code isn't contained in bitset<> itself, but in the
-// base class _Base_bitset. The base class works with whole words, not with
-// individual bits. This allows us to specialize _Base_bitset for the
-// important special case where the bitset is only a single word.
-
-// The C++ standard does not define the precise semantics of operator[].
-// In this implementation the const version of operator[] is equivalent
-// to test(), except that it does no range checking. The non-const version
-// returns a reference to a bit, again without doing any range checking.
-
-
-#include <stddef.h> // for size_t
-#include <limits.h> // for CHAR_BIT
-#include <string>
-#include <stdexcept> // for invalid_argument, out_of_range, overflow_error
-#include <iostream.h> // for istream, ostream
-
-#define __BITS_PER_WORDT(__wt) (CHAR_BIT*sizeof(__wt))
-#define __BITSET_WORDS(__n,__wt) \
- ((__n) < 1 ? 1 : ((__n) + __BITS_PER_WORDT(__wt) - 1)/__BITS_PER_WORDT(__wt))
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
-
-// structure to aid in counting bits
-template<bool __dummy>
-struct _Bit_count {
- static unsigned char _S_bit_count[256];
-};
-
-// Mapping from 8 bit unsigned integers to the index of the first one
-// bit:
-template<bool __dummy>
-struct _First_one {
- static unsigned char _S_first_one[256];
-};
-
-//
-// Base class: general case.
-//
-
-template<size_t _Nw, class _WordT>
-struct _Base_bitset {
- _WordT _M_w[_Nw]; // 0 is the least significant word.
-
- _Base_bitset( void ) { _M_do_reset(); }
-
- _Base_bitset(unsigned long __val);
-
- static size_t _S_whichword( size_t __pos ) {
- return __pos / __BITS_PER_WORDT(_WordT);
- }
- static size_t _S_whichbyte( size_t __pos ) {
- return (__pos % __BITS_PER_WORDT(_WordT)) / CHAR_BIT;
- }
- static size_t _S_whichbit( size_t __pos ) {
- return __pos % __BITS_PER_WORDT(_WordT);
- }
- static _WordT _S_maskbit( size_t __pos ) {
- return (static_cast<_WordT>(1)) << _S_whichbit(__pos);
- }
-
- _WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; }
- _WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; }
-
- _WordT& _M_hiword() { return _M_w[_Nw - 1]; }
- _WordT _M_hiword() const { return _M_w[_Nw - 1]; }
-
- void _M_do_and(const _Base_bitset<_Nw,_WordT>& __x) {
- for ( size_t __i = 0; __i < _Nw; __i++ ) {
- _M_w[__i] &= __x._M_w[__i];
- }
- }
-
- void _M_do_or(const _Base_bitset<_Nw,_WordT>& __x) {
- for ( size_t __i = 0; __i < _Nw; __i++ ) {
- _M_w[__i] |= __x._M_w[__i];
- }
- }
-
- void _M_do_xor(const _Base_bitset<_Nw,_WordT>& __x) {
- for ( size_t __i = 0; __i < _Nw; __i++ ) {
- _M_w[__i] ^= __x._M_w[__i];
- }
- }
-
- void _M_do_left_shift(size_t __shift);
-
- void _M_do_right_shift(size_t __shift);
-
- void _M_do_flip() {
- for ( size_t __i = 0; __i < _Nw; __i++ ) {
- _M_w[__i] = ~_M_w[__i];
- }
- }
-
- void _M_do_set() {
- for ( size_t __i = 0; __i < _Nw; __i++ ) {
- _M_w[__i] = ~static_cast<_WordT>(0);
- }
- }
-
- void _M_do_reset() {
- for ( size_t __i = 0; __i < _Nw; __i++ ) {
- _M_w[__i] = 0;
- }
- }
-
- bool _M_is_equal(const _Base_bitset<_Nw,_WordT>& __x) const {
- for (size_t __i = 0; __i < _Nw; ++__i) {
- if (_M_w[__i] != __x._M_w[__i])
- return false;
- }
- return true;
- }
-
- bool _M_is_any() const {
- for ( size_t __i = 0; __i < __BITSET_WORDS(_Nw,_WordT); __i++ ) {
- if ( _M_w[__i] != static_cast<_WordT>(0) )
- return true;
- }
- return false;
- }
-
- size_t _M_do_count() const {
- size_t __result = 0;
- const unsigned char* __byte_ptr = (const unsigned char*)_M_w;
- const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw);
-
- while ( __byte_ptr < __end_ptr ) {
- __result += _Bit_count<true>::_S_bit_count[*__byte_ptr];
- __byte_ptr++;
- }
- return __result;
- }
-
- unsigned long _M_do_to_ulong() const;
-
- // find first "on" bit
- size_t _M_do_find_first(size_t __not_found) const;
-
- // find the next "on" bit that follows "prev"
- size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
-};
-
-//
-// Definitions of non-inline functions from _Base_bitset.
-//
-
-template<size_t _Nw, class _WordT>
-_Base_bitset<_Nw, _WordT>::_Base_bitset(unsigned long __val)
-{
- _M_do_reset();
- const size_t __n = min(sizeof(unsigned long)*CHAR_BIT,
- __BITS_PER_WORDT(_WordT)*_Nw);
- for(size_t __i = 0; __i < __n; ++__i, __val >>= 1)
- if ( __val & 0x1 )
- _M_getword(__i) |= _S_maskbit(__i);
-}
-
-template<size_t _Nw, class _WordT>
-void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift)
-{
- if (__shift != 0) {
- const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT);
- const size_t __offset = __shift % __BITS_PER_WORDT(_WordT);
- const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset;
- size_t __n = _Nw - 1;
- for ( ; __n > __wshift; --__n)
- _M_w[__n] = (_M_w[__n - __wshift] << __offset) |
- (_M_w[__n - __wshift - 1] >> __sub_offset);
- if (__n == __wshift)
- _M_w[__n] = _M_w[0] << __offset;
- for (size_t __n1 = 0; __n1 < __n; ++__n1)
- _M_w[__n1] = static_cast<_WordT>(0);
- }
-}
-
-template<size_t _Nw, class _WordT>
-void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift)
-{
- if (__shift != 0) {
- const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT);
- const size_t __offset = __shift % __BITS_PER_WORDT(_WordT);
- const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset;
- const size_t __limit = _Nw - __wshift - 1;
- size_t __n = 0;
- for ( ; __n < __limit; ++__n)
- _M_w[__n] = (_M_w[__n + __wshift] >> __offset) |
- (_M_w[__n + __wshift + 1] << __sub_offset);
- _M_w[__limit] = _M_w[_Nw-1] >> __offset;
- for (size_t __n1 = __limit + 1; __n1 < _Nw; ++__n1)
- _M_w[__n1] = static_cast<_WordT>(0);
- }
-}
-
-template<size_t _Nw, class _WordT>
-unsigned long _Base_bitset<_Nw, _WordT>::_M_do_to_ulong() const
-{
- const overflow_error __overflow("bitset");
-
- if (sizeof(_WordT) >= sizeof(unsigned long)) {
- for (size_t __i = 1; __i < _Nw; ++__i)
- if (_M_w[__i])
- __STL_THROW(__overflow);
-
- const _WordT __mask = static_cast<_WordT>(static_cast<unsigned long>(-1));
- if (_M_w[0] & ~__mask)
- __STL_THROW(__overflow);
-
- return static_cast<unsigned long>(_M_w[0] & __mask);
- }
- else { // sizeof(_WordT) < sizeof(unsigned long).
- const size_t __nwords =
- (sizeof(unsigned long) + sizeof(_WordT) - 1) / sizeof(_WordT);
-
- size_t __min_nwords = __nwords;
- if (_Nw > __nwords) {
- for (size_t __i = __nwords; __i < _Nw; ++__i)
- if (_M_w[__i])
- __STL_THROW(__overflow);
- }
- else
- __min_nwords = _Nw;
-
- // If unsigned long is 8 bytes and _WordT is 6 bytes, then an unsigned
- // long consists of all of one word plus 2 bytes from another word.
- const size_t __part = sizeof(unsigned long) % sizeof(_WordT);
-
- if (__part != 0 && __nwords <= _Nw &&
- (_M_w[__min_nwords - 1] >> ((sizeof(_WordT) - __part) * CHAR_BIT)) != 0)
- __STL_THROW(__overflow);
-
- unsigned long __result = 0;
- for (size_t __i = 0; __i < __min_nwords; ++__i) {
- __result |= static_cast<unsigned long>(
- _M_w[__i]) << (__i * sizeof(_WordT) * CHAR_BIT);
- }
- return __result;
- }
-} // End _M_do_to_ulong
-
-template<size_t _Nw, class _WordT>
-size_t _Base_bitset<_Nw, _WordT>::_M_do_find_first(size_t __not_found) const
-{
- for ( size_t __i = 0; __i < _Nw; __i++ ) {
- _WordT __thisword = _M_w[__i];
- if ( __thisword != static_cast<_WordT>(0) ) {
- // find byte within word
- for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
- unsigned char __this_byte
- = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
- if ( __this_byte )
- return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT +
- _First_one<true>::_S_first_one[__this_byte];
-
- __thisword >>= CHAR_BIT;
- }
- }
- }
- // not found, so return an indication of failure.
- return __not_found;
-}
-
-template<size_t _Nw, class _WordT>
-size_t
-_Base_bitset<_Nw, _WordT>::_M_do_find_next(size_t __prev,
- size_t __not_found) const
-{
- // make bound inclusive
- ++__prev;
-
- // check out of bounds
- if ( __prev >= _Nw * __BITS_PER_WORDT(_WordT) )
- return __not_found;
-
- // search first word
- size_t __i = _S_whichword(__prev);
- _WordT __thisword = _M_w[__i];
-
- // mask off bits below bound
- __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);
-
- if ( __thisword != static_cast<_WordT>(0) ) {
- // find byte within word
- // get first byte into place
- __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
- for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) {
- unsigned char __this_byte
- = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
- if ( __this_byte )
- return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT +
- _First_one<true>::_S_first_one[__this_byte];
-
- __thisword >>= CHAR_BIT;
- }
- }
-
- // check subsequent words
- __i++;
- for ( ; __i < _Nw; __i++ ) {
- _WordT __thisword = _M_w[__i];
- if ( __thisword != static_cast<_WordT>(0) ) {
- // find byte within word
- for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
- unsigned char __this_byte
- = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
- if ( __this_byte )
- return __i*__BITS_PER_WORDT(_WordT) + __j*CHAR_BIT +
- _First_one<true>::_S_first_one[__this_byte];
-
- __thisword >>= CHAR_BIT;
- }
- }
- }
-
- // not found, so return an indication of failure.
- return __not_found;
-} // end _M_do_find_next
-
-
-// ------------------------------------------------------------
-
-//
-// Base class: specialization for a single word.
-//
-
-template<class _WordT>
-struct _Base_bitset<1, _WordT> {
- _WordT _M_w;
-
- _Base_bitset( void ) { _M_do_reset(); }
-
- _Base_bitset(unsigned long __val);
-
- static size_t _S_whichword( size_t __pos ) {
- return __pos / __BITS_PER_WORDT(_WordT);
- }
- static size_t _S_whichbyte( size_t __pos ) {
- return (__pos % __BITS_PER_WORDT(_WordT)) / CHAR_BIT;
- }
- static size_t _S_whichbit( size_t __pos ) {
- return __pos % __BITS_PER_WORDT(_WordT);
- }
- static _WordT _S_maskbit( size_t __pos ) {
- return (static_cast<_WordT>(1)) << _S_whichbit(__pos);
- }
-
- _WordT& _M_getword(size_t) { return _M_w; }
- _WordT _M_getword(size_t) const { return _M_w; }
-
- _WordT& _M_hiword() { return _M_w; }
- _WordT _M_hiword() const { return _M_w; }
-
- void _M_do_and(const _Base_bitset<1,_WordT>& __x) { _M_w &= __x._M_w; }
- void _M_do_or(const _Base_bitset<1,_WordT>& __x) { _M_w |= __x._M_w; }
- void _M_do_xor(const _Base_bitset<1,_WordT>& __x) { _M_w ^= __x._M_w; }
- void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; }
- void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; }
- void _M_do_flip() { _M_w = ~_M_w; }
- void _M_do_set() { _M_w = ~static_cast<_WordT>(0); }
- void _M_do_reset() { _M_w = 0; }
-
- bool _M_is_equal(const _Base_bitset<1,_WordT>& __x) const {
- return _M_w == __x._M_w;
- }
- bool _M_is_any() const {
- return _M_w != 0;
- }
-
- size_t _M_do_count() const {
- size_t __result = 0;
- const unsigned char* __byte_ptr = (const unsigned char*)&_M_w;
- const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w);
- while ( __byte_ptr < __end_ptr ) {
- __result += _Bit_count<true>::_S_bit_count[*__byte_ptr];
- __byte_ptr++;
- }
- return __result;
- }
-
- unsigned long _M_do_to_ulong() const {
- if (sizeof(_WordT) <= sizeof(unsigned long))
- return static_cast<unsigned long>(_M_w);
- else {
- const _WordT __mask = static_cast<_WordT>(static_cast<unsigned long>(-1));
- if (_M_w & ~__mask)
- __STL_THROW(overflow_error("bitset"));
- return static_cast<unsigned long>(_M_w);
- }
- }
-
- size_t _M_do_find_first(size_t __not_found) const;
-
- // find the next "on" bit that follows "prev"
- size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
-
-};
-
-//
-// Definitions of non-inline functions from the single-word version of
-// _Base_bitset.
-//
-
-template <class _WordT>
-_Base_bitset<1, _WordT>::_Base_bitset(unsigned long __val)
-{
- _M_do_reset();
- const size_t __n = min(sizeof(unsigned long)*CHAR_BIT,
- __BITS_PER_WORDT(_WordT)*_Nw);
- for(size_t __i = 0; __i < __n; ++__i, __val >>= 1)
- if ( __val & 0x1 )
- _M_w |= _S_maskbit(__i);
-}
-
-template <class _WordT>
-size_t _Base_bitset<1, _WordT>::_M_do_find_first(size_t __not_found) const
-{
- _WordT __thisword = _M_w;
-
- if ( __thisword != static_cast<_WordT>(0) ) {
- // find byte within word
- for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
- unsigned char __this_byte
- = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
- if ( __this_byte )
- return __j*CHAR_BIT + _First_one<true>::_S_first_one[__this_byte];
-
- __thisword >>= CHAR_BIT;
- }
- }
- // not found, so return a value that indicates failure.
- return __not_found;
-}
-
-template <class _WordT>
-size_t
-_Base_bitset<1, _WordT>::_M_do_find_next(size_t __prev,
- size_t __not_found ) const
-{
- // make bound inclusive
- ++__prev;
-
- // check out of bounds
- if ( __prev >= __BITS_PER_WORDT(_WordT) )
- return __not_found;
-
- // search first (and only) word
- _WordT __thisword = _M_w;
-
- // mask off bits below bound
- __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);
-
- if ( __thisword != static_cast<_WordT>(0) ) {
- // find byte within word
- // get first byte into place
- __thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
- for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) {
- unsigned char __this_byte
- = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
- if ( __this_byte )
- return __j*CHAR_BIT + _First_one<true>::_S_first_one[__this_byte];
-
- __thisword >>= CHAR_BIT;
- }
- }
-
- // not found, so return a value that indicates failure.
- return __not_found;
-} // end _M_do_find_next
-
-//
-// One last specialization: _M_do_to_ulong() and the constructor from
-// unsigned long are very simple if the bitset consists of a single
-// word of type unsigned long.
-//
-
-template<>
-inline unsigned long
-_Base_bitset<1, unsigned long>::_M_do_to_ulong() const { return _M_w; }
-
-template<>
-inline _Base_bitset<1, unsigned long>::_Base_bitset(unsigned long __val) {
- _M_w = __val;
-}
-
-
-// ------------------------------------------------------------
-// Helper class to zero out the unused high-order bits in the highest word.
-
-template <class _WordT, size_t _Extrabits> struct _Sanitize {
- static void _M_do_sanitize(_WordT& __val)
- { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
-};
-
-template <class _WordT> struct _Sanitize<_WordT, 0> {
- static void _M_do_sanitize(_WordT) {}
-};
-
-// ------------------------------------------------------------
-// Class bitset.
-// _Nb may be any nonzero number of type size_t.
-// Type _WordT may be any unsigned integral type.
-
-template<size_t _Nb, class _WordT = unsigned long>
-class bitset : private _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>
-{
-private:
- typedef _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> _Base;
-
- // Import base's protected interface. Necessary because of new template
- // name resolution rules.
- using _Base::_S_whichword;
- using _Base::_S_whichbyte;
- using _Base::_S_whichbit;
- using _Base::_S_maskbit;
- using _Base::_M_getword;
- using _Base::_M_hiword;
- using _Base::_M_do_and;
- using _Base::_M_do_or;
- using _Base::_M_do_xor;
- using _Base::_M_do_left_shift;
- using _Base::_M_do_right_shift;
- using _Base::_M_do_flip;
- using _Base::_M_do_set;
- using _Base::_M_do_reset;
- using _Base::_M_is_equal;
- using _Base::_M_is_any;
- using _Base::_M_do_count;
- using _Base::_M_do_to_ulong;
- using _Base::_M_do_find_first;
- using _Base::_M_do_find_next;
-
-private:
- void _M_do_sanitize() {
- _Sanitize<_WordT,_Nb%__BITS_PER_WORDT(_WordT) >
- ::_M_do_sanitize(_M_hiword());
- }
-
-public:
-
- // bit reference:
- class reference;
- friend class reference;
- class reference {
- friend class bitset;
-
- _WordT *_M_wp;
- size_t _M_bpos;
-
- // left undefined
- reference();
-
- reference( bitset& __b, size_t __pos ) {
- _M_wp = &__b._M_getword(__pos);
- _M_bpos = _S_whichbit(__pos);
- }
-
- public:
- ~reference() {}
-
- // for b[i] = __x;
- reference& operator=(bool __x) {
- if ( __x )
- *_M_wp |= _S_maskbit(_M_bpos);
- else
- *_M_wp &= ~_S_maskbit(_M_bpos);
-
- return *this;
- }
-
- // for b[i] = b[__j];
- reference& operator=(const reference& __j) {
- if ( (*(__j._M_wp) & _S_maskbit(__j._M_bpos)) )
- *_M_wp |= _S_maskbit(_M_bpos);
- else
- *_M_wp &= ~_S_maskbit(_M_bpos);
-
- return *this;
- }
-
- // flips the bit
- bool operator~() const { return (*(_M_wp) & _S_maskbit(_M_bpos)) == 0; }
-
- // for __x = b[i];
- operator bool() const { return (*(_M_wp) & _S_maskbit(_M_bpos)) != 0; }
-
- // for b[i].flip();
- reference& flip() {
- *_M_wp ^= _S_maskbit(_M_bpos);
- return *this;
- }
- };
-
- // 23.3.5.1 constructors:
- bitset() {}
- bitset(unsigned long __val) :
- _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>(__val) {}
-
- template<class _CharT, class _Traits, class _Alloc>
- explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s,
- size_t __pos = 0,
- size_t __n = size_t(basic_string<_CharT,_Traits,_Alloc>::npos))
- : _Base()
- {
- if (__pos > __s.size())
- __STL_THROW(out_of_range("bitset"));
- _M_copy_from_string(__s, __pos, __n);
- }
-
- // 23.3.5.2 bitset operations:
- bitset<_Nb,_WordT>& operator&=(const bitset<_Nb,_WordT>& __rhs) {
- _M_do_and(__rhs);
- return *this;
- }
-
- bitset<_Nb,_WordT>& operator|=(const bitset<_Nb,_WordT>& __rhs) {
- _M_do_or(__rhs);
- return *this;
- }
-
- bitset<_Nb,_WordT>& operator^=(const bitset<_Nb,_WordT>& __rhs) {
- _M_do_xor(__rhs);
- return *this;
- }
-
- bitset<_Nb,_WordT>& operator<<=(size_t __pos) {
- _M_do_left_shift(__pos);
- _M_do_sanitize();
- return *this;
- }
-
- bitset<_Nb,_WordT>& operator>>=(size_t __pos) {
- _M_do_right_shift(__pos);
- _M_do_sanitize();
- return *this;
- }
-
- //
- // Extension:
- // Versions of single-bit set, reset, flip, test with no range checking.
- //
-
- bitset<_Nb,_WordT>& _Unchecked_set(size_t __pos) {
- _M_getword(__pos) |= _S_maskbit(__pos);
- return *this;
- }
-
- bitset<_Nb,_WordT>& _Unchecked_set(size_t __pos, int __val) {
- if (__val)
- _M_getword(__pos) |= _S_maskbit(__pos);
- else
- _M_getword(__pos) &= ~_S_maskbit(__pos);
-
- return *this;
- }
-
- bitset<_Nb,_WordT>& _Unchecked_reset(size_t __pos) {
- _M_getword(__pos) &= ~_S_maskbit(__pos);
- return *this;
- }
-
- bitset<_Nb,_WordT>& _Unchecked_flip(size_t __pos) {
- _M_getword(__pos) ^= _S_maskbit(__pos);
- return *this;
- }
-
- bool _Unchecked_test(size_t __pos) const {
- return (_M_getword(__pos) & _S_maskbit(__pos)) != static_cast<_WordT>(0);
- }
-
- // Set, reset, and flip.
-
- bitset<_Nb,_WordT>& set() {
- _M_do_set();
- _M_do_sanitize();
- return *this;
- }
-
- bitset<_Nb,_WordT>& set(size_t __pos) {
- if (__pos >= _Nb)
- __STL_THROW(out_of_range("bitset"));
-
- return _Unchecked_set(__pos);
- }
-
- bitset<_Nb,_WordT>& set(size_t __pos, int __val) {
- if (__pos >= _Nb)
- __STL_THROW(out_of_range("bitset"));
-
- return _Unchecked_set(__pos, __val);
- }
-
- bitset<_Nb,_WordT>& reset() {
- _M_do_reset();
- return *this;
- }
-
- bitset<_Nb,_WordT>& reset(size_t __pos) {
- if (__pos >= _Nb)
- __STL_THROW(out_of_range("bitset"));
-
- return _Unchecked_reset(__pos);
- }
-
- bitset<_Nb,_WordT>& flip() {
- _M_do_flip();
- _M_do_sanitize();
- return *this;
- }
-
- bitset<_Nb,_WordT>& flip(size_t __pos) {
- if (__pos >= _Nb)
- __STL_THROW(out_of_range("bitset"));
-
- return _Unchecked_flip(__pos);
- }
-
- bitset<_Nb,_WordT> operator~() const {
- return bitset<_Nb,_WordT>(*this).flip();
- }
-
- // element access:
- //for b[i];
- reference operator[](size_t __pos) { return reference(*this,__pos); }
- bool operator[](size_t __pos) const { return _Unchecked_test(__pos); }
-
- unsigned long to_ulong() const { return _M_do_to_ulong(); }
-
-#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
- template <class _CharT, class _Traits, class _Alloc>
- basic_string<_CharT, _Traits, _Alloc> to_string() const {
- basic_string<_CharT, _Traits, _Alloc> __result;
- _M_copy_to_string(__result);
- return __result;
- }
-#endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */
-
- // Helper functions for string operations.
- template<class _CharT, class _Traits, class _Alloc>
- void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s,
- size_t,
- size_t);
-
- // Helper functions for string operations.
- template<class _CharT, class _Traits, class _Alloc>
- void _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const;
-
- size_t count() const { return _M_do_count(); }
-
- size_t size() const { return _Nb; }
-
- bool operator==(const bitset<_Nb,_WordT>& __rhs) const {
- return _M_is_equal(__rhs);
- }
- bool operator!=(const bitset<_Nb,_WordT>& __rhs) const {
- return !_M_is_equal(__rhs);
- }
-
- bool test(size_t __pos) const {
- if (__pos > _Nb)
- __STL_THROW(out_of_range("bitset"));
-
- return _Unchecked_test(__pos);
- }
-
- bool any() const { return _M_is_any(); }
- bool none() const { return !_M_is_any(); }
-
- bitset<_Nb,_WordT> operator<<(size_t __pos) const
- { return bitset<_Nb,_WordT>(*this) <<= __pos; }
- bitset<_Nb,_WordT> operator>>(size_t __pos) const
- { return bitset<_Nb,_WordT>(*this) >>= __pos; }
-
- //
- // EXTENSIONS: bit-find operations. These operations are
- // experimental, and are subject to change or removal in future
- // versions.
- //
-
- // find the index of the first "on" bit
- size_t _Find_first() const
- { return _M_do_find_first(_Nb); }
-
- // find the index of the next "on" bit after prev
- size_t _Find_next( size_t __prev ) const
- { return _M_do_find_next(__prev, _Nb); }
-
-};
-
-//
-// Definitions of non-inline member functions.
-//
-
-template <size_t _Nb, class _WordT>
-template<class _CharT, class _Traits, class _Alloc>
-void bitset<_Nb, _WordT>
- ::_M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s,
- size_t __pos,
- size_t __n)
-{
- reset();
- const size_t __nbits = min(_Nb, min(__n, __s.size() - __pos));
- for (size_t __i = 0; __i < __nbits; ++__i) {
- switch(__s[__pos + __nbits - __i - 1]) {
- case '0':
- break;
- case '1':
- set(__i);
- break;
- default:
- __STL_THROW(invalid_argument("bitset"));
- }
- }
-}
-
-template <size_t _Nb, class _WordT>
-template <class _CharT, class _Traits, class _Alloc>
-void bitset<_Nb, _WordT>
- ::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const
-{
- __s.assign(_Nb, '0');
-
- for (size_t __i = 0; __i < _Nb; ++__i)
- if (_Unchecked_test(__i))
- __s[_Nb - 1 - __i] = '1';
-}
-
-// ------------------------------------------------------------
-
-//
-// 23.3.5.3 bitset operations:
-//
-
-template <size_t _Nb, class _WordT>
-inline bitset<_Nb,_WordT> operator&(const bitset<_Nb,_WordT>& __x,
- const bitset<_Nb,_WordT>& __y) {
- bitset<_Nb,_WordT> __result(__x);
- __result &= __y;
- return __result;
-}
-
-
-template <size_t _Nb, class _WordT>
-inline bitset<_Nb,_WordT> operator|(const bitset<_Nb,_WordT>& __x,
- const bitset<_Nb,_WordT>& __y) {
- bitset<_Nb,_WordT> __result(__x);
- __result |= __y;
- return __result;
-}
-
-template <size_t _Nb, class _WordT>
-inline bitset<_Nb,_WordT> operator^(const bitset<_Nb,_WordT>& __x,
- const bitset<_Nb,_WordT>& __y) {
- bitset<_Nb,_WordT> __result(__x);
- __result ^= __y;
- return __result;
-}
-
-// NOTE: these must be rewritten once we have templatized iostreams.
-
-template <size_t _Nb, class _WordT>
-istream&
-operator>>(istream& __is, bitset<_Nb,_WordT>& __x) {
- string __tmp;
- __tmp.reserve(_Nb);
-
- // In new templatized iostreams, use istream::sentry
- if (__is.flags() & ios::skipws) {
- char __c;
- do
- __is.get(__c);
- while (__is && isspace(__c));
- if (__is)
- __is.putback(__c);
- }
-
- for (size_t __i = 0; __i < _Nb; ++__i) {
- char __c;
- __is.get(__c);
-
- if (!__is)
- break;
- else if (__c != '0' && __c != '1') {
- __is.putback(__c);
- break;
- }
- else
- __tmp.push_back(__c);
- }
-
- if (__tmp.empty())
- __is.clear(__is.rdstate() | ios::failbit);
- else
- __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);
-
- return __is;
-}
-
-template <size_t _Nb, class _WordT>
-ostream& operator<<(ostream& __os, const bitset<_Nb,_WordT>& __x) {
- string __tmp;
- __x._M_copy_to_string(__tmp);
- return __os << __tmp;
-}
-
-// ------------------------------------------------------------
-// Lookup tables for find and count operations.
-
-template<bool __dummy>
-unsigned char _Bit_count<__dummy>::_S_bit_count[] = {
- 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */
- 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */
- 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */
- 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */
- 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */
- 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */
- 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */
- 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */
- 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */
- 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */
- 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */
- 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */
- 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */
- 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */
- 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */
- 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */
- 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */
- 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */
- 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */
- 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */
- 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */
- 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */
- 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */
- 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */
- 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */
- 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */
- 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */
- 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */
- 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */
- 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */
- 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */
- 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */
- 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */
- 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */
- 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */
- 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */
- 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */
- 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */
- 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */
- 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */
- 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */
- 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */
- 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */
- 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */
- 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */
- 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */
- 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */
- 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */
- 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */
- 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */
- 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */
- 8 /* 255 */
-}; // end _Bit_count
-
-template<bool __dummy>
-unsigned char _First_one<__dummy>::_S_first_one[] = {
- 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */
- 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */
- 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */
- 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */
- 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */
- 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */
- 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */
- 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */
- 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */
- 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */
- 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */
- 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */
- 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */
- 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */
- 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */
- 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */
- 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */
- 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */
- 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */
- 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */
- 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */
- 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */
- 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */
- 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */
- 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */
- 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */
- 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */
- 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */
- 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */
- 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */
- 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */
- 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */
- 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */
- 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */
- 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */
- 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */
- 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */
- 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */
- 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */
- 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */
- 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */
- 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */
- 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */
- 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */
- 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */
- 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */
- 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */
- 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */
- 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */
- 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */
- 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */
- 0, /* 255 */
-}; // end _First_one
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
-
-
-#undef __BITS_PER_WORDT
-#undef __BITSET_WORDS
-
-#endif /* __SGI_STL_BITSET */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/bvector.h b/contrib/libstdc++/stl/bvector.h
deleted file mode 100644
index 03a3fb1..0000000
--- a/contrib/libstdc++/stl/bvector.h
+++ /dev/null
@@ -1,51 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_BVECTOR_H
-#define __SGI_STL_BVECTOR_H
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-#include <vector.h>
-#else
-#include <algobase.h>
-#include <alloc.h>
-#endif
-
-#include <stl_bvector.h>
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::bit_vector;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_BVECTOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
-
-
diff --git a/contrib/libstdc++/stl/defalloc.h b/contrib/libstdc++/stl/defalloc.h
deleted file mode 100644
index 0bfcc2c..0000000
--- a/contrib/libstdc++/stl/defalloc.h
+++ /dev/null
@@ -1,87 +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.
- *
- */
-
-// Inclusion of this file is DEPRECATED. This is the original HP
-// default allocator. It is provided only for backward compatibility.
-// This file WILL BE REMOVED in a future release.
-//
-// DO NOT USE THIS FILE unless you have an old container implementation
-// that requires an allocator with the HP-style interface.
-//
-// Standard-conforming allocators have a very different interface. The
-// standard default allocator is declared in the header <memory>.
-
-#ifndef DEFALLOC_H
-#define DEFALLOC_H
-
-#include <new.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <iostream.h>
-#include <algobase.h>
-
-
-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 void deallocate(T* buffer) {
- ::operator delete(buffer);
-}
-
-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;
- 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)));
- }
-};
-
-class allocator<void> {
-public:
- typedef void* pointer;
-};
-
-
-
-#endif
diff --git a/contrib/libstdc++/stl/deque b/contrib/libstdc++/stl/deque
deleted file mode 100644
index 61654ac..0000000
--- a/contrib/libstdc++/stl/deque
+++ /dev/null
@@ -1,40 +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.
- *
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_DEQUE
-#define __SGI_STL_DEQUE
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_deque.h>
-
-#endif /* __SGI_STL_DEQUE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/deque.h b/contrib/libstdc++/stl/deque.h
deleted file mode 100644
index ede38b1..0000000
--- a/contrib/libstdc++/stl/deque.h
+++ /dev/null
@@ -1,42 +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.
- *
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_DEQUE_H
-#define __SGI_STL_DEQUE_H
-
-#include <algobase.h>
-#include <alloc.h>
-#include <stl_deque.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::deque;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_DEQUE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/function.h b/contrib/libstdc++/stl/function.h
deleted file mode 100644
index 6474dd9..0000000
--- a/contrib/libstdc++/stl/function.h
+++ /dev/null
@@ -1,118 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_FUNCTION_H
-#define __SGI_STL_FUNCTION_H
-
-#ifndef __STL_CONFIG_H
-#include <stl_config.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_RELOPS
-#include <stl_relops.h>
-#endif
-#include <stddef.h>
-#ifndef __SGI_STL_INTERNAL_FUNCTION_H
-#include <stl_function.h>
-#endif
-
-#ifdef __STL_USE_NAMESPACE_FOR_RELOPS
-
-// Names from stl_relops.h
-using __STD_RELOPS::operator!=;
-using __STD_RELOPS::operator>;
-using __STD_RELOPS::operator<=;
-using __STD_RELOPS::operator>=;
-
-#endif /* __STL_USE_NAMESPACE_FOR_RELOPS */
-
-#ifdef __STL_USE_NAMESPACES
-
-// Names from stl_function.h
-using __STD::unary_function;
-using __STD::binary_function;
-using __STD::plus;
-using __STD::minus;
-using __STD::multiplies;
-using __STD::divides;
-using __STD::identity_element;
-using __STD::modulus;
-using __STD::negate;
-using __STD::equal_to;
-using __STD::not_equal_to;
-using __STD::greater;
-using __STD::less;
-using __STD::greater_equal;
-using __STD::less_equal;
-using __STD::logical_and;
-using __STD::logical_or;
-using __STD::logical_not;
-using __STD::unary_negate;
-using __STD::binary_negate;
-using __STD::not1;
-using __STD::not2;
-using __STD::binder1st;
-using __STD::binder2nd;
-using __STD::bind1st;
-using __STD::bind2nd;
-using __STD::unary_compose;
-using __STD::binary_compose;
-using __STD::compose1;
-using __STD::compose2;
-using __STD::pointer_to_unary_function;
-using __STD::pointer_to_binary_function;
-using __STD::ptr_fun;
-using __STD::identity;
-using __STD::select1st;
-using __STD::select2nd;
-using __STD::project1st;
-using __STD::project2nd;
-using __STD::constant_void_fun;
-using __STD::constant_unary_fun;
-using __STD::constant_binary_fun;
-using __STD::constant0;
-using __STD::constant1;
-using __STD::constant2;
-using __STD::subtractive_rng;
-using __STD::mem_fun_t;
-using __STD::const_mem_fun_t;
-using __STD::mem_fun_ref_t;
-using __STD::const_mem_fun_ref_t;
-using __STD::mem_fun1_t;
-using __STD::const_mem_fun1_t;
-using __STD::mem_fun1_ref_t;
-using __STD::const_mem_fun1_ref_t;
-using __STD::mem_fun;
-using __STD::mem_fun_ref;
-using __STD::mem_fun1;
-using __STD::mem_fun1_ref;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_FUNCTION_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/functional b/contrib/libstdc++/stl/functional
deleted file mode 100644
index d046dbb..0000000
--- a/contrib/libstdc++/stl/functional
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_FUNCTIONAL
-#define __SGI_STL_FUNCTIONAL
-
-#include <stl_config.h>
-#include <stddef.h>
-#include <stl_function.h>
-
-#endif /* __SGI_STL_FUNCTIONAL */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/hash_map b/contrib/libstdc++/stl/hash_map
deleted file mode 100644
index f7421e0..0000000
--- a/contrib/libstdc++/stl/hash_map
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_HASH_MAP
-#define __SGI_STL_HASH_MAP
-
-#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
-#include <stl_hashtable.h>
-#endif
-
-#include <stl_hash_map.h>
-
-#endif /* __SGI_STL_HASH_MAP */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/hash_map.h b/contrib/libstdc++/stl/hash_map.h
deleted file mode 100644
index f347162..0000000
--- a/contrib/libstdc++/stl/hash_map.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_HASH_MAP_H
-#define __SGI_STL_HASH_MAP_H
-
-#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
-#include <stl_hashtable.h>
-#endif
-
-#include <algobase.h>
-#include <stl_hash_map.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::hash;
-using __STD::hashtable;
-using __STD::hash_map;
-using __STD::hash_multimap;
-#endif /* __STL_USE_NAMESPACES */
-
-
-#endif /* __SGI_STL_HASH_MAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/hash_set b/contrib/libstdc++/stl/hash_set
deleted file mode 100644
index 2244f47..0000000
--- a/contrib/libstdc++/stl/hash_set
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_HASH_SET
-#define __SGI_STL_HASH_SET
-
-#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
-#include <stl_hashtable.h>
-#endif
-
-#include <stl_hash_set.h>
-
-#endif /* __SGI_STL_HASH_SET */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/hash_set.h b/contrib/libstdc++/stl/hash_set.h
deleted file mode 100644
index d3e93c0..0000000
--- a/contrib/libstdc++/stl/hash_set.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_HASH_SET_H
-#define __SGI_STL_HASH_SET_H
-
-#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
-#include <stl_hashtable.h>
-#endif
-
-#include <algobase.h>
-#include <stl_hash_set.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::hash;
-using __STD::hashtable;
-using __STD::hash_set;
-using __STD::hash_multiset;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_HASH_SET_H */
diff --git a/contrib/libstdc++/stl/hashtable.h b/contrib/libstdc++/stl/hashtable.h
deleted file mode 100644
index 15dbfc9..0000000
--- a/contrib/libstdc++/stl/hashtable.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_HASHTABLE_H
-#define __SGI_STL_HASHTABLE_H
-
-#include <stl_hashtable.h>
-#include <algo.h>
-#include <alloc.h>
-#include <vector.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::hash;
-using __STD::hashtable;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_HASHTABLE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/heap.h b/contrib/libstdc++/stl/heap.h
deleted file mode 100644
index 2ec93c0..0000000
--- a/contrib/libstdc++/stl/heap.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.
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_HEAP_H
-#define __SGI_STL_HEAP_H
-
-#include <stl_config.h>
-#include <stl_heap.h>
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::push_heap;
-using __STD::pop_heap;
-using __STD::make_heap;
-using __STD::sort_heap;
-
-#endif /* __STL_USE_NAMESPACES */
-
-
-#endif /* __SGI_STL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/iterator b/contrib/libstdc++/stl/iterator
deleted file mode 100644
index 4ddd208..0000000
--- a/contrib/libstdc++/stl/iterator
+++ /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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ITERATOR
-#define __SGI_STL_ITERATOR
-
-#include <stl_config.h>
-#include <stl_relops.h>
-#include <stddef.h> /* XXX should use <cstddef> */
-#if 0 /* XXX define a flag for this */
-#include <iostream>
-#else
-#include <iostream.h>
-#endif
-#include <stl_iterator.h>
-
-#endif /* __SGI_STL_ITERATOR */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/iterator.h b/contrib/libstdc++/stl/iterator.h
deleted file mode 100644
index f8a0237..0000000
--- a/contrib/libstdc++/stl/iterator.h
+++ /dev/null
@@ -1,104 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ITERATOR_H
-#define __SGI_STL_ITERATOR_H
-
-#ifndef __SGI_STL_FUNCTION_H
-#include <function.h>
-#endif
-#include <stddef.h>
-#include <iostream.h>
-#ifndef __SGI_STL_INTERNAL_ITERATOR_H
-#include <stl_iterator.h>
-#endif
-#ifndef __TYPE_TRAITS_H
-#include <type_traits.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H
-#include <stl_construct.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H
-#include <stl_raw_storage_iter.h>
-#endif
-
-#ifdef __STL_USE_NAMESPACES
-
-// Names from stl_iterator.h
-
-using __STD::input_iterator_tag;
-using __STD::output_iterator_tag;
-using __STD::forward_iterator_tag;
-using __STD::bidirectional_iterator_tag;
-using __STD::random_access_iterator_tag;
-
-#if 0
-using __STD::iterator;
-#endif
-using __STD::input_iterator;
-using __STD::output_iterator;
-using __STD::forward_iterator;
-using __STD::bidirectional_iterator;
-using __STD::random_access_iterator;
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-using __STD::iterator_traits;
-#endif
-
-using __STD::iterator_category;
-using __STD::distance_type;
-using __STD::value_type;
-
-using __STD::distance;
-using __STD::advance;
-
-using __STD::insert_iterator;
-using __STD::front_insert_iterator;
-using __STD::back_insert_iterator;
-using __STD::inserter;
-using __STD::front_inserter;
-using __STD::back_inserter;
-
-using __STD::reverse_iterator;
-using __STD::reverse_bidirectional_iterator;
-
-using __STD::istream_iterator;
-using __STD::ostream_iterator;
-
-// Names from stl_construct.h
-using __STD::construct;
-using __STD::destroy;
-
-// Names from stl_raw_storage_iter.h
-using __STD::raw_storage_iterator;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_ITERATOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/list b/contrib/libstdc++/stl/list
deleted file mode 100644
index 5294f39..0000000
--- a/contrib/libstdc++/stl/list
+++ /dev/null
@@ -1,40 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_LIST
-#define __SGI_STL_LIST
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_list.h>
-
-#endif /* __SGI_STL_LIST */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/list.h b/contrib/libstdc++/stl/list.h
deleted file mode 100644
index 4e6ee0b..0000000
--- a/contrib/libstdc++/stl/list.h
+++ /dev/null
@@ -1,42 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_LIST_H
-#define __SGI_STL_LIST_H
-
-#include <algobase.h>
-#include <alloc.h>
-#include <stl_list.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::list;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_LIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/map b/contrib/libstdc++/stl/map
deleted file mode 100644
index 4cfb765..0000000
--- a/contrib/libstdc++/stl/map
+++ /dev/null
@@ -1,40 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_MAP
-#define __SGI_STL_MAP
-
-#ifndef __SGI_STL_INTERNAL_TREE_H
-#include <stl_tree.h>
-#endif
-#include <stl_map.h>
-#include <stl_multimap.h>
-
-#endif /* __SGI_STL_MAP */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/map.h b/contrib/libstdc++/stl/map.h
deleted file mode 100644
index a89bd31..0000000
--- a/contrib/libstdc++/stl/map.h
+++ /dev/null
@@ -1,41 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_MAP_H
-#define __SGI_STL_MAP_H
-
-#include <tree.h>
-#include <stl_map.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::map;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_MAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/memory b/contrib/libstdc++/stl/memory
deleted file mode 100644
index 64338dd..0000000
--- a/contrib/libstdc++/stl/memory
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_MEMORY
-#define __SGI_STL_MEMORY
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_tempbuf.h>
-#include <stl_uninitialized.h>
-#include <stl_raw_storage_iter.h>
-
-
-#if defined(__STL_MEMBER_TEMPLATES)
-
-__STL_BEGIN_NAMESPACE
-
-template <class _Tp> class auto_ptr {
-private:
- _Tp* _M_ptr;
-
-public:
- typedef _Tp element_type;
- explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
- auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
- template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
- : _M_ptr(__a.release()) {}
- auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
- if (&__a != this) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
- template <class _Tp1>
- auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
- if (__a.get() != this->get()) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
- ~auto_ptr() __STL_NOTHROW { delete _M_ptr; }
-
- _Tp& operator*() const __STL_NOTHROW {
- return *_M_ptr;
- }
- _Tp* operator->() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* get() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* release() __STL_NOTHROW {
- _Tp* __tmp = _M_ptr;
- _M_ptr = 0;
- return __tmp;
- }
- void reset(_Tp* __p = 0) __STL_NOTHROW {
- delete _M_ptr;
- _M_ptr = __p;
- }
-
- // According to the C++ standard, these conversions are required. Most
- // present-day compilers, however, do not enforce that requirement---and,
- // in fact, most present-day compilers do not support the language
- // features that these conversions rely on.
-
-#ifdef __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-
-private:
- template<class _Tp1> struct auto_ptr_ref {
- _Tp1* _M_ptr;
- auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
- };
-
-public:
- auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
- : _M_ptr(__ref._M_ptr) {}
- template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
- { return auto_ptr_ref<_Tp>(this->release()); }
- template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
- { return auto_ptr<_Tp1>(this->release()); }
-
-#endif /* __SGI_STL_USE_AUTO_PTR_CONVERSIONS */
-};
-
-__STL_END_NAMESPACE
-#endif /* member templates */
-
-#endif /* __SGI_STL_MEMORY */
-
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/multimap.h b/contrib/libstdc++/stl/multimap.h
deleted file mode 100644
index 1a8ec4a..0000000
--- a/contrib/libstdc++/stl/multimap.h
+++ /dev/null
@@ -1,41 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_MULTIMAP_H
-#define __SGI_STL_MULTIMAP_H
-
-#include <tree.h>
-#include <stl_multimap.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::multimap;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_MULTIMAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/multiset.h b/contrib/libstdc++/stl/multiset.h
deleted file mode 100644
index 3024fd7..0000000
--- a/contrib/libstdc++/stl/multiset.h
+++ /dev/null
@@ -1,41 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_MULTISET_H
-#define __SGI_STL_MULTISET_H
-
-#include <tree.h>
-#include <stl_multiset.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::multiset;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_MULTISET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/numeric b/contrib/libstdc++/stl/numeric
deleted file mode 100644
index 7f048e1..0000000
--- a/contrib/libstdc++/stl/numeric
+++ /dev/null
@@ -1,42 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_NUMERIC
-#define __SGI_STL_NUMERIC
-
-#include <stl_config.h>
-#include <stl_relops.h>
-#include <stddef.h>
-#include <iostream.h>
-#include <stl_iterator.h>
-#include <stl_function.h>
-#include <stl_numeric.h>
-
-#endif /* __SGI_STL_NUMERIC */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/pair.h b/contrib/libstdc++/stl/pair.h
deleted file mode 100644
index 00f5cad..0000000
--- a/contrib/libstdc++/stl/pair.h
+++ /dev/null
@@ -1,51 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_PAIR_H
-#define __SGI_STL_PAIR_H
-
-#ifndef __STL_CONFIG_H
-#include <stl_config.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_RELOPS
-#include <stl_relops.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_PAIR_H
-#include <stl_pair.h>
-#endif
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::pair;
-using __STD::make_pair;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_PAIR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/pthread_alloc b/contrib/libstdc++/stl/pthread_alloc
deleted file mode 100644
index 1852908..0000000
--- a/contrib/libstdc++/stl/pthread_alloc
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_PTHREAD_ALLOC
-#define __SGI_STL_PTHREAD_ALLOC
-
-// Pthread-specific node allocator.
-// This is similar to the default allocator, except that free-list
-// information is kept separately for each thread, avoiding locking.
-// This should be reasonably fast even in the presence of threads.
-// The down side is that storage may not be well-utilized.
-// It is not an error to allocate memory in thread A and deallocate
-// it in thread B. But this effectively transfers ownership of the memory,
-// so that it can only be reallocated by thread B. Thus this can effectively
-// result in a storage leak if it's done on a regular basis.
-// It can also result in frequent sharing of
-// cache lines among processors, with potentially serious performance
-// consequences.
-
-#include <stl_config.h>
-#include <stl_alloc.h>
-#ifndef __RESTRICT
-# define __RESTRICT
-#endif
-
-__STL_BEGIN_NAMESPACE
-
-#define __STL_DATA_ALIGNMENT 8
-
-union _Pthread_alloc_obj {
- union _Pthread_alloc_obj * __free_list_link;
- char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */
-};
-
-// Pthread allocators don't appear to the client to have meaningful
-// instances. We do in fact need to associate some state with each
-// thread. That state is represented by
-// _Pthread_alloc_per_thread_state<_Max_size>.
-
-template<size_t _Max_size>
-struct _Pthread_alloc_per_thread_state {
- typedef _Pthread_alloc_obj __obj;
- enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT };
- _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
- _Pthread_alloc_per_thread_state<_Max_size> * __next;
- // Free list link for list of available per thread structures.
- // When one of these becomes available for reuse due to thread
- // termination, any objects in its free list remain associated
- // with it. The whole structure may then be used by a newly
- // created thread.
- _Pthread_alloc_per_thread_state() : __next(0)
- {
- memset((void *)__free_list, 0, _S_NFREELISTS * sizeof(__obj *));
- }
- // Returns an object of size __n, and possibly adds to size n free list.
- void *_M_refill(size_t __n);
-};
-
-// Pthread-specific allocator.
-// The argument specifies the largest object size allocated from per-thread
-// free lists. Larger objects are allocated using malloc_alloc.
-// Max_size must be a power of 2.
-template <size_t _Max_size = 128>
-class _Pthread_alloc_template {
-
-public: // but only for internal use:
-
- typedef _Pthread_alloc_obj __obj;
-
- // Allocates a chunk for nobjs of size "size". nobjs may be reduced
- // if it is inconvenient to allocate the requested number.
- static char *_S_chunk_alloc(size_t __size, int &__nobjs);
-
- enum {_S_ALIGN = __STL_DATA_ALIGNMENT};
-
- static size_t _S_round_up(size_t __bytes) {
- return (((__bytes) + _S_ALIGN-1) & ~(_S_ALIGN - 1));
- }
- static size_t _S_freelist_index(size_t __bytes) {
- return (((__bytes) + _S_ALIGN-1)/_S_ALIGN - 1);
- }
-
-private:
- // Chunk allocation state. And other shared state.
- // Protected by _S_chunk_allocator_lock.
- static pthread_mutex_t _S_chunk_allocator_lock;
- static char *_S_start_free;
- static char *_S_end_free;
- static size_t _S_heap_size;
- static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states;
- static pthread_key_t _S_key;
- static bool _S_key_initialized;
- // Pthread key under which per thread state is stored.
- // Allocator instances that are currently unclaimed by any thread.
- static void _S_destructor(void *instance);
- // Function to be called on thread exit to reclaim per thread
- // state.
- static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state();
- // Return a recycled or new per thread state.
- static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state();
- // ensure that the current thread has an associated
- // per thread state.
- friend class _M_lock;
- class _M_lock {
- public:
- _M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); }
- ~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); }
- };
-
-public:
-
- /* n must be > 0 */
- static void * allocate(size_t __n)
- {
- __obj * volatile * __my_free_list;
- __obj * __RESTRICT __result;
- _Pthread_alloc_per_thread_state<_Max_size>* __a;
-
- if (__n > _Max_size) {
- return(malloc_alloc::allocate(__n));
- }
- if (!_S_key_initialized ||
- !(__a = (_Pthread_alloc_per_thread_state<_Max_size>*)
- pthread_getspecific(_S_key))) {
- __a = _S_get_per_thread_state();
- }
- __my_free_list = __a -> __free_list + _S_freelist_index(__n);
- __result = *__my_free_list;
- if (__result == 0) {
- void *__r = __a -> _M_refill(_S_round_up(__n));
- return __r;
- }
- *__my_free_list = __result -> __free_list_link;
- return (__result);
- };
-
- /* p may not be 0 */
- static void deallocate(void *__p, size_t __n)
- {
- __obj *__q = (__obj *)__p;
- __obj * volatile * __my_free_list;
- _Pthread_alloc_per_thread_state<_Max_size>* __a;
-
- if (__n > _Max_size) {
- malloc_alloc::deallocate(__p, __n);
- return;
- }
- if (!_S_key_initialized ||
- !(__a = (_Pthread_alloc_per_thread_state<_Max_size> *)
- pthread_getspecific(_S_key))) {
- __a = _S_get_per_thread_state();
- }
- __my_free_list = __a->__free_list + _S_freelist_index(__n);
- __q -> __free_list_link = *__my_free_list;
- *__my_free_list = __q;
- }
-
- static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz);
-
-} ;
-
-typedef _Pthread_alloc_template<> pthread_alloc;
-
-
-template <size_t _Max_size>
-void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance)
-{
- _M_lock __lock_instance; // Need to acquire lock here.
- _Pthread_alloc_per_thread_state<_Max_size>* __s =
- (_Pthread_alloc_per_thread_state<_Max_size> *)__instance;
- __s -> __next = _S_free_per_thread_states;
- _S_free_per_thread_states = __s;
-}
-
-template <size_t _Max_size>
-_Pthread_alloc_per_thread_state<_Max_size> *
-_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state()
-{
- /* lock already held here. */
- if (0 != _S_free_per_thread_states) {
- _Pthread_alloc_per_thread_state<_Max_size> *__result =
- _S_free_per_thread_states;
- _S_free_per_thread_states = _S_free_per_thread_states -> __next;
- return __result;
- } else {
- return new _Pthread_alloc_per_thread_state<_Max_size>;
- }
-}
-
-template <size_t _Max_size>
-_Pthread_alloc_per_thread_state<_Max_size> *
-_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state()
-{
- /*REFERENCED*/
- _M_lock __lock_instance; // Need to acquire lock here.
- _Pthread_alloc_per_thread_state<_Max_size> * __result;
- if (!_S_key_initialized) {
- if (pthread_key_create(&_S_key, _S_destructor)) {
- abort(); // failed
- }
- _S_key_initialized = true;
- }
- __result = _S_new_per_thread_state();
- if (pthread_setspecific(_S_key, __result)) abort();
- return __result;
-}
-
-/* We allocate memory in large chunks in order to avoid fragmenting */
-/* the malloc heap too much. */
-/* We assume that size is properly aligned. */
-template <size_t _Max_size>
-char *_Pthread_alloc_template<_Max_size>
-::_S_chunk_alloc(size_t __size, int &__nobjs)
-{
- {
- char * __result;
- size_t __total_bytes;
- size_t __bytes_left;
- /*REFERENCED*/
- _M_lock __lock_instance; // Acquire lock for this routine
-
- __total_bytes = __size * __nobjs;
- __bytes_left = _S_end_free - _S_start_free;
- if (__bytes_left >= __total_bytes) {
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return(__result);
- } else if (__bytes_left >= __size) {
- __nobjs = __bytes_left/__size;
- __total_bytes = __size * __nobjs;
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return(__result);
- } else {
- size_t __bytes_to_get =
- 2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
- // Try to make use of the left-over piece.
- if (__bytes_left > 0) {
- _Pthread_alloc_per_thread_state<_Max_size>* __a =
- (_Pthread_alloc_per_thread_state<_Max_size>*)
- pthread_getspecific(_S_key);
- __obj * volatile * __my_free_list =
- __a->__free_list + _S_freelist_index(__bytes_left);
-
- ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
- *__my_free_list = (__obj *)_S_start_free;
- }
-# ifdef _SGI_SOURCE
- // Try to get memory that's aligned on something like a
- // cache line boundary, so as to avoid parceling out
- // parts of the same line to different threads and thus
- // possibly different processors.
- {
- const int __cache_line_size = 128; // probable upper bound
- __bytes_to_get &= ~(__cache_line_size-1);
- _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
- if (0 == _S_start_free) {
- _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
- }
- }
-# else /* !SGI_SOURCE */
- _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
-# endif
- _S_heap_size += __bytes_to_get;
- _S_end_free = _S_start_free + __bytes_to_get;
- }
- }
- // lock is released here
- return(_S_chunk_alloc(__size, __nobjs));
-}
-
-
-/* Returns an object of size n, and optionally adds to size n free list.*/
-/* We assume that n is properly aligned. */
-/* We hold the allocation lock. */
-template <size_t _Max_size>
-void *_Pthread_alloc_per_thread_state<_Max_size>
-::_M_refill(size_t __n)
-{
- int __nobjs = 128;
- char * __chunk =
- _Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs);
- __obj * volatile * __my_free_list;
- __obj * __result;
- __obj * __current_obj, * __next_obj;
- int __i;
-
- if (1 == __nobjs) {
- return(__chunk);
- }
- __my_free_list = __free_list
- + _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n);
-
- /* Build free list in chunk */
- __result = (__obj *)__chunk;
- *__my_free_list = __next_obj = (__obj *)(__chunk + __n);
- for (__i = 1; ; __i++) {
- __current_obj = __next_obj;
- __next_obj = (__obj *)((char *)__next_obj + __n);
- if (__nobjs - 1 == __i) {
- __current_obj -> __free_list_link = 0;
- break;
- } else {
- __current_obj -> __free_list_link = __next_obj;
- }
- }
- return(__result);
-}
-
-template <size_t _Max_size>
-void *_Pthread_alloc_template<_Max_size>
-::reallocate(void *__p, size_t __old_sz, size_t __new_sz)
-{
- void * __result;
- size_t __copy_sz;
-
- if (__old_sz > _Max_size
- && __new_sz > _Max_size) {
- return(realloc(__p, __new_sz));
- }
- if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
- __result = allocate(__new_sz);
- __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
- memcpy(__result, __p, __copy_sz);
- deallocate(__p, __old_sz);
- return(__result);
-}
-
-template <size_t _Max_size>
-_Pthread_alloc_per_thread_state<_Max_size> *
-_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0;
-
-template <size_t _Max_size>
-pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key;
-
-template <size_t _Max_size>
-bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false;
-
-template <size_t _Max_size>
-pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock
-= PTHREAD_MUTEX_INITIALIZER;
-
-template <size_t _Max_size>
-char *_Pthread_alloc_template<_Max_size>
-::_S_start_free = 0;
-
-template <size_t _Max_size>
-char *_Pthread_alloc_template<_Max_size>
-::_S_end_free = 0;
-
-template <size_t _Max_size>
-size_t _Pthread_alloc_template<_Max_size>
-::_S_heap_size = 0;
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-template <class _Tp>
-class pthread_allocator {
- typedef pthread_alloc _S_Alloc; // The underlying allocator.
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
- template <class _Up> struct rebind {
- typedef pthread_allocator<_Up> other;
- };
-
- pthread_allocator() __STL_NOTHROW {}
- pthread_allocator(const pthread_allocator& a) __STL_NOTHROW {}
- template <class _Up> pthread_allocator(const pthread_allocator<_Up>&)
- __STL_NOTHROW {}
- ~pthread_allocator() __STL_NOTHROW {}
-
- pointer address(reference __x) const { return &__x; }
- const_pointer address(const_reference __x) const { return &__x; }
-
- // __n is permitted to be 0. The C++ standard says nothing about what
- // the return value is when __n == 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp)))
- : 0;
- }
-
- // p is not permitted to be a null pointer.
- void deallocate(pointer __p, size_type __n)
- { _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
-
- size_type max_size() const __STL_NOTHROW
- { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
- void destroy(pointer _p) { _p->~_Tp(); }
-};
-
-template<>
-class pthread_allocator<void> {
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-
- template <class _Up> struct rebind {
- typedef pthread_allocator<_Up> other;
- };
-};
-
-template <size_t _Max_size>
-inline bool operator==(const _Pthread_alloc_template<_Max_size>&,
- const _Pthread_alloc_template<_Max_size>&)
-{
- return true;
-}
-
-template <class _T1, class _T2>
-inline bool operator==(const pthread_allocator<_T1>&,
- const pthread_allocator<_T2>& a2)
-{
- return true;
-}
-
-template <class _T1, class _T2>
-inline bool operator!=(const pthread_allocator<_T1>&,
- const pthread_allocator<_T2>&)
-{
- return false;
-}
-
-template <class _Tp, size_t _Max_size>
-struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type;
- typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> >
- allocator_type;
-};
-
-template <class _Tp, class _Up, size_t _Max>
-struct _Alloc_traits<_Tp, __allocator<_Up, _Pthread_alloc_template<_Max> > >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type;
- typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type;
-};
-
-template <class _Tp, class _Up>
-struct _Alloc_traits<_Tp, pthread_allocator<_Up> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type;
- typedef pthread_allocator<_Tp> allocator_type;
-};
-
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_PTHREAD_ALLOC */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/pthread_alloc.h b/contrib/libstdc++/stl/pthread_alloc.h
deleted file mode 100644
index 774ef04..0000000
--- a/contrib/libstdc++/stl/pthread_alloc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 1996-1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_PTHREAD_ALLOC_H
-#define __SGI_STL_PTHREAD_ALLOC_H
-
-#include <pthread_alloc>
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::_Pthread_alloc_template;
-using __STD::pthread_alloc;
-
-#endif /* __STL_USE_NAMESPACES */
-
-
-#endif /* __SGI_STL_PTHREAD_ALLOC_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/queue b/contrib/libstdc++/stl/queue
deleted file mode 100644
index f9417fb..0000000
--- a/contrib/libstdc++/stl/queue
+++ /dev/null
@@ -1,45 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_QUEUE
-#define __SGI_STL_QUEUE
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_vector.h>
-#include <stl_bvector.h>
-#include <stl_heap.h>
-#include <stl_deque.h>
-#include <stl_function.h>
-#include <stl_queue.h>
-
-#endif /* __SGI_STL_QUEUE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/rope b/contrib/libstdc++/stl/rope
deleted file mode 100644
index f861500..0000000
--- a/contrib/libstdc++/stl/rope
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ROPE
-#define __SGI_STL_ROPE
-
-#include <stl_algobase.h>
-#include <stl_tempbuf.h>
-#include <stl_algo.h>
-#include <stl_function.h>
-#include <stl_numeric.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_hash_fun.h>
-#include <stl_rope.h>
-
-#endif /* __SGI_STL_ROPE */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/rope.h b/contrib/libstdc++/stl/rope.h
deleted file mode 100644
index d767fa3..0000000
--- a/contrib/libstdc++/stl/rope.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_ROPE_H
-#define __SGI_STL_ROPE_H
-
-#include <hashtable.h>
-#include <stl_rope.h>
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::char_producer;
-using __STD::sequence_buffer;
-using __STD::rope;
-using __STD::crope;
-using __STD::wrope;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_ROPE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/ropeimpl.h b/contrib/libstdc++/stl/ropeimpl.h
deleted file mode 100644
index 18bb2c9..0000000
--- a/contrib/libstdc++/stl/ropeimpl.h
+++ /dev/null
@@ -1,1550 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-# include <stdio.h> /* XXX should use <cstdio> */
-# include <iostream.h> /* XXX should use <iostream> */
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#endif
-
-// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
-// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
-// Results in a valid buf_ptr if the iterator can be legitimately
-// dereferenced.
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
- _Rope_iterator_base<_CharT,_Alloc>& __x)
-{
- const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
- size_t __leaf_pos = __x._M_leaf_pos;
- size_t __pos = __x._M_current_pos;
-
- switch(__leaf->_M_tag) {
- case _RopeRep::_S_leaf:
- __x._M_buf_start =
- ((_Rope_RopeLeaf<_CharT,_Alloc>*)__leaf)->_M_data;
- __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
- __x._M_buf_end = __x._M_buf_start + __leaf->_M_size;
- break;
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- {
- size_t __len = _S_iterator_buf_len;
- size_t __buf_start_pos = __leaf_pos;
- size_t __leaf_end = __leaf_pos + __leaf->_M_size;
- char_producer<_CharT>* __fn =
- ((_Rope_RopeFunction<_CharT,_Alloc>*)__leaf)->_M_fn;
-
- if (__buf_start_pos + __len <= __pos) {
- __buf_start_pos = __pos - __len/4;
- if (__buf_start_pos + __len > __leaf_end) {
- __buf_start_pos = __leaf_end - __len;
- }
- }
- if (__buf_start_pos + __len > __leaf_end) {
- __len = __leaf_end - __buf_start_pos;
- }
- (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf);
- __x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos);
- __x._M_buf_start = __x._M_tmp_buf;
- __x._M_buf_end = __x._M_tmp_buf + __len;
- }
- break;
- default:
- __stl_assert(0);
- }
-}
-
-// Set path and buffer inside a rope iterator. We assume that
-// pos and root are already set.
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache
-(_Rope_iterator_base<_CharT,_Alloc>& __x)
-{
- const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1];
- const _RopeRep* __curr_rope;
- int __curr_depth = -1; /* index into path */
- size_t __curr_start_pos = 0;
- size_t __pos = __x._M_current_pos;
- unsigned char __dirns = 0; // Bit vector marking right turns in the path
-
- __stl_assert(__pos <= __x._M_root->_M_size);
- if (__pos >= __x._M_root->_M_size) {
- __x._M_buf_ptr = 0;
- return;
- }
- __curr_rope = __x._M_root;
- if (0 != __curr_rope->_M_c_string) {
- /* Treat the root as a leaf. */
- __x._M_buf_start = __curr_rope->_M_c_string;
- __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size;
- __x._M_buf_ptr = __curr_rope->_M_c_string + __pos;
- __x._M_path_end[0] = __curr_rope;
- __x._M_leaf_index = 0;
- __x._M_leaf_pos = 0;
- return;
- }
- for(;;) {
- ++__curr_depth;
- __stl_assert(__curr_depth <= _RopeRep::_S_max_rope_depth);
- __path[__curr_depth] = __curr_rope;
- switch(__curr_rope->_M_tag) {
- case _RopeRep::_S_leaf:
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- __x._M_leaf_pos = __curr_start_pos;
- goto done;
- case _RopeRep::_S_concat:
- {
- _Rope_RopeConcatenation<_CharT,_Alloc>* __c =
- (_Rope_RopeConcatenation<_CharT,_Alloc>*)__curr_rope;
- _RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size;
-
- __dirns <<= 1;
- if (__pos >= __curr_start_pos + __left_len) {
- __dirns |= 1;
- __curr_rope = __c->_M_right;
- __curr_start_pos += __left_len;
- } else {
- __curr_rope = __left;
- }
- }
- break;
- }
- }
- done:
- // Copy last section of path into _M_path_end.
- {
- int __i = -1;
- int __j = __curr_depth + 1 - _S_path_cache_len;
-
- if (__j < 0) __j = 0;
- while (__j <= __curr_depth) {
- __x._M_path_end[++__i] = __path[__j++];
- }
- __x._M_leaf_index = __i;
- }
- __x._M_path_directions = __dirns;
- _S_setbuf(__x);
-}
-
-// Specialized version of the above. Assumes that
-// the path cache is valid for the previous position.
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr
-(_Rope_iterator_base<_CharT,_Alloc>& __x)
-{
- int __current_index = __x._M_leaf_index;
- const _RopeRep* __current_node = __x._M_path_end[__current_index];
- size_t __len = __current_node->_M_size;
- size_t __node_start_pos = __x._M_leaf_pos;
- unsigned char __dirns = __x._M_path_directions;
- _Rope_RopeConcatenation<_CharT,_Alloc>* __c;
-
- __stl_assert(__x._M_current_pos <= __x._M_root->_M_size);
- if (__x._M_current_pos - __node_start_pos < __len) {
- /* More stuff in this leaf, we just didn't cache it. */
- _S_setbuf(__x);
- return;
- }
- __stl_assert(__node_start_pos + __len == __x._M_current_pos);
- // node_start_pos is starting position of last_node.
- while (--__current_index >= 0) {
- if (!(__dirns & 1) /* Path turned left */)
- break;
- __current_node = __x._M_path_end[__current_index];
- __c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node;
- // Otherwise we were in the right child. Thus we should pop
- // the concatenation node.
- __node_start_pos -= __c->_M_left->_M_size;
- __dirns >>= 1;
- }
- if (__current_index < 0) {
- // We underflowed the cache. Punt.
- _S_setcache(__x);
- return;
- }
- __current_node = __x._M_path_end[__current_index];
- __c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node;
- // current_node is a concatenation node. We are positioned on the first
- // character in its right child.
- // node_start_pos is starting position of current_node.
- __node_start_pos += __c->_M_left->_M_size;
- __current_node = __c->_M_right;
- __x._M_path_end[++__current_index] = __current_node;
- __dirns |= 1;
- while (_RopeRep::_S_concat == __current_node->_M_tag) {
- ++__current_index;
- if (_S_path_cache_len == __current_index) {
- int __i;
- for (__i = 0; __i < _S_path_cache_len-1; __i++) {
- __x._M_path_end[__i] = __x._M_path_end[__i+1];
- }
- --__current_index;
- }
- __current_node =
- ((_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node)->_M_left;
- __x._M_path_end[__current_index] = __current_node;
- __dirns <<= 1;
- // node_start_pos is unchanged.
- }
- __x._M_leaf_index = __current_index;
- __x._M_leaf_pos = __node_start_pos;
- __x._M_path_directions = __dirns;
- _S_setbuf(__x);
-}
-
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) {
- _M_current_pos += __n;
- if (0 != _M_buf_ptr) {
- size_t __chars_left = _M_buf_end - _M_buf_ptr;
- if (__chars_left > __n) {
- _M_buf_ptr += __n;
- } else if (__chars_left == __n) {
- _M_buf_ptr += __n;
- _S_setcache_for_incr(*this);
- } else {
- _M_buf_ptr = 0;
- }
- }
-}
-
-template <class _CharT, class _Alloc>
-void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) {
- if (0 != _M_buf_ptr) {
- size_t __chars_left = _M_buf_ptr - _M_buf_start;
- if (__chars_left >= __n) {
- _M_buf_ptr -= __n;
- } else {
- _M_buf_ptr = 0;
- }
- }
- _M_current_pos -= __n;
-}
-
-template <class _CharT, class _Alloc>
-void _Rope_iterator<_CharT,_Alloc>::_M_check() {
- if (_M_root_rope->_M_tree_ptr != _M_root) {
- // _Rope was modified. Get things fixed up.
- _RopeRep::_S_unref(_M_root);
- _M_root = _M_root_rope->_M_tree_ptr;
- _RopeRep::_S_ref(_M_root);
- _M_buf_ptr = 0;
- }
-}
-
-template <class _CharT, class _Alloc>
-inline
-_Rope_const_iterator<_CharT, _Alloc>::_Rope_const_iterator(
- const _Rope_iterator<_CharT,_Alloc>& __x)
-: _Rope_iterator_base<_CharT,_Alloc>(__x)
-{ }
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>::_Rope_iterator(
- rope<_CharT,_Alloc>& __r, size_t __pos)
-: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),
- _M_root_rope(&__r)
-{
- _RopeRep::_S_ref(_M_root);
-}
-
-template <class _CharT, class _Alloc>
-inline size_t
-rope<_CharT,_Alloc>::_S_char_ptr_len(const _CharT* __s)
-{
- const _CharT* __p = __s;
-
- while (!_S_is0(*__p)) { ++__p; }
- return (__p - __s);
-}
-
-
-#ifndef __GC
-
-template <class _CharT, class _Alloc>
-inline void _Rope_RopeRep<_CharT,_Alloc>::_M_free_c_string()
-{
- _CharT* __cstr = _M_c_string;
- if (0 != __cstr) {
- size_t __size = _M_size + 1;
- destroy(__cstr, __cstr + __size);
- _Data_deallocate(__cstr, __size);
- }
-}
-
-
-template <class _CharT, class _Alloc>
-#ifdef __STL_USE_STD_ALLOCATORS
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
- size_t __n,
- allocator_type __a)
-#else
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
- size_t __n)
-#endif
-{
- if (!_S_is_basic_char_type((_CharT*)0)) {
- destroy(__s, __s + __n);
- }
-// This has to be a static member, so this gets a bit messy
-# ifdef __STL_USE_STD_ALLOCATORS
- __a.deallocate(
- __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
-# else
- _Data_deallocate(
- __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
-# endif
-}
-
-
-// There are several reasons for not doing this with virtual destructors
-// and a class specific delete operator:
-// - A class specific delete operator can't easily get access to
-// allocator instances if we need them.
-// - Any virtual function would need a 4 or byte vtable pointer;
-// this only requires a one byte tag per object.
-template <class _CharT, class _Alloc>
-void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree()
-{
- switch(_M_tag) {
- case _S_leaf:
- {
- _Rope_RopeLeaf<_CharT,_Alloc>* __l
- = (_Rope_RopeLeaf<_CharT,_Alloc>*)this;
- __l->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf();
- _L_deallocate(__l, 1);
- break;
- }
- case _S_concat:
- {
- _Rope_RopeConcatenation<_CharT,_Alloc>* __c
- = (_Rope_RopeConcatenation<_CharT,_Alloc>*)this;
- __c->_Rope_RopeConcatenation<_CharT,_Alloc>::
- ~_Rope_RopeConcatenation();
- _C_deallocate(__c, 1);
- break;
- }
- case _S_function:
- {
- _Rope_RopeFunction<_CharT,_Alloc>* __f
- = (_Rope_RopeFunction<_CharT,_Alloc>*)this;
- __f->_Rope_RopeFunction<_CharT,_Alloc>::~_Rope_RopeFunction();
- _F_deallocate(__f, 1);
- break;
- }
- case _S_substringfn:
- {
- _Rope_RopeSubstring<_CharT,_Alloc>* __ss =
- (_Rope_RopeSubstring<_CharT,_Alloc>*)this;
- __ss->_Rope_RopeSubstring<_CharT,_Alloc>::
- ~_Rope_RopeSubstring();
- _S_deallocate(__ss, 1);
- break;
- }
- }
-}
-#else
-
-template <class _CharT, class _Alloc>
-#ifdef __STL_USE_STD_ALLOCATORS
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
- (const _CharT*, size_t, allocator_type)
-#else
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
- (const _CharT*, size_t)
-#endif
-{}
-
-#endif
-
-
-// Concatenate a C string onto a leaf rope by copying the rope data.
-// Used for short ropes.
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeLeaf*
-rope<_CharT,_Alloc>::_S_leaf_concat_char_iter
- (_RopeLeaf* __r, const _CharT* __iter, size_t __len)
-{
- size_t __old_len = __r->_M_size;
- _CharT* __new_data = (_CharT*)
- _Data_allocate(_S_rounded_up_size(__old_len + __len));
- _RopeLeaf* __result;
-
- uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
- uninitialized_copy_n(__iter, __len, __new_data + __old_len);
- _S_cond_store_eos(__new_data[__old_len + __len]);
- __STL_TRY {
- __result = _S_new_RopeLeaf(__new_data, __old_len + __len,
- __r->get_allocator());
- }
- __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
- __r->get_allocator()));
- return __result;
-}
-
-#ifndef __GC
-// As above, but it's OK to clobber original if refcount is 1
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeLeaf*
-rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter
- (_RopeLeaf* __r, const _CharT* __iter, size_t __len)
-{
- __stl_assert(__r->_M_refcount >= 1);
- if (__r->_M_refcount > 1)
- return _S_leaf_concat_char_iter(__r, __iter, __len);
- size_t __old_len = __r->_M_size;
- if (_S_allocated_capacity(__old_len) >= __old_len + __len) {
- // The space has been partially initialized for the standard
- // character types. But that doesn't matter for those types.
- uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len);
- if (_S_is_basic_char_type((_CharT*)0)) {
- _S_cond_store_eos(__r->_M_data[__old_len + __len]);
- __stl_assert(__r->_M_c_string == __r->_M_data);
- } else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) {
- __r->_M_free_c_string();
- __r->_M_c_string = 0;
- }
- __r->_M_size = __old_len + __len;
- __stl_assert(__r->_M_refcount == 1);
- __r->_M_refcount = 2;
- return __r;
- } else {
- _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);
- __stl_assert(__result->_M_refcount == 1);
- return __result;
- }
-}
-#endif
-
-// Assumes left and right are not 0.
-// Does not increment (nor decrement on exception) child reference counts.
-// Result has ref count 1.
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeRep*
-rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right)
-{
- _RopeConcatenation* __result =
- _S_new_RopeConcatenation(__left, __right, __left->get_allocator());
- size_t __depth = __result->_M_depth;
-
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(__left->get_allocator() == __right->get_allocator());
-# endif
- if (__depth > 20 && (__result->_M_size < 1000 ||
- __depth > _RopeRep::_S_max_rope_depth)) {
- _RopeRep* __balanced;
-
- __STL_TRY {
- __balanced = _S_balance(__result);
-# ifndef __GC
- if (__result != __balanced) {
- __stl_assert(1 == __result->_M_refcount
- && 1 == __balanced->_M_refcount);
- }
-# endif
- __result->_M_unref_nonnil();
- }
- __STL_UNWIND((_C_deallocate(__result,1)));
- // In case of exception, we need to deallocate
- // otherwise dangling result node. But caller
- // still owns its children. Thus unref is
- // inappropriate.
- return __balanced;
- } else {
- return __result;
- }
-}
-
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter
- (_RopeRep* __r, const _CharT*__s, size_t __slen)
-{
- _RopeRep* __result;
- if (0 == __slen) {
- _S_ref(__r);
- return __r;
- }
- if (0 == __r)
- return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
- __r->get_allocator());
- if (_RopeRep::_S_leaf == __r->_M_tag &&
- __r->_M_size + __slen <= _S_copy_max) {
- __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
-# ifndef __GC
- __stl_assert(1 == __result->_M_refcount);
-# endif
- return __result;
- }
- if (_RopeRep::_S_concat == __r->_M_tag
- && _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) {
- _RopeLeaf* __right =
- (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
- if (__right->_M_size + __slen <= _S_copy_max) {
- _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
- _RopeRep* __nright =
- _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
- __left->_M_ref_nonnil();
- __STL_TRY {
- __result = _S_tree_concat(__left, __nright);
- }
- __STL_UNWIND(_S_unref(__left); _S_unref(__nright));
-# ifndef __GC
- __stl_assert(1 == __result->_M_refcount);
-# endif
- return __result;
- }
- }
- _RopeRep* __nright =
- __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
- __STL_TRY {
- __r->_M_ref_nonnil();
- __result = _S_tree_concat(__r, __nright);
- }
- __STL_UNWIND(_S_unref(__r); _S_unref(__nright));
-# ifndef __GC
- __stl_assert(1 == __result->_M_refcount);
-# endif
- return __result;
-}
-
-#ifndef __GC
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeRep*
-rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
- _RopeRep* __r, const _CharT* __s, size_t __slen)
-{
- _RopeRep* __result;
- if (0 == __r)
- return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
- __r->get_allocator());
- size_t __count = __r->_M_refcount;
- size_t __orig_size = __r->_M_size;
- __stl_assert(__count >= 1);
- if (__count > 1) return _S_concat_char_iter(__r, __s, __slen);
- if (0 == __slen) {
- __r->_M_refcount = 2; // One more than before
- return __r;
- }
- if (__orig_size + __slen <= _S_copy_max &&
- _RopeRep::_S_leaf == __r->_M_tag) {
- __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
- return __result;
- }
- if (_RopeRep::_S_concat == __r->_M_tag) {
- _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)__r)->_M_right);
- if (_RopeRep::_S_leaf == __right->_M_tag
- && __right->_M_size + __slen <= _S_copy_max) {
- _RopeRep* __new_right =
- _S_destr_leaf_concat_char_iter(__right, __s, __slen);
- if (__right == __new_right) {
- __stl_assert(__new_right->_M_refcount == 2);
- __new_right->_M_refcount = 1;
- } else {
- __stl_assert(__new_right->_M_refcount >= 1);
- __right->_M_unref_nonnil();
- }
- __stl_assert(__r->_M_refcount == 1);
- __r->_M_refcount = 2; // One more than before.
- ((_RopeConcatenation*)__r)->_M_right = __new_right;
- __r->_M_size = __orig_size + __slen;
- if (0 != __r->_M_c_string) {
- __r->_M_free_c_string();
- __r->_M_c_string = 0;
- }
- return __r;
- }
- }
- _RopeRep* __right =
- __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
- __r->_M_ref_nonnil();
- __STL_TRY {
- __result = _S_tree_concat(__r, __right);
- }
- __STL_UNWIND(_S_unref(__r); _S_unref(__right))
- __stl_assert(1 == __result->_M_refcount);
- return __result;
-}
-#endif /* !__GC */
-
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeRep*
-rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right)
-{
- if (0 == __left) {
- _S_ref(__right);
- return __right;
- }
- if (0 == __right) {
- __left->_M_ref_nonnil();
- return __left;
- }
- if (_RopeRep::_S_leaf == __right->_M_tag) {
- if (_RopeRep::_S_leaf == __left->_M_tag) {
- if (__right->_M_size + __left->_M_size <= _S_copy_max) {
- return _S_leaf_concat_char_iter((_RopeLeaf*)__left,
- ((_RopeLeaf*)__right)->_M_data,
- __right->_M_size);
- }
- } else if (_RopeRep::_S_concat == __left->_M_tag
- && _RopeRep::_S_leaf ==
- ((_RopeConcatenation*)__left)->_M_right->_M_tag) {
- _RopeLeaf* __leftright =
- (_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right);
- if (__leftright->_M_size + __right->_M_size <= _S_copy_max) {
- _RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left;
- _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
- ((_RopeLeaf*)__right)->_M_data,
- __right->_M_size);
- __leftleft->_M_ref_nonnil();
- __STL_TRY {
- return(_S_tree_concat(__leftleft, __rest));
- }
- __STL_UNWIND(_S_unref(__leftleft); _S_unref(__rest))
- }
- }
- }
- __left->_M_ref_nonnil();
- __right->_M_ref_nonnil();
- __STL_TRY {
- return(_S_tree_concat(__left, __right));
- }
- __STL_UNWIND(_S_unref(__left); _S_unref(__right));
-}
-
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeRep*
-rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base,
- size_t __start, size_t __endp1)
-{
- if (0 == __base) return 0;
- size_t __len = __base->_M_size;
- size_t __adj_endp1;
- const size_t __lazy_threshold = 128;
-
- if (__endp1 >= __len) {
- if (0 == __start) {
- __base->_M_ref_nonnil();
- return __base;
- } else {
- __adj_endp1 = __len;
- }
- } else {
- __adj_endp1 = __endp1;
- }
- switch(__base->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__base;
- _RopeRep* __left = __c->_M_left;
- _RopeRep* __right = __c->_M_right;
- size_t __left_len = __left->_M_size;
- _RopeRep* __result;
-
- if (__adj_endp1 <= __left_len) {
- return _S_substring(__left, __start, __endp1);
- } else if (__start >= __left_len) {
- return _S_substring(__right, __start - __left_len,
- __adj_endp1 - __left_len);
- }
- _Self_destruct_ptr __left_result(
- _S_substring(__left, __start, __left_len));
- _Self_destruct_ptr __right_result(
- _S_substring(__right, 0, __endp1 - __left_len));
- __result = _S_concat(__left_result, __right_result);
-# ifndef __GC
- __stl_assert(1 == __result->_M_refcount);
-# endif
- return __result;
- }
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = (_RopeLeaf*)__base;
- _RopeLeaf* __result;
- size_t __result_len;
- if (__start >= __adj_endp1) return 0;
- __result_len = __adj_endp1 - __start;
- if (__result_len > __lazy_threshold) goto lazy;
-# ifdef __GC
- const _CharT* __section = __l->_M_data + __start;
- __result = _S_new_RopeLeaf(__section, __result_len,
- __base->get_allocator());
- __result->_M_c_string = 0; // Not eos terminated.
-# else
- // We should sometimes create substring node instead.
- __result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(
- __l->_M_data + __start, __result_len,
- __base->get_allocator());
-# endif
- return __result;
- }
- case _RopeRep::_S_substringfn:
- // Avoid introducing multiple layers of substring nodes.
- {
- _RopeSubstring* __old = (_RopeSubstring*)__base;
- size_t __result_len;
- if (__start >= __adj_endp1) return 0;
- __result_len = __adj_endp1 - __start;
- if (__result_len > __lazy_threshold) {
- _RopeSubstring* __result =
- _S_new_RopeSubstring(__old->_M_base,
- __start + __old->_M_start,
- __adj_endp1 - __start,
- __base->get_allocator());
- return __result;
-
- } // *** else fall through: ***
- }
- case _RopeRep::_S_function:
- {
- _RopeFunction* __f = (_RopeFunction*)__base;
- _CharT* __section;
- size_t __result_len;
- if (__start >= __adj_endp1) return 0;
- __result_len = __adj_endp1 - __start;
-
- if (__result_len > __lazy_threshold) goto lazy;
- __section = (_CharT*)
- _Data_allocate(_S_rounded_up_size(__result_len));
- __STL_TRY {
- (*(__f->_M_fn))(__start, __result_len, __section);
- }
- __STL_UNWIND(_RopeRep::__STL_FREE_STRING(
- __section, __result_len, __base->get_allocator()));
- _S_cond_store_eos(__section[__result_len]);
- return _S_new_RopeLeaf(__section, __result_len,
- __base->get_allocator());
- }
- }
- /*NOTREACHED*/
- __stl_assert(false);
- lazy:
- {
- // Create substring node.
- return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
- __base->get_allocator());
- }
-}
-
-template<class _CharT>
-class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> {
- private:
- _CharT* _M_buf_ptr;
- public:
- // _CharT* _M_buffer; // XXX not used
-
- _Rope_flatten_char_consumer(_CharT* __buffer) {
- _M_buf_ptr = __buffer;
- };
- ~_Rope_flatten_char_consumer() {}
- bool operator() (const _CharT* __leaf, size_t __n) {
- uninitialized_copy_n(__leaf, __n, _M_buf_ptr);
- _M_buf_ptr += __n;
- return true;
- }
-};
-
-template<class _CharT>
-class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
- private:
- _CharT _M_pattern;
- public:
- size_t _M_count; // Number of nonmatching characters
- _Rope_find_char_char_consumer(_CharT __p)
- : _M_pattern(__p), _M_count(0) {}
- ~_Rope_find_char_char_consumer() {}
- bool operator() (const _CharT* __leaf, size_t __n) {
- size_t __i;
- for (__i = 0; __i < __n; __i++) {
- if (__leaf[__i] == _M_pattern) {
- _M_count += __i; return false;
- }
- }
- _M_count += __n; return true;
- }
-};
-
-template<class _CharT>
-class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
- private:
- typedef ostream _Insert_ostream;
- _Insert_ostream& _M_o;
- public:
- // _CharT* buffer; // XXX not used
- _Rope_insert_char_consumer(_Insert_ostream& __writer)
- : _M_o(__writer) {};
- ~_Rope_insert_char_consumer() { };
- // Caller is presumed to own the ostream
- bool operator() (const _CharT* __leaf, size_t __n);
- // Returns true to continue traversal.
-};
-
-template<class _CharT>
-bool _Rope_insert_char_consumer<_CharT>::operator()
- (const _CharT* __leaf, size_t __n)
-{
- size_t __i;
- // We assume that formatting is set up correctly for each element.
- for (__i = 0; __i < __n; __i++) _M_o << __leaf[__i];
- return true;
-}
-
-inline bool _Rope_insert_char_consumer<char>::operator()
- (const char* __leaf, size_t __n)
-{
- size_t __i;
- for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
- return true;
-}
-
-#if 0
-// I couldn't get this to work work with the VC++ version of basic_ostream.
-// It also doesn't really do the right thing unless o is a wide stream.
-// Given that wchar_t is often 4 bytes, its not clear to me how useful
-// this stuff is anyway.
-inline bool _Rope_insert_char_consumer<wchar_t>::operator()
- (const wchar_t* __leaf, size_t __n)
-{
- size_t __i;
- for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
- return true;
-}
-#endif /* !_MSC_VER && !BORLAND */
-
-template <class _CharT, class _Alloc>
-bool rope<_CharT, _Alloc>::_S_apply_to_pieces(
- _Rope_char_consumer<_CharT>& __c,
- const _RopeRep* __r,
- size_t __begin, size_t __end)
-{
- if (0 == __r) return true;
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __conc = (_RopeConcatenation*)__r;
- _RopeRep* __left = __conc->_M_left;
- size_t __left_len = __left->_M_size;
- if (__begin < __left_len) {
- size_t __left_end = min(__left_len, __end);
- if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
- return false;
- }
- if (__end > __left_len) {
- _RopeRep* __right = __conc->_M_right;
- size_t __right_start = max(__left_len, __begin);
- if (!_S_apply_to_pieces(__c, __right,
- __right_start - __left_len,
- __end - __left_len)) {
- return false;
- }
- }
- }
- return true;
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = (_RopeLeaf*)__r;
- return __c(__l->_M_data + __begin, __end - __begin);
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- {
- _RopeFunction* __f = (_RopeFunction*)__r;
- size_t __len = __end - __begin;
- bool __result;
- _CharT* __buffer =
- (_CharT*)alloc::allocate(__len * sizeof(_CharT));
- __STL_TRY {
- (*(__f->_M_fn))(__begin, __end, __buffer);
- __result = __c(__buffer, __len);
- alloc::deallocate(__buffer, __len * sizeof(_CharT));
- }
- __STL_UNWIND((alloc::deallocate(__buffer,
- __len * sizeof(_CharT))))
- return __result;
- }
- default:
- __stl_assert(false);
- /*NOTREACHED*/
- return false;
- }
-}
-
-inline void _Rope_fill(ostream& __o, size_t __n)
-{
- char __f = __o.fill();
- size_t __i;
-
- for (__i = 0; __i < __n; __i++) __o.put(__f);
-}
-
-
-template <class _CharT> inline bool _Rope_is_simple(_CharT*) { return false; }
-inline bool _Rope_is_simple(char*) { return true; }
-inline bool _Rope_is_simple(wchar_t*) { return true; }
-
-
-template<class _CharT, class _Alloc>
-ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r)
-{
- size_t __w = __o.width();
- bool __left = bool(__o.flags() & ios::left);
- size_t __pad_len;
- size_t __rope_len = __r.size();
- _Rope_insert_char_consumer<_CharT> __c(__o);
- bool __is_simple = _Rope_is_simple((_CharT*)0);
-
- if (__rope_len < __w) {
- __pad_len = __w - __rope_len;
- } else {
- __pad_len = 0;
- }
- if (!__is_simple) __o.width(__w/__rope_len);
- __STL_TRY {
- if (__is_simple && !__left && __pad_len > 0) {
- _Rope_fill(__o, __pad_len);
- }
- __r.apply_to_pieces(0, __r.size(), __c);
- if (__is_simple && __left && __pad_len > 0) {
- _Rope_fill(__o, __pad_len);
- }
- if (!__is_simple)
- __o.width(__w);
- }
- __STL_UNWIND(if (!__is_simple) __o.width(__w))
- return __o;
-}
-
-template <class _CharT, class _Alloc>
-_CharT*
-rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r,
- size_t __start, size_t __len,
- _CharT* __buffer)
-{
- _Rope_flatten_char_consumer<_CharT> __c(__buffer);
- _S_apply_to_pieces(__c, __r, __start, __start + __len);
- return(__buffer + __len);
-}
-
-template <class _CharT, class _Alloc>
-size_t
-rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const
-{
- _Rope_find_char_char_consumer<_CharT> __c(__pattern);
- _S_apply_to_pieces(__c, _M_tree_ptr, __start, size());
- size_type __result_pos = __start + __c._M_count;
-# ifndef __STL_OLD_ROPE_SEMANTICS
- if (__result_pos == size()) __result_pos = npos;
-# endif
- return __result_pos;
-}
-
-template <class _CharT, class _Alloc>
-_CharT*
-rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r, _CharT* __buffer)
-{
- if (0 == __r) return __buffer;
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
- _RopeRep* __left = __c->_M_left;
- _RopeRep* __right = __c->_M_right;
- _CharT* __rest = _S_flatten(__left, __buffer);
- return _S_flatten(__right, __rest);
- }
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = (_RopeLeaf*)__r;
- return copy_n(__l->_M_data, __l->_M_size, __buffer).second;
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- // We dont yet do anything with substring nodes.
- // This needs to be fixed before ropefiles will work well.
- {
- _RopeFunction* __f = (_RopeFunction*)__r;
- (*(__f->_M_fn))(0, __f->_M_size, __buffer);
- return __buffer + __f->_M_size;
- }
- default:
- __stl_assert(false);
- /*NOTREACHED*/
- return 0;
- }
-}
-
-
-// This needs work for _CharT != char
-template <class _CharT, class _Alloc>
-void
-rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent)
-{
- for (int __i = 0; __i < __indent; __i++) putchar(' ');
- if (0 == __r) {
- printf("NULL\n"); return;
- }
- if (_RopeRep::_S_concat == __r->_M_tag) {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
- _RopeRep* __left = __c->_M_left;
- _RopeRep* __right = __c->_M_right;
-
-# ifdef __GC
- printf("Concatenation %p (depth = %d, len = %ld, %s balanced)\n",
- __r, __r->_M_depth, __r->_M_size, __r->_M_is_balanced? "" : "not");
-# else
- printf("Concatenation %p (rc = %ld, depth = %d, "
- "len = %ld, %s balanced)\n",
- __r, __r->_M_refcount, __r->_M_depth, __r->_M_size,
- __r->_M_is_balanced? "" : "not");
-# endif
- _S_dump(__left, __indent + 2);
- _S_dump(__right, __indent + 2);
- return;
- } else {
- char* __kind;
-
- switch (__r->_M_tag) {
- case _RopeRep::_S_leaf:
- __kind = "Leaf";
- break;
- case _RopeRep::_S_function:
- __kind = "Function";
- break;
- case _RopeRep::_S_substringfn:
- __kind = "Function representing substring";
- break;
- default:
- __kind = "(corrupted kind field!)";
- }
-# ifdef __GC
- printf("%s %p (depth = %d, len = %ld) ",
- __kind, __r, __r->_M_depth, __r->_M_size);
-# else
- printf("%s %p (rc = %ld, depth = %d, len = %ld) ",
- __kind, __r, __r->_M_refcount, __r->_M_depth, __r->_M_size);
-# endif
- if (_S_is_one_byte_char_type((_CharT*)0)) {
- const int __max_len = 40;
- _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));
- _CharT __buffer[__max_len + 1];
- bool __too_big = __r->_M_size > __prefix->_M_size;
-
- _S_flatten(__prefix, __buffer);
- __buffer[__prefix->_M_size] = _S_eos((_CharT*)0);
- printf("%s%s\n",
- (char*)__buffer, __too_big? "...\n" : "\n");
- } else {
- printf("\n");
- }
- }
-}
-
-template <class _CharT, class _Alloc>
-const unsigned long
-rope<_CharT,_Alloc>::_S_min_len[
- _Rope_RopeRep<_CharT,_Alloc>::_S_max_rope_depth + 1] = {
-/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21,
-/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377,
-/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181,
-/* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368,
-/* 23 */75025, /* 24 */121393, /* 25 */196418, /* 26 */317811,
-/* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309,
-/* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352,
-/* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155,
-/* 39 */165580141, /* 40 */267914296, /* 41 */433494437,
-/* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903,
-/* 45 */2971215073u };
-// These are Fibonacci numbers < 2**32.
-
-template <class _CharT, class _Alloc>
-rope<_CharT,_Alloc>::_RopeRep*
-rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r)
-{
- _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1];
- _RopeRep* __result = 0;
- int __i;
- // Invariant:
- // The concatenation of forest in descending order is equal to __r.
- // __forest[__i]._M_size >= _S_min_len[__i]
- // __forest[__i]._M_depth = __i
- // References from forest are included in refcount.
-
- for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
- __forest[__i] = 0;
- __STL_TRY {
- _S_add_to_forest(__r, __forest);
- for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
- if (0 != __forest[__i]) {
-# ifndef __GC
- _Self_destruct_ptr __old(__result);
-# endif
- __result = _S_concat(__forest[__i], __result);
- __forest[__i]->_M_unref_nonnil();
-# if !defined(__GC) && defined(__STL_USE_EXCEPTIONS)
- __forest[__i] = 0;
-# endif
- }
- }
- __STL_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; __i++)
- _S_unref(__forest[__i]))
- if (__result->_M_depth > _RopeRep::_S_max_rope_depth) abort();
- return(__result);
-}
-
-
-template <class _CharT, class _Alloc>
-void
-rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)
-{
- if (__r->_M_is_balanced) {
- _S_add_leaf_to_forest(__r, __forest);
- return;
- }
- __stl_assert(__r->_M_tag == _RopeRep::_S_concat);
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
-
- _S_add_to_forest(__c->_M_left, __forest);
- _S_add_to_forest(__c->_M_right, __forest);
- }
-}
-
-
-template <class _CharT, class _Alloc>
-void
-rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
-{
- _RopeRep* __insertee; // included in refcount
- _RopeRep* __too_tiny = 0; // included in refcount
- int __i; // forest[0..__i-1] is empty
- size_t __s = __r->_M_size;
-
- for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) {
- if (0 != __forest[__i]) {
-# ifndef __GC
- _Self_destruct_ptr __old(__too_tiny);
-# endif
- __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny);
- __forest[__i]->_M_unref_nonnil();
- __forest[__i] = 0;
- }
- }
- {
-# ifndef __GC
- _Self_destruct_ptr __old(__too_tiny);
-# endif
- __insertee = _S_concat_and_set_balanced(__too_tiny, __r);
- }
- // Too_tiny dead, and no longer included in refcount.
- // Insertee is live and included.
- __stl_assert(_S_is_almost_balanced(__insertee));
- __stl_assert(__insertee->_M_depth <= __r->_M_depth + 1);
- for (;; ++__i) {
- if (0 != __forest[__i]) {
-# ifndef __GC
- _Self_destruct_ptr __old(__insertee);
-# endif
- __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee);
- __forest[__i]->_M_unref_nonnil();
- __forest[__i] = 0;
- __stl_assert(_S_is_almost_balanced(__insertee));
- }
- __stl_assert(_S_min_len[__i] <= __insertee->_M_size);
- __stl_assert(__forest[__i] == 0);
- if (__i == _RopeRep::_S_max_rope_depth ||
- __insertee->_M_size < _S_min_len[__i+1]) {
- __forest[__i] = __insertee;
- // refcount is OK since __insertee is now dead.
- return;
- }
- }
-}
-
-template <class _CharT, class _Alloc>
-_CharT
-rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i)
-{
- __GC_CONST _CharT* __cstr = __r->_M_c_string;
-
- __stl_assert(__i < __r->_M_size);
- if (0 != __cstr) return __cstr[__i];
- for(;;) {
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
- _RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size;
-
- if (__i >= __left_len) {
- __i -= __left_len;
- __r = __c->_M_right;
- } else {
- __r = __left;
- }
- }
- break;
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = (_RopeLeaf*)__r;
- return __l->_M_data[__i];
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- {
- _RopeFunction* __f = (_RopeFunction*)__r;
- _CharT __result;
-
- (*(__f->_M_fn))(__i, 1, &__result);
- return __result;
- }
- }
- }
-}
-
-# ifndef __GC
-// Return a uniquely referenced character slot for the given
-// position, or 0 if that's not possible.
-template <class _CharT, class _Alloc>
-_CharT*
-rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i)
-{
- _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth];
- size_t __csptr = 0;
-
- for(;;) {
- if (__r->_M_refcount > 1) return 0;
- switch(__r->_M_tag) {
- case _RopeRep::_S_concat:
- {
- _RopeConcatenation* __c = (_RopeConcatenation*)__r;
- _RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size;
-
- if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c;
- if (__i >= __left_len) {
- __i -= __left_len;
- __r = __c->_M_right;
- } else {
- __r = __left;
- }
- }
- break;
- case _RopeRep::_S_leaf:
- {
- _RopeLeaf* __l = (_RopeLeaf*)__r;
- if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)
- __clrstack[__csptr++] = __l;
- while (__csptr > 0) {
- -- __csptr;
- _RopeRep* __d = __clrstack[__csptr];
- __d->_M_free_c_string();
- __d->_M_c_string = 0;
- }
- return __l->_M_data + __i;
- }
- case _RopeRep::_S_function:
- case _RopeRep::_S_substringfn:
- return 0;
- }
- }
-}
-# endif /* __GC */
-
-// The following could be implemented trivially using
-// lexicographical_compare_3way.
-// We do a little more work to avoid dealing with rope iterators for
-// flat strings.
-template <class _CharT, class _Alloc>
-int
-rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left,
- const _RopeRep* __right)
-{
- size_t __left_len;
- size_t __right_len;
-
- if (0 == __right) return 0 != __left;
- if (0 == __left) return -1;
- __left_len = __left->_M_size;
- __right_len = __right->_M_size;
- if (_RopeRep::_S_leaf == __left->_M_tag) {
- _RopeLeaf* __l = (_RopeLeaf*) __left;
- if (_RopeRep::_S_leaf == __right->_M_tag) {
- _RopeLeaf* __r = (_RopeLeaf*) __right;
- return lexicographical_compare_3way(
- __l->_M_data, __l->_M_data + __left_len,
- __r->_M_data, __r->_M_data + __right_len);
- } else {
- const_iterator __rstart(__right, 0);
- const_iterator __rend(__right, __right_len);
- return lexicographical_compare_3way(
- __l->_M_data, __l->_M_data + __left_len,
- __rstart, __rend);
- }
- } else {
- const_iterator __lstart(__left, 0);
- const_iterator __lend(__left, __left_len);
- if (_RopeRep::_S_leaf == __right->_M_tag) {
- _RopeLeaf* __r = (_RopeLeaf*) __right;
- return lexicographical_compare_3way(
- __lstart, __lend,
- __r->_M_data, __r->_M_data + __right_len);
- } else {
- const_iterator __rstart(__right, 0);
- const_iterator __rend(__right, __right_len);
- return lexicographical_compare_3way(
- __lstart, __lend,
- __rstart, __rend);
- }
- }
-}
-
-// Assignment to reference proxies.
-template <class _CharT, class _Alloc>
-_Rope_char_ref_proxy<_CharT, _Alloc>&
-_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) {
- _RopeRep* __old = _M_root->_M_tree_ptr;
-# ifndef __GC
- // First check for the case in which everything is uniquely
- // referenced. In that case we can do this destructively.
- _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);
- if (0 != __ptr) {
- *__ptr = __c;
- return *this;
- }
-# endif
- _Self_destruct_ptr __left(
- _My_rope::_S_substring(__old, 0, _M_pos));
- _Self_destruct_ptr __right(
- _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size));
- _Self_destruct_ptr __result_left(
- _My_rope::_S_destr_concat_char_iter(__left, &__c, 1));
-
-# ifndef __GC
- __stl_assert(__left == __result_left || 1 == __result_left->_M_refcount);
-# endif
- _RopeRep* __result =
- _My_rope::_S_concat(__result_left, __right);
-# ifndef __GC
- __stl_assert(1 <= __result->_M_refcount);
- _RopeRep::_S_unref(__old);
-# endif
- _M_root->_M_tree_ptr = __result;
- return *this;
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const
-{
- if (_M_current_valid) {
- return _M_current;
- } else {
- return _My_rope::_S_fetch(_M_root->_M_tree_ptr, _M_pos);
- }
-}
-template <class _CharT, class _Alloc>
-_Rope_char_ptr_proxy<_CharT, _Alloc>
-_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const {
- return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this);
-}
-
-template <class _CharT, class _Alloc>
-rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c,
- const allocator_type& __a)
-: _Base(__a)
-{
- rope<_CharT,_Alloc> __result;
- const size_t __exponentiate_threshold = 32;
- size_t __exponent;
- size_t __rest;
- _CharT* __rest_buffer;
- _RopeRep* __remainder;
- rope<_CharT,_Alloc> __remainder_rope;
-
- if (0 == __n)
- return;
-
- __exponent = __n / __exponentiate_threshold;
- __rest = __n % __exponentiate_threshold;
- if (0 == __rest) {
- __remainder = 0;
- } else {
- __rest_buffer = _Data_allocate(_S_rounded_up_size(__rest));
- uninitialized_fill_n(__rest_buffer, __rest, __c);
- _S_cond_store_eos(__rest_buffer[__rest]);
- __STL_TRY {
- __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a);
- }
- __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, __a))
- }
- __remainder_rope._M_tree_ptr = __remainder;
- if (__exponent != 0) {
- _CharT* __base_buffer =
- _Data_allocate(_S_rounded_up_size(__exponentiate_threshold));
- _RopeLeaf* __base_leaf;
- rope __base_rope;
- uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c);
- _S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
- __STL_TRY {
- __base_leaf = _S_new_RopeLeaf(__base_buffer,
- __exponentiate_threshold, __a);
- }
- __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__base_buffer,
- __exponentiate_threshold, __a))
- __base_rope._M_tree_ptr = __base_leaf;
- if (1 == __exponent) {
- __result = __base_rope;
-# ifndef __GC
- __stl_assert(2 == __result._M_tree_ptr->_M_refcount);
- // One each for base_rope and __result
-# endif
- } else {
- // XXX what is power()?
- __result = power(__base_rope, __exponent, _Concat_fn());
- }
- if (0 != __remainder) {
- __result += __remainder_rope;
- }
- } else {
- __result = __remainder_rope;
- }
- _M_tree_ptr = __result._M_tree_ptr;
- _M_tree_ptr->_M_ref_nonnil();
-}
-
-template<class _CharT, class _Alloc>
- _CharT rope<_CharT,_Alloc>::_S_empty_c_str[1];
-
-# ifdef __STL_PTHREADS
- template<class _CharT, class _Alloc>
- pthread_mutex_t
- rope<_CharT,_Alloc>::_S_swap_lock = PTHREAD_MUTEX_INITIALIZER;
-# endif
-
-template<class _CharT, class _Alloc>
-const _CharT* rope<_CharT,_Alloc>::c_str() const {
- if (0 == _M_tree_ptr) {
- _S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant,
- // but probably fast.
- return _S_empty_c_str;
- }
- __GC_CONST _CharT* __old_c_string = _M_tree_ptr->_M_c_string;
- if (0 != __old_c_string) return(__old_c_string);
- size_t __s = size();
- _CharT* __result = _Data_allocate(__s + 1);
- _S_flatten(_M_tree_ptr, __result);
- __result[__s] = _S_eos((_CharT*)0);
-# ifdef __GC
- _M_tree_ptr->_M_c_string = __result;
-# else
- if ((__old_c_string =
- _S_atomic_swap(&(_M_tree_ptr->_M_c_string), __result)) != 0) {
- // It must have been added in the interim. Hence it had to have been
- // separately allocated. Deallocate the old copy, since we just
- // replaced it.
- destroy(__old_c_string, __old_c_string + __s + 1);
- _Data_deallocate(__old_c_string, __s + 1);
- }
-# endif
- return(__result);
-}
-
-template<class _CharT, class _Alloc>
-const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() {
- if (0 == _M_tree_ptr) {
- _S_empty_c_str[0] = _S_eos((_CharT*)0);
- return _S_empty_c_str;
- }
- __GC_CONST _CharT* __old_c_string = _M_tree_ptr->_M_c_string;
- if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag && 0 != __old_c_string) {
- return(__old_c_string);
- }
- size_t __s = size();
- _CharT* __result = _Data_allocate(_S_rounded_up_size(__s));
- _S_flatten(_M_tree_ptr, __result);
- __result[__s] = _S_eos((_CharT*)0);
- _M_tree_ptr->_M_unref_nonnil();
- _M_tree_ptr = _S_new_RopeLeaf(__result, __s, get_allocator());
- return(__result);
-}
-
-// Algorithm specializations. More should be added.
-
-#ifndef _MSC_VER
-// I couldn't get this to work with VC++
-template<class _CharT,class _Alloc>
-void
-_Rope_rotate(_Rope_iterator<_CharT,_Alloc> __first,
- _Rope_iterator<_CharT,_Alloc> __middle,
- _Rope_iterator<_CharT,_Alloc> __last)
-{
- __stl_assert(__first.container() == __middle.container()
- && __middle.container() == __last.container());
- rope<_CharT,_Alloc>& __r(__first.container());
- rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
- rope<_CharT,_Alloc> __suffix =
- __r.substr(__last.index(), __r.size() - __last.index());
- rope<_CharT,_Alloc> __part1 =
- __r.substr(__middle.index(), __last.index() - __middle.index());
- rope<_CharT,_Alloc> __part2 =
- __r.substr(__first.index(), __middle.index() - __first.index());
- __r = __prefix;
- __r += __part1;
- __r += __part2;
- __r += __suffix;
-}
-
-#if !defined(__GNUC__)
-// Appears to confuse g++
-inline void rotate(_Rope_iterator<char,__STL_DEFAULT_ALLOCATOR(char)> __first,
- _Rope_iterator<char,__STL_DEFAULT_ALLOCATOR(char)> __middle,
- _Rope_iterator<char,__STL_DEFAULT_ALLOCATOR(char)> __last) {
- _Rope_rotate(__first, __middle, __last);
-}
-#endif
-
-# if 0
-// Probably not useful for several reasons:
-// - for SGIs 7.1 compiler and probably some others,
-// this forces lots of rope<wchar_t, ...> instantiations, creating a
-// code bloat and compile time problem. (Fixed in 7.2.)
-// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive
-// for unicode strings. Unsigned short may be a better character
-// type.
-inline void rotate(
- _Rope_iterator<wchar_t,__STL_DEFAULT_ALLOCATOR(char)> __first,
- _Rope_iterator<wchar_t,__STL_DEFAULT_ALLOCATOR(char)> __middle,
- _Rope_iterator<wchar_t,__STL_DEFAULT_ALLOCATOR(char)> __last) {
- _Rope_rotate(__first, __middle, __last);
-}
-# endif
-#endif /* _MSC_VER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#endif
-
-__STL_END_NAMESPACE
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/set b/contrib/libstdc++/stl/set
deleted file mode 100644
index c836c45..0000000
--- a/contrib/libstdc++/stl/set
+++ /dev/null
@@ -1,40 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_SET
-#define __SGI_STL_SET
-
-#ifndef __SGI_STL_INTERNAL_TREE_H
-#include <stl_tree.h>
-#endif
-#include <stl_set.h>
-#include <stl_multiset.h>
-
-#endif /* __SGI_STL_SET */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/set.h b/contrib/libstdc++/stl/set.h
deleted file mode 100644
index 9004d2e..0000000
--- a/contrib/libstdc++/stl/set.h
+++ /dev/null
@@ -1,41 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_SET_H
-#define __SGI_STL_SET_H
-
-#include <tree.h>
-#include <stl_set.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::set;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_SET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/slist b/contrib/libstdc++/stl/slist
deleted file mode 100644
index c3ec742..0000000
--- a/contrib/libstdc++/stl/slist
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_SLIST
-#define __SGI_STL_SLIST
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_slist.h>
-
-#endif /* __SGI_STL_SLIST */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/slist.h b/contrib/libstdc++/stl/slist.h
deleted file mode 100644
index d2377b0..0000000
--- a/contrib/libstdc++/stl/slist.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __SGI_STL_SLIST_H
-#define __SGI_STL_SLIST_H
-
-#include <algobase.h>
-#include <alloc.h>
-#include <stl_slist.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::slist;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_SLIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stack b/contrib/libstdc++/stl/stack
deleted file mode 100644
index 36461d9..0000000
--- a/contrib/libstdc++/stl/stack
+++ /dev/null
@@ -1,41 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_STACK
-#define __SGI_STL_STACK
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_deque.h>
-#include <stl_stack.h>
-
-#endif /* __SGI_STL_STACK */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stack.h b/contrib/libstdc++/stl/stack.h
deleted file mode 100644
index 89beca8..0000000
--- a/contrib/libstdc++/stl/stack.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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_STACK_H
-#define __SGI_STL_STACK_H
-
-#include <vector.h>
-#include <deque.h>
-#include <heap.h>
-#include <stl_stack.h>
-#include <stl_queue.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::stack;
-using __STD::queue;
-using __STD::priority_queue;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_STACK_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_algo.h b/contrib/libstdc++/stl/stl_algo.h
deleted file mode 100644
index e9beaee..0000000
--- a/contrib/libstdc++/stl/stl_algo.h
+++ /dev/null
@@ -1,2894 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_ALGO_H
-#define __SGI_STL_INTERNAL_ALGO_H
-
-#include <stl_heap.h>
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
-
-// __median (an extension, not present in the C++ standard).
-
-template <class _Tp>
-inline const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __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 _Tp, class _Compare>
-inline const _Tp&
-__median(const _Tp& __a, const _Tp& __b, const _Tp& __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;
-}
-
-// for_each. Apply a function to every element of a range.
-template <class _InputIter, class _Function>
-_Function for_each(_InputIter __first, _InputIter __last, _Function __f) {
- for ( ; __first != __last; ++__first)
- __f(*__first);
- return __f;
-}
-
-// find and find_if.
-
-template <class _InputIter, class _Tp>
-inline _InputIter find(_InputIter __first, _InputIter __last,
- const _Tp& __val,
- input_iterator_tag)
-{
- while (__first != __last && *__first != __val)
- ++__first;
- return __first;
-}
-
-template <class _InputIter, class _Predicate>
-inline _InputIter find_if(_InputIter __first, _InputIter __last,
- _Predicate __pred,
- input_iterator_tag)
-{
- while (__first != __last && !__pred(*__first))
- ++__first;
- return __first;
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _RandomAccessIter, class _Tp>
-_RandomAccessIter find(_RandomAccessIter __first, _RandomAccessIter __last,
- const _Tp& __val,
- random_access_iterator_tag)
-{
- typename iterator_traits<_RandomAccessIter>::difference_type __trip_count
- = (__last - __first) >> 2;
-
- for ( ; __trip_count > 0 ; --__trip_count) {
- if (*__first == __val) return __first;
- ++__first;
-
- if (*__first == __val) return __first;
- ++__first;
-
- if (*__first == __val) return __first;
- ++__first;
-
- if (*__first == __val) return __first;
- ++__first;
- }
-
- switch(__last - __first) {
- case 3:
- if (*__first == __val) return __first;
- ++__first;
- case 2:
- if (*__first == __val) return __first;
- ++__first;
- case 1:
- if (*__first == __val) return __first;
- ++__first;
- case 0:
- default:
- return __last;
- }
-}
-
-template <class _RandomAccessIter, class _Predicate>
-_RandomAccessIter find_if(_RandomAccessIter __first, _RandomAccessIter __last,
- _Predicate __pred,
- random_access_iterator_tag)
-{
- typename iterator_traits<_RandomAccessIter>::difference_type __trip_count
- = (__last - __first) >> 2;
-
- for ( ; __trip_count > 0 ; --__trip_count) {
- if (__pred(*__first)) return __first;
- ++__first;
-
- if (__pred(*__first)) return __first;
- ++__first;
-
- if (__pred(*__first)) return __first;
- ++__first;
-
- if (__pred(*__first)) return __first;
- ++__first;
- }
-
- switch(__last - __first) {
- case 3:
- if (__pred(*__first)) return __first;
- ++__first;
- case 2:
- if (__pred(*__first)) return __first;
- ++__first;
- case 1:
- if (__pred(*__first)) return __first;
- ++__first;
- case 0:
- default:
- return __last;
- }
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIter, class _Tp>
-inline _InputIter find(_InputIter __first, _InputIter __last,
- const _Tp& __val)
-{
- return find(__first, __last, __val, __ITERATOR_CATEGORY(__first));
-}
-
-template <class _InputIter, class _Predicate>
-inline _InputIter find_if(_InputIter __first, _InputIter __last,
- _Predicate __pred) {
- return find_if(__first, __last, __pred, __ITERATOR_CATEGORY(__first));
-}
-
-// adjacent_find.
-
-template <class _ForwardIter>
-_ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last) {
- if (__first == __last)
- return __last;
- _ForwardIter __next = __first;
- while(++__next != __last) {
- if (*__first == *__next)
- return __first;
- __first = __next;
- }
- return __last;
-}
-
-template <class _ForwardIter, class _BinaryPredicate>
-_ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last,
- _BinaryPredicate __binary_pred) {
- if (__first == __last)
- return __last;
- _ForwardIter __next = __first;
- while(++__next != __last) {
- if (__binary_pred(*__first, *__next))
- return __first;
- __first = __next;
- }
- return __last;
-}
-
-// count and count_if. There are two version of each, one whose return type
-// type is void and one (present only if we have partial specialization)
-// whose return type is iterator_traits<_InputIter>::difference_type. The
-// C++ standard only has the latter version, but the former, which was present
-// in the HP STL, is retained for backward compatibility.
-
-template <class _InputIter, class _Tp, class _Size>
-void count(_InputIter __first, _InputIter __last, const _Tp& __value,
- _Size& __n) {
- for ( ; __first != __last; ++__first)
- if (*__first == __value)
- ++__n;
-}
-
-template <class _InputIter, class _Predicate, class _Size>
-void count_if(_InputIter __first, _InputIter __last, _Predicate __pred,
- _Size& __n) {
- for ( ; __first != __last; ++__first)
- if (__pred(*__first))
- ++__n;
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _InputIter, class _Tp>
-typename iterator_traits<_InputIter>::difference_type
-count(_InputIter __first, _InputIter __last, const _Tp& __value) {
- typename iterator_traits<_InputIter>::difference_type __n = 0;
- for ( ; __first != __last; ++__first)
- if (*__first == __value)
- ++__n;
- return __n;
-}
-
-template <class _InputIter, class _Predicate>
-typename iterator_traits<_InputIter>::difference_type
-count_if(_InputIter __first, _InputIter __last, _Predicate __pred) {
- typename iterator_traits<_InputIter>::difference_type __n = 0;
- for ( ; __first != __last; ++__first)
- if (__pred(*__first))
- ++__n;
- return __n;
-}
-
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// search.
-
-template <class _ForwardIter1, class _ForwardIter2>
-_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2)
-{
- // Test for empty ranges
- if (__first1 == __last1 || __first2 == __last2)
- return __first1;
-
- // Test for a pattern of length 1.
- _ForwardIter2 __tmp(__first2);
- ++__tmp;
- if (__tmp == __last2)
- return find(__first1, __last1, *__first2);
-
- // General case.
-
- _ForwardIter2 __p1, __p;
-
- __p1 = __first2; ++__p1;
-
- _ForwardIter1 __current = __first1;
-
- while (__first1 != __last1) {
- __first1 = find(__first1, __last1, *__first2);
- if (__first1 == __last1)
- return __last1;
-
- __p = __p1;
- __current = __first1;
- if (++__current == __last1)
- return __last1;
-
- while (*__current == *__p) {
- if (++__p == __last2)
- return __first1;
- if (++__current == __last1)
- return __last1;
- }
-
- ++__first1;
- }
- return __first1;
-}
-
-template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
-_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- _BinaryPred __predicate)
-{
- // Test for empty ranges
- if (__first1 == __last1 || __first2 == __last2)
- return __first1;
-
- // Test for a pattern of length 1.
- _ForwardIter2 __tmp(__first2);
- ++__tmp;
- if (__tmp == __last2)
- return find(__first1, __last1, *__first2);
-
- // General case.
-
- _ForwardIter2 __p1, __p;
-
- __p1 = __first2; ++__p1;
-
- _ForwardIter1 __current = __first1;
-
- while (__first1 != __last1) {
- while (__first1 != __last1) {
- if (__predicate(*__first1, *__first2))
- break;
- ++__first1;
- }
- while (__first1 != __last1 && !__predicate(*__first1, *__first2))
- ++__first1;
- if (__first1 == __last1)
- return __last1;
-
- __p = __p1;
- __current = __first1;
- if (++__current == __last1) return __last1;
-
- while (__predicate(*__current, *__p)) {
- if (++__p == __last2)
- return __first1;
- if (++__current == __last1)
- return __last1;
- }
-
- ++__first1;
- }
- return __first1;
-}
-
-// search_n. Search for __count consecutive copies of __val.
-
-template <class _ForwardIter, class _Integer, class _Tp>
-_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
- _Integer __count, const _Tp& __val) {
- if (__count <= 0)
- return __first;
- else {
- __first = find(__first, __last, __val);
- while (__first != __last) {
- _Integer __n = __count - 1;
- _ForwardIter __i = __first;
- ++__i;
- while (__i != __last && __n != 0 && *__i == __val) {
- ++__i;
- --__n;
- }
- if (__n == 0)
- return __first;
- else
- __first = find(__i, __last, __val);
- }
- return __last;
- }
-}
-
-template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
-_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
- _Integer __count, const _Tp& __val,
- _BinaryPred __binary_pred) {
- if (__count <= 0)
- return __first;
- else {
- while (__first != __last) {
- if (__binary_pred(*__first, __val))
- break;
- ++__first;
- }
- while (__first != __last) {
- _Integer __n = __count - 1;
- _ForwardIter __i = __first;
- ++__i;
- while (__i != __last && __n != 0 && __binary_pred(*__i, __val)) {
- ++__i;
- --__n;
- }
- if (__n == 0)
- return __first;
- else {
- while (__i != __last) {
- if (__binary_pred(*__i, __val))
- break;
- ++__i;
- }
- __first = __i;
- }
- }
- return __last;
- }
-}
-
-// swap_ranges
-
-template <class _ForwardIter1, class _ForwardIter2>
-_ForwardIter2 swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2) {
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- iter_swap(__first1, __first2);
- return __first2;
-}
-
-// transform
-
-template <class _InputIter, class _OutputIter, class _UnaryOperation>
-_OutputIter transform(_InputIter __first, _InputIter __last,
- _OutputIter __result, _UnaryOperation __oper) {
- for ( ; __first != __last; ++__first, ++__result)
- *__result = __oper(*__first);
- return __result;
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _BinaryOperation>
-_OutputIter transform(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _OutputIter __result,
- _BinaryOperation __binary_op) {
- for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result)
- *__result = __binary_op(*__first1, *__first2);
- return __result;
-}
-
-// replace, replace_if, replace_copy, replace_copy_if
-
-template <class _ForwardIter, class _Tp>
-void replace(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __old_value, const _Tp& __new_value) {
- for ( ; __first != __last; ++__first)
- if (*__first == __old_value)
- *__first = __new_value;
-}
-
-template <class _ForwardIter, class _Predicate, class _Tp>
-void replace_if(_ForwardIter __first, _ForwardIter __last,
- _Predicate __pred, const _Tp& __new_value) {
- for ( ; __first != __last; ++__first)
- if (__pred(*__first))
- *__first = __new_value;
-}
-
-template <class _InputIter, class _OutputIter, class _Tp>
-_OutputIter replace_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result,
- const _Tp& __old_value, const _Tp& __new_value) {
- for ( ; __first != __last; ++__first, ++__result)
- *__result = *__first == __old_value ? __new_value : *__first;
- return __result;
-}
-
-template <class Iterator, class _OutputIter, class _Predicate, class _Tp>
-_OutputIter replace_copy_if(Iterator __first, Iterator __last,
- _OutputIter __result,
- _Predicate __pred, const _Tp& __new_value) {
- for ( ; __first != __last; ++__first, ++__result)
- *__result = __pred(*__first) ? __new_value : *__first;
- return __result;
-}
-
-// generate and generate_n
-
-template <class _ForwardIter, class _Generator>
-void generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) {
- for ( ; __first != __last; ++__first)
- *__first = __gen();
-}
-
-template <class _OutputIter, class _Size, class _Generator>
-_OutputIter generate_n(_OutputIter __first, _Size __n, _Generator __gen) {
- for ( ; __n > 0; --__n, ++__first)
- *__first = __gen();
- return __first;
-}
-
-// remove, remove_if, remove_copy, remove_copy_if
-
-template <class _InputIter, class _OutputIter, class _Tp>
-_OutputIter remove_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result, const _Tp& __value) {
- for ( ; __first != __last; ++__first)
- if (*__first != __value) {
- *__result = *__first;
- ++__result;
- }
- return __result;
-}
-
-template <class _InputIter, class _OutputIter, class _Predicate>
-_OutputIter remove_copy_if(_InputIter __first, _InputIter __last,
- _OutputIter __result, _Predicate __pred) {
- for ( ; __first != __last; ++__first)
- if (!__pred(*__first)) {
- *__result = *__first;
- ++__result;
- }
- return __result;
-}
-
-template <class _ForwardIter, class _Tp>
-_ForwardIter remove(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __value) {
- __first = find(__first, __last, __value);
- _ForwardIter __i = __first;
- return __first == __last ? __first
- : remove_copy(++__i, __last, __first, __value);
-}
-
-template <class _ForwardIter, class _Predicate>
-_ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last,
- _Predicate __pred) {
- __first = find_if(__first, __last, __pred);
- _ForwardIter __i = __first;
- return __first == __last ? __first
- : remove_copy_if(++__i, __last, __first, __pred);
-}
-
-// unique and unique_copy
-
-template <class _InputIter, class _OutputIter, class _Tp>
-_OutputIter __unique_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result, _Tp*) {
- _Tp __value = *__first;
- *__result = __value;
- while (++__first != __last)
- if (__value != *__first) {
- __value = *__first;
- *++__result = __value;
- }
- return ++__result;
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter __unique_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result,
- output_iterator_tag) {
- return __unique_copy(__first, __last, __result, __VALUE_TYPE(__first));
-}
-
-template <class _InputIter, class _ForwardIter>
-_ForwardIter __unique_copy(_InputIter __first, _InputIter __last,
- _ForwardIter __result, forward_iterator_tag) {
- *__result = *__first;
- while (++__first != __last)
- if (*__result != *__first) *++__result = *__first;
- return ++__result;
-}
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter unique_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result) {
- if (__first == __last) return __result;
- return __unique_copy(__first, __last, __result,
- __ITERATOR_CATEGORY(__result));
-}
-
-template <class _InputIter, class _OutputIter, class _BinaryPredicate,
- class _Tp>
-_OutputIter __unique_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result,
- _BinaryPredicate __binary_pred, _Tp*) {
- _Tp __value = *__first;
- *__result = __value;
- while (++__first != __last)
- if (!__binary_pred(__value, *__first)) {
- __value = *__first;
- *++__result = __value;
- }
- return ++__result;
-}
-
-template <class _InputIter, class _OutputIter, class _BinaryPredicate>
-inline _OutputIter __unique_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result,
- _BinaryPredicate __binary_pred,
- output_iterator_tag) {
- return __unique_copy(__first, __last, __result, __binary_pred,
- __VALUE_TYPE(__first));
-}
-
-template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
-_ForwardIter __unique_copy(_InputIter __first, _InputIter __last,
- _ForwardIter __result,
- _BinaryPredicate __binary_pred,
- forward_iterator_tag) {
- *__result = *__first;
- while (++__first != __last)
- if (!__binary_pred(*__result, *__first)) *++__result = *__first;
- return ++__result;
-}
-
-template <class _InputIter, class _OutputIter, class _BinaryPredicate>
-inline _OutputIter unique_copy(_InputIter __first, _InputIter __last,
- _OutputIter __result,
- _BinaryPredicate __binary_pred) {
- if (__first == __last) return __result;
- return __unique_copy(__first, __last, __result, __binary_pred,
- __ITERATOR_CATEGORY(__result));
-}
-
-template <class _ForwardIter>
-_ForwardIter unique(_ForwardIter __first, _ForwardIter __last) {
- __first = adjacent_find(__first, __last);
- return unique_copy(__first, __last, __first);
-}
-
-template <class _ForwardIter, class _BinaryPredicate>
-_ForwardIter unique(_ForwardIter __first, _ForwardIter __last,
- _BinaryPredicate __binary_pred) {
- __first = adjacent_find(__first, __last, __binary_pred);
- return unique_copy(__first, __last, __first, __binary_pred);
-}
-
-// reverse and reverse_copy, and their auxiliary functions
-
-template <class _BidirectionalIter>
-void __reverse(_BidirectionalIter __first, _BidirectionalIter __last,
- bidirectional_iterator_tag) {
- while (true)
- if (__first == __last || __first == --__last)
- return;
- else
- iter_swap(__first++, __last);
-}
-
-template <class _RandomAccessIter>
-void __reverse(_RandomAccessIter __first, _RandomAccessIter __last,
- random_access_iterator_tag) {
- while (__first < __last)
- iter_swap(__first++, --__last);
-}
-
-template <class _BidirectionalIter>
-inline void reverse(_BidirectionalIter __first, _BidirectionalIter __last) {
- __reverse(__first, __last, __ITERATOR_CATEGORY(__first));
-}
-
-template <class _BidirectionalIter, class _OutputIter>
-_OutputIter reverse_copy(_BidirectionalIter __first,
- _BidirectionalIter __last,
- _OutputIter __result) {
- while (__first != __last) {
- --__last;
- *__result = *__last;
- ++__result;
- }
- return __result;
-}
-
-// rotate and rotate_copy, and their auxiliary functions
-
-template <class _EuclideanRingElement>
-_EuclideanRingElement __gcd(_EuclideanRingElement __m,
- _EuclideanRingElement __n)
-{
- while (__n != 0) {
- _EuclideanRingElement __t = __m % __n;
- __m = __n;
- __n = __t;
- }
- return __m;
-}
-
-template <class _ForwardIter, class _Distance>
-_ForwardIter __rotate(_ForwardIter __first,
- _ForwardIter __middle,
- _ForwardIter __last,
- _Distance*,
- forward_iterator_tag) {
- if (__first == __middle)
- return __last;
- if (__last == __middle)
- return __first;
-
- _ForwardIter __first2 = __middle;
- do {
- swap(*__first++, *__first2++);
- if (__first == __middle)
- __middle = __first2;
- } while (__first2 != __last);
-
- _ForwardIter __new_middle = __first;
-
- __first2 = __middle;
-
- while (__first2 != __last) {
- swap (*__first++, *__first2++);
- if (__first == __middle)
- __middle = __first2;
- else if (__first2 == __last)
- __first2 = __middle;
- }
-
- return __new_middle;
-}
-
-
-template <class _BidirectionalIter, class _Distance>
-_BidirectionalIter __rotate(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance*,
- bidirectional_iterator_tag) {
- if (__first == __middle)
- return __last;
- if (__last == __middle)
- return __first;
-
- __reverse(__first, __middle, bidirectional_iterator_tag());
- __reverse(__middle, __last, bidirectional_iterator_tag());
-
- while (__first != __middle && __middle != __last)
- swap (*__first++, *--__last);
-
- if (__first == __middle) {
- __reverse(__middle, __last, bidirectional_iterator_tag());
- return __last;
- }
- else {
- __reverse(__first, __middle, bidirectional_iterator_tag());
- return __first;
- }
-}
-
-template <class _RandomAccessIter, class _Distance, class _Tp>
-_RandomAccessIter __rotate(_RandomAccessIter __first,
- _RandomAccessIter __middle,
- _RandomAccessIter __last,
- _Distance *, _Tp *) {
-
- _Distance __n = __last - __first;
- _Distance __k = __middle - __first;
- _Distance __l = __n - __k;
- _RandomAccessIter __result = __first + (__last - __middle);
-
- if (__k == __l) {
- swap_ranges(__first, __middle, __middle);
- return __result;
- }
-
- _Distance __d = __gcd(__n, __k);
-
- for (_Distance __i = 0; __i < __d; __i++) {
- _Tp __tmp = *__first;
- _RandomAccessIter __p = __first;
-
- if (__k < __l) {
- for (_Distance __j = 0; __j < __l/__d; __j++) {
- if (__p > __first + __l) {
- *__p = *(__p - __l);
- __p -= __l;
- }
-
- *__p = *(__p + __k);
- __p += __k;
- }
- }
-
- else {
- for (_Distance __j = 0; __j < __k/__d - 1; __j ++) {
- if (__p < __last - __k) {
- *__p = *(__p + __k);
- __p += __k;
- }
-
- *__p = * (__p - __l);
- __p -= __l;
- }
- }
-
- *__p = __tmp;
- ++__first;
- }
-
- return __result;
-}
-
-template <class _ForwardIter>
-inline _ForwardIter rotate(_ForwardIter __first, _ForwardIter __middle,
- _ForwardIter __last) {
- return __rotate(__first, __middle, __last,
- __DISTANCE_TYPE(__first),
- __ITERATOR_CATEGORY(__first));
-}
-
-template <class _ForwardIter, class _OutputIter>
-_OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle,
- _ForwardIter __last, _OutputIter __result) {
- return copy(__first, __middle, copy(__middle, __last, __result));
-}
-
-// Return a random number in the range [0, __n). This function encapsulates
-// whether we're using rand (part of the standard C library) or lrand48
-// (not standard, but a much better choice whenever it's available).
-
-template <class _Distance>
-inline _Distance __random_number(_Distance __n) {
-#ifdef __STL_NO_DRAND48
- return rand() % __n;
-#else
- return lrand48() % __n;
-#endif
-}
-
-// random_shuffle
-
-template <class _RandomAccessIter>
-inline void random_shuffle(_RandomAccessIter __first,
- _RandomAccessIter __last) {
- if (__first == __last) return;
- for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
- iter_swap(__i, __first + __random_number((__i - __first) + 1));
-}
-
-template <class _RandomAccessIter, class _RandomNumberGenerator>
-void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
- _RandomNumberGenerator& __rand) {
- if (__first == __last) return;
- for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
- iter_swap(__i, __first + __rand((__i - __first) + 1));
-}
-
-// random_sample and random_sample_n (extensions, not part of the standard).
-
-template <class _ForwardIter, class _OutputIter, class _Distance>
-_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
- _OutputIter __out, const _Distance __n)
-{
- _Distance __remaining = 0;
- distance(__first, __last, __remaining);
- _Distance __m = min(__n, __remaining);
-
- while (__m > 0) {
- if (__random_number(__remaining) < __m) {
- *__out = *__first;
- ++__out;
- --__m;
- }
-
- --__remaining;
- ++__first;
- }
- return __out;
-}
-
-template <class _ForwardIter, class _OutputIter, class _Distance,
- class _RandomNumberGenerator>
-_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
- _OutputIter __out, const _Distance __n,
- _RandomNumberGenerator& __rand)
-{
- _Distance __remaining = 0;
- distance(__first, __last, __remaining);
- _Distance __m = min(__n, __remaining);
-
- while (__m > 0) {
- if (__rand(__remaining) < __m) {
- *__out = *__first;
- ++__out;
- --__m;
- }
-
- --__remaining;
- ++__first;
- }
- return __out;
-}
-
-template <class _InputIter, class _RandomAccessIter, class _Distance>
-_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out,
- const _Distance __n)
-{
- _Distance __m = 0;
- _Distance __t = __n;
- for ( ; __first != __last && __m < __n; ++__m, ++__first)
- __out[__m] = *__first;
-
- while (__first != __last) {
- ++__t;
- _Distance __M = __random_number(__t);
- if (__M < __n)
- __out[__M] = *__first;
- ++__first;
- }
-
- return __out + __m;
-}
-
-template <class _InputIter, class _RandomAccessIter,
- class _RandomNumberGenerator, class _Distance>
-_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out,
- _RandomNumberGenerator& __rand,
- const _Distance __n)
-{
- _Distance __m = 0;
- _Distance __t = __n;
- for ( ; __first != __last && __m < __n; ++__m, ++__first)
- __out[__m] = *__first;
-
- while (__first != __last) {
- ++__t;
- _Distance __M = __rand(__t);
- if (__M < __n)
- __out[__M] = *__first;
- ++__first;
- }
-
- return __out + __m;
-}
-
-template <class _InputIter, class _RandomAccessIter>
-inline _RandomAccessIter
-random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_first, _RandomAccessIter __out_last)
-{
- return __random_sample(__first, __last,
- __out_first, __out_last - __out_first);
-}
-
-
-template <class _InputIter, class _RandomAccessIter,
- class _RandomNumberGenerator>
-inline _RandomAccessIter
-random_sample(_InputIter __first, _InputIter __last,
- _RandomAccessIter __out_first, _RandomAccessIter __out_last,
- _RandomNumberGenerator& __rand)
-{
- return __random_sample(__first, __last,
- __out_first, __rand,
- __out_last - __out_first);
-}
-
-// partition, stable_partition, and their auxiliary functions
-
-template <class _ForwardIter, class _Predicate>
-_ForwardIter __partition(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred,
- forward_iterator_tag) {
- if (__first == __last) return __first;
-
- while (__pred(*__first))
- if (++__first == __last) return __first;
-
- _ForwardIter __next = __first;
-
- while (++__next != __last)
- if (__pred(*__next)) {
- swap(*__first, *__next);
- ++__first;
- }
-
- return __first;
-}
-
-template <class _BidirectionalIter, class _Predicate>
-_BidirectionalIter __partition(_BidirectionalIter __first,
- _BidirectionalIter __last,
- _Predicate __pred,
- bidirectional_iterator_tag) {
- 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 _ForwardIter, class _Predicate>
-inline _ForwardIter partition(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred) {
- return __partition(__first, __last, __pred, __ITERATOR_CATEGORY(__first));
-}
-
-
-template <class _ForwardIter, class _Predicate, class _Distance>
-_ForwardIter __inplace_stable_partition(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred, _Distance __len) {
- if (__len == 1)
- return __pred(*__first) ? __last : __first;
- _ForwardIter __middle = __first;
- advance(__middle, __len / 2);
- return rotate(__inplace_stable_partition(__first, __middle, __pred,
- __len / 2),
- __middle,
- __inplace_stable_partition(__middle, __last, __pred,
- __len - __len / 2));
-}
-
-template <class _ForwardIter, class _Pointer, class _Predicate,
- class _Distance>
-_ForwardIter __stable_partition_adaptive(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred, _Distance __len,
- _Pointer __buffer,
- _Distance __buffer_size)
-{
- if (__len <= __buffer_size) {
- _ForwardIter __result1 = __first;
- _Pointer __result2 = __buffer;
- for ( ; __first != __last ; ++__first)
- if (__pred(*__first)) {
- *__result1 = *__first;
- ++__result1;
- }
- else {
- *__result2 = *__first;
- ++__result2;
- }
- copy(__buffer, __result2, __result1);
- return __result1;
- }
- else {
- _ForwardIter __middle = __first;
- advance(__middle, __len / 2);
- return rotate(__stable_partition_adaptive(
- __first, __middle, __pred,
- __len / 2, __buffer, __buffer_size),
- __middle,
- __stable_partition_adaptive(
- __middle, __last, __pred,
- __len - __len / 2, __buffer, __buffer_size));
- }
-}
-
-template <class _ForwardIter, class _Predicate, class _Tp, class _Distance>
-inline _ForwardIter
-__stable_partition_aux(_ForwardIter __first, _ForwardIter __last,
- _Predicate __pred, _Tp*, _Distance*)
-{
- _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last);
- if (__buf.size() > 0)
- return __stable_partition_adaptive(__first, __last, __pred,
- _Distance(__buf.requested_size()),
- __buf.begin(), __buf.size());
- else
- return __inplace_stable_partition(__first, __last, __pred,
- _Distance(__buf.requested_size()));
-}
-
-template <class _ForwardIter, class _Predicate>
-inline _ForwardIter stable_partition(_ForwardIter __first,
- _ForwardIter __last,
- _Predicate __pred) {
- if (__first == __last)
- return __first;
- else
- return __stable_partition_aux(__first, __last, __pred,
- __VALUE_TYPE(__first),
- __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIter, class _Tp>
-_RandomAccessIter __unguarded_partition(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Tp __pivot)
-{
- while (true) {
- while (*__first < __pivot)
- ++__first;
- --__last;
- while (__pivot < *__last)
- --__last;
- if (!(__first < __last))
- return __first;
- iter_swap(__first, __last);
- ++__first;
- }
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-_RandomAccessIter __unguarded_partition(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Tp __pivot, _Compare __comp)
-{
- while (true) {
- 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;
-
-// sort() and its auxiliary functions.
-
-template <class _RandomAccessIter, class _Tp>
-void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val) {
- _RandomAccessIter __next = __last;
- --__next;
- while (__val < *__next) {
- *__last = *__next;
- __last = __next;
- --__next;
- }
- *__last = __val;
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val,
- _Compare __comp) {
- _RandomAccessIter __next = __last;
- --__next;
- while (__comp(__val, *__next)) {
- *__last = *__next;
- __last = __next;
- --__next;
- }
- *__last = __val;
-}
-
-template <class _RandomAccessIter, class _Tp>
-inline void __linear_insert(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*) {
- _Tp __val = *__last;
- if (__val < *__first) {
- copy_backward(__first, __last, __last + 1);
- *__first = __val;
- }
- else
- __unguarded_linear_insert(__last, __val);
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-inline void __linear_insert(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*, _Compare __comp) {
- _Tp __val = *__last;
- if (__comp(__val, *__first)) {
- copy_backward(__first, __last, __last + 1);
- *__first = __val;
- }
- else
- __unguarded_linear_insert(__last, __val, __comp);
-}
-
-template <class _RandomAccessIter>
-void __insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last) {
- if (__first == __last) return;
- for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
- __linear_insert(__first, __i, __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIter, class _Compare>
-void __insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Compare __comp) {
- if (__first == __last) return;
- for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i)
- __linear_insert(__first, __i, __VALUE_TYPE(__first), __comp);
-}
-
-template <class _RandomAccessIter, class _Tp>
-void __unguarded_insertion_sort_aux(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*) {
- for (_RandomAccessIter __i = __first; __i != __last; ++__i)
- __unguarded_linear_insert(__i, _Tp(*__i));
-}
-
-template <class _RandomAccessIter>
-inline void __unguarded_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last) {
- __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __unguarded_insertion_sort_aux(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Tp*, _Compare __comp) {
- for (_RandomAccessIter __i = __first; __i != __last; ++__i)
- __unguarded_linear_insert(__i, _Tp(*__i), __comp);
-}
-
-template <class _RandomAccessIter, class _Compare>
-inline void __unguarded_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Compare __comp) {
- __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first),
- __comp);
-}
-
-template <class _RandomAccessIter>
-void __final_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __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 _RandomAccessIter, class _Compare>
-void __final_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __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 _Size>
-inline _Size __lg(_Size __n) {
- _Size __k;
- for (__k = 0; __n != 1; __n >>= 1) ++__k;
- return __k;
-}
-
-template <class _RandomAccessIter, class _Tp, class _Size>
-void __introsort_loop(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*,
- _Size __depth_limit)
-{
- while (__last - __first > __stl_threshold) {
- if (__depth_limit == 0) {
- partial_sort(__first, __last, __last);
- return;
- }
- --__depth_limit;
- _RandomAccessIter __cut =
- __unguarded_partition(__first, __last,
- _Tp(__median(*__first,
- *(__first + (__last - __first)/2),
- *(__last - 1))));
- __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit);
- __last = __cut;
- }
-}
-
-template <class _RandomAccessIter, class _Tp, class _Size, class _Compare>
-void __introsort_loop(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*,
- _Size __depth_limit, _Compare __comp)
-{
- while (__last - __first > __stl_threshold) {
- if (__depth_limit == 0) {
- partial_sort(__first, __last, __last, __comp);
- return;
- }
- --__depth_limit;
- _RandomAccessIter __cut =
- __unguarded_partition(__first, __last,
- _Tp(__median(*__first,
- *(__first + (__last - __first)/2),
- *(__last - 1), __comp)),
- __comp);
- __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp);
- __last = __cut;
- }
-}
-
-template <class _RandomAccessIter>
-inline void sort(_RandomAccessIter __first, _RandomAccessIter __last) {
- if (__first != __last) {
- __introsort_loop(__first, __last,
- __VALUE_TYPE(__first),
- __lg(__last - __first) * 2);
- __final_insertion_sort(__first, __last);
- }
-}
-
-template <class _RandomAccessIter, class _Compare>
-inline void sort(_RandomAccessIter __first, _RandomAccessIter __last,
- _Compare __comp) {
- if (__first != __last) {
- __introsort_loop(__first, __last,
- __VALUE_TYPE(__first),
- __lg(__last - __first) * 2,
- __comp);
- __final_insertion_sort(__first, __last, __comp);
- }
-}
-
-// stable_sort() and its auxiliary functions.
-
-template <class _RandomAccessIter>
-void __inplace_stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last) {
- if (__last - __first < 15) {
- __insertion_sort(__first, __last);
- return;
- }
- _RandomAccessIter __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 _RandomAccessIter, class _Compare>
-void __inplace_stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Compare __comp) {
- if (__last - __first < 15) {
- __insertion_sort(__first, __last, __comp);
- return;
- }
- _RandomAccessIter __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 _RandomAccessIter1, class _RandomAccessIter2,
- class _Distance>
-void __merge_sort_loop(_RandomAccessIter1 __first,
- _RandomAccessIter1 __last,
- _RandomAccessIter2 __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 _RandomAccessIter1, class _RandomAccessIter2,
- class _Distance, class _Compare>
-void __merge_sort_loop(_RandomAccessIter1 __first,
- _RandomAccessIter1 __last,
- _RandomAccessIter2 __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 _RandomAccessIter, class _Distance>
-void __chunk_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Distance __chunk_size)
-{
- while (__last - __first >= __chunk_size) {
- __insertion_sort(__first, __first + __chunk_size);
- __first += __chunk_size;
- }
- __insertion_sort(__first, __last);
-}
-
-template <class _RandomAccessIter, class _Distance, class _Compare>
-void __chunk_insertion_sort(_RandomAccessIter __first,
- _RandomAccessIter __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 _RandomAccessIter, class _Pointer, class _Distance>
-void __merge_sort_with_buffer(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _Pointer __buffer, _Distance*) {
- _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 _RandomAccessIter, class _Pointer, class _Distance,
- class _Compare>
-void __merge_sort_with_buffer(_RandomAccessIter __first,
- _RandomAccessIter __last, _Pointer __buffer,
- _Distance*, _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 _RandomAccessIter, class _Pointer, class _Distance>
-void __stable_sort_adaptive(_RandomAccessIter __first,
- _RandomAccessIter __last, _Pointer __buffer,
- _Distance __buffer_size) {
- _Distance __len = (__last - __first + 1) / 2;
- _RandomAccessIter __middle = __first + __len;
- if (__len > __buffer_size) {
- __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size);
- __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size);
- }
- else {
- __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0);
- __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0);
- }
- __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first),
- _Distance(__last - __middle), __buffer, __buffer_size);
-}
-
-template <class _RandomAccessIter, class _Pointer, class _Distance,
- class _Compare>
-void __stable_sort_adaptive(_RandomAccessIter __first,
- _RandomAccessIter __last, _Pointer __buffer,
- _Distance __buffer_size, _Compare __comp) {
- _Distance __len = (__last - __first + 1) / 2;
- _RandomAccessIter __middle = __first + __len;
- if (__len > __buffer_size) {
- __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size,
- __comp);
- __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size,
- __comp);
- }
- else {
- __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0,
- __comp);
- __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0,
- __comp);
- }
- __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first),
- _Distance(__last - __middle), __buffer, __buffer_size,
- __comp);
-}
-
-template <class _RandomAccessIter, class _Tp, class _Distance>
-inline void __stable_sort_aux(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*, _Distance*) {
- _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last);
- if (buf.begin() == 0)
- __inplace_stable_sort(__first, __last);
- else
- __stable_sort_adaptive(__first, __last, buf.begin(),
- _Distance(buf.size()));
-}
-
-template <class _RandomAccessIter, class _Tp, class _Distance, class _Compare>
-inline void __stable_sort_aux(_RandomAccessIter __first,
- _RandomAccessIter __last, _Tp*, _Distance*,
- _Compare __comp) {
- _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last);
- if (buf.begin() == 0)
- __inplace_stable_sort(__first, __last, __comp);
- else
- __stable_sort_adaptive(__first, __last, buf.begin(),
- _Distance(buf.size()),
- __comp);
-}
-
-template <class _RandomAccessIter>
-inline void stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last) {
- __stable_sort_aux(__first, __last,
- __VALUE_TYPE(__first),
- __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIter, class _Compare>
-inline void stable_sort(_RandomAccessIter __first,
- _RandomAccessIter __last, _Compare __comp) {
- __stable_sort_aux(__first, __last,
- __VALUE_TYPE(__first),
- __DISTANCE_TYPE(__first),
- __comp);
-}
-
-// partial_sort, partial_sort_copy, and auxiliary functions.
-
-template <class _RandomAccessIter, class _Tp>
-void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
- _RandomAccessIter __last, _Tp*) {
- make_heap(__first, __middle);
- for (_RandomAccessIter __i = __middle; __i < __last; ++__i)
- if (*__i < *__first)
- __pop_heap(__first, __middle, __i, _Tp(*__i),
- __DISTANCE_TYPE(__first));
- sort_heap(__first, __middle);
-}
-
-template <class _RandomAccessIter>
-inline void partial_sort(_RandomAccessIter __first,
- _RandomAccessIter __middle,
- _RandomAccessIter __last) {
- __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
- _RandomAccessIter __last, _Tp*, _Compare __comp) {
- make_heap(__first, __middle, __comp);
- for (_RandomAccessIter __i = __middle; __i < __last; ++__i)
- if (__comp(*__i, *__first))
- __pop_heap(__first, __middle, __i, _Tp(*__i), __comp,
- __DISTANCE_TYPE(__first));
- sort_heap(__first, __middle, __comp);
-}
-
-template <class _RandomAccessIter, class _Compare>
-inline void partial_sort(_RandomAccessIter __first,
- _RandomAccessIter __middle,
- _RandomAccessIter __last, _Compare __comp) {
- __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first), __comp);
-}
-
-template <class _InputIter, class _RandomAccessIter, class _Distance,
- class _Tp>
-_RandomAccessIter __partial_sort_copy(_InputIter __first,
- _InputIter __last,
- _RandomAccessIter __result_first,
- _RandomAccessIter __result_last,
- _Distance*, _Tp*) {
- if (__result_first == __result_last) return __result_last;
- _RandomAccessIter __result_real_last = __result_first;
- while(__first != __last && __result_real_last != __result_last) {
- *__result_real_last = *__first;
- ++__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),
- _Tp(*__first));
- ++__first;
- }
- sort_heap(__result_first, __result_real_last);
- return __result_real_last;
-}
-
-template <class _InputIter, class _RandomAccessIter>
-inline _RandomAccessIter
-partial_sort_copy(_InputIter __first, _InputIter __last,
- _RandomAccessIter __result_first,
- _RandomAccessIter __result_last) {
- return __partial_sort_copy(__first, __last, __result_first, __result_last,
- __DISTANCE_TYPE(__result_first),
- __VALUE_TYPE(__first));
-}
-
-template <class _InputIter, class _RandomAccessIter, class _Compare,
- class _Distance, class _Tp>
-_RandomAccessIter __partial_sort_copy(_InputIter __first,
- _InputIter __last,
- _RandomAccessIter __result_first,
- _RandomAccessIter __result_last,
- _Compare __comp, _Distance*, _Tp*) {
- if (__result_first == __result_last) return __result_last;
- _RandomAccessIter __result_real_last = __result_first;
- while(__first != __last && __result_real_last != __result_last) {
- *__result_real_last = *__first;
- ++__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),
- _Tp(*__first),
- __comp);
- ++__first;
- }
- sort_heap(__result_first, __result_real_last, __comp);
- return __result_real_last;
-}
-
-template <class _InputIter, class _RandomAccessIter, class _Compare>
-inline _RandomAccessIter
-partial_sort_copy(_InputIter __first, _InputIter __last,
- _RandomAccessIter __result_first,
- _RandomAccessIter __result_last, _Compare __comp) {
- return __partial_sort_copy(__first, __last, __result_first, __result_last,
- __comp,
- __DISTANCE_TYPE(__result_first),
- __VALUE_TYPE(__first));
-}
-
-// nth_element() and its auxiliary functions.
-
-template <class _RandomAccessIter, class _Tp>
-void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last, _Tp*) {
- while (__last - __first > 3) {
- _RandomAccessIter __cut =
- __unguarded_partition(__first, __last,
- _Tp(__median(*__first,
- *(__first + (__last - __first)/2),
- *(__last - 1))));
- if (__cut <= __nth)
- __first = __cut;
- else
- __last = __cut;
- }
- __insertion_sort(__first, __last);
-}
-
-template <class _RandomAccessIter>
-inline void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last) {
- __nth_element(__first, __nth, __last, __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIter, class _Tp, class _Compare>
-void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last, _Tp*, _Compare __comp) {
- while (__last - __first > 3) {
- _RandomAccessIter __cut =
- __unguarded_partition(__first, __last,
- _Tp(__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 _RandomAccessIter, class _Compare>
-inline void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
- _RandomAccessIter __last, _Compare __comp) {
- __nth_element(__first, __nth, __last, __VALUE_TYPE(__first), __comp);
-}
-
-
-// Binary search (lower_bound, upper_bound, equal_range, binary_search).
-
-template <class _ForwardIter, class _Tp, class _Distance>
-_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Distance*)
-{
- _Distance __len = 0;
- distance(__first, __last, __len);
- _Distance __half;
- _ForwardIter __middle;
-
- while (__len > 0) {
- __half = __len >> 1;
- __middle = __first;
- advance(__middle, __half);
- if (*__middle < __val) {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else
- __len = __half;
- }
- return __first;
-}
-
-template <class _ForwardIter, class _Tp>
-inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val) {
- return __lower_bound(__first, __last, __val,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _ForwardIter, class _Tp, class _Compare, class _Distance>
-_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Compare __comp, _Distance*)
-{
- _Distance __len = 0;
- distance(__first, __last, __len);
- _Distance __half;
- _ForwardIter __middle;
-
- while (__len > 0) {
- __half = __len >> 1;
- __middle = __first;
- advance(__middle, __half);
- if (__comp(*__middle, __val)) {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else
- __len = __half;
- }
- return __first;
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Compare __comp) {
- return __lower_bound(__first, __last, __val, __comp,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _ForwardIter, class _Tp, class _Distance>
-_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Distance*)
-{
- _Distance __len = 0;
- distance(__first, __last, __len);
- _Distance __half;
- _ForwardIter __middle;
-
- while (__len > 0) {
- __half = __len >> 1;
- __middle = __first;
- advance(__middle, __half);
- if (__val < *__middle)
- __len = __half;
- else {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- }
- return __first;
-}
-
-template <class _ForwardIter, class _Tp>
-inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val) {
- return __upper_bound(__first, __last, __val,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _ForwardIter, class _Tp, class _Compare, class _Distance>
-_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Compare __comp, _Distance*)
-{
- _Distance __len = 0;
- distance(__first, __last, __len);
- _Distance __half;
- _ForwardIter __middle;
-
- while (__len > 0) {
- __half = __len >> 1;
- __middle = __first;
- advance(__middle, __half);
- if (__comp(__val, *__middle))
- __len = __half;
- else {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- }
- return __first;
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val, _Compare __comp) {
- return __upper_bound(__first, __last, __val, __comp,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _ForwardIter, class _Tp, class _Distance>
-pair<_ForwardIter, _ForwardIter>
-__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Distance*)
-{
- _Distance __len = 0;
- distance(__first, __last, __len);
- _Distance __half;
- _ForwardIter __middle, __left, __right;
-
- while (__len > 0) {
- __half = __len >> 1;
- __middle = __first;
- advance(__middle, __half);
- if (*__middle < __val) {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else if (__val < *__middle)
- __len = __half;
- else {
- __left = lower_bound(__first, __middle, __val);
- advance(__first, __len);
- __right = upper_bound(++__middle, __first, __val);
- return pair<_ForwardIter, _ForwardIter>(__left, __right);
- }
- }
- return pair<_ForwardIter, _ForwardIter>(__first, __first);
-}
-
-template <class _ForwardIter, class _Tp>
-inline pair<_ForwardIter, _ForwardIter>
-equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
- return __equal_range(__first, __last, __val,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _ForwardIter, class _Tp, class _Compare, class _Distance>
-pair<_ForwardIter, _ForwardIter>
-__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare __comp, _Distance*)
-{
- _Distance __len = 0;
- distance(__first, __last, __len);
- _Distance __half;
- _ForwardIter __middle, __left, __right;
-
- while (__len > 0) {
- __half = __len >> 1;
- __middle = __first;
- advance(__middle, __half);
- if (__comp(*__middle, __val)) {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else if (__comp(__val, *__middle))
- __len = __half;
- else {
- __left = lower_bound(__first, __middle, __val, __comp);
- advance(__first, __len);
- __right = upper_bound(++__middle, __first, __val, __comp);
- return pair<_ForwardIter, _ForwardIter>(__left, __right);
- }
- }
- return pair<_ForwardIter, _ForwardIter>(__first, __first);
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-inline pair<_ForwardIter, _ForwardIter>
-equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
- _Compare __comp) {
- return __equal_range(__first, __last, __val, __comp,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _ForwardIter, class _Tp>
-bool binary_search(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val) {
- _ForwardIter __i = lower_bound(__first, __last, __val);
- return __i != __last && !(__val < *__i);
-}
-
-template <class _ForwardIter, class _Tp, class _Compare>
-bool binary_search(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __val,
- _Compare __comp) {
- _ForwardIter __i = lower_bound(__first, __last, __val, __comp);
- return __i != __last && !__comp(__val, *__i);
-}
-
-// merge, with and without an explicitly supplied comparison function.
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- while (__first1 != __last1 && __first2 != __last2) {
- if (*__first2 < *__first1) {
- *__result = *__first2;
- ++__first2;
- }
- else {
- *__result = *__first1;
- ++__first1;
- }
- ++__result;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- while (__first1 != __last1 && __first2 != __last2) {
- if (__comp(*__first2, *__first1)) {
- *__result = *__first2;
- ++__first2;
- }
- else {
- *__result = *__first1;
- ++__first1;
- }
- ++__result;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-// inplace_merge and its auxiliary functions.
-
-template <class _BidirectionalIter, class _Distance>
-void __merge_without_buffer(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance __len1, _Distance __len2) {
- if (__len1 == 0 || __len2 == 0)
- return;
- if (__len1 + __len2 == 2) {
- if (*__middle < *__first)
- iter_swap(__first, __middle);
- return;
- }
- _BidirectionalIter __first_cut = __first;
- _BidirectionalIter __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);
- }
- _BidirectionalIter __new_middle
- = rotate(__first_cut, __middle, __second_cut);
- __merge_without_buffer(__first, __first_cut, __new_middle,
- __len11, __len22);
- __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11,
- __len2 - __len22);
-}
-
-template <class _BidirectionalIter, class _Distance, class _Compare>
-void __merge_without_buffer(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __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;
- }
- _BidirectionalIter __first_cut = __first;
- _BidirectionalIter __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);
- }
- _BidirectionalIter __new_middle
- = rotate(__first_cut, __middle, __second_cut);
- __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 _BidirectionalIter1, class _BidirectionalIter2,
- class _Distance>
-_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first,
- _BidirectionalIter1 __middle,
- _BidirectionalIter1 __last,
- _Distance __len1, _Distance __len2,
- _BidirectionalIter2 __buffer,
- _Distance __buffer_size) {
- _BidirectionalIter2 __buffer_end;
- if (__len1 > __len2 && __len2 <= __buffer_size) {
- __buffer_end = copy(__middle, __last, __buffer);
- copy_backward(__first, __middle, __last);
- return copy(__buffer, __buffer_end, __first);
- }
- else if (__len1 <= __buffer_size) {
- __buffer_end = copy(__first, __middle, __buffer);
- copy(__middle, __last, __first);
- return copy_backward(__buffer, __buffer_end, __last);
- }
- else
- return rotate(__first, __middle, __last);
-}
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _BidirectionalIter3>
-_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
- _BidirectionalIter1 __last1,
- _BidirectionalIter2 __first2,
- _BidirectionalIter2 __last2,
- _BidirectionalIter3 __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 _BidirectionalIter1, class _BidirectionalIter2,
- class _BidirectionalIter3, class _Compare>
-_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1,
- _BidirectionalIter1 __last1,
- _BidirectionalIter2 __first2,
- _BidirectionalIter2 __last2,
- _BidirectionalIter3 __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 _BidirectionalIter, class _Distance, class _Pointer>
-void __merge_adaptive(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance __len1, _Distance __len2,
- _Pointer __buffer, _Distance __buffer_size) {
- if (__len1 <= __len2 && __len1 <= __buffer_size) {
- _Pointer __buffer_end = copy(__first, __middle, __buffer);
- merge(__buffer, __buffer_end, __middle, __last, __first);
- }
- else if (__len2 <= __buffer_size) {
- _Pointer __buffer_end = copy(__middle, __last, __buffer);
- __merge_backward(__first, __middle, __buffer, __buffer_end, __last);
- }
- else {
- _BidirectionalIter __first_cut = __first;
- _BidirectionalIter __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);
- }
- _BidirectionalIter __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);
- __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11,
- __len2 - __len22, __buffer, __buffer_size);
- }
-}
-
-template <class _BidirectionalIter, class _Distance, class _Pointer,
- class _Compare>
-void __merge_adaptive(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last,
- _Distance __len1, _Distance __len2,
- _Pointer __buffer, _Distance __buffer_size,
- _Compare __comp) {
- if (__len1 <= __len2 && __len1 <= __buffer_size) {
- _Pointer __buffer_end = copy(__first, __middle, __buffer);
- merge(__buffer, __buffer_end, __middle, __last, __first, __comp);
- }
- else if (__len2 <= __buffer_size) {
- _Pointer __buffer_end = copy(__middle, __last, __buffer);
- __merge_backward(__first, __middle, __buffer, __buffer_end, __last,
- __comp);
- }
- else {
- _BidirectionalIter __first_cut = __first;
- _BidirectionalIter __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);
- }
- _BidirectionalIter __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, __comp);
- __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11,
- __len2 - __len22, __buffer, __buffer_size, __comp);
- }
-}
-
-template <class _BidirectionalIter, class _Tp, class _Distance>
-inline void __inplace_merge_aux(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last, _Tp*, _Distance*) {
- _Distance __len1 = 0;
- distance(__first, __middle, __len1);
- _Distance __len2 = 0;
- distance(__middle, __last, __len2);
-
- _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last);
- if (__buf.begin() == 0)
- __merge_without_buffer(__first, __middle, __last, __len1, __len2);
- else
- __merge_adaptive(__first, __middle, __last, __len1, __len2,
- __buf.begin(), _Distance(__buf.size()));
-}
-
-template <class _BidirectionalIter, class _Tp,
- class _Distance, class _Compare>
-inline void __inplace_merge_aux(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last, _Tp*, _Distance*,
- _Compare __comp) {
- _Distance __len1 = 0;
- distance(__first, __middle, __len1);
- _Distance __len2 = 0;
- distance(__middle, __last, __len2);
-
- _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last);
- if (__buf.begin() == 0)
- __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp);
- else
- __merge_adaptive(__first, __middle, __last, __len1, __len2,
- __buf.begin(), _Distance(__buf.size()),
- __comp);
-}
-
-template <class _BidirectionalIter>
-inline void inplace_merge(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last) {
- if (__first == __middle || __middle == __last)
- return;
- __inplace_merge_aux(__first, __middle, __last,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
-}
-
-template <class _BidirectionalIter, class _Compare>
-inline void inplace_merge(_BidirectionalIter __first,
- _BidirectionalIter __middle,
- _BidirectionalIter __last, _Compare __comp) {
- if (__first == __middle || __middle == __last)
- return;
- __inplace_merge_aux(__first, __middle, __last,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first),
- __comp);
-}
-
-// Set algorithms: includes, set_union, set_intersection, set_difference,
-// set_symmetric_difference. All of these algorithms have the precondition
-// that their input ranges are sorted and the postcondition that their output
-// ranges are sorted.
-
-template <class _InputIter1, class _InputIter2>
-bool includes(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2) {
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first2 < *__first1)
- return false;
- else if(*__first1 < *__first2)
- ++__first1;
- else
- ++__first1, ++__first2;
-
- return __first2 == __last2;
-}
-
-template <class _InputIter1, class _InputIter2, class _Compare>
-bool includes(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __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 _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- while (__first1 != __last1 && __first2 != __last2) {
- if (*__first1 < *__first2) {
- *__result = *__first1;
- ++__first1;
- }
- else if (*__first2 < *__first1) {
- *__result = *__first2;
- ++__first2;
- }
- else {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- }
- ++__result;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- while (__first1 != __last1 && __first2 != __last2) {
- if (__comp(*__first1, *__first2)) {
- *__result = *__first1;
- ++__first1;
- }
- else if (__comp(*__first2, *__first1)) {
- *__result = *__first2;
- ++__first2;
- }
- else {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- }
- ++__result;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first1 < *__first2)
- ++__first1;
- else if (*__first2 < *__first1)
- ++__first2;
- else {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- ++__result;
- }
- return __result;
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first1, *__first2))
- ++__first1;
- else if (__comp(*__first2, *__first1))
- ++__first2;
- else {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- ++__result;
- }
- return __result;
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first1 < *__first2) {
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (*__first2 < *__first1)
- ++__first2;
- else {
- ++__first1;
- ++__first2;
- }
- return copy(__first1, __last1, __result);
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result, _Compare __comp) {
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first1, *__first2)) {
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (__comp(*__first2, *__first1))
- ++__first2;
- else {
- ++__first1;
- ++__first2;
- }
- return copy(__first1, __last1, __result);
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter>
-_OutputIter
-set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result) {
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first1 < *__first2) {
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (*__first2 < *__first1) {
- *__result = *__first2;
- ++__first2;
- ++__result;
- }
- else {
- ++__first1;
- ++__first2;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-template <class _InputIter1, class _InputIter2, class _OutputIter,
- class _Compare>
-_OutputIter
-set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _OutputIter __result,
- _Compare __comp) {
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first1, *__first2)) {
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (__comp(*__first2, *__first1)) {
- *__result = *__first2;
- ++__first2;
- ++__result;
- }
- else {
- ++__first1;
- ++__first2;
- }
- return copy(__first2, __last2, copy(__first1, __last1, __result));
-}
-
-// min_element and max_element, with and without an explicitly supplied
-// comparison function.
-
-template <class _ForwardIter>
-_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) {
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last)
- if (*__result < *__first)
- __result = __first;
- return __result;
-}
-
-template <class _ForwardIter, class _Compare>
-_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
- _Compare __comp) {
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last)
- if (__comp(*__result, *__first)) __result = __first;
- return __result;
-}
-
-template <class _ForwardIter>
-_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) {
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last)
- if (*__first < *__result)
- __result = __first;
- return __result;
-}
-
-template <class _ForwardIter, class _Compare>
-_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
- _Compare __comp) {
- if (__first == __last) return __first;
- _ForwardIter __result = __first;
- while (++__first != __last)
- if (__comp(*__first, *__result))
- __result = __first;
- return __result;
-}
-
-// next_permutation and prev_permutation, with and without an explicitly
-// supplied comparison function.
-
-template <class _BidirectionalIter>
-bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
- if (__first == __last)
- return false;
- _BidirectionalIter __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;) {
- _BidirectionalIter __ii = __i;
- --__i;
- if (*__i < *__ii) {
- _BidirectionalIter __j = __last;
- while (!(*__i < *--__j))
- {}
- iter_swap(__i, __j);
- reverse(__ii, __last);
- return true;
- }
- if (__i == __first) {
- reverse(__first, __last);
- return false;
- }
- }
-}
-
-template <class _BidirectionalIter, class _Compare>
-bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp) {
- if (__first == __last)
- return false;
- _BidirectionalIter __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;) {
- _BidirectionalIter __ii = __i;
- --__i;
- if (__comp(*__i, *__ii)) {
- _BidirectionalIter __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 _BidirectionalIter>
-bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) {
- if (__first == __last)
- return false;
- _BidirectionalIter __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;) {
- _BidirectionalIter __ii = __i;
- --__i;
- if (*__ii < *__i) {
- _BidirectionalIter __j = __last;
- while (!(*--__j < *__i))
- {}
- iter_swap(__i, __j);
- reverse(__ii, __last);
- return true;
- }
- if (__i == __first) {
- reverse(__first, __last);
- return false;
- }
- }
-}
-
-template <class _BidirectionalIter, class _Compare>
-bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
- _Compare __comp) {
- if (__first == __last)
- return false;
- _BidirectionalIter __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;) {
- _BidirectionalIter __ii = __i;
- --__i;
- if (__comp(*__ii, *__i)) {
- _BidirectionalIter __j = __last;
- while (!__comp(*--__j, *__i))
- {}
- iter_swap(__i, __j);
- reverse(__ii, __last);
- return true;
- }
- if (__i == __first) {
- reverse(__first, __last);
- return false;
- }
- }
-}
-
-// find_first_of, with and without an explicitly supplied comparison function.
-
-template <class _InputIter, class _ForwardIter>
-_InputIter find_first_of(_InputIter __first1, _InputIter __last1,
- _ForwardIter __first2, _ForwardIter __last2)
-{
- for ( ; __first1 != __last1; ++__first1)
- for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter)
- if (*__first1 == *__iter)
- return __first1;
- return __last1;
-}
-
-template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
-_InputIter find_first_of(_InputIter __first1, _InputIter __last1,
- _ForwardIter __first2, _ForwardIter __last2,
- _BinaryPredicate __comp)
-{
- for ( ; __first1 != __last1; ++__first1)
- for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter)
- if (__comp(*__first1, *__iter))
- return __first1;
- return __last1;
-}
-
-
-// find_end, with and without an explicitly supplied comparison function.
-// Search [first2, last2) as a subsequence in [first1, last1), and return
-// the *last* possible match. Note that find_end for bidirectional iterators
-// is much faster than for forward iterators.
-
-// find_end for forward iterators.
-template <class _ForwardIter1, class _ForwardIter2>
-_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- forward_iterator_tag, forward_iterator_tag)
-{
- if (__first2 == __last2)
- return __last1;
- else {
- _ForwardIter1 __result = __last1;
- while (1) {
- _ForwardIter1 __new_result
- = search(__first1, __last1, __first2, __last2);
- if (__new_result == __last1)
- return __result;
- else {
- __result = __new_result;
- __first1 = __new_result;
- ++__first1;
- }
- }
- }
-}
-
-template <class _ForwardIter1, class _ForwardIter2,
- class _BinaryPredicate>
-_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- forward_iterator_tag, forward_iterator_tag,
- _BinaryPredicate __comp)
-{
- if (__first2 == __last2)
- return __last1;
- else {
- _ForwardIter1 __result = __last1;
- while (1) {
- _ForwardIter1 __new_result
- = search(__first1, __last1, __first2, __last2, __comp);
- if (__new_result == __last1)
- return __result;
- else {
- __result = __new_result;
- __first1 = __new_result;
- ++__first1;
- }
- }
- }
-}
-
-// find_end for bidirectional iterators. Requires partial specialization.
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _BidirectionalIter1, class _BidirectionalIter2>
-_BidirectionalIter1
-__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
- _BidirectionalIter2 __first2, _BidirectionalIter2 __last2,
- bidirectional_iterator_tag, bidirectional_iterator_tag)
-{
- typedef reverse_iterator<_BidirectionalIter1> _RevIter1;
- typedef reverse_iterator<_BidirectionalIter2> _RevIter2;
-
- _RevIter1 __rlast1(__first1);
- _RevIter2 __rlast2(__first2);
- _RevIter1 __rresult = search(_RevIter1(__last1), __rlast1,
- _RevIter2(__last2), __rlast2);
-
- if (__rresult == __rlast1)
- return __last1;
- else {
- _BidirectionalIter1 __result = __rresult.base();
- advance(__result, -distance(__first2, __last2));
- return __result;
- }
-}
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _BinaryPredicate>
-_BidirectionalIter1
-__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
- _BidirectionalIter2 __first2, _BidirectionalIter2 __last2,
- bidirectional_iterator_tag, bidirectional_iterator_tag,
- _BinaryPredicate __comp)
-{
- typedef reverse_iterator<_BidirectionalIter1> _RevIter1;
- typedef reverse_iterator<_BidirectionalIter2> _RevIter2;
-
- _RevIter1 __rlast1(__first1);
- _RevIter2 __rlast2(__first2);
- _RevIter1 __rresult = search(_RevIter1(__last1), __rlast1,
- _RevIter2(__last2), __rlast2,
- __comp);
-
- if (__rresult == __rlast1)
- return __last1;
- else {
- _BidirectionalIter1 __result = __rresult.base();
- advance(__result, -distance(__first2, __last2));
- return __result;
- }
-}
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// Dispatching functions for find_end.
-
-template <class _ForwardIter1, class _ForwardIter2>
-inline _ForwardIter1
-find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2)
-{
- return __find_end(__first1, __last1, __first2, __last2,
- __ITERATOR_CATEGORY(__first1),
- __ITERATOR_CATEGORY(__first2));
-}
-
-template <class _ForwardIter1, class _ForwardIter2,
- class _BinaryPredicate>
-inline _ForwardIter1
-find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
- _ForwardIter2 __first2, _ForwardIter2 __last2,
- _BinaryPredicate __comp)
-{
- return __find_end(__first1, __last1, __first2, __last2,
- __ITERATOR_CATEGORY(__first1),
- __ITERATOR_CATEGORY(__first2),
- __comp);
-}
-
-// is_heap, a predicate testing whether or not a range is
-// a heap. This function is an extension, not part of the C++
-// standard.
-
-template <class _RandomAccessIter, class _Distance>
-bool __is_heap(_RandomAccessIter __first, _Distance __n)
-{
- _Distance __parent = 0;
- for (_Distance __child = 1; __child < __n; ++__child) {
- if (__first[__parent] < __first[__child])
- return false;
- if ((__child & 1) == 0)
- ++__parent;
- }
- return true;
-}
-
-template <class _RandomAccessIter, class _Distance, class _StrictWeakOrdering>
-bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp,
- _Distance __n)
-{
- _Distance __parent = 0;
- for (_Distance __child = 1; __child < __n; ++__child) {
- if (__comp(__first[__parent], __first[__child]))
- return false;
- if ((__child & 1) == 0)
- ++__parent;
- }
- return true;
-}
-
-template <class _RandomAccessIter>
-inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last)
-{
- return __is_heap(__first, __last - __first);
-}
-
-
-template <class _RandomAccessIter, class _StrictWeakOrdering>
-inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
- _StrictWeakOrdering __comp)
-{
- return __is_heap(__first, __comp, __last - __first);
-}
-
-// is_sorted, a predicated testing whether a range is sorted in
-// nondescending order. This is an extension, not part of the C++
-// standard.
-
-template <class _ForwardIter>
-bool is_sorted(_ForwardIter __first, _ForwardIter __last)
-{
- if (__first == __last)
- return true;
-
- _ForwardIter __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next) {
- if (*__next < *__first)
- return false;
- }
-
- return true;
-}
-
-template <class _ForwardIter, class _StrictWeakOrdering>
-bool is_sorted(_ForwardIter __first, _ForwardIter __last,
- _StrictWeakOrdering __comp)
-{
- if (__first == __last)
- return true;
-
- _ForwardIter __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next) {
- if (__comp(*__next, *__first))
- return false;
- }
-
- return true;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_ALGO_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_algobase.h b/contrib/libstdc++/stl/stl_algobase.h
deleted file mode 100644
index 15e535f..0000000
--- a/contrib/libstdc++/stl/stl_algobase.h
+++ /dev/null
@@ -1,526 +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.
- *
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-
-#ifndef __SGI_STL_INTERNAL_ALGOBASE_H
-#define __SGI_STL_INTERNAL_ALGOBASE_H
-
-#ifndef __STL_CONFIG_H
-#include <stl_config.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_RELOPS
-#include <stl_relops.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_PAIR_H
-#include <stl_pair.h>
-#endif
-#ifndef __TYPE_TRAITS_H_
-#include <type_traits.h>
-#endif
-
-#include <string.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <new.h>
-#include <iostream.h>
-
-#ifndef __SGI_STL_INTERNAL_ITERATOR_H
-#include <stl_iterator.h>
-#endif
-
-__STL_BEGIN_NAMESPACE
-
-// swap and iter_swap
-
-template <class _ForwardIter1, class _ForwardIter2, class _Tp>
-inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) {
- _Tp __tmp = *__a;
- *__a = *__b;
- *__b = __tmp;
-}
-
-template <class _ForwardIter1, class _ForwardIter2>
-inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) {
- __iter_swap(__a, __b, __VALUE_TYPE(__a));
-}
-
-template <class _Tp>
-inline void swap(_Tp& __a, _Tp& __b) {
- _Tp __tmp = __a;
- __a = __b;
- __b = __tmp;
-}
-
-//--------------------------------------------------
-// min and max
-
-#ifndef __BORLANDC__
-
-#undef min
-#undef max
-
-template <class _Tp>
-inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
- return __b < __a ? __b : __a;
-}
-
-template <class _Tp>
-inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
- return __a < __b ? __b : __a;
-}
-
-#endif /* __BORLANDC__ */
-
-template <class _Tp, class _Compare>
-inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) {
- return __comp(__b, __a) ? __b : __a;
-}
-
-template <class _Tp, class _Compare>
-inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) {
- return __comp(__a, __b) ? __b : __a;
-}
-
-//--------------------------------------------------
-// copy
-
-// All of these auxiliary functions serve two purposes. (1) Replace
-// calls to copy with memmove whenever possible. (Memmove, not memcpy,
-// because the input and output ranges are permitted to overlap.)
-// (2) If we're using random access iterators, then write the loop as
-// a for loop with an explicit count. The auxiliary class __copy_dispatch
-// is a workaround for compilers that don't support partial ordering of
-// function templates.
-
-template <class _InputIter, class _OutputIter, class _Distance>
-inline _OutputIter __copy(_InputIter __first, _InputIter __last,
- _OutputIter __result,
- input_iterator_tag, _Distance*)
-{
- for ( ; __first != __last; ++__result, ++__first)
- *__result = *__first;
- return __result;
-}
-
-template <class _RandomAccessIter, class _OutputIter, class _Distance>
-inline _OutputIter
-__copy(_RandomAccessIter __first, _RandomAccessIter __last,
- _OutputIter __result, random_access_iterator_tag, _Distance*)
-{
- for (_Distance __n = __last - __first; __n > 0; --__n) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
- return __result;
-}
-
-template <class _Tp>
-inline _Tp*
-__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) {
- memmove(__result, __first, sizeof(_Tp) * (__last - __first));
- return __result + (__last - __first);
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _InputIter, class _OutputIter, class _BoolType>
-struct __copy_dispatch {
- static _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result) {
- typedef typename iterator_traits<_InputIter>::iterator_category _Category;
- typedef typename iterator_traits<_InputIter>::difference_type _Distance;
- return __copy(__first, __last, __result, _Category(), (_Distance*) 0);
- }
-};
-
-template <class _Tp>
-struct __copy_dispatch<_Tp*, _Tp*, __true_type>
-{
- static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
- return __copy_trivial(__first, __last, __result);
- }
-};
-
-template <class _Tp>
-struct __copy_dispatch<const _Tp*, _Tp*, __true_type>
-{
- static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
- return __copy_trivial(__first, __last, __result);
- }
-};
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result) {
- typedef typename iterator_traits<_InputIter>::value_type _Tp;
- typedef typename __type_traits<_Tp>::has_trivial_assignment_operator
- _Trivial;
- return __copy_dispatch<_InputIter, _OutputIter, _Trivial>
- ::copy(__first, __last, __result);
-}
-
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result)
-{
- return __copy(__first, __last, __result,
- __ITERATOR_CATEGORY(__first),
- __DISTANCE_TYPE(__first));
-}
-
-inline char* copy(const char* __first, const char* __last, char* __result) {
- memmove(__result, __first, __last - __first);
- return __result + (__last - __first);
-}
-
-inline wchar_t* copy(const wchar_t* __first, const wchar_t* __last,
- wchar_t* __result) {
- memmove(__result, __first, sizeof(wchar_t) * (__last - __first));
- return __result + (__last - __first);
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-//--------------------------------------------------
-// copy_backward
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _Distance>
-inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
- _BidirectionalIter1 __last,
- _BidirectionalIter2 __result,
- bidirectional_iterator_tag,
- _Distance*)
-{
- while (__first != __last)
- *--__result = *--__last;
- return __result;
-}
-
-template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
-inline _BidirectionalIter __copy_backward(_RandomAccessIter __first,
- _RandomAccessIter __last,
- _BidirectionalIter __result,
- random_access_iterator_tag,
- _Distance*)
-{
- for (_Distance __n = __last - __first; __n > 0; --__n)
- *--__result = *--__last;
- return __result;
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-// This dispatch class is a workaround for compilers that do not
-// have partial ordering of function templates. All we're doing is
-// creating a specialization so that we can turn a call to copy_backward
-// into a memmove whenever possible.
-
-template <class _BidirectionalIter1, class _BidirectionalIter2,
- class _BoolType>
-struct __copy_backward_dispatch
-{
- typedef typename iterator_traits<_BidirectionalIter1>::iterator_category
- _Cat;
- typedef typename iterator_traits<_BidirectionalIter1>::difference_type
- _Distance;
-
- static _BidirectionalIter2 copy(_BidirectionalIter1 __first,
- _BidirectionalIter1 __last,
- _BidirectionalIter2 __result) {
- return __copy_backward(__first, __last, __result, _Cat(), (_Distance*) 0);
- }
-};
-
-template <class _Tp>
-struct __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
-{
- static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
- const ptrdiff_t _Num = __last - __first;
- memmove(__result - _Num, __first, sizeof(_Tp) * _Num);
- return __result - _Num;
- }
-};
-
-template <class _Tp>
-struct __copy_backward_dispatch<const _Tp*, _Tp*, __true_type>
-{
- static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) {
- return __copy_backward_dispatch<_Tp*, _Tp*, __true_type>
- ::copy(__first, __last, __result);
- }
-};
-
-template <class _BI1, class _BI2>
-inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
- typedef typename __type_traits<typename iterator_traits<_BI2>::value_type>
- ::has_trivial_assignment_operator
- _Trivial;
- return __copy_backward_dispatch<_BI1, _BI2, _Trivial>
- ::copy(__first, __last, __result);
-}
-
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _BI1, class _BI2>
-inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) {
- return __copy_backward(__first, __last, __result,
- __ITERATOR_CATEGORY(__first),
- __DISTANCE_TYPE(__first));
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-//--------------------------------------------------
-// copy_n (not part of the C++ standard)
-
-template <class _InputIter, class _Size, class _OutputIter>
-pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count,
- _OutputIter __result,
- input_iterator_tag) {
- for ( ; __count > 0; --__count) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
- return pair<_InputIter, _OutputIter>(__first, __result);
-}
-
-template <class _RAIter, class _Size, class _OutputIter>
-inline pair<_RAIter, _OutputIter>
-__copy_n(_RAIter __first, _Size __count,
- _OutputIter __result,
- random_access_iterator_tag) {
- _RAIter __last = __first + __count;
- return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result));
-}
-
-template <class _InputIter, class _Size, class _OutputIter>
-inline pair<_InputIter, _OutputIter>
-__copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
- return __copy_n(__first, __count, __result,
- __ITERATOR_CATEGORY(__first));
-}
-
-template <class _InputIter, class _Size, class _OutputIter>
-inline pair<_InputIter, _OutputIter>
-copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
- return __copy_n(__first, __count, __result);
-}
-
-//--------------------------------------------------
-// fill and fill_n
-
-
-template <class _ForwardIter, class _Tp>
-void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) {
- for ( ; __first != __last; ++__first)
- *__first = __value;
-}
-
-template <class _OutputIter, class _Size, class _Tp>
-_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) {
- for ( ; __n > 0; --__n, ++__first)
- *__first = __value;
- return __first;
-}
-
-//--------------------------------------------------
-// equal and mismatch
-
-template <class _InputIter1, class _InputIter2>
-pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
- _InputIter1 __last1,
- _InputIter2 __first2) {
- while (__first1 != __last1 && *__first1 == *__first2) {
- ++__first1;
- ++__first2;
- }
- return pair<_InputIter1, _InputIter2>(__first1, __first2);
-}
-
-template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
-pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
- _InputIter1 __last1,
- _InputIter2 __first2,
- _BinaryPredicate __binary_pred) {
- while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
- ++__first1;
- ++__first2;
- }
- return pair<_InputIter1, _InputIter2>(__first1, __first2);
-}
-
-template <class _InputIter1, class _InputIter2>
-inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2) {
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- if (*__first1 != *__first2)
- return false;
- return true;
-}
-
-template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
-inline bool equal(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _BinaryPredicate __binary_pred) {
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- if (!__binary_pred(*__first1, *__first2))
- return false;
- return true;
-}
-
-//--------------------------------------------------
-// lexicographical_compare and lexicographical_compare_3way.
-// (the latter is not part of the C++ standard.)
-
-template <class _InputIter1, class _InputIter2>
-bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2) {
- for ( ; __first1 != __last1 && __first2 != __last2
- ; ++__first1, ++__first2) {
- if (*__first1 < *__first2)
- return true;
- if (*__first2 < *__first1)
- return false;
- }
- return __first1 == __last1 && __first2 != __last2;
-}
-
-template <class _InputIter1, class _InputIter2, class _Compare>
-bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _Compare __comp) {
- for ( ; __first1 != __last1 && __first2 != __last2
- ; ++__first1, ++__first2) {
- if (__comp(*__first1, *__first2))
- return true;
- if (__comp(*__first2, *__first1))
- return false;
- }
- return __first1 == __last1 && __first2 != __last2;
-}
-
-inline bool
-lexicographical_compare(const unsigned char* __first1,
- const unsigned char* __last1,
- const unsigned char* __first2,
- const unsigned char* __last2)
-{
- const size_t __len1 = __last1 - __first1;
- const size_t __len2 = __last2 - __first2;
- const int __result = memcmp(__first1, __first2, min(__len1, __len2));
- return __result != 0 ? __result < 0 : __len1 < __len2;
-}
-
-inline bool lexicographical_compare(const char* __first1, const char* __last1,
- const char* __first2, const char* __last2)
-{
-#if CHAR_MAX == SCHAR_MAX
- return lexicographical_compare((const signed char*) __first1,
- (const signed char*) __last1,
- (const signed char*) __first2,
- (const signed char*) __last2);
-#else /* CHAR_MAX == SCHAR_MAX */
- return lexicographical_compare((const unsigned char*) __first1,
- (const unsigned char*) __last1,
- (const unsigned char*) __first2,
- (const unsigned char*) __last2);
-#endif /* CHAR_MAX == SCHAR_MAX */
-}
-
-template <class _InputIter1, class _InputIter2>
-int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2)
-{
- while (__first1 != __last1 && __first2 != __last2) {
- if (*__first1 < *__first2)
- return -1;
- if (*__first2 < *__first1)
- return 1;
- ++__first1;
- ++__first2;
- }
- if (__first2 == __last2) {
- return !(__first1 == __last1);
- }
- else {
- return -1;
- }
-}
-
-inline int
-__lexicographical_compare_3way(const unsigned char* __first1,
- const unsigned char* __last1,
- const unsigned char* __first2,
- const unsigned char* __last2)
-{
- const ptrdiff_t __len1 = __last1 - __first1;
- const ptrdiff_t __len2 = __last2 - __first2;
- const int __result = memcmp(__first1, __first2, min(__len1, __len2));
- return __result != 0 ? __result
- : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
-}
-
-inline int
-__lexicographical_compare_3way(const char* __first1, const char* __last1,
- const char* __first2, const char* __last2)
-{
-#if CHAR_MAX == SCHAR_MAX
- return __lexicographical_compare_3way(
- (const signed char*) __first1,
- (const signed char*) __last1,
- (const signed char*) __first2,
- (const signed char*) __last2);
-#else
- return __lexicographical_compare_3way((const unsigned char*) __first1,
- (const unsigned char*) __last1,
- (const unsigned char*) __first2,
- (const unsigned char*) __last2);
-#endif
-}
-
-template <class _InputIter1, class _InputIter2>
-int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2)
-{
- return __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
-}
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_ALGOBASE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_alloc.h b/contrib/libstdc++/stl/stl_alloc.h
deleted file mode 100644
index 208309a..0000000
--- a/contrib/libstdc++/stl/stl_alloc.h
+++ /dev/null
@@ -1,1057 +0,0 @@
-/*
- * Copyright (c) 1996-1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_ALLOC_H
-#define __SGI_STL_INTERNAL_ALLOC_H
-
-#ifdef __SUNPRO_CC
-# define __PRIVATE public
- // Extra access restrictions prevent us from really making some things
- // private.
-#else
-# define __PRIVATE private
-#endif
-
-#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
-# define __USE_MALLOC
-#endif
-
-
-// This implements some standard node allocators. These are
-// NOT the same as the allocators in the C++ draft standard or in
-// in the original STL. They do not encapsulate different pointer
-// types; indeed we assume that there is only one pointer type.
-// The allocation primitives are intended to allocate individual objects,
-// not larger arenas as with the original STL allocators.
-
-#if 0
-# include <new>
-# define __THROW_BAD_ALLOC throw bad_alloc()
-#elif !defined(__THROW_BAD_ALLOC)
-# include <iostream.h>
-# define __THROW_BAD_ALLOC cerr << "out of memory" << endl; exit(1)
-#endif
-
-#ifdef __STL_WIN32THREADS
-# include <windows.h>
-#endif
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#ifndef __RESTRICT
-# define __RESTRICT
-#endif
-
-#if !defined(__STL_PTHREADS) && !defined(__STL_SOLTHREADS) \
- && !defined(_NOTHREADS) \
- && !defined(__STL_SGI_THREADS) && !defined(__STL_WIN32THREADS)
-# define _NOTHREADS
-#endif
-
-# ifdef __STL_PTHREADS
- // POSIX Threads
- // This is dubious, since this is likely to be a high contention
- // lock. Performance may not be adequate.
-# include <pthread.h>
-# define __NODE_ALLOCATOR_LOCK \
- if (threads) pthread_mutex_lock(&_S_node_allocator_lock)
-# define __NODE_ALLOCATOR_UNLOCK \
- if (threads) pthread_mutex_unlock(&_S_node_allocator_lock)
-# define __NODE_ALLOCATOR_THREADS true
-# define __VOLATILE volatile // Needed at -O3 on SGI
-# endif
-# ifdef __STL_SOLTHREADS
-# include <thread.h>
-# define __NODE_ALLOCATOR_LOCK \
- if (threads) mutex_lock(&_S_node_allocator_lock)
-# define __NODE_ALLOCATOR_UNLOCK \
- if (threads) mutex_unlock(&_S_node_allocator_lock)
-# define __NODE_ALLOCATOR_THREADS true
-# define __VOLATILE
-# endif
-# ifdef __STL_WIN32THREADS
- // The lock needs to be initialized by constructing an allocator
- // objects of the right type. We do that here explicitly for alloc.
-# define __NODE_ALLOCATOR_LOCK \
- EnterCriticalSection(&_S_node_allocator_lock)
-# define __NODE_ALLOCATOR_UNLOCK \
- LeaveCriticalSection(&_S_node_allocator_lock)
-# define __NODE_ALLOCATOR_THREADS true
-# define __VOLATILE volatile // may not be needed
-# endif /* WIN32THREADS */
-# ifdef __STL_SGI_THREADS
- // This should work without threads, with sproc threads, or with
- // pthreads. It is suboptimal in all cases.
- // It is unlikely to even compile on nonSGI machines.
-
- extern "C" {
- extern int __us_rsthread_malloc;
- }
- // The above is copied from malloc.h. Including <malloc.h>
- // would be cleaner but fails with certain levels of standard
- // conformance.
-# define __NODE_ALLOCATOR_LOCK if (threads && __us_rsthread_malloc) \
- { _S_lock(&_S_node_allocator_lock); }
-# define __NODE_ALLOCATOR_UNLOCK if (threads && __us_rsthread_malloc) \
- { _S_unlock(&_S_node_allocator_lock); }
-# define __NODE_ALLOCATOR_THREADS true
-# define __VOLATILE volatile // Needed at -O3 on SGI
-# endif
-# ifdef _NOTHREADS
-// Thread-unsafe
-# define __NODE_ALLOCATOR_LOCK
-# define __NODE_ALLOCATOR_UNLOCK
-# define __NODE_ALLOCATOR_THREADS false
-# define __VOLATILE
-# endif
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#endif
-
-// Malloc-based allocator. Typically slower than default alloc below.
-// Typically thread-safe and more storage efficient.
-#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG
-# ifdef __DECLARE_GLOBALS_HERE
- void (* __malloc_alloc_oom_handler)() = 0;
- // g++ 2.7.2 does not handle static template data members.
-# else
- extern void (* __malloc_alloc_oom_handler)();
-# endif
-#endif
-
-template <int __inst>
-class __malloc_alloc_template {
-
-private:
-
- static void* _S_oom_malloc(size_t);
- static void* _S_oom_realloc(void*, size_t);
-
-#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
- static void (* __malloc_alloc_oom_handler)();
-#endif
-
-public:
-
- static void* allocate(size_t __n)
- {
- void* __result = malloc(__n);
- if (0 == __result) __result = _S_oom_malloc(__n);
- return __result;
- }
-
- static void deallocate(void* __p, size_t /* __n */)
- {
- free(__p);
- }
-
- static void* reallocate(void* __p, size_t /* old_sz */, size_t __new_sz)
- {
- void* __result = realloc(__p, __new_sz);
- if (0 == __result) __result = _S_oom_realloc(__p, __new_sz);
- return __result;
- }
-
- static void (* __set_malloc_handler(void (*__f)()))()
- {
- void (* __old)() = __malloc_alloc_oom_handler;
- __malloc_alloc_oom_handler = __f;
- return(__old);
- }
-
-};
-
-// malloc_alloc out-of-memory handling
-
-#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG
-template <int __inst>
-void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;
-#endif
-
-template <int __inst>
-void*
-__malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n)
-{
- void (* __my_malloc_handler)();
- void* __result;
-
- for (;;) {
- __my_malloc_handler = __malloc_alloc_oom_handler;
- if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
- (*__my_malloc_handler)();
- __result = malloc(__n);
- if (__result) return(__result);
- }
-}
-
-template <int __inst>
-void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n)
-{
- void (* __my_malloc_handler)();
- void* __result;
-
- for (;;) {
- __my_malloc_handler = __malloc_alloc_oom_handler;
- if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; }
- (*__my_malloc_handler)();
- __result = realloc(__p, __n);
- if (__result) return(__result);
- }
-}
-
-typedef __malloc_alloc_template<0> malloc_alloc;
-
-template<class _Tp, class _Alloc>
-class simple_alloc {
-
-public:
- static _Tp* allocate(size_t __n)
- { return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); }
- static _Tp* allocate(void)
- { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
- static void deallocate(_Tp* __p, size_t __n)
- { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
- static void deallocate(_Tp* __p)
- { _Alloc::deallocate(__p, sizeof (_Tp)); }
-};
-
-// Allocator adaptor to check size arguments for debugging.
-// Reports errors using assert. Checking can be disabled with
-// NDEBUG, but it's far better to just use the underlying allocator
-// instead when no checking is desired.
-// There is some evidence that this can confuse Purify.
-template <class _Alloc>
-class debug_alloc {
-
-private:
-
- enum {_S_extra = 8}; // Size of space used to store size. Note
- // that this must be large enough to preserve
- // alignment.
-
-public:
-
- static void* allocate(size_t __n)
- {
- char* __result = (char*)_Alloc::allocate(__n + _S_extra);
- *(size_t*)__result = __n;
- return __result + _S_extra;
- }
-
- static void deallocate(void* __p, size_t __n)
- {
- char* __real_p = (char*)__p - _S_extra;
- assert(*(size_t*)__real_p == __n);
- _Alloc::deallocate(__real_p, __n + _S_extra);
- }
-
- static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz)
- {
- char* __real_p = (char*)__p - _S_extra;
- assert(*(size_t*)__real_p == __old_sz);
- char* __result = (char*)
- _Alloc::reallocate(__real_p, __old_sz + _S_extra, __new_sz + _S_extra);
- *(size_t*)__result = __new_sz;
- return __result + _S_extra;
- }
-
-};
-
-
-# ifdef __USE_MALLOC
-
-typedef malloc_alloc alloc;
-typedef malloc_alloc single_client_alloc;
-
-# else
-
-
-// Default node allocator.
-// With a reasonable compiler, this should be roughly as fast as the
-// original STL class-specific allocators, but with less fragmentation.
-// Default_alloc_template parameters are experimental and MAY
-// DISAPPEAR in the future. Clients should just use alloc for now.
-//
-// Important implementation properties:
-// 1. If the client request an object of size > _MAX_BYTES, the resulting
-// object will be obtained directly from malloc.
-// 2. In all other cases, we allocate an object of size exactly
-// _S_round_up(requested_size). Thus the client has enough size
-// information that we can return the object to the proper free list
-// without permanently losing part of the object.
-//
-
-// The first template parameter specifies whether more than one thread
-// may use this allocator. It is safe to allocate an object from
-// one instance of a default_alloc and deallocate it with another
-// one. This effectively transfers its ownership to the second one.
-// This may have undesirable effects on reference locality.
-// The second parameter is unreferenced and serves only to allow the
-// creation of multiple default_alloc instances.
-// Node that containers built on different allocator instances have
-// different types, limiting the utility of this approach.
-#ifdef __SUNPRO_CC
-// breaks if we make these template class members:
- enum {_ALIGN = 8};
- enum {_MAX_BYTES = 128};
- enum {_NFREELISTS = _MAX_BYTES/_ALIGN};
-#endif
-
-template <bool threads, int inst>
-class __default_alloc_template {
-
-private:
- // Really we should use static const int x = N
- // instead of enum { x = N }, but few compilers accept the former.
-# ifndef __SUNPRO_CC
- enum {_ALIGN = 8};
- enum {_MAX_BYTES = 128};
- enum {_NFREELISTS = _MAX_BYTES/_ALIGN};
-# endif
- static size_t
- _S_round_up(size_t __bytes)
- { return (((__bytes) + _ALIGN-1) & ~(_ALIGN - 1)); }
-
-__PRIVATE:
- union _Obj {
- union _Obj* _M_free_list_link;
- char _M_client_data[1]; /* The client sees this. */
- };
-private:
-# ifdef __SUNPRO_CC
- static _Obj* __VOLATILE _S_free_list[];
- // Specifying a size results in duplicate def for 4.1
-# else
- static _Obj* __VOLATILE _S_free_list[_NFREELISTS];
-# endif
- static size_t _S_freelist_index(size_t __bytes) {
- return (((__bytes) + _ALIGN-1)/_ALIGN - 1);
- }
-
- // Returns an object of size __n, and optionally adds to size __n free list.
- static void* _S_refill(size_t __n);
- // Allocates a chunk for nobjs of size "size". nobjs may be reduced
- // if it is inconvenient to allocate the requested number.
- static char* _S_chunk_alloc(size_t __size, int& __nobjs);
-
- // Chunk allocation state.
- static char* _S_start_free;
- static char* _S_end_free;
- static size_t _S_heap_size;
-
-# ifdef __STL_SGI_THREADS
- static volatile unsigned long _S_node_allocator_lock;
- static void _S_lock(volatile unsigned long*);
- static inline void _S_unlock(volatile unsigned long*);
-# endif
-
-# ifdef __STL_PTHREADS
- static pthread_mutex_t _S_node_allocator_lock;
-# endif
-
-# ifdef __STL_SOLTHREADS
- static mutex_t _S_node_allocator_lock;
-# endif
-
-# ifdef __STL_WIN32THREADS
- static CRITICAL_SECTION _S_node_allocator_lock;
- static bool _S_node_allocator_lock_initialized;
-
- public:
- __default_alloc_template() {
- // This assumes the first constructor is called before threads
- // are started.
- if (!_S_node_allocator_lock_initialized) {
- InitializeCriticalSection(&_S_node_allocator_lock);
- _S_node_allocator_lock_initialized = true;
- }
- }
- private:
-# endif
-
- class _Lock {
- public:
- _Lock() { __NODE_ALLOCATOR_LOCK; }
- ~_Lock() { __NODE_ALLOCATOR_UNLOCK; }
- };
- friend class _Lock;
-
-public:
-
- /* __n must be > 0 */
- static void* allocate(size_t __n)
- {
- _Obj* __VOLATILE* __my_free_list;
- _Obj* __RESTRICT __result;
-
- if (__n > (size_t) _MAX_BYTES) {
- return(malloc_alloc::allocate(__n));
- }
- __my_free_list = _S_free_list + _S_freelist_index(__n);
- // Acquire the lock here with a constructor call.
- // This ensures that it is released in exit or during stack
- // unwinding.
-# ifndef _NOTHREADS
- /*REFERENCED*/
- _Lock __lock_instance;
-# endif
- __result = *__my_free_list;
- if (__result == 0) {
- void* __r = _S_refill(_S_round_up(__n));
- return __r;
- }
- *__my_free_list = __result -> _M_free_list_link;
- return (__result);
- };
-
- /* __p may not be 0 */
- static void deallocate(void* __p, size_t __n)
- {
- _Obj* __q = (_Obj*)__p;
- _Obj* __VOLATILE* __my_free_list;
-
- if (__n > (size_t) _MAX_BYTES) {
- malloc_alloc::deallocate(__p, __n);
- return;
- }
- __my_free_list = _S_free_list + _S_freelist_index(__n);
- // acquire lock
-# ifndef _NOTHREADS
- /*REFERENCED*/
- _Lock __lock_instance;
-# endif /* _NOTHREADS */
- __q -> _M_free_list_link = *__my_free_list;
- *__my_free_list = __q;
- // lock is released here
- }
-
- static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz);
-
-} ;
-
-typedef __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0> alloc;
-typedef __default_alloc_template<false, 0> single_client_alloc;
-
-
-
-/* We allocate memory in large chunks in order to avoid fragmenting */
-/* the malloc heap too much. */
-/* We assume that size is properly aligned. */
-/* We hold the allocation lock. */
-template <bool __threads, int __inst>
-char*
-__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size,
- int& __nobjs)
-{
- char* __result;
- size_t __total_bytes = __size * __nobjs;
- size_t __bytes_left = _S_end_free - _S_start_free;
-
- if (__bytes_left >= __total_bytes) {
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return(__result);
- } else if (__bytes_left >= __size) {
- __nobjs = (int)(__bytes_left/__size);
- __total_bytes = __size * __nobjs;
- __result = _S_start_free;
- _S_start_free += __total_bytes;
- return(__result);
- } else {
- size_t __bytes_to_get =
- 2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
- // Try to make use of the left-over piece.
- if (__bytes_left > 0) {
- _Obj* __VOLATILE* __my_free_list =
- _S_free_list + _S_freelist_index(__bytes_left);
-
- ((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list;
- *__my_free_list = (_Obj*)_S_start_free;
- }
- _S_start_free = (char*)malloc(__bytes_to_get);
- if (0 == _S_start_free) {
- size_t __i;
- _Obj* __VOLATILE* __my_free_list;
- _Obj* __p;
- // Try to make do with what we have. That can't
- // hurt. We do not try smaller requests, since that tends
- // to result in disaster on multi-process machines.
- for (__i = __size; __i <= _MAX_BYTES; __i += _ALIGN) {
- __my_free_list = _S_free_list + _S_freelist_index(__i);
- __p = *__my_free_list;
- if (0 != __p) {
- *__my_free_list = __p -> _M_free_list_link;
- _S_start_free = (char*)__p;
- _S_end_free = _S_start_free + __i;
- return(_S_chunk_alloc(__size, __nobjs));
- // Any leftover piece will eventually make it to the
- // right free list.
- }
- }
- _S_end_free = 0; // In case of exception.
- _S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get);
- // This should either throw an
- // exception or remedy the situation. Thus we assume it
- // succeeded.
- }
- _S_heap_size += __bytes_to_get;
- _S_end_free = _S_start_free + __bytes_to_get;
- return(_S_chunk_alloc(__size, __nobjs));
- }
-}
-
-
-/* Returns an object of size __n, and optionally adds to size __n free list.*/
-/* We assume that __n is properly aligned. */
-/* We hold the allocation lock. */
-template <bool __threads, int __inst>
-void*
-__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
-{
- int __nobjs = 20;
- char* __chunk = _S_chunk_alloc(__n, __nobjs);
- _Obj* __VOLATILE* __my_free_list;
- _Obj* __result;
- _Obj* __current_obj;
- _Obj* __next_obj;
- int __i;
-
- if (1 == __nobjs) return(__chunk);
- __my_free_list = _S_free_list + _S_freelist_index(__n);
-
- /* Build free list in chunk */
- __result = (_Obj*)__chunk;
- *__my_free_list = __next_obj = (_Obj*)(__chunk + __n);
- for (__i = 1; ; __i++) {
- __current_obj = __next_obj;
- __next_obj = (_Obj*)((char*)__next_obj + __n);
- if (__nobjs - 1 == __i) {
- __current_obj -> _M_free_list_link = 0;
- break;
- } else {
- __current_obj -> _M_free_list_link = __next_obj;
- }
- }
- return(__result);
-}
-
-template <bool threads, int inst>
-void*
-__default_alloc_template<threads, inst>::reallocate(void* __p,
- size_t __old_sz,
- size_t __new_sz)
-{
- void* __result;
- size_t __copy_sz;
-
- if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) {
- return(realloc(__p, __new_sz));
- }
- if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
- __result = allocate(__new_sz);
- __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
- memcpy(__result, __p, __copy_sz);
- deallocate(__p, __old_sz);
- return(__result);
-}
-
-#ifdef __STL_PTHREADS
- template <bool __threads, int __inst>
- pthread_mutex_t
- __default_alloc_template<__threads, __inst>::_S_node_allocator_lock
- = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-#ifdef __STL_SOLTHREADS
- template <bool __threads, int __inst>
- mutex_t
- __default_alloc_template<__threads, __inst>::_S_node_allocator_lock
- = DEFAULTMUTEX;
-#endif
-
-#ifdef __STL_WIN32THREADS
- template <bool __threads, int __inst>
- CRITICAL_SECTION
- __default_alloc_template<__threads, __inst>::
- _S_node_allocator_lock;
-
- template <bool __threads, int __inst>
- bool
- __default_alloc_template<__threads, __inst>::
- _S_node_allocator_lock_initialized
- = false;
-#endif
-
-#ifdef __STL_SGI_THREADS
-__STL_END_NAMESPACE
-#include <mutex.h>
-#include <time.h> /* XXX should use <ctime> */
-__STL_BEGIN_NAMESPACE
-// Somewhat generic lock implementations. We need only test-and-set
-// and some way to sleep. These should work with both SGI pthreads
-// and sproc threads. They may be useful on other systems.
-template <bool __threads, int __inst>
-volatile unsigned long
-__default_alloc_template<__threads, __inst>::_S_node_allocator_lock = 0;
-
-#if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) || defined(__GNUC__)
-# define __test_and_set(l,v) test_and_set(l,v)
-#endif
-
-template <bool __threads, int __inst>
-void
-__default_alloc_template<__threads, __inst>::
- _S_lock(volatile unsigned long* __lock)
-{
- const unsigned __low_spin_max = 30; // spins if we suspect uniprocessor
- const unsigned __high_spin_max = 1000; // spins for multiprocessor
- static unsigned __spin_max = __low_spin_max;
- unsigned __my_spin_max;
- static unsigned __last_spins = 0;
- unsigned __my_last_spins;
- unsigned __junk;
-# define __ALLOC_PAUSE \
- __junk *= __junk; __junk *= __junk; __junk *= __junk; __junk *= __junk
- int __i;
-
- if (!__test_and_set((unsigned long*)__lock, 1)) {
- return;
- }
- __my_spin_max = __spin_max;
- __my_last_spins = __last_spins;
- for (__i = 0; __i < __my_spin_max; __i++) {
- if (__i < __my_last_spins/2 || *__lock) {
- __ALLOC_PAUSE;
- continue;
- }
- if (!__test_and_set((unsigned long*)__lock, 1)) {
- // got it!
- // Spinning worked. Thus we're probably not being scheduled
- // against the other process with which we were contending.
- // Thus it makes sense to spin longer the next time.
- __last_spins = __i;
- __spin_max = __high_spin_max;
- return;
- }
- }
- // We are probably being scheduled against the other process. Sleep.
- __spin_max = __low_spin_max;
- for (__i = 0 ;; ++__i) {
- struct timespec __ts;
- int __log_nsec = __i + 6;
-
- if (!__test_and_set((unsigned long *)__lock, 1)) {
- return;
- }
- if (__log_nsec > 27) __log_nsec = 27;
- /* Max sleep is 2**27nsec ~ 60msec */
- __ts.tv_sec = 0;
- __ts.tv_nsec = 1 << __log_nsec;
- nanosleep(&__ts, 0);
- }
-}
-
-template <bool __threads, int __inst>
-inline void
-__default_alloc_template<__threads, __inst>::_S_unlock(
- volatile unsigned long* __lock)
-{
-# if defined(__GNUC__) && __mips >= 3
- asm("sync");
- *__lock = 0;
-# elif __mips >= 3 && (defined (_ABIN32) || defined(_ABI64))
- __lock_release(__lock);
-# else
- *__lock = 0;
- // This is not sufficient on many multiprocessors, since
- // writes to protected variables and the lock may be reordered.
-# endif
-}
-#endif
-
-template <bool __threads, int __inst>
-char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;
-
-template <bool __threads, int __inst>
-char* __default_alloc_template<__threads, __inst>::_S_end_free = 0;
-
-template <bool __threads, int __inst>
-size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0;
-
-template <bool __threads, int __inst>
-__default_alloc_template<__threads, __inst>::_Obj* __VOLATILE
-__default_alloc_template<__threads, __inst> ::_S_free_list[
- _NFREELISTS
-] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
-// The 16 zeros are necessary to make version 4.1 of the SunPro
-// compiler happy. Otherwise it appears to allocate too little
-// space for the array.
-
-# ifdef __STL_WIN32THREADS
- // Create one to get critical section initialized.
- // We do this onece per file, but only the first constructor
- // does anything.
- static alloc __node_allocator_dummy_instance;
-# endif
-
-#endif /* ! __USE_MALLOC */
-
-// This implements allocators as specified in the C++ standard.
-//
-// Note that standard-conforming allocators use many language features
-// that are not yet widely implemented. In particular, they rely on
-// member templates, partial specialization, partial ordering of function
-// templates, the typename keyword, and the use of the template keyword
-// to refer to a template member of a dependent type.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-template <class _Tp>
-class allocator {
- typedef alloc _Alloc; // The underlying allocator.
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
- template <class _Tp1> struct rebind {
- typedef allocator<_Tp1> other;
- };
-
- allocator() __STL_NOTHROW {}
- allocator(const allocator&) __STL_NOTHROW {}
- template <class _Tp1> allocator(const allocator<_Tp1>&) __STL_NOTHROW {}
- ~allocator() __STL_NOTHROW {}
-
- pointer address(reference __x) const { return &__x; }
- const_pointer address(const_reference __x) const { return &__x; }
-
- // __n is permitted to be 0. The C++ standard says nothing about what
- // the return value is when __n == 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- return __n != 0 ? static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)))
- : 0;
- }
-
- // __p is not permitted to be a null pointer.
- void deallocate(pointer __p, size_type __n)
- { _Alloc::deallocate(__p, __n * sizeof(_Tp)); }
-
- size_type max_size() const __STL_NOTHROW
- { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
- void destroy(pointer __p) { __p->~_Tp(); }
-};
-
-template<>
-class allocator<void> {
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-
- template <class _Tp1> struct rebind {
- typedef allocator<_Tp1> other;
- };
-};
-
-
-template <class _T1, class _T2>
-inline bool operator==(const allocator<_T1>&, const allocator<_T2>&)
-{
- return true;
-}
-
-template <class _T1, class _T2>
-inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&)
-{
- return false;
-}
-
-// Allocator adaptor to turn an SGI-style allocator (e.g. alloc, malloc_alloc)
-// into a standard-conforming allocator. Note that this adaptor does
-// *not* assume that all objects of the underlying alloc class are
-// identical, nor does it assume that all of the underlying alloc's
-// member functions are static member functions. Note, also, that
-// __allocator<_Tp, alloc> is essentially the same thing as allocator<_Tp>.
-
-template <class _Tp, class _Alloc>
-struct __allocator {
- _Alloc __underlying_alloc;
-
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef const _Tp* const_pointer;
- typedef _Tp& reference;
- typedef const _Tp& const_reference;
- typedef _Tp value_type;
-
- template <class _Tp1> struct rebind {
- typedef __allocator<_Tp1, _Alloc> other;
- };
-
- __allocator() __STL_NOTHROW {}
- __allocator(const __allocator& __a) __STL_NOTHROW
- : __underlying_alloc(__a.__underlying_alloc) {}
- template <class _Tp1>
- __allocator(const __allocator<_Tp1, _Alloc>& __a) __STL_NOTHROW
- : __underlying_alloc(__a.__underlying_alloc) {}
- ~__allocator() __STL_NOTHROW {}
-
- pointer address(reference __x) const { return &__x; }
- const_pointer address(const_reference __x) const { return &__x; }
-
- // __n is permitted to be 0.
- _Tp* allocate(size_type __n, const void* = 0) {
- return __n != 0
- ? static_cast<_Tp*>(__underlying_alloc.allocate(__n * sizeof(_Tp)))
- : 0;
- }
-
- // __p is not permitted to be a null pointer.
- void deallocate(pointer __p, size_type __n)
- { __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }
-
- size_type max_size() const __STL_NOTHROW
- { return size_t(-1) / sizeof(_Tp); }
-
- void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
- void destroy(pointer __p) { __p->~_Tp(); }
-};
-
-template <class _Alloc>
-class __allocator<void, _Alloc> {
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef void* pointer;
- typedef const void* const_pointer;
- typedef void value_type;
-
- template <class _Tp1> struct rebind {
- typedef __allocator<_Tp1, _Alloc> other;
- };
-};
-
-template <class _Tp, class _Alloc>
-inline bool operator==(const __allocator<_Tp, _Alloc>& __a1,
- const __allocator<_Tp, _Alloc>& __a2)
-{
- return __a1.__underlying_alloc == __a2.__underlying_alloc;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-template <class _Tp, class _Alloc>
-inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1,
- const __allocator<_Tp, _Alloc>& __a2)
-{
- return __a1.__underlying_alloc != __a2.__underlying_alloc;
-}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-// Comparison operators for all of the predifined SGI-style allocators.
-// This ensures that __allocator<malloc_alloc> (for example) will
-// work correctly.
-
-template <int inst>
-inline bool operator==(const __malloc_alloc_template<inst>&,
- const __malloc_alloc_template<inst>&)
-{
- return true;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-template <int __inst>
-inline bool operator!=(const __malloc_alloc_template<__inst>&,
- const __malloc_alloc_template<__inst>&)
-{
- return false;
-}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#ifndef __USE_MALLOC
-template <bool __threads, int __inst>
-inline bool operator==(const __default_alloc_template<__threads, __inst>&,
- const __default_alloc_template<__threads, __inst>&)
-{
- return true;
-}
-
-# ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-template <bool __threads, int __inst>
-inline bool operator!=(const __default_alloc_template<__threads, __inst>&,
- const __default_alloc_template<__threads, __inst>&)
-{
- return false;
-}
-# endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-#endif
-
-template <class _Alloc>
-inline bool operator==(const debug_alloc<_Alloc>&,
- const debug_alloc<_Alloc>&) {
- return true;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-template <class _Alloc>
-inline bool operator!=(const debug_alloc<_Alloc>&,
- const debug_alloc<_Alloc>&) {
- return false;
-}
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-// Another allocator adaptor: _Alloc_traits. This serves two
-// purposes. First, make it possible to write containers that can use
-// either SGI-style allocators or standard-conforming allocator.
-// Second, provide a mechanism so that containers can query whether or
-// not the allocator has distinct instances. If not, the container
-// can avoid wasting a word of memory to store an empty object.
-
-// This adaptor uses partial specialization. The general case of
-// _Alloc_traits<_Tp, _Alloc> assumes that _Alloc is a
-// standard-conforming allocator, possibly with non-equal instances
-// and non-static members. (It still behaves correctly even if _Alloc
-// has static member and if all instances are equal. Refinements
-// affect performance, not correctness.)
-
-// There are always two members: allocator_type, which is a standard-
-// conforming allocator type for allocating objects of type _Tp, and
-// _S_instanceless, a static const member of type bool. If
-// _S_instanceless is true, this means that there is no difference
-// between any two instances of type allocator_type. Furthermore, if
-// _S_instanceless is true, then _Alloc_traits has one additional
-// member: _Alloc_type. This type encapsulates allocation and
-// deallocation of objects of type _Tp through a static interface; it
-// has two member functions, whose signatures are
-// static _Tp* allocate(size_t)
-// static void deallocate(_Tp*, size_t)
-
-// The fully general version.
-
-template <class _Tp, class _Allocator>
-struct _Alloc_traits
-{
- static const bool _S_instanceless = false;
- typedef typename _Allocator::__STL_TEMPLATE rebind<_Tp>::other
- allocator_type;
-};
-
-template <class _Tp, class _Allocator>
-const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless;
-
-// The version for the default allocator.
-
-template <class _Tp, class _Tp1>
-struct _Alloc_traits<_Tp, allocator<_Tp1> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, alloc> _Alloc_type;
- typedef allocator<_Tp> allocator_type;
-};
-
-// Versions for the predefined SGI-style allocators.
-
-template <class _Tp, int __inst>
-struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
- typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
-};
-
-#ifndef __USE_MALLOC
-template <class _Tp, bool __threads, int __inst>
-struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, __default_alloc_template<__threads, __inst> >
- _Alloc_type;
- typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> >
- allocator_type;
-};
-#endif
-
-template <class _Tp, class _Alloc>
-struct _Alloc_traits<_Tp, debug_alloc<_Alloc> >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
- typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
-};
-
-// Versions for the __allocator adaptor used with the predefined
-// SGI-style allocators.
-
-template <class _Tp, class _Tp1, int __inst>
-struct _Alloc_traits<_Tp,
- __allocator<_Tp1, __malloc_alloc_template<__inst> > >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
- typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
-};
-
-#ifndef __USE_MALLOC
-template <class _Tp, class _Tp1, bool __thr, int __inst>
-struct _Alloc_traits<_Tp,
- __allocator<_Tp1,
- __default_alloc_template<__thr, __inst> > >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, __default_alloc_template<__thr,__inst> >
- _Alloc_type;
- typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> >
- allocator_type;
-};
-#endif
-
-template <class _Tp, class _Tp1, class _Alloc>
-struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > >
-{
- static const bool _S_instanceless = true;
- typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type;
- typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type;
-};
-
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#endif
-
-__STL_END_NAMESPACE
-
-#undef __PRIVATE
-
-#endif /* __SGI_STL_INTERNAL_ALLOC_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_bvector.h b/contrib/libstdc++/stl/stl_bvector.h
deleted file mode 100644
index 0d0cdb6..0000000
--- a/contrib/libstdc++/stl/stl_bvector.h
+++ /dev/null
@@ -1,838 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_BVECTOR_H
-#define __SGI_STL_INTERNAL_BVECTOR_H
-
-__STL_BEGIN_NAMESPACE
-
-static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-struct _Bit_reference {
- unsigned int* _M_p;
- unsigned int _M_mask;
- _Bit_reference(unsigned int* __x, unsigned int __y)
- : _M_p(__x), _M_mask(__y) {}
-
-public:
- _Bit_reference() : _M_p(0), _M_mask(0) {}
- operator bool() const { return !(!(*_M_p & _M_mask)); }
- _Bit_reference& operator=(bool __x)
- {
- if (__x) *_M_p |= _M_mask;
- else *_M_p &= ~_M_mask;
- return *this;
- }
- _Bit_reference& operator=(const _Bit_reference& __x)
- { return *this = bool(__x); }
- bool operator==(const _Bit_reference& __x) const
- { return bool(*this) == bool(__x); }
- bool operator<(const _Bit_reference& __x) const {
- return !bool(*this) && bool(__x);
- }
- void flip() { *_M_p ^= _M_mask; }
-};
-
-inline void swap(_Bit_reference __x, _Bit_reference __y)
-{
- bool __tmp = __x;
- __x = __y;
- __y = __tmp;
-}
-
-struct _Bit_iterator : public random_access_iterator<bool, ptrdiff_t> {
- typedef _Bit_reference reference;
- typedef _Bit_reference* pointer;
- typedef _Bit_iterator iterator;
-
- unsigned int* _M_p;
- unsigned int _M_offset;
- void bump_up() {
- if (_M_offset++ == __WORD_BIT - 1) {
- _M_offset = 0;
- ++_M_p;
- }
- }
- void bump_down() {
- if (_M_offset-- == 0) {
- _M_offset = __WORD_BIT - 1;
- --_M_p;
- }
- }
-
- _Bit_iterator() : _M_p(0), _M_offset(0) {}
- _Bit_iterator(unsigned int* __x, unsigned int __y)
- : _M_p(__x), _M_offset(__y) {}
- reference operator*() const { return reference(_M_p, 1U << _M_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 + _M_offset;
- _M_p += __n / __WORD_BIT;
- __n = __n % __WORD_BIT;
- if (__n < 0) {
- _M_offset = (unsigned int) __n + __WORD_BIT;
- --_M_p;
- } else
- _M_offset = (unsigned int) __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 * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
- }
- reference operator[](difference_type __i) { return *(*this + __i); }
- bool operator==(const iterator& __x) const {
- return _M_p == __x._M_p && _M_offset == __x._M_offset;
- }
- bool operator!=(const iterator& __x) const {
- return _M_p != __x._M_p || _M_offset != __x._M_offset;
- }
- bool operator<(iterator __x) const {
- return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset);
- }
-};
-
-struct _Bit_const_iterator
- : public random_access_iterator<bool, ptrdiff_t>
-{
- typedef bool reference;
- typedef bool const_reference;
- typedef const bool* pointer;
- typedef _Bit_const_iterator const_iterator;
-
- unsigned int* _M_p;
- unsigned int _M_offset;
- void bump_up() {
- if (_M_offset++ == __WORD_BIT - 1) {
- _M_offset = 0;
- ++_M_p;
- }
- }
- void bump_down() {
- if (_M_offset-- == 0) {
- _M_offset = __WORD_BIT - 1;
- --_M_p;
- }
- }
-
- _Bit_const_iterator() : _M_p(0), _M_offset(0) {}
- _Bit_const_iterator(unsigned int* __x, unsigned int __y)
- : _M_p(__x), _M_offset(__y) {}
- _Bit_const_iterator(const _Bit_iterator& __x)
- : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
- const_reference operator*() const {
- return _Bit_reference(_M_p, 1U << _M_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 + _M_offset;
- _M_p += __n / __WORD_BIT;
- __n = __n % __WORD_BIT;
- if (__n < 0) {
- _M_offset = (unsigned int) __n + __WORD_BIT;
- --_M_p;
- } else
- _M_offset = (unsigned int) __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 * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
- }
- const_reference operator[](difference_type __i) {
- return *(*this + __i);
- }
- bool operator==(const const_iterator& __x) const {
- return _M_p == __x._M_p && _M_offset == __x._M_offset;
- }
- bool operator!=(const const_iterator& __x) const {
- return _M_p != __x._M_p || _M_offset != __x._M_offset;
- }
- bool operator<(const_iterator __x) const {
- return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset);
- }
-};
-
-// Bit-vector base class, which encapsulates the difference between
-// old SGI-style allocators and standard-conforming allocators.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-// Base class for ordinary allocators.
-template <class _Allocator, bool __is_static>
-class _Bvector_alloc_base {
-public:
- typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _M_data_allocator; }
-
- _Bvector_alloc_base(const allocator_type& __a)
- : _M_data_allocator(__a), _M_start(), _M_finish(), _M_end_of_storage(0) {}
-
-protected:
- unsigned int* _M_bit_alloc(size_t __n)
- { return _M_data_allocator.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
- void _M_deallocate() {
- if (_M_start._M_p)
- _M_data_allocator.deallocate(_M_start._M_p,
- _M_end_of_storage - _M_start._M_p);
- }
-
- typename _Alloc_traits<unsigned int, _Allocator>::allocator_type
- _M_data_allocator;
- _Bit_iterator _M_start;
- _Bit_iterator _M_finish;
- unsigned int* _M_end_of_storage;
-};
-
-// Specialization for instanceless allocators.
-template <class _Allocator>
-class _Bvector_alloc_base<_Allocator, true> {
-public:
- typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Bvector_alloc_base(const allocator_type&)
- : _M_start(), _M_finish(), _M_end_of_storage(0) {}
-
-protected:
- typedef typename _Alloc_traits<unsigned int, _Allocator>::_Alloc_type
- _Alloc_type;
-
- unsigned int* _M_bit_alloc(size_t __n)
- { return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
- void _M_deallocate() {
- if (_M_start._M_p)
- _Alloc_type::deallocate(_M_start._M_p,
- _M_end_of_storage - _M_start._M_p);
- }
-
- _Bit_iterator _M_start;
- _Bit_iterator _M_finish;
- unsigned int* _M_end_of_storage;
-};
-
-template <class _Alloc>
-class _Bvector_base
- : public _Bvector_alloc_base<_Alloc,
- _Alloc_traits<bool, _Alloc>::_S_instanceless>
-{
- typedef _Bvector_alloc_base<_Alloc,
- _Alloc_traits<bool, _Alloc>::_S_instanceless>
- _Base;
-public:
- typedef typename _Base::allocator_type allocator_type;
-
- _Bvector_base(const allocator_type& __a) : _Base(__a) {}
- ~_Bvector_base() { _Base::_M_deallocate(); }
-};
-
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Alloc>
-class _Bvector_base
-{
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Bvector_base(const allocator_type&)
- : _M_start(), _M_finish(), _M_end_of_storage(0) {}
- ~_Bvector_base() { _M_deallocate(); }
-
-protected:
- typedef simple_alloc<unsigned int, _Alloc> _Alloc_type;
-
- unsigned int* _M_bit_alloc(size_t __n)
- { return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
- void _M_deallocate() {
- if (_M_start._M_p)
- _Alloc_type::deallocate(_M_start._M_p,
- _M_end_of_storage - _M_start._M_p);
- }
-
- _Bit_iterator _M_start;
- _Bit_iterator _M_finish;
- unsigned int* _M_end_of_storage;
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-// The next few lines are confusing. What we're doing is declaring a
-// partial specialization of vector<T, Alloc> if we have the necessary
-// compiler support. Otherwise, we define a class bit_vector which uses
-// the default allocator.
-
-#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && !defined(__STL_NO_BOOL)
-#define __SGI_STL_VECBOOL_TEMPLATE
-#define __BVECTOR vector
-#else
-#undef __SGI_STL_VECBOOL_TEMPLATE
-#define __BVECTOR bit_vector
-#endif
-
-# ifdef __SGI_STL_VECBOOL_TEMPLATE
- __STL_END_NAMESPACE
-# include <stl_vector.h>
- __STL_BEGIN_NAMESPACE
-template<class _Alloc> class vector<bool,_Alloc>
- : public _Bvector_base<_Alloc>
-# else /* __SGI_STL_VECBOOL_TEMPLATE */
-class bit_vector
- : public _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) >
-# endif /* __SGI_STL_VECBOOL_TEMPLATE */
-{
-# ifdef __SGI_STL_VECBOOL_TEMPLATE
- typedef _Bvector_base<_Alloc> _Base;
-# else /* __SGI_STL_VECBOOL_TEMPLATE */
- typedef _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) > _Base;
-# endif /* __SGI_STL_VECBOOL_TEMPLATE */
-public:
- typedef bool value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Bit_reference reference;
- typedef bool const_reference;
- typedef _Bit_reference* pointer;
- typedef const bool* const_pointer;
-
- typedef _Bit_iterator iterator;
- typedef _Bit_const_iterator const_iterator;
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
- typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- 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;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
- typedef typename _Base::allocator_type allocator_type;
- allocator_type get_allocator() const { return _Base::get_allocator(); }
-
-protected:
-#ifdef __STL_USE_NAMESPACES
- using _Base::_M_bit_alloc;
- using _Base::_M_deallocate;
- using _Base::_M_start;
- using _Base::_M_finish;
- using _Base::_M_end_of_storage;
-#endif /* __STL_USE_NAMESPACES */
-
-protected:
- void _M_initialize(size_type __n) {
- unsigned int* __q = _M_bit_alloc(__n);
- _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
- _M_finish = _M_start + difference_type(__n);
- }
- void _M_insert_aux(iterator __position, bool __x) {
- if (_M_finish._M_p != _M_end_of_storage) {
- copy_backward(__position, _M_finish, _M_finish + 1);
- *__position = __x;
- ++_M_finish;
- }
- else {
- size_type __len = size() ? 2 * size() : __WORD_BIT;
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- *__i++ = __x;
- _M_finish = copy(__position, end(), __i);
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
- }
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void _M_initialize_range(_InputIterator __first, _InputIterator __last,
- input_iterator_tag) {
- _M_start = iterator();
- _M_finish = iterator();
- _M_end_of_storage = 0;
- for ( ; __first != __last; ++__first)
- push_back(*__first);
- }
-
- template <class _ForwardIterator>
- void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag) {
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_initialize(__n);
- copy(__first, __last, _M_start);
- }
-
- template <class _InputIterator>
- void _M_insert_range(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- input_iterator_tag) {
- for ( ; __first != __last; ++__first) {
- __pos = insert(__pos, *__first);
- ++__pos;
- }
- }
-
- template <class _ForwardIterator>
- void _M_insert_range(iterator __position,
- _ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag) {
- if (__first != __last) {
- size_type __n = 0;
- distance(__first, __last, __n);
- if (capacity() - size() >= __n) {
- copy_backward(__position, end(), _M_finish + difference_type(__n));
- copy(__first, __last, __position);
- _M_finish += difference_type(__n);
- }
- else {
- size_type __len = size() + max(size(), __n);
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- _M_finish = copy(__position, end(), __i);
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
- }
- }
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-public:
- iterator begin() { return _M_start; }
- const_iterator begin() const { return _M_start; }
- iterator end() { return _M_finish; }
- const_iterator end() const { return _M_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 size_type(-1); }
- size_type capacity() const {
- return size_type(const_iterator(_M_end_of_storage, 0) - begin());
- }
- bool empty() const { return begin() == end(); }
- reference operator[](size_type __n) {
- return *(begin() + difference_type(__n));
- }
- const_reference operator[](size_type __n) const {
- return *(begin() + difference_type(__n));
- }
-
- explicit __BVECTOR(const allocator_type& __a = allocator_type())
- : _Base(__a) {}
-
- __BVECTOR(size_type __n, bool __value,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- _M_initialize(__n);
- fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0);
- }
-
- explicit __BVECTOR(size_type __n)
- : _Base(allocator_type())
- {
- _M_initialize(__n);
- fill(_M_start._M_p, _M_end_of_storage, 0);
- }
-
- __BVECTOR(const __BVECTOR& __x) : _Base(__x.get_allocator()) {
- _M_initialize(__x.size());
- copy(__x.begin(), __x.end(), _M_start);
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- __BVECTOR(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_initialize_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
- _M_initialize(__n);
- fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
- }
-
- template <class _InputIterator>
- void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
- __false_type) {
- _M_initialize_range(__first, __last, __ITERATOR_CATEGORY(__first));
- }
-#else /* __STL_MEMBER_TEMPLATES */
- __BVECTOR(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_initialize(__n);
- copy(__first, __last, _M_start);
- }
- __BVECTOR(const bool* __first, const bool* __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_initialize(__n);
- copy(__first, __last, _M_start);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- ~__BVECTOR() { }
-
- __BVECTOR& operator=(const __BVECTOR& __x) {
- if (&__x == this) return *this;
- if (__x.size() > capacity()) {
- _M_deallocate();
- _M_initialize(__x.size());
- }
- copy(__x.begin(), __x.end(), begin());
- _M_finish = begin() + difference_type(__x.size());
- return *this;
- }
-
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_t __n, bool __x) {
- if (__n > size()) {
- fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
- insert(end(), __n - size(), __x);
- }
- else {
- erase(begin() + __n, end());
- fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
- }
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { assign((size_t) __n, (bool) __val); }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
- { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
-
- template <class _InputIterator>
- void _M_assign_aux(_InputIterator __first, _InputIterator __last,
- input_iterator_tag) {
- iterator __cur = begin();
- for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
- *__cur = *__first;
- if (__first == __last)
- erase(__cur, end());
- else
- insert(end(), __first, __last);
- }
-
- template <class _ForwardIterator>
- void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag) {
- size_type __len = 0;
- distance(__first, __last, __len);
- if (__len < size())
- erase(copy(__first, __last, begin()), end());
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, size());
- copy(__first, __mid, begin());
- insert(end(), __mid, __last);
- }
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void reserve(size_type __n) {
- if (capacity() < __n) {
- unsigned int* __q = _M_bit_alloc(__n);
- _M_finish = copy(begin(), end(), iterator(__q, 0));
- _M_deallocate();
- _M_start = iterator(__q, 0);
- _M_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 (_M_finish._M_p != _M_end_of_storage)
- *_M_finish++ = __x;
- else
- _M_insert_aux(end(), __x);
- }
- void swap(__BVECTOR& __x) {
- __STD::swap(_M_start, __x._M_start);
- __STD::swap(_M_finish, __x._M_finish);
- __STD::swap(_M_end_of_storage, __x._M_end_of_storage);
- }
- iterator insert(iterator __position, bool __x = bool()) {
- difference_type __n = __position - begin();
- if (_M_finish._M_p != _M_end_of_storage && __position == end())
- *_M_finish++ = __x;
- else
- _M_insert_aux(__position, __x);
- return begin() + __n;
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- void insert(iterator __position,
- _InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_insert_dispatch(__position, __first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- __true_type) {
- insert(__pos, (size_type) __n, (bool) __x);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- __false_type) {
- _M_insert_range(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
- }
-#else /* __STL_MEMBER_TEMPLATES */
- void 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(), _M_finish + __n);
- copy(__first, __last, __position);
- _M_finish += __n;
- }
- else {
- size_type __len = size() + max(size(), __n);
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- _M_finish = copy(__position, end(), __i);
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
- }
- }
-
- void insert(iterator __position, const bool* __first, const bool* __last) {
- if (__first == __last) return;
- size_type __n = 0;
- distance(__first, __last, __n);
- if (capacity() - size() >= __n) {
- copy_backward(__position, end(), _M_finish + __n);
- copy(__first, __last, __position);
- _M_finish += __n;
- }
- else {
- size_type __len = size() + max(size(), __n);
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- __i = copy(__first, __last, __i);
- _M_finish = copy(__position, end(), __i);
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
- }
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void insert(iterator __position, size_type __n, bool __x) {
- if (__n == 0) return;
- if (capacity() - size() >= __n) {
- copy_backward(__position, end(), _M_finish + difference_type(__n));
- fill(__position, __position + difference_type(__n), __x);
- _M_finish += difference_type(__n);
- }
- else {
- size_type __len = size() + max(size(), __n);
- unsigned int* __q = _M_bit_alloc(__len);
- iterator __i = copy(begin(), __position, iterator(__q, 0));
- fill_n(__i, __n, __x);
- _M_finish = copy(__position, end(), __i + difference_type(__n));
- _M_deallocate();
- _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
- _M_start = iterator(__q, 0);
- }
- }
-
- void pop_back() { --_M_finish; }
- iterator erase(iterator __position) {
- if (__position + 1 != end())
- copy(__position + 1, end(), __position);
- --_M_finish;
- return __position;
- }
- iterator erase(iterator __first, iterator __last) {
- _M_finish = copy(__last, end(), __first);
- return __first;
- }
- void resize(size_type __new_size, bool __x = bool()) {
- if (__new_size < size())
- erase(begin() + difference_type(__new_size), end());
- else
- insert(end(), __new_size - size(), __x);
- }
- void clear() { erase(begin(), end()); }
-};
-
-#ifdef __SGI_STL_VECBOOL_TEMPLATE
-
-typedef vector<bool, alloc> bit_vector;
-
-#else /* __SGI_STL_VECBOOL_TEMPLATE */
-
-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());
-}
-
-#endif /* __SGI_STL_VECBOOL_TEMPLATE */
-
-#undef __SGI_STL_VECBOOL_TEMPLATE
-#undef __BVECTOR
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_BVECTOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_config.h b/contrib/libstdc++/stl/stl_config.h
deleted file mode 100644
index d72f9e1..0000000
--- a/contrib/libstdc++/stl/stl_config.h
+++ /dev/null
@@ -1,356 +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.
- *
- * Copyright (c) 1997
- * Silicon Graphics
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __STL_CONFIG_H
-# define __STL_CONFIG_H
-
-// Flags:
-// * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin
-// type.
-// * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type.
-// * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48
-// function.
-// * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle
-// static members of template classes.
-// * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports
-// partial specialization of template classes.
-// * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler
-// supports partial specialization syntax for full specialization of
-// class templates. (Even if it doesn't actually support partial
-// specialization itself.)
-// * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports
-// partial ordering of function templates. (a.k.a partial specialization
-// of function templates.)
-// * __STL_MEMBER_TEMPLATES: defined if the compiler supports template
-// member functions of classes.
-// * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports
-// nested classes that are member templates of other classes.
-// * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler
-// supports calling a function template by providing its template
-// arguments explicitly.
-// * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable
-// to handle default template parameters that depend on previous template
-// parameters.
-// * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with
-// function template argument deduction for non-type template parameters.
-// * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable
-// to support the -> operator for iterators.
-// * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation
-// mode) supports exceptions.
-// * __STL_USE_NAMESPACES: defined if the compiler has the necessary
-// support for namespaces.
-// * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a
-// standard-conforming header <exception>.
-// * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX
-// system in multithreaded mode, using native SGI threads instead of
-// pthreads.
-// * __STL_WIN32THREADS: defined if this is being compiled on a WIN32
-// compiler in multithreaded mode.
-// * __STL_LONG_LONG if the compiler has long long and unsigned long long
-// types. (They're not in the C++ standard, but they are expected to be
-// included in the forthcoming C9X standard.)
-
-
-// User-settable macros that control compilation:
-// * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older
-// SGI-style allocators, instead of standard-conforming allocators,
-// even if the compiler supports all of the language features needed
-// for standard-conforming allocators.
-// * __STL_NO_NAMESPACES: if defined, don't put the library in namespace
-// std, even if the compiler supports namespaces.
-// * __STL_ASSERTIONS: if defined, then enable runtime checking through the
-// __stl_assert macro.
-// * _PTHREADS: if defined, use Posix threads for multithreading support.
-// * _NOTHREADS: if defined, don't use any multithreading support.
-
-
-// Other macros defined by this file:
-
-// * bool, true, and false, if __STL_NO_BOOL is defined.
-// * typename, as a null macro if it's not already a keyword.
-// * explicit, as a null macro if it's not already a keyword.
-// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.)
-// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.)
-// * __stl_assert, either as a test or as a null macro, depending on
-// whether or not __STL_ASSERTIONS is defined.
-
-#ifdef _PTHREADS
-# define __STL_PTHREADS
-#endif
-#ifdef _SOLTHREADS
-# define __STL_SOLTHREADS
-#endif
-
-# if defined(__sgi) && !defined(__GNUC__)
-# if !defined(_BOOL)
-# define __STL_NO_BOOL
-# endif
-# if defined(_WCHAR_T_IS_KEYWORD)
-# define __STL_HAS_WCHAR_T
-# endif
-# if !defined(_TYPENAME_IS_KEYWORD)
-# define __STL_NEED_TYPENAME
-# endif
-# ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# endif
-# ifdef _MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# endif
-# if defined(_MEMBER_TEMPLATE_KEYWORD)
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if !defined(_EXPLICIT_IS_KEYWORD)
-# define __STL_NEED_EXPLICIT
-# endif
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES)
-# define __STL_HAS_NAMESPACES
-# endif
-# if (_COMPILER_VERSION < 721)
-# define __STL_NO_EXCEPTION_HEADER
-# endif
-# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS)
-# define __STL_SGI_THREADS
-# endif
-# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
-# define __STL_LONG_LONG
-# endif
-# endif
-
-# ifdef __GNUC__
-# include <_G_config.h>
-# define __STL_HAS_WCHAR_T
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-# define __STL_STATIC_TEMPLATE_MEMBER_BUG
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# else
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_HAS_NAMESPACES
-# define __STL_NO_NAMESPACES
-# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-# define __STL_USE_NAMESPACES
-# endif
-# if defined(__linux__)
- /* glibc pre 2.0 is very buggy. We have to disable thread for it.
- It should be upgraded to glibc 2.0 or later. */
-# if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS)
-# define __STL_PTHREADS
-# ifdef __STRICT_ANSI__
- /* Work around a bug in the glibc 2.0.x pthread.h. */
-# define sigset_t __sigset_t
-# endif
-# endif
-# endif
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifndef __STRICT_ANSI__
-# define __STL_LONG_LONG
-# endif
-# endif
-
-# if defined(__SUNPRO_CC)
-# define __STL_NO_BOOL
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# define __STL_USE_EXCEPTIONS
-# endif
-
-# if defined(__COMO__)
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_USE_EXCEPTIONS
-# define __STL_HAS_NAMESPACES
-# endif
-
-# if defined(__MINGW32__)
-# define __STL_NO_DRAND48
-# endif
-
-# if defined(__CYGWIN__)
-# define __STL_NO_DRAND48
-# endif
-
-# if defined(_MSC_VER)
-# define __STL_NO_DRAND48
-# define __STL_NEED_TYPENAME
-# if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */
-# define __STL_NEED_EXPLICIT
-# define __STL_NO_BOOL
-# if _MSC_VER > 1000
-# include <yvals.h>
-# define __STL_DONT_USE_BOOL_TYPEDEF
-# endif
-# endif
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# define __SGI_STL_NO_ARROW_OPERATOR
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# if _MSC_VER >= 1200
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_HAS_NAMESPACES
-# define __STL_NO_NAMESPACES
-# endif
-# endif
-
-# if defined(__BORLANDC__)
-# define __STL_NO_DRAND48
-# define __STL_NEED_TYPENAME
-# define __STL_LIMITED_DEFAULT_TEMPLATES
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef __MT__
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-# if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF)
- typedef int bool;
-# define true 1
-# define false 0
-# endif
-
-# ifdef __STL_NEED_TYPENAME
-# define typename
-# endif
-
-# ifdef __STL_MEMBER_TEMPLATE_KEYWORD
-# define __STL_TEMPLATE template
-# else
-# define __STL_TEMPLATE
-# endif
-
-# ifdef __STL_NEED_EXPLICIT
-# define explicit
-# endif
-
-# ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_NULL_TMPL_ARGS <>
-# else
-# define __STL_NULL_TMPL_ARGS
-# endif
-
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX)
-# define __STL_TEMPLATE_NULL template<>
-# else
-# define __STL_TEMPLATE_NULL
-# endif
-
-// Use standard-conforming allocators if we have the necessary language
-// features. __STL_USE_SGI_ALLOCATORS is a hook so that users can
-// disable new-style allocators, and continue to use the same kind of
-// allocators as before, without having to edit library headers.
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \
- defined(__STL_MEMBER_TEMPLATES) && \
- defined(__STL_MEMBER_TEMPLATE_CLASSES) && \
- !defined(__STL_NO_BOOL) && \
- !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \
- !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \
- !defined(__STL_USE_SGI_ALLOCATORS)
-# define __STL_USE_STD_ALLOCATORS
-# endif
-
-# ifndef __STL_DEFAULT_ALLOCATOR
-# ifdef __STL_USE_STD_ALLOCATORS
-# define __STL_DEFAULT_ALLOCATOR(T) allocator<T>
-# else
-# define __STL_DEFAULT_ALLOCATOR(T) alloc
-# endif
-# endif
-
-// __STL_NO_NAMESPACES is a hook so that users can disable namespaces
-// without having to edit library headers.
-# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES)
-# define __STD std
-# define __STL_BEGIN_NAMESPACE namespace std {
-# define __STL_END_NAMESPACE }
-# define __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE namespace std {
-# define __STL_END_RELOPS_NAMESPACE }
-# define __STD_RELOPS std
-# define __STL_USE_NAMESPACES
-# else
-# define __STD
-# define __STL_BEGIN_NAMESPACE
-# define __STL_END_NAMESPACE
-# undef __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE
-# define __STL_END_RELOPS_NAMESPACE
-# define __STD_RELOPS
-# undef __STL_USE_NAMESPACES
-# endif
-
-# ifdef __STL_USE_EXCEPTIONS
-# define __STL_TRY try
-# define __STL_CATCH_ALL catch(...)
-# define __STL_THROW(x) throw x
-# define __STL_RETHROW throw
-# define __STL_NOTHROW throw()
-# define __STL_UNWIND(action) catch(...) { action; throw; }
-# else
-# define __STL_TRY
-# define __STL_CATCH_ALL if (false)
-# define __STL_THROW(x)
-# define __STL_RETHROW
-# define __STL_NOTHROW
-# define __STL_UNWIND(action)
-# endif
-
-#ifdef __STL_ASSERTIONS
-# include <stdio.h>
-# define __stl_assert(expr) \
- if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \
- __FILE__, __LINE__, # expr); abort(); }
-#else
-# define __stl_assert(expr)
-#endif
-
-#endif /* __STL_CONFIG_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_construct.h b/contrib/libstdc++/stl/stl_construct.h
deleted file mode 100644
index 761784d..0000000
--- a/contrib/libstdc++/stl/stl_construct.h
+++ /dev/null
@@ -1,90 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H
-#define __SGI_STL_INTERNAL_CONSTRUCT_H
-
-#include <new.h>
-
-__STL_BEGIN_NAMESPACE
-
-// construct and destroy. These functions are not part of the C++ standard,
-// and are provided for backward compatibility with the HP STL.
-
-template <class _Tp>
-inline void destroy(_Tp* __pointer) {
- __pointer->~_Tp();
-}
-
-template <class _T1, class _T2>
-inline void construct(_T1* __p, const _T2& __value) {
- new (__p) _T1(__value);
-}
-
-template <class _T1>
-inline void construct(_T1* __p) {
- new (__p) _T1();
-}
-
-template <class _ForwardIterator>
-inline void
-__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type)
-{
- for ( ; __first != __last; ++__first)
- destroy(&*__first);
-}
-
-template <class _ForwardIterator>
-inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) {}
-
-template <class _ForwardIterator, class _Tp>
-inline void
-__destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*)
-{
- typedef typename __type_traits<_Tp>::has_trivial_destructor
- _Trivial_destructor;
- __destroy_aux(__first, __last, _Trivial_destructor());
-}
-
-template <class _ForwardIterator>
-inline void destroy(_ForwardIterator __first, _ForwardIterator __last) {
- __destroy(__first, __last, __VALUE_TYPE(__first));
-}
-
-inline void destroy(char*, char*) {}
-inline void destroy(wchar_t*, wchar_t*) {}
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_CONSTRUCT_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_deque.h b/contrib/libstdc++/stl/stl_deque.h
deleted file mode 100644
index 24a8bfb..0000000
--- a/contrib/libstdc++/stl/stl_deque.h
+++ /dev/null
@@ -1,1698 +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.
- *
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_DEQUE_H
-#define __SGI_STL_INTERNAL_DEQUE_H
-
-/* Class invariants:
- * For any nonsingular iterator i:
- * i.node is the address of an element in the map array. The
- * contents of i.node is a pointer to the beginning of a node.
- * i.first == *(i.node)
- * i.last == i.first + node_size
- * i.cur is a pointer in the range [i.first, i.last). NOTE:
- * the implication of this is that i.cur is always a dereferenceable
- * pointer, even if i is a past-the-end iterator.
- * Start and Finish are always nonsingular iterators. NOTE: this means
- * that an empty deque must have one node, and that a deque
- * with N elements, where N is the buffer size, must have two nodes.
- * For every node other than start.node and finish.node, every element
- * in the node is an initialized object. If start.node == finish.node,
- * then [start.cur, finish.cur) are initialized objects, and
- * the elements outside that range are uninitialized storage. Otherwise,
- * [start.cur, start.last) and [finish.first, finish.cur) are initialized
- * objects, and [start.first, start.cur) and [finish.cur, finish.last)
- * are uninitialized storage.
- * [map, map + map_size) is a valid, non-empty range.
- * [start.node, finish.node] is a valid range contained within
- * [map, map + map_size).
- * A pointer in the range [map, map + map_size) points to an allocated node
- * if and only if the pointer is in the range [start.node, finish.node].
- */
-
-
-/*
- * In previous versions of deque, node_size was fixed by the
- * implementation. In this version, however, users can select
- * the node size. Deque has three template parameters; the third,
- * a number of type size_t, is the number of elements per node.
- * If the third template parameter is 0 (which is the default),
- * then deque will use a default node size.
- *
- * The only reason for using an alternate node size is if your application
- * requires a different performance tradeoff than the default. If,
- * for example, your program contains many deques each of which contains
- * only a few elements, then you might want to save memory (possibly
- * by sacrificing some speed) by using smaller nodes.
- *
- * Unfortunately, some compilers have trouble with non-type template
- * parameters; stl_config.h defines __STL_NON_TYPE_TMPL_PARAM_BUG if
- * that is the case. If your compiler is one of them, then you will
- * not be able to use alternate node sizes; you will have to use the
- * default value.
- */
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-// Note: this function is simply a kludge to work around several compilers'
-// bugs in handling constant expressions.
-inline size_t
-__deque_buf_size(size_t __n, size_t __size)
-{
- return __n != 0 ? __n : (__size < 512 ? size_t(512 / __size) : size_t(1));
-}
-
-#ifndef __STL_NON_TYPE_TMPL_PARAM_BUG
-template <class _Tp, class _Ref, class _Ptr, size_t __bufsiz>
-struct _Deque_iterator {
- typedef _Deque_iterator<_Tp,_Tp&,_Tp*,__bufsiz> iterator;
- typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*,__bufsiz> const_iterator;
- static size_t
- _S_buffer_size() { return __deque_buf_size(__bufsiz, sizeof(_Tp)); }
-#else /* __STL_NON_TYPE_TMPL_PARAM_BUG */
-template <class _Tp, class _Ref, class _Ptr>
-struct _Deque_iterator {
- typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
- typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
- static size_t
- _S_buffer_size() { return __deque_buf_size(0, sizeof(_Tp)); }
-#endif
-
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Ptr pointer;
- typedef _Ref reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp** _Map_pointer;
-
- typedef _Deque_iterator _Self;
-
- _Tp* _M_cur;
- _Tp* _M_first;
- _Tp* _M_last;
- _Map_pointer _M_node;
-
- _Deque_iterator(_Tp* __x, _Map_pointer __y)
- : _M_cur(__x), _M_first(*__y),
- _M_last(*__y + _S_buffer_size()), _M_node(__y) {}
- _Deque_iterator() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {}
- _Deque_iterator(const iterator& __x)
- : _M_cur(__x._M_cur), _M_first(__x._M_first),
- _M_last(__x._M_last), _M_node(__x._M_node) {}
-
- reference operator*() const { return *_M_cur; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return _M_cur; }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
-
- difference_type operator-(const _Self& __x) const {
- return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) +
- (_M_cur - _M_first) + (__x._M_last - __x._M_cur);
- }
-
- _Self& operator++() {
- ++_M_cur;
- if (_M_cur == _M_last) {
- _M_set_node(_M_node + 1);
- _M_cur = _M_first;
- }
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- ++*this;
- return __tmp;
- }
-
- _Self& operator--() {
- if (_M_cur == _M_first) {
- _M_set_node(_M_node - 1);
- _M_cur = _M_last;
- }
- --_M_cur;
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- --*this;
- return __tmp;
- }
-
- _Self& operator+=(difference_type __n)
- {
- difference_type __offset = __n + (_M_cur - _M_first);
- if (__offset >= 0 && __offset < difference_type(_S_buffer_size()))
- _M_cur += __n;
- else {
- difference_type __node_offset =
- __offset > 0 ? __offset / difference_type(_S_buffer_size())
- : -difference_type((-__offset - 1) / _S_buffer_size()) - 1;
- _M_set_node(_M_node + __node_offset);
- _M_cur = _M_first +
- (__offset - __node_offset * difference_type(_S_buffer_size()));
- }
- return *this;
- }
-
- _Self operator+(difference_type __n) const
- {
- _Self __tmp = *this;
- return __tmp += __n;
- }
-
- _Self& operator-=(difference_type __n) { return *this += -__n; }
-
- _Self operator-(difference_type __n) const {
- _Self __tmp = *this;
- return __tmp -= __n;
- }
-
- reference operator[](difference_type __n) const { return *(*this + __n); }
-
- bool operator==(const _Self& __x) const { return _M_cur == __x._M_cur; }
- bool operator!=(const _Self& __x) const { return !(*this == __x); }
- bool operator<(const _Self& __x) const {
- return (_M_node == __x._M_node) ?
- (_M_cur < __x._M_cur) : (_M_node < __x._M_node);
- }
-
- void _M_set_node(_Map_pointer __new_node) {
- _M_node = __new_node;
- _M_first = *__new_node;
- _M_last = _M_first + difference_type(_S_buffer_size());
- }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-#ifndef __STL_NON_TYPE_TMPL_PARAM_BUG
-
-template <class _Tp, class _Ref, class _Ptr, size_t __bufsiz>
-inline random_access_iterator_tag
-iterator_category(const _Deque_iterator<_Tp,_Ref,_Ptr,__bufsiz>&) {
- return random_access_iterator_tag();
-}
-
-template <class _Tp, class _Ref, class _Ptr, size_t __bufsiz>
-inline _Tp*
-value_type(const _Deque_iterator<_Tp,_Ref,_Ptr,__bufsiz>&) {
- return 0;
-}
-
-template <class _Tp, class _Ref, class _Ptr, size_t __bufsiz>
-inline ptrdiff_t*
-distance_type(const _Deque_iterator<_Tp,_Ref,_Ptr,__bufsiz>&) {
- return 0;
-}
-
-#else /* __STL_NON_TYPE_TMPL_PARAM_BUG */
-
-template <class _Tp, class _Ref, class _Ptr>
-inline random_access_iterator_tag
-iterator_category(const _Deque_iterator<_Tp,_Ref,_Ptr>&)
-{
- return random_access_iterator_tag();
-}
-
-template <class _Tp, class _Ref, class _Ptr>
-inline _Tp*
-value_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) { return 0; }
-
-template <class _Tp, class _Ref, class _Ptr>
-inline ptrdiff_t*
-distance_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) {
- return 0;
-}
-
-#endif /* __STL_NON_TYPE_TMPL_PARAM_BUG */
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// Deque base class. It has two purposes. First, its constructor
-// and destructor allocate (but don't initialize) storage. This makes
-// exception safety easier. Second, the base class encapsulates all of
-// the differences between SGI-style allocators and standard-conforming
-// allocators.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-// Base class for ordinary allocators.
-template <class _Tp, class _Alloc, size_t __bufsiz, bool __is_static>
-class _Deque_alloc_base {
-public:
- typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type;
- allocator_type get_allocator() const { return node_allocator; }
-
- _Deque_alloc_base(const allocator_type& __a)
- : node_allocator(__a), map_allocator(__a), _M_map(0), _M_map_size(0)
- {}
-
-protected:
- typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type
- map_allocator_type;
-
- allocator_type node_allocator;
- map_allocator_type map_allocator;
-
- _Tp* _M_allocate_node() {
- return node_allocator.allocate(__deque_buf_size(__bufsiz,sizeof(_Tp)));
- }
- void _M_deallocate_node(_Tp* __p) {
- node_allocator.deallocate(__p, __deque_buf_size(__bufsiz,sizeof(_Tp)));
- }
- _Tp** _M_allocate_map(size_t __n)
- { return map_allocator.allocate(__n); }
- void _M_deallocate_map(_Tp** __p, size_t __n)
- { map_allocator.deallocate(__p, __n); }
-
- _Tp** _M_map;
- size_t _M_map_size;
-};
-
-// Specialization for instanceless allocators.
-template <class _Tp, class _Alloc, size_t __bufsiz>
-class _Deque_alloc_base<_Tp, _Alloc, __bufsiz, true>
-{
-public:
- typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Deque_alloc_base(const allocator_type&) : _M_map(0), _M_map_size(0) {}
-
-protected:
- typedef typename _Alloc_traits<_Tp, _Alloc>::_Alloc_type _Node_alloc_type;
- typedef typename _Alloc_traits<_Tp*, _Alloc>::_Alloc_type _Map_alloc_type;
-
- _Tp* _M_allocate_node()
- { return _Node_alloc_type::allocate(__deque_buf_size(__bufsiz,
- sizeof(_Tp))); }
- void _M_deallocate_node(_Tp* __p)
- { _Node_alloc_type::deallocate(__p, __deque_buf_size(__bufsiz,
- sizeof(_Tp))); }
- _Tp** _M_allocate_map(size_t __n)
- { return _Map_alloc_type::allocate(__n); }
- void _M_deallocate_map(_Tp** __p, size_t __n)
- { _Map_alloc_type::deallocate(__p, __n); }
-
- _Tp** _M_map;
- size_t _M_map_size;
-};
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-class _Deque_base
- : public _Deque_alloc_base<_Tp,_Alloc,__bufsiz,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
-{
-public:
- typedef _Deque_alloc_base<_Tp,_Alloc,__bufsiz,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
- typedef _Deque_iterator<_Tp,_Tp&,_Tp*,__bufsiz> iterator;
- typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*, __bufsiz> const_iterator;
-
- _Deque_base(const allocator_type& __a, size_t __num_elements)
- : _Base(__a), _M_start(), _M_finish()
- { _M_initialize_map(__num_elements); }
- _Deque_base(const allocator_type& __a)
- : _Base(__a), _M_start(), _M_finish() {}
- ~_Deque_base();
-
-protected:
- void _M_initialize_map(size_t);
- void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
- void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
- enum { _S_initial_map_size = 8 };
-
-protected:
- iterator _M_start;
- iterator _M_finish;
-};
-
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-class _Deque_base {
-public:
-#ifndef __STL_NON_TYPE_TMPL_PARAM_BUG
- typedef _Deque_iterator<_Tp,_Tp&,_Tp*,__bufsiz> iterator;
- typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*, __bufsiz> const_iterator;
-#else /* __STL_NON_TYPE_TMPL_PARAM_BUG */
- typedef _Deque_iterator<_Tp,_Tp&,_Tp*> iterator;
- typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
-#endif /* __STL_NON_TYPE_TMPL_PARAM_BUG */
-
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Deque_base(const allocator_type&, size_t __num_elements)
- : _M_map(0), _M_map_size(0), _M_start(), _M_finish() {
- _M_initialize_map(__num_elements);
- }
- _Deque_base(const allocator_type&)
- : _M_map(0), _M_map_size(0), _M_start(), _M_finish() {}
- ~_Deque_base();
-
-protected:
- void _M_initialize_map(size_t);
- void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
- void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
- enum { _S_initial_map_size = 8 };
-
-protected:
- _Tp** _M_map;
- size_t _M_map_size;
- iterator _M_start;
- iterator _M_finish;
-
- typedef simple_alloc<_Tp, _Alloc> _Node_alloc_type;
- typedef simple_alloc<_Tp*, _Alloc> _Map_alloc_type;
-
- _Tp* _M_allocate_node()
- { return _Node_alloc_type::allocate(__deque_buf_size(__bufsiz,
- sizeof(_Tp))); }
- void _M_deallocate_node(_Tp* __p)
- { _Node_alloc_type::deallocate(__p, __deque_buf_size(__bufsiz,
- sizeof(_Tp))); }
- _Tp** _M_allocate_map(size_t __n)
- { return _Map_alloc_type::allocate(__n); }
- void _M_deallocate_map(_Tp** __p, size_t __n)
- { _Map_alloc_type::deallocate(__p, __n); }
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-// Non-inline member functions from _Deque_base.
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-_Deque_base<_Tp,_Alloc,__bufsiz>::~_Deque_base() {
- if (_M_map) {
- _M_destroy_nodes(_M_start._M_node, _M_finish._M_node + 1);
- _M_deallocate_map(_M_map, _M_map_size);
- }
-}
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-void
-_Deque_base<_Tp,_Alloc,__bufsiz>::_M_initialize_map(size_t __num_elements)
-{
- size_t __num_nodes =
- __num_elements / __deque_buf_size(__bufsiz, sizeof(_Tp)) + 1;
-
- _M_map_size = max((size_t) _S_initial_map_size, __num_nodes + 2);
- _M_map = _M_allocate_map(_M_map_size);
-
- _Tp** __nstart = _M_map + (_M_map_size - __num_nodes) / 2;
- _Tp** __nfinish = __nstart + __num_nodes;
-
- __STL_TRY {
- _M_create_nodes(__nstart, __nfinish);
- }
- __STL_UNWIND((_M_deallocate_map(_M_map, _M_map_size),
- _M_map = 0, _M_map_size = 0));
- _M_start._M_set_node(__nstart);
- _M_finish._M_set_node(__nfinish - 1);
- _M_start._M_cur = _M_start._M_first;
- _M_finish._M_cur = _M_finish._M_first +
- __num_elements % __deque_buf_size(__bufsiz, sizeof(_Tp));
-}
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-void
-_Deque_base<_Tp,_Alloc,__bufsiz>::_M_create_nodes(_Tp** __nstart,
- _Tp** __nfinish)
-{
- _Tp** __cur;
- __STL_TRY {
- for (__cur = __nstart; __cur < __nfinish; ++__cur)
- *__cur = _M_allocate_node();
- }
- __STL_UNWIND(_M_destroy_nodes(__nstart, __cur));
-}
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-void
-_Deque_base<_Tp,_Alloc,__bufsiz>::_M_destroy_nodes(_Tp** __nstart,
- _Tp** __nfinish)
-{
- for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
- _M_deallocate_node(*__n);
-}
-
-// See __deque_buf_size(). The only reason that the default value is 0
-// is as a workaround for bugs in the way that some compilers handle
-// constant expressions.
-template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp),
- size_t __bufsiz = 0>
-class deque : protected _Deque_base<_Tp, _Alloc, __bufsiz> {
- typedef _Deque_base<_Tp, _Alloc, __bufsiz> _Base;
-public: // Basic types
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef typename _Base::allocator_type allocator_type;
- allocator_type get_allocator() const { return _Base::get_allocator(); }
-
-public: // Iterators
- typedef typename _Base::iterator iterator;
- typedef typename _Base::const_iterator const_iterator;
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
- typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- 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;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-protected: // Internal typedefs
- typedef pointer* _Map_pointer;
- static size_t _S_buffer_size()
- { return __deque_buf_size(__bufsiz, sizeof(_Tp)); }
-
-protected:
-#ifdef __STL_USE_NAMESPACES
- using _Base::_M_initialize_map;
- using _Base::_M_create_nodes;
- using _Base::_M_destroy_nodes;
- using _Base::_M_allocate_node;
- using _Base::_M_deallocate_node;
- using _Base::_M_allocate_map;
- using _Base::_M_deallocate_map;
-
- using _Base::_M_map;
- using _Base::_M_map_size;
- using _Base::_M_start;
- using _Base::_M_finish;
-#endif /* __STL_USE_NAMESPACES */
-
-public: // Basic accessors
- iterator begin() { return _M_start; }
- iterator end() { return _M_finish; }
- const_iterator begin() const { return _M_start; }
- const_iterator end() const { return _M_finish; }
-
- reverse_iterator rbegin() { return reverse_iterator(_M_finish); }
- reverse_iterator rend() { return reverse_iterator(_M_start); }
- const_reverse_iterator rbegin() const
- { return const_reverse_iterator(_M_finish); }
- const_reverse_iterator rend() const
- { return const_reverse_iterator(_M_start); }
-
- reference operator[](size_type __n)
- { return _M_start[difference_type(__n)]; }
- const_reference operator[](size_type __n) const
- { return _M_start[difference_type(__n)]; }
-
- reference front() { return *_M_start; }
- reference back() {
- iterator __tmp = _M_finish;
- --__tmp;
- return *__tmp;
- }
- const_reference front() const { return *_M_start; }
- const_reference back() const {
- const_iterator __tmp = _M_finish;
- --__tmp;
- return *__tmp;
- }
-
- size_type size() const { return _M_finish - _M_start;; }
- size_type max_size() const { return size_type(-1); }
- bool empty() const { return _M_finish == _M_start; }
-
-public: // Constructor, destructor.
- explicit deque(const allocator_type& __a = allocator_type())
- : _Base(__a, 0) {}
- deque(const deque& __x) : _Base(__x.get_allocator(), __x.size())
- { uninitialized_copy(__x.begin(), __x.end(), _M_start); }
- deque(size_type __n, const value_type& __value,
- const allocator_type& __a = allocator_type()) : _Base(__a, __n)
- { _M_fill_initialize(__value); }
- explicit deque(size_type __n) : _Base(allocator_type(), __n)
- { _M_fill_initialize(value_type()); }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- deque(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a = allocator_type()) : _Base(__a) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_initialize_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
- _M_initialize_map(__n);
- _M_fill_initialize(__x);
- }
-
- template <class _InputIter>
- void _M_initialize_dispatch(_InputIter __first, _InputIter __last,
- __false_type) {
- _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first));
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- deque(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a, __last - __first)
- { uninitialized_copy(__first, __last, _M_start); }
- deque(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a, __last - __first)
- { uninitialized_copy(__first, __last, _M_start); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- ~deque() { destroy(_M_start, _M_finish); }
-
- deque& operator= (const deque& __x) {
- const size_type __len = size();
- if (&__x != this) {
- if (__len >= __x.size())
- erase(copy(__x.begin(), __x.end(), _M_start), _M_finish);
- else {
- const_iterator __mid = __x.begin() + difference_type(__len);
- copy(__x.begin(), __mid, _M_start);
- insert(_M_finish, __mid, __x.end());
- }
- }
- return *this;
- }
-
- void swap(deque& __x) {
- __STD::swap(_M_start, __x._M_start);
- __STD::swap(_M_finish, __x._M_finish);
- __STD::swap(_M_map, __x._M_map);
- __STD::swap(_M_map_size, __x._M_map_size);
- }
-
-public:
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_type __n, const _Tp& __val) {
- if (__n > size()) {
- fill(begin(), end(), __val);
- insert(end(), __n - size(), __val);
- }
- else {
- erase(begin() + __n, end());
- fill(begin(), end(), __val);
- }
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
-private: // helper functions for assign()
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { assign((size_type) __n, (_Tp) __val); }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- __false_type) {
- _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first));
- }
-
- template <class _InputIterator>
- void _M_assign_aux(_InputIterator __first, _InputIterator __last,
- input_iterator_tag);
-
- template <class _ForwardIterator>
- void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag) {
- size_type __len = 0;
- distance(__first, __last, __len);
- if (__len > size()) {
- _ForwardIterator __mid = __first;
- advance(__mid, size());
- copy(__first, __mid, begin());
- insert(end(), __mid, __last);
- }
- else
- erase(copy(__first, __last, begin()), end());
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-public: // push_* and pop_*
-
- void push_back(const value_type& __t) {
- if (_M_finish._M_cur != _M_finish._M_last - 1) {
- construct(_M_finish._M_cur, __t);
- ++_M_finish._M_cur;
- }
- else
- _M_push_back_aux(__t);
- }
-
- void push_back() {
- if (_M_finish._M_cur != _M_finish._M_last - 1) {
- construct(_M_finish._M_cur);
- ++_M_finish._M_cur;
- }
- else
- _M_push_back_aux();
- }
-
- void push_front(const value_type& __t) {
- if (_M_start._M_cur != _M_start._M_first) {
- construct(_M_start._M_cur - 1, __t);
- --_M_start._M_cur;
- }
- else
- _M_push_front_aux(__t);
- }
-
- void push_front() {
- if (_M_start._M_cur != _M_start._M_first) {
- construct(_M_start._M_cur - 1);
- --_M_start._M_cur;
- }
- else
- _M_push_front_aux();
- }
-
-
- void pop_back() {
- if (_M_finish._M_cur != _M_finish._M_first) {
- --_M_finish._M_cur;
- destroy(_M_finish._M_cur);
- }
- else
- _M_pop_back_aux();
- }
-
- void pop_front() {
- if (_M_start._M_cur != _M_start._M_last - 1) {
- destroy(_M_start._M_cur);
- ++_M_start._M_cur;
- }
- else
- _M_pop_front_aux();
- }
-
-public: // Insert
-
- iterator insert(iterator position, const value_type& __x) {
- if (position._M_cur == _M_start._M_cur) {
- push_front(__x);
- return _M_start;
- }
- else if (position._M_cur == _M_finish._M_cur) {
- push_back(__x);
- iterator __tmp = _M_finish;
- --__tmp;
- return __tmp;
- }
- else {
- return _M_insert_aux(position, __x);
- }
- }
-
- iterator insert(iterator __position)
- { return insert(__position, value_type()); }
-
- void insert(iterator __pos, size_type __n, const value_type& __x);
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- __true_type) {
- insert(__pos, (size_type) __n, (value_type) __x);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- __false_type) {
- insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- void insert(iterator __pos,
- const value_type* __first, const value_type* __last);
- void insert(iterator __pos,
- const_iterator __first, const_iterator __last);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void resize(size_type __new_size, const value_type& __x) {
- const size_type __len = size();
- if (__new_size < __len)
- erase(_M_start + __new_size, _M_finish);
- else
- insert(_M_finish, __new_size - __len, __x);
- }
-
- void resize(size_type new_size) { resize(new_size, value_type()); }
-
-public: // Erase
- iterator erase(iterator __pos) {
- iterator __next = __pos;
- ++__next;
- difference_type __index = __pos - _M_start;
- if (static_cast<size_type>(__index) < (size() >> 1)) {
- copy_backward(_M_start, __pos, __next);
- pop_front();
- }
- else {
- copy(__next, _M_finish, __pos);
- pop_back();
- }
- return _M_start + __index;
- }
-
- iterator erase(iterator __first, iterator __last);
- void clear();
-
-protected: // Internal construction/destruction
-
- void _M_fill_initialize(const value_type& __value);
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void _M_range_initialize(_InputIterator __first, _InputIterator __last,
- input_iterator_tag);
-
- template <class _ForwardIterator>
- void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-protected: // Internal push_* and pop_*
-
- void _M_push_back_aux(const value_type&);
- void _M_push_back_aux();
- void _M_push_front_aux(const value_type&);
- void _M_push_front_aux();
- void _M_pop_back_aux();
- void _M_pop_front_aux();
-
-protected: // Internal insert functions
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last,
- input_iterator_tag);
-
- template <class _ForwardIterator>
- void insert(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- iterator _M_insert_aux(iterator __pos, const value_type& __x);
- iterator _M_insert_aux(iterator __pos);
- void _M_insert_aux(iterator __pos, size_type __n, const value_type& __x);
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _ForwardIterator>
- void _M_insert_aux(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
- size_type __n);
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- void _M_insert_aux(iterator __pos,
- const value_type* __first, const value_type* __last,
- size_type __n);
-
- void _M_insert_aux(iterator __pos,
- const_iterator __first, const_iterator __last,
- size_type __n);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- iterator _M_reserve_elements_at_front(size_type __n) {
- size_type __vacancies = _M_start._M_cur - _M_start._M_first;
- if (__n > __vacancies)
- _M_new_elements_at_front(__n - __vacancies);
- return _M_start - difference_type(__n);
- }
-
- iterator _M_reserve_elements_at_back(size_type __n) {
- size_type __vacancies = (_M_finish._M_last - _M_finish._M_cur) - 1;
- if (__n > __vacancies)
- _M_new_elements_at_back(__n - __vacancies);
- return _M_finish + difference_type(__n);
- }
-
- void _M_new_elements_at_front(size_type __new_elements);
- void _M_new_elements_at_back(size_type __new_elements);
-
-protected: // Allocation of _M_map and nodes
-
- // Makes sure the _M_map has space for new nodes. Does not actually
- // add the nodes. Can invalidate _M_map pointers. (And consequently,
- // deque iterators.)
-
- void _M_reserve_map_at_back (size_type __nodes_to_add = 1) {
- if (__nodes_to_add + 1 > _M_map_size - (_M_finish._M_node - _M_map))
- _M_reallocate_map(__nodes_to_add, false);
- }
-
- void _M_reserve_map_at_front (size_type __nodes_to_add = 1) {
- if (__nodes_to_add > size_type(_M_start._M_node - _M_map))
- _M_reallocate_map(__nodes_to_add, true);
- }
-
- void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);
-
-#ifdef __STL_NON_TYPE_TMPL_PARAM_BUG
-public:
- bool operator==(const deque<_Tp,_Alloc,0>& __x) const {
- return size() == __x.size() && equal(begin(), end(), __x.begin());
- }
- bool operator!=(const deque<_Tp,_Alloc,0>& __x) const {
- return size() != __x.size() || !equal(begin(), end(), __x.begin());
- }
- bool operator<(const deque<_Tp,_Alloc,0>& __x) const {
- return lexicographical_compare(begin(), end(), __x.begin(), __x.end());
- }
-#endif /* __STL_NON_TYPE_TMPL_PARAM_BUG */
-};
-
-// Non-inline member functions
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-template <class _InputIter>
-void deque<_Tp, _Alloc, __bufsize>
- ::_M_assign_aux(_InputIter __first, _InputIter __last, input_iterator_tag)
-{
- iterator __cur = begin();
- for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
- *__cur = *__first;
- if (__first == __last)
- erase(__cur, end());
- else
- insert(end(), __first, __last);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp, _Alloc, __bufsize>::insert(iterator __pos,
- size_type __n, const value_type& __x)
-{
- if (__pos._M_cur == _M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- uninitialized_fill(__new_start, _M_start, __x);
- _M_start = __new_start;
- }
- else if (__pos._M_cur == _M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- uninitialized_fill(_M_finish, __new_finish, __x);
- _M_finish = __new_finish;
- }
- else
- _M_insert_aux(__pos, __n, __x);
-}
-
-#ifndef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void deque<_Tp, _Alloc, __bufsize>::insert(iterator __pos,
- const value_type* __first,
- const value_type* __last) {
- size_type __n = __last - __first;
- if (__pos._M_cur == _M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __new_start);
- _M_start = __new_start;
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else if (__pos._M_cur == _M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, _M_finish);
- _M_finish = __new_finish;
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
- else
- _M_insert_aux(__pos, __first, __last, __n);
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void deque<_Tp,_Alloc,__bufsize>::insert(iterator __pos,
- const_iterator __first,
- const_iterator __last)
-{
- size_type __n = __last - __first;
- if (__pos._M_cur == _M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __new_start);
- _M_start = __new_start;
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else if (__pos._M_cur == _M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, _M_finish);
- _M_finish = __new_finish;
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
- else
- _M_insert_aux(__pos, __first, __last, __n);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-deque<_Tp,_Alloc,__bufsize>::iterator
-deque<_Tp,_Alloc,__bufsize>::erase(iterator __first, iterator __last)
-{
- if (__first == _M_start && __last == _M_finish) {
- clear();
- return _M_finish;
- }
- else {
- difference_type __n = __last - __first;
- difference_type __elems_before = __first - _M_start;
- if (static_cast<size_type>(__elems_before) < (size() - __n) / 2) {
- copy_backward(_M_start, __first, __last);
- iterator __new_start = _M_start + __n;
- destroy(_M_start, __new_start);
- _M_destroy_nodes(__new_start._M_node, _M_start._M_node);
- _M_start = __new_start;
- }
- else {
- copy(__last, _M_finish, __first);
- iterator __new_finish = _M_finish - __n;
- destroy(__new_finish, _M_finish);
- _M_destroy_nodes(__new_finish._M_node + 1, _M_finish._M_node + 1);
- _M_finish = __new_finish;
- }
- return _M_start + __elems_before;
- }
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void deque<_Tp,_Alloc,__bufsize>::clear()
-{
- for (_Map_pointer __node = _M_start._M_node + 1;
- __node < _M_finish._M_node;
- ++__node) {
- destroy(*__node, *__node + _S_buffer_size());
- _M_deallocate_node(*__node);
- }
-
- if (_M_start._M_node != _M_finish._M_node) {
- destroy(_M_start._M_cur, _M_start._M_last);
- destroy(_M_finish._M_first, _M_finish._M_cur);
- _M_deallocate_node(_M_finish._M_first);
- }
- else
- destroy(_M_start._M_cur, _M_finish._M_cur);
-
- _M_finish = _M_start;
-}
-
-// Precondition: _M_start and _M_finish have already been initialized,
-// but none of the deque's elements have yet been constructed.
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_fill_initialize(const value_type& __value) {
- _Map_pointer __cur;
- __STL_TRY {
- for (__cur = _M_start._M_node; __cur < _M_finish._M_node; ++__cur)
- uninitialized_fill(*__cur, *__cur + _S_buffer_size(), __value);
- uninitialized_fill(_M_finish._M_first, _M_finish._M_cur, __value);
- }
- __STL_UNWIND(destroy(_M_start, iterator(*__cur, __cur)));
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-template <class _InputIterator>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_range_initialize(_InputIterator __first,
- _InputIterator __last,
- input_iterator_tag)
-{
- _M_initialize_map(0);
- for ( ; __first != __last; ++__first)
- push_back(*__first);
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-template <class _ForwardIterator>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_range_initialize(_ForwardIterator __first,
- _ForwardIterator __last,
- forward_iterator_tag)
-{
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_initialize_map(__n);
-
- _Map_pointer __cur_node;
- __STL_TRY {
- for (__cur_node = _M_start._M_node;
- __cur_node < _M_finish._M_node;
- ++__cur_node) {
- _ForwardIterator __mid = __first;
- advance(__mid, _S_buffer_size());
- uninitialized_copy(__first, __mid, *__cur_node);
- __first = __mid;
- }
- uninitialized_copy(__first, __last, _M_finish._M_first);
- }
- __STL_UNWIND(destroy(_M_start, iterator(*__cur_node, __cur_node)));
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_push_back_aux(const value_type& __t)
-{
- value_type __t_copy = __t;
- _M_reserve_map_at_back();
- *(_M_finish._M_node + 1) = _M_allocate_node();
- __STL_TRY {
- construct(_M_finish._M_cur, __t_copy);
- _M_finish._M_set_node(_M_finish._M_node + 1);
- _M_finish._M_cur = _M_finish._M_first;
- }
- __STL_UNWIND(_M_deallocate_node(*(_M_finish._M_node + 1)));
-}
-
-// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_push_back_aux()
-{
- _M_reserve_map_at_back();
- *(_M_finish._M_node + 1) = _M_allocate_node();
- __STL_TRY {
- construct(_M_finish._M_cur);
- _M_finish._M_set_node(_M_finish._M_node + 1);
- _M_finish._M_cur = _M_finish._M_first;
- }
- __STL_UNWIND(_M_deallocate_node(*(_M_finish._M_node + 1)));
-}
-
-// Called only if _M_start._M_cur == _M_start._M_first.
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_push_front_aux(const value_type& __t)
-{
- value_type __t_copy = __t;
- _M_reserve_map_at_front();
- *(_M_start._M_node - 1) = _M_allocate_node();
- __STL_TRY {
- _M_start._M_set_node(_M_start._M_node - 1);
- _M_start._M_cur = _M_start._M_last - 1;
- construct(_M_start._M_cur, __t_copy);
- }
- __STL_UNWIND((++_M_start, _M_deallocate_node(*(_M_start._M_node - 1))));
-}
-
-// Called only if _M_start._M_cur == _M_start._M_first.
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_push_front_aux()
-{
- _M_reserve_map_at_front();
- *(_M_start._M_node - 1) = _M_allocate_node();
- __STL_TRY {
- _M_start._M_set_node(_M_start._M_node - 1);
- _M_start._M_cur = _M_start._M_last - 1;
- construct(_M_start._M_cur);
- }
- __STL_UNWIND((++_M_start, _M_deallocate_node(*(_M_start._M_node - 1))));
-}
-
-// Called only if _M_finish._M_cur == _M_finish._M_first.
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_pop_back_aux()
-{
- _M_deallocate_node(_M_finish._M_first);
- _M_finish._M_set_node(_M_finish._M_node - 1);
- _M_finish._M_cur = _M_finish._M_last - 1;
- destroy(_M_finish._M_cur);
-}
-
-// Called only if _M_start._M_cur == _M_start._M_last - 1. Note that
-// if the deque has at least one element (a precondition for this member
-// function), and if _M_start._M_cur == _M_start._M_last, then the deque
-// must have at least two nodes.
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_pop_front_aux()
-{
- destroy(_M_start._M_cur);
- _M_deallocate_node(_M_start._M_first);
- _M_start._M_set_node(_M_start._M_node + 1);
- _M_start._M_cur = _M_start._M_first;
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-template <class _InputIterator>
-void
-deque<_Tp,_Alloc,__bufsize>::insert(iterator __pos,
- _InputIterator __first,
- _InputIterator __last,
- input_iterator_tag)
-{
- copy(__first, __last, inserter(*this, __pos));
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-template <class _ForwardIterator>
-void
-deque<_Tp,_Alloc,__bufsize>::insert(iterator __pos,
- _ForwardIterator __first,
- _ForwardIterator __last,
- forward_iterator_tag) {
- size_type __n = 0;
- distance(__first, __last, __n);
- if (__pos._M_cur == _M_start._M_cur) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __new_start);
- _M_start = __new_start;
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else if (__pos._M_cur == _M_finish._M_cur) {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, _M_finish);
- _M_finish = __new_finish;
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
- else
- _M_insert_aux(__pos, __first, __last, __n);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-typename deque<_Tp, _Alloc, __bufsize>::iterator
-deque<_Tp,_Alloc,__bufsize>::_M_insert_aux(iterator __pos,
- const value_type& __x)
-{
- difference_type __index = __pos - _M_start;
- value_type __x_copy = __x;
- if (static_cast<size_type>(__index) < size() / 2) {
- push_front(front());
- iterator __front1 = _M_start;
- ++__front1;
- iterator __front2 = __front1;
- ++__front2;
- __pos = _M_start + __index;
- iterator __pos1 = __pos;
- ++__pos1;
- copy(__front2, __pos1, __front1);
- }
- else {
- push_back(back());
- iterator __back1 = _M_finish;
- --__back1;
- iterator __back2 = __back1;
- --__back2;
- __pos = _M_start + __index;
- copy_backward(__pos, __back2, __back1);
- }
- *__pos = __x_copy;
- return __pos;
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-typename deque<_Tp,_Alloc,__bufsize>::iterator
-deque<_Tp,_Alloc,__bufsize>::_M_insert_aux(iterator __pos)
-{
- difference_type __index = __pos - _M_start;
- if (static_cast<size_type>(__index) < size() / 2) {
- push_front(front());
- iterator __front1 = _M_start;
- ++__front1;
- iterator __front2 = __front1;
- ++__front2;
- __pos = _M_start + __index;
- iterator __pos1 = __pos;
- ++__pos1;
- copy(__front2, __pos1, __front1);
- }
- else {
- push_back(back());
- iterator __back1 = _M_finish;
- --__back1;
- iterator __back2 = __back1;
- --__back2;
- __pos = _M_start + __index;
- copy_backward(__pos, __back2, __back1);
- }
- *__pos = value_type();
- return __pos;
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_insert_aux(iterator __pos,
- size_type __n,
- const value_type& __x)
-{
- const difference_type __elems_before = __pos - _M_start;
- size_type __length = size();
- value_type __x_copy = __x;
- if (static_cast<size_type>(__elems_before) < __length / 2) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = _M_start;
- __pos = _M_start + __elems_before;
- __STL_TRY {
- if (__elems_before >= difference_type(__n)) {
- iterator __start_n = _M_start + difference_type(__n);
- uninitialized_copy(_M_start, __start_n, __new_start);
- _M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- fill(__pos - difference_type(__n), __pos, __x_copy);
- }
- else {
- __uninitialized_copy_fill(_M_start, __pos, __new_start,
- _M_start, __x_copy);
- _M_start = __new_start;
- fill(__old_start, __pos, __x_copy);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = _M_finish;
- const difference_type __elems_after =
- difference_type(__length) - __elems_before;
- __pos = _M_finish - __elems_after;
- __STL_TRY {
- if (__elems_after > difference_type(__n)) {
- iterator __finish_n = _M_finish - difference_type(__n);
- uninitialized_copy(__finish_n, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- fill(__pos, __pos + difference_type(__n), __x_copy);
- }
- else {
- __uninitialized_fill_copy(_M_finish, __pos + difference_type(__n),
- __x_copy, __pos, _M_finish);
- _M_finish = __new_finish;
- fill(__pos, __old_finish, __x_copy);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-template <class _ForwardIterator>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_insert_aux(iterator __pos,
- _ForwardIterator __first,
- _ForwardIterator __last,
- size_type __n)
-{
- const difference_type __elemsbefore = __pos - _M_start;
- size_type __length = size();
- if (static_cast<size_type>(__elemsbefore) < __length / 2) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = _M_start;
- __pos = _M_start + __elemsbefore;
- __STL_TRY {
- if (__elemsbefore >= difference_type(__n)) {
- iterator __start_n = _M_start + difference_type(__n);
- uninitialized_copy(_M_start, __start_n, __new_start);
- _M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, difference_type(__n) - __elemsbefore);
- __uninitialized_copy_copy(_M_start, __pos, __first, __mid,
- __new_start);
- _M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = _M_finish;
- const difference_type __elemsafter =
- difference_type(__length) - __elemsbefore;
- __pos = _M_finish - __elemsafter;
- __STL_TRY {
- if (__elemsafter > difference_type(__n)) {
- iterator __finish_n = _M_finish - difference_type(__n);
- uninitialized_copy(__finish_n, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, __elemsafter);
- __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
-}
-
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_insert_aux(iterator __pos,
- const value_type* __first,
- const value_type* __last,
- size_type __n)
-{
- const difference_type __elemsbefore = __pos - _M_start;
- size_type __length = size();
- if (__elemsbefore < __length / 2) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = _M_start;
- __pos = _M_start + __elemsbefore;
- __STL_TRY {
- if (__elemsbefore >= difference_type(__n)) {
- iterator __start_n = _M_start + difference_type(__n);
- uninitialized_copy(_M_start, __start_n, __new_start);
- _M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- const value_type* __mid =
- __first + (difference_type(__n) - __elemsbefore);
- __uninitialized_copy_copy(_M_start, __pos, __first, __mid,
- __new_start);
- _M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = _M_finish;
- const difference_type __elemsafter =
- difference_type(__length) - __elemsbefore;
- __pos = _M_finish - __elemsafter;
- __STL_TRY {
- if (__elemsafter > difference_type(__n)) {
- iterator __finish_n = _M_finish - difference_type(__n);
- uninitialized_copy(__finish_n, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- const value_type* __mid = __first + __elemsafter;
- __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_insert_aux(iterator __pos,
- const_iterator __first,
- const_iterator __last,
- size_type __n)
-{
- const difference_type __elemsbefore = __pos - _M_start;
- size_type __length = size();
- if (__elemsbefore < __length / 2) {
- iterator __new_start = _M_reserve_elements_at_front(__n);
- iterator __old_start = _M_start;
- __pos = _M_start + __elemsbefore;
- __STL_TRY {
- if (__elemsbefore >= __n) {
- iterator __start_n = _M_start + __n;
- uninitialized_copy(_M_start, __start_n, __new_start);
- _M_start = __new_start;
- copy(__start_n, __pos, __old_start);
- copy(__first, __last, __pos - difference_type(__n));
- }
- else {
- const_iterator __mid = __first + (__n - __elemsbefore);
- __uninitialized_copy_copy(_M_start, __pos, __first, __mid,
- __new_start);
- _M_start = __new_start;
- copy(__mid, __last, __old_start);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node));
- }
- else {
- iterator __new_finish = _M_reserve_elements_at_back(__n);
- iterator __old_finish = _M_finish;
- const difference_type __elemsafter = __length - __elemsbefore;
- __pos = _M_finish - __elemsafter;
- __STL_TRY {
- if (__elemsafter > __n) {
- iterator __finish_n = _M_finish - difference_type(__n);
- uninitialized_copy(__finish_n, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy_backward(__pos, __finish_n, __old_finish);
- copy(__first, __last, __pos);
- }
- else {
- const_iterator __mid = __first + __elemsafter;
- __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish);
- _M_finish = __new_finish;
- copy(__first, __mid, __pos);
- }
- }
- __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1,
- __new_finish._M_node + 1));
- }
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_new_elements_at_front(size_type __new_elems)
-{
- size_type __new_nodes
- = (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
- _M_reserve_map_at_front(__new_nodes);
- size_type __i;
- __STL_TRY {
- for (__i = 1; __i <= __new_nodes; ++__i)
- *(_M_start._M_node - __i) = _M_allocate_node();
- }
-# ifdef __STL_USE_EXCEPTIONS
- catch(...) {
- for (size_type __j = 1; __j < __i; ++__j)
- _M_deallocate_node(*(_M_start._M_node - __j));
- throw;
- }
-# endif /* __STL_USE_EXCEPTIONS */
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_new_elements_at_back(size_type __new_elems)
-{
- size_type __new_nodes
- = (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
- _M_reserve_map_at_back(__new_nodes);
- size_type __i;
- __STL_TRY {
- for (__i = 1; __i <= __new_nodes; ++__i)
- *(_M_finish._M_node + __i) = _M_allocate_node();
- }
-# ifdef __STL_USE_EXCEPTIONS
- catch(...) {
- for (size_type __j = 1; __j < __i; ++__j)
- _M_deallocate_node(*(_M_finish._M_node + __j));
- throw;
- }
-# endif /* __STL_USE_EXCEPTIONS */
-}
-
-template <class _Tp, class _Alloc, size_t __bufsize>
-void
-deque<_Tp,_Alloc,__bufsize>::_M_reallocate_map(size_type __nodes_to_add,
- bool __add_at_front)
-{
- size_type __old_num_nodes = _M_finish._M_node - _M_start._M_node + 1;
- size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
-
- _Map_pointer __new_nstart;
- if (_M_map_size > 2 * __new_num_nodes) {
- __new_nstart = _M_map + (_M_map_size - __new_num_nodes) / 2
- + (__add_at_front ? __nodes_to_add : 0);
- if (__new_nstart < _M_start._M_node)
- copy(_M_start._M_node, _M_finish._M_node + 1, __new_nstart);
- else
- copy_backward(_M_start._M_node, _M_finish._M_node + 1,
- __new_nstart + __old_num_nodes);
- }
- else {
- size_type __new_map_size =
- _M_map_size + max(_M_map_size, __nodes_to_add) + 2;
-
- _Map_pointer __new_map = _M_allocate_map(__new_map_size);
- __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
- + (__add_at_front ? __nodes_to_add : 0);
- copy(_M_start._M_node, _M_finish._M_node + 1, __new_nstart);
- _M_deallocate_map(_M_map, _M_map_size);
-
- _M_map = __new_map;
- _M_map_size = __new_map_size;
- }
-
- _M_start._M_set_node(__new_nstart);
- _M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
-}
-
-
-// Nonmember functions.
-
-#ifndef __STL_NON_TYPE_TMPL_PARAM_BUG
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-bool operator==(const deque<_Tp, _Alloc, __bufsiz>& __x,
- const deque<_Tp, _Alloc, __bufsiz>& __y)
-{
- return __x.size() == __y.size() &&
- equal(__x.begin(), __x.end(), __y.begin());
-}
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-bool operator<(const deque<_Tp, _Alloc, __bufsiz>& __x,
- const deque<_Tp, _Alloc, __bufsiz>& __y)
-{
- return lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
-}
-
-#endif /* __STL_NON_TYPE_TMPL_PARAM_BUG */
-
-#if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) && \
- !defined(__STL_NON_TYPE_TMPL_PARAM_BUG)
-
-template <class _Tp, class _Alloc, size_t __bufsiz>
-inline void
-swap(deque<_Tp,_Alloc,__bufsiz>& __x, deque<_Tp,_Alloc,__bufsiz>& __y)
-{
- __x.swap(__y);
-}
-
-#endif
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_DEQUE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_function.h b/contrib/libstdc++/stl/stl_function.h
deleted file mode 100644
index a5a8486..0000000
--- a/contrib/libstdc++/stl/stl_function.h
+++ /dev/null
@@ -1,700 +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.
- *
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_FUNCTION_H
-#define __SGI_STL_INTERNAL_FUNCTION_H
-
-__STL_BEGIN_NAMESPACE
-
-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 _Tp>
-struct plus : public binary_function<_Tp,_Tp,_Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; }
-};
-
-template <class _Tp>
-struct minus : public binary_function<_Tp,_Tp,_Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; }
-};
-
-template <class _Tp>
-struct multiplies : public binary_function<_Tp,_Tp,_Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; }
-};
-
-template <class _Tp>
-struct divides : public binary_function<_Tp,_Tp,_Tp> {
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; }
-};
-
-// identity_element (not part of the C++ standard).
-
-template <class _Tp> inline _Tp identity_element(plus<_Tp>) {
- return _Tp(0);
-}
-template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) {
- return _Tp(1);
-}
-
-template <class _Tp>
-struct modulus : public binary_function<_Tp,_Tp,_Tp>
-{
- _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; }
-};
-
-template <class _Tp>
-struct negate : public unary_function<_Tp,_Tp>
-{
- _Tp operator()(const _Tp& __x) const { return -__x; }
-};
-
-template <class _Tp>
-struct equal_to : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; }
-};
-
-template <class _Tp>
-struct not_equal_to : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; }
-};
-
-template <class _Tp>
-struct greater : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; }
-};
-
-template <class _Tp>
-struct less : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; }
-};
-
-template <class _Tp>
-struct greater_equal : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; }
-};
-
-template <class _Tp>
-struct less_equal : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; }
-};
-
-template <class _Tp>
-struct logical_and : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; }
-};
-
-template <class _Tp>
-struct logical_or : public binary_function<_Tp,_Tp,bool>
-{
- bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; }
-};
-
-template <class _Tp>
-struct logical_not : public unary_function<_Tp,bool>
-{
- bool operator()(const _Tp& __x) const { return !__x; }
-};
-
-template <class _Predicate>
-class unary_negate
- : public unary_function<typename _Predicate::argument_type, bool> {
-protected:
- _Predicate _M_pred;
-public:
- explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
- bool operator()(const typename _Predicate::argument_type& __x) const {
- return !_M_pred(__x);
- }
-};
-
-template <class _Predicate>
-inline unary_negate<_Predicate>
-not1(const _Predicate& __pred)
-{
- return unary_negate<_Predicate>(__pred);
-}
-
-template <class _Predicate>
-class binary_negate
- : public binary_function<typename _Predicate::first_argument_type,
- typename _Predicate::second_argument_type,
- bool> {
-protected:
- _Predicate _M_pred;
-public:
- explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
- bool operator()(const typename _Predicate::first_argument_type& __x,
- const typename _Predicate::second_argument_type& __y) const
- {
- return !_M_pred(__x, __y);
- }
-};
-
-template <class _Predicate>
-inline binary_negate<_Predicate>
-not2(const _Predicate& __pred)
-{
- return binary_negate<_Predicate>(__pred);
-}
-
-template <class _Operation>
-class binder1st
- : public unary_function<typename _Operation::second_argument_type,
- typename _Operation::result_type> {
-protected:
- _Operation op;
- typename _Operation::first_argument_type value;
-public:
- binder1st(const _Operation& __x,
- const typename _Operation::first_argument_type& __y)
- : op(__x), value(__y) {}
- typename _Operation::result_type
- operator()(const typename _Operation::second_argument_type& __x) const {
- return op(value, __x);
- }
-};
-
-template <class _Operation, class _Tp>
-inline binder1st<_Operation>
-bind1st(const _Operation& __oper, const _Tp& __x)
-{
- typedef typename _Operation::first_argument_type _Arg1_type;
- return binder1st<_Operation>(__oper, _Arg1_type(__x));
-}
-
-template <class _Operation>
-class binder2nd
- : public unary_function<typename _Operation::first_argument_type,
- typename _Operation::result_type> {
-protected:
- _Operation op;
- typename _Operation::second_argument_type value;
-public:
- binder2nd(const _Operation& __x,
- const typename _Operation::second_argument_type& __y)
- : op(__x), value(__y) {}
- typename _Operation::result_type
- operator()(const typename _Operation::first_argument_type& __x) const {
- return op(__x, value);
- }
-};
-
-template <class _Operation, class _Tp>
-inline binder2nd<_Operation>
-bind2nd(const _Operation& __oper, const _Tp& __x)
-{
- typedef typename _Operation::second_argument_type _Arg2_type;
- return binder2nd<_Operation>(__oper, _Arg2_type(__x));
-}
-
-// unary_compose and binary_compose (extensions, not part of the standard).
-
-template <class _Operation1, class _Operation2>
-class unary_compose
- : public unary_function<typename _Operation2::argument_type,
- typename _Operation1::result_type>
-{
-protected:
- _Operation1 __op1;
- _Operation2 __op2;
-public:
- unary_compose(const _Operation1& __x, const _Operation2& __y)
- : __op1(__x), __op2(__y) {}
- typename _Operation1::result_type
- operator()(const typename _Operation2::argument_type& __x) const {
- return __op1(__op2(__x));
- }
-};
-
-template <class _Operation1, class _Operation2>
-inline 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<typename _Operation2::argument_type,
- typename _Operation1::result_type> {
-protected:
- _Operation1 _M_op1;
- _Operation2 _M_op2;
- _Operation3 _M_op3;
-public:
- binary_compose(const _Operation1& __x, const _Operation2& __y,
- const _Operation3& __z)
- : _M_op1(__x), _M_op2(__y), _M_op3(__z) { }
- typename _Operation1::result_type
- operator()(const typename _Operation2::argument_type& __x) const {
- return _M_op1(_M_op2(__x), _M_op3(__x));
- }
-};
-
-template <class _Operation1, class _Operation2, class _Operation3>
-inline 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 (*_M_ptr)(_Arg);
-public:
- pointer_to_unary_function() {}
- explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
- _Result operator()(_Arg __x) const { return _M_ptr(__x); }
-};
-
-template <class _Arg, class _Result>
-inline 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 (*_M_ptr)(_Arg1, _Arg2);
-public:
- pointer_to_binary_function() {}
- explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
- : _M_ptr(__x) {}
- _Result operator()(_Arg1 __x, _Arg2 __y) const {
- return _M_ptr(__x, __y);
- }
-};
-
-template <class _Arg1, class _Arg2, class _Result>
-inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
-ptr_fun(_Result (*__x)(_Arg1, _Arg2)) {
- return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__x);
-}
-
-// identity is an extensions: it is not part of the standard.
-template <class _Tp>
-struct _Identity : public unary_function<_Tp,_Tp> {
- const _Tp& operator()(const _Tp& __x) const { return __x; }
-};
-
-template <class _Tp> struct identity : public _Identity<_Tp> {};
-
-// select1st and select2nd are extensions: they are not part of the standard.
-template <class _Pair>
-struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
- const typename _Pair::first_type& operator()(const _Pair& __x) const {
- return __x.first;
- }
-};
-
-template <class _Pair>
-struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type>
-{
- const typename _Pair::second_type& operator()(const _Pair& __x) const {
- return __x.second;
- }
-};
-
-template <class _Pair> struct select1st : public _Select1st<_Pair> {};
-template <class _Pair> struct select2nd : public _Select2nd<_Pair> {};
-
-// project1st and project2nd are extensions: they are not part of the standard
-template <class _Arg1, class _Arg2>
-struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> {
- _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; }
-};
-
-template <class _Arg1, class _Arg2>
-struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
- _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; }
-};
-
-template <class _Arg1, class _Arg2>
-struct project1st : public _Project1st<_Arg1, _Arg2> {};
-
-template <class _Arg1, class _Arg2>
-struct project2nd : public _Project2nd<_Arg1, _Arg2> {};
-
-// constant_void_fun, constant_unary_fun, and constant_binary_fun are
-// extensions: they are not part of the standard. (The same, of course,
-// is true of the helper functions constant0, constant1, and constant2.)
-template <class _Result>
-struct constant_void_fun
-{
- typedef _Result result_type;
- result_type __val;
- constant_void_fun(const result_type& __v) : __val(__v) {}
- const result_type& operator()() const { return __val; }
-};
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Result, class _Argument = _Result>
-#else
-template <class _Result, class _Argument>
-#endif
-struct constant_unary_fun : public unary_function<_Argument, _Result> {
- _Result _M_val;
- constant_unary_fun(const _Result& __v) : _M_val(__v) {}
- const _Result& operator()(const _Argument&) const { return _M_val; }
-};
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Result, class _Arg1 = _Result, class _Arg2 = _Arg1>
-#else
-template <class _Result, class _Arg1, class _Arg2>
-#endif
-struct constant_binary_fun : public binary_function<_Arg1, _Arg2, _Result> {
- _Result _M_val;
- constant_binary_fun(const _Result& __v) : _M_val(__v) {}
- const _Result& operator()(const _Arg1&, const _Arg2&) const {
- return _M_val;
- }
-};
-
-template <class _Result>
-inline constant_void_fun<_Result> constant0(const _Result& __val)
-{
- return constant_void_fun<_Result>(__val);
-}
-
-template <class _Result>
-inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val)
-{
- return constant_unary_fun<_Result,_Result>(__val);
-}
-
-template <class _Result>
-inline constant_binary_fun<_Result,_Result,_Result>
-constant2(const _Result& __val)
-{
- return constant_binary_fun<_Result,_Result,_Result>(__val);
-}
-
-// subtractive_rng is an extension: it is not part of the standard.
-// Note: this code assumes that int is 32 bits.
-class subtractive_rng : public unary_function<unsigned int, unsigned int> {
-private:
- unsigned int _M_table[55];
- size_t _M_index1;
- size_t _M_index2;
-public:
- unsigned int operator()(unsigned int __limit) {
- _M_index1 = (_M_index1 + 1) % 55;
- _M_index2 = (_M_index2 + 1) % 55;
- _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
- return _M_table[_M_index1] % __limit;
- }
-
- void _M_initialize(unsigned int __seed)
- {
- unsigned int __k = 1;
- _M_table[54] = __seed;
- size_t __i;
- for (__i = 0; __i < 54; __i++) {
- size_t __ii = (21 * (__i + 1) % 55) - 1;
- _M_table[__ii] = __k;
- __k = __seed - __k;
- __seed = _M_table[__ii];
- }
- for (int __loop = 0; __loop < 4; __loop++) {
- for (__i = 0; __i < 55; __i++)
- _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
- }
- _M_index1 = 0;
- _M_index2 = 31;
- }
-
- subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
- subtractive_rng() { _M_initialize(161803398u); }
-};
-
-
-// Adaptor function objects: pointers to member functions.
-
-// There are a total of 16 = 2^4 function objects in this family.
-// (1) Member functions taking no arguments vs member functions taking
-// one argument.
-// (2) Call through pointer vs call through reference.
-// (3) Member function with void return type vs member function with
-// non-void return type.
-// (4) Const vs non-const member function.
-
-// Note that choice (3) is nothing more than a workaround: according
-// to the draft, compilers should handle void and non-void the same way.
-// This feature is not yet widely implemented, though. You can only use
-// member functions returning void if your compiler supports partial
-// specialization.
-
-// All of this complexity is in the function objects themselves. You can
-// ignore it by using the helper function mem_fun and mem_fun_ref,
-// which create whichever type of adaptor is appropriate.
-// (mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
-// but they are provided for backward compatibility.)
-
-
-template <class _Ret, class _Tp>
-class mem_fun_t : public unary_function<_Tp*,_Ret> {
-public:
- explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {}
- _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
-private:
- _Ret (_Tp::*_M_f)();
-};
-
-template <class _Ret, class _Tp>
-class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
-public:
- explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
- _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
-private:
- _Ret (_Tp::*_M_f)() const;
-};
-
-
-template <class _Ret, class _Tp>
-class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
-public:
- explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {}
- _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
-private:
- _Ret (_Tp::*_M_f)();
-};
-
-template <class _Ret, class _Tp>
-class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
-public:
- explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
- _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
-private:
- _Ret (_Tp::*_M_f)() const;
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
-public:
- explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
- _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
-private:
- _Ret (_Tp::*_M_f)(_Arg);
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
-public:
- explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
- _Ret operator()(const _Tp* __p, _Arg __x) const
- { return (__p->*_M_f)(__x); }
-private:
- _Ret (_Tp::*_M_f)(_Arg) const;
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
-public:
- explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
- _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
-private:
- _Ret (_Tp::*_M_f)(_Arg);
-};
-
-template <class _Ret, class _Tp, class _Arg>
-class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
-public:
- explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
- _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
-private:
- _Ret (_Tp::*_M_f)(_Arg) const;
-};
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp>
-class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
-public:
- explicit mem_fun_t(void (_Tp::*__pf)()) : _M_f(__pf) {}
- void operator()(_Tp* __p) const { (__p->*_M_f)(); }
-private:
- void (_Tp::*_M_f)();
-};
-
-template <class _Tp>
-class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
-public:
- explicit const_mem_fun_t(void (_Tp::*__pf)() const) : _M_f(__pf) {}
- void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
-private:
- void (_Tp::*_M_f)() const;
-};
-
-template <class _Tp>
-class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
-public:
- explicit mem_fun_ref_t(void (_Tp::*__pf)()) : _M_f(__pf) {}
- void operator()(_Tp& __r) const { (__r.*_M_f)(); }
-private:
- void (_Tp::*_M_f)();
-};
-
-template <class _Tp>
-class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
-public:
- explicit const_mem_fun_ref_t(void (_Tp::*__pf)() const) : _M_f(__pf) {}
- void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
-private:
- void (_Tp::*_M_f)() const;
-};
-
-template <class _Tp, class _Arg>
-class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
-public:
- explicit mem_fun1_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
- void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
-private:
- void (_Tp::*_M_f)(_Arg);
-};
-
-template <class _Tp, class _Arg>
-class const_mem_fun1_t<void, _Tp, _Arg>
- : public binary_function<const _Tp*,_Arg,void> {
-public:
- explicit const_mem_fun1_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
- void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
-private:
- void (_Tp::*_M_f)(_Arg) const;
-};
-
-template <class _Tp, class _Arg>
-class mem_fun1_ref_t<void, _Tp, _Arg>
- : public binary_function<_Tp,_Arg,void> {
-public:
- explicit mem_fun1_ref_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
- void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
-private:
- void (_Tp::*_M_f)(_Arg);
-};
-
-template <class _Tp, class _Arg>
-class const_mem_fun1_ref_t<void, _Tp, _Arg>
- : public binary_function<_Tp,_Arg,void> {
-public:
- explicit const_mem_fun1_ref_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
- void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
-private:
- void (_Tp::*_M_f)(_Arg) const;
-};
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// Mem_fun adaptor helper functions. There are only two:
-// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
-// are provided for backward compatibility, but they are no longer
-// part of the C++ standard.)
-
-template <class _Ret, class _Tp>
-inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)())
- { return mem_fun_t<_Ret,_Tp>(__f); }
-
-template <class _Ret, class _Tp>
-inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const)
- { return const_mem_fun_t<_Ret,_Tp>(__f); }
-
-template <class _Ret, class _Tp>
-inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)())
- { return mem_fun_ref_t<_Ret,_Tp>(__f); }
-
-template <class _Ret, class _Tp>
-inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
- { return const_mem_fun_ref_t<_Ret,_Tp>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
-mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
-
-template <class _Ret, class _Tp, class _Arg>
-inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
-mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_FUNCTION_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_hash_fun.h b/contrib/libstdc++/stl/stl_hash_fun.h
deleted file mode 100644
index 44ab9bb..0000000
--- a/contrib/libstdc++/stl/stl_hash_fun.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_HASH_FUN_H
-#define __SGI_STL_HASH_FUN_H
-
-#include <stddef.h>
-
-__STL_BEGIN_NAMESPACE
-
-template <class _Key> struct hash { };
-
-inline size_t __stl_hash_string(const char* __s)
-{
- unsigned long __h = 0;
- for ( ; *__s; ++__s)
- __h = 5*__h + *__s;
-
- return size_t(__h);
-}
-
-__STL_TEMPLATE_NULL struct hash<char*>
-{
- size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
-};
-
-__STL_TEMPLATE_NULL struct hash<const char*>
-{
- size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
-};
-
-__STL_TEMPLATE_NULL struct hash<char> {
- size_t operator()(char __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<unsigned char> {
- size_t operator()(unsigned char __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<signed char> {
- size_t operator()(unsigned char __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<short> {
- size_t operator()(short __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<unsigned short> {
- size_t operator()(unsigned short __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<int> {
- size_t operator()(int __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<unsigned int> {
- size_t operator()(unsigned int __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<long> {
- size_t operator()(long __x) const { return __x; }
-};
-__STL_TEMPLATE_NULL struct hash<unsigned long> {
- size_t operator()(unsigned long __x) const { return __x; }
-};
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_HASH_FUN_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_hash_map.h b/contrib/libstdc++/stl/stl_hash_map.h
deleted file mode 100644
index bf16f60..0000000
--- a/contrib/libstdc++/stl/stl_hash_map.h
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_HASH_MAP_H
-#define __SGI_STL_INTERNAL_HASH_MAP_H
-
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Key, class _Tp, class _HashFcn = hash<_Key>,
- class _EqualKey = equal_to<_Key>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#else
-template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#endif
-class hash_map
-{
-private:
- typedef hashtable<pair<const _Key,_Tp>,_Key,_HashFcn,
- _Select1st<pair<const _Key,_Tp> >,_EqualKey,_Alloc> _Ht;
- _Ht _M_ht;
-
-public:
- typedef typename _Ht::key_type key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
- hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_map(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_map(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
-#else
- hash_map(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_map(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_map(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); }
- friend bool
- operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&);
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
-public:
- pair<iterator,bool> insert(const value_type& __obj)
- { return _M_ht.insert_unique(__obj); }
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
- { _M_ht.insert_unique(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_unique(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
- pair<iterator,bool> insert_noresize(const value_type& __obj)
- { return _M_ht.insert_unique_noresize(__obj); }
-
- iterator find(const key_type& __key) { return _M_ht.find(__key); }
- const_iterator find(const key_type& __key) const
- { return _M_ht.find(__key); }
-
- _Tp& operator[](const key_type& __key) {
- return _M_ht.find_or_insert(value_type(__key, _Tp())).second;
- }
-
- size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
- pair<iterator, iterator> equal_range(const key_type& __key)
- { return _M_ht.equal_range(__key); }
- pair<const_iterator, const_iterator>
- equal_range(const key_type& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-inline bool
-operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
- const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
-{
- return __hm1._M_ht == __hm2._M_ht;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-inline void
-swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
- hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
-{
- __hm1.swap(__hm2);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Key, class _Tp, class _HashFcn = hash<_Key>,
- class _EqualKey = equal_to<_Key>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#else
-template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#endif
-class hash_multimap
-{
-private:
- typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn,
- _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
- _Ht;
- _Ht _M_ht;
-
-public:
- typedef typename _Ht::key_type key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
- hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_multimap(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_multimap(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
-#else
- hash_multimap(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multimap(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
- friend bool
- operator== __STL_NULL_TMPL_ARGS (const hash_multimap&,
- const hash_multimap&);
-
- iterator begin() { return _M_ht.begin(); }
- iterator end() { return _M_ht.end(); }
- const_iterator begin() const { return _M_ht.begin(); }
- const_iterator end() const { return _M_ht.end(); }
-
-public:
- iterator insert(const value_type& __obj)
- { return _M_ht.insert_equal(__obj); }
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
- { _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_equal(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
- iterator insert_noresize(const value_type& __obj)
- { return _M_ht.insert_equal_noresize(__obj); }
-
- iterator find(const key_type& __key) { return _M_ht.find(__key); }
- const_iterator find(const key_type& __key) const
- { return _M_ht.find(__key); }
-
- size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
- pair<iterator, iterator> equal_range(const key_type& __key)
- { return _M_ht.equal_range(__key); }
- pair<const_iterator, const_iterator>
- equal_range(const key_type& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
-public:
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
-inline bool
-operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
- const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2)
-{
- return __hm1._M_ht == __hm2._M_ht;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-inline void
-swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
- hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
-{
- __hm1.swap(__hm2);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_HASH_MAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_hash_set.h b/contrib/libstdc++/stl/stl_hash_set.h
deleted file mode 100644
index b623a64..0000000
--- a/contrib/libstdc++/stl/stl_hash_set.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_HASH_SET_H
-#define __SGI_STL_INTERNAL_HASH_SET_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Value, class _HashFcn = hash<_Value>,
- class _EqualKey = equal_to<_Value>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
-#else
-template <class _Value, class _HashFcn, class _EqualKey,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
-#endif
-class hash_set
-{
-private:
- typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
- _EqualKey, _Alloc> _Ht;
- _Ht _M_ht;
-
-public:
- typedef typename _Ht::key_type key_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::const_pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::const_reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::const_iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
- hash_set()
- : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_set(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_set(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- template <class _InputIterator>
- hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#else
-
- hash_set(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-
- hash_set(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_unique(__f, __l); }
- hash_set(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
- friend bool operator== __STL_NULL_TMPL_ARGS (const hash_set&,
- const hash_set&);
-
- iterator begin() const { return _M_ht.begin(); }
- iterator end() const { return _M_ht.end(); }
-
-public:
- pair<iterator, bool> insert(const value_type& __obj)
- {
- pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);
- return pair<iterator,bool>(__p.first, __p.second);
- }
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
- { _M_ht.insert_unique(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_unique(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- {_M_ht.insert_unique(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
- pair<iterator, bool> insert_noresize(const value_type& __obj)
- {
- pair<typename _Ht::iterator, bool> __p =
- _M_ht.insert_unique_noresize(__obj);
- return pair<iterator, bool>(__p.first, __p.second);
- }
-
- iterator find(const key_type& __key) const { return _M_ht.find(__key); }
-
- size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
- pair<iterator, iterator> equal_range(const key_type& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
-public:
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-inline bool
-operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
- const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
-{
- return __hs1._M_ht == __hs2._M_ht;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-inline void
-swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
- hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
-{
- __hs1.swap(__hs2);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Value, class _HashFcn = hash<_Value>,
- class _EqualKey = equal_to<_Value>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
-#else
-template <class _Value, class _HashFcn, class _EqualKey,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
-#endif
-class hash_multiset
-{
-private:
- typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
- _EqualKey, _Alloc> _Ht;
- _Ht _M_ht;
-
-public:
- typedef typename _Ht::key_type key_type;
- typedef typename _Ht::value_type value_type;
- typedef typename _Ht::hasher hasher;
- typedef typename _Ht::key_equal key_equal;
-
- typedef typename _Ht::size_type size_type;
- typedef typename _Ht::difference_type difference_type;
- typedef typename _Ht::const_pointer pointer;
- typedef typename _Ht::const_pointer const_pointer;
- typedef typename _Ht::const_reference reference;
- typedef typename _Ht::const_reference const_reference;
-
- typedef typename _Ht::const_iterator iterator;
- typedef typename _Ht::const_iterator const_iterator;
-
- typedef typename _Ht::allocator_type allocator_type;
-
- hasher hash_funct() const { return _M_ht.hash_funct(); }
- key_equal key_eq() const { return _M_ht.key_eq(); }
- allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
- hash_multiset()
- : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
- explicit hash_multiset(size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_multiset(size_type __n, const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- template <class _InputIterator>
- hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#else
-
- hash_multiset(const value_type* __f, const value_type* __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-
- hash_multiset(const_iterator __f, const_iterator __l)
- : _M_ht(100, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
- : _M_ht(__n, hasher(), key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf)
- : _M_ht(__n, __hf, key_equal(), allocator_type())
- { _M_ht.insert_equal(__f, __l); }
- hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
- : _M_ht(__n, __hf, __eql, __a)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
-
-public:
- size_type size() const { return _M_ht.size(); }
- size_type max_size() const { return _M_ht.max_size(); }
- bool empty() const { return _M_ht.empty(); }
- void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
- friend bool operator== __STL_NULL_TMPL_ARGS (const hash_multiset&,
- const hash_multiset&);
-
- iterator begin() const { return _M_ht.begin(); }
- iterator end() const { return _M_ht.end(); }
-
-public:
- iterator insert(const value_type& __obj)
- { return _M_ht.insert_equal(__obj); }
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __f, _InputIterator __l)
- { _M_ht.insert_equal(__f,__l); }
-#else
- void insert(const value_type* __f, const value_type* __l) {
- _M_ht.insert_equal(__f,__l);
- }
- void insert(const_iterator __f, const_iterator __l)
- { _M_ht.insert_equal(__f, __l); }
-#endif /*__STL_MEMBER_TEMPLATES */
- iterator insert_noresize(const value_type& __obj)
- { return _M_ht.insert_equal_noresize(__obj); }
-
- iterator find(const key_type& __key) const { return _M_ht.find(__key); }
-
- size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
- pair<iterator, iterator> equal_range(const key_type& __key) const
- { return _M_ht.equal_range(__key); }
-
- size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
- void erase(iterator __it) { _M_ht.erase(__it); }
- void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
- void clear() { _M_ht.clear(); }
-
-public:
- void resize(size_type __hint) { _M_ht.resize(__hint); }
- size_type bucket_count() const { return _M_ht.bucket_count(); }
- size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
- size_type elems_in_bucket(size_type __n) const
- { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-inline bool
-operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
- const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
-{
- return __hs1._M_ht == __hs2._M_ht;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-inline void
-swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
- hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
- __hs1.swap(__hs2);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_HASH_SET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_hashtable.h b/contrib/libstdc++/stl/stl_hashtable.h
deleted file mode 100644
index 78b36c1..0000000
--- a/contrib/libstdc++/stl/stl_hashtable.h
+++ /dev/null
@@ -1,1039 +0,0 @@
-/*
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
-#define __SGI_STL_INTERNAL_HASHTABLE_H
-
-// Hashtable class, used to implement the hashed associative containers
-// hash_set, hash_map, hash_multiset, and hash_multimap.
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_tempbuf.h>
-#include <stl_algo.h>
-#include <stl_uninitialized.h>
-#include <stl_function.h>
-#include <stl_vector.h>
-#include <stl_hash_fun.h>
-
-__STL_BEGIN_NAMESPACE
-
-template <class _Val>
-struct _Hashtable_node
-{
- _Hashtable_node* _M_next;
- _Val _M_val;
-};
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc = alloc>
-class hashtable;
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_iterator;
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_const_iterator;
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_iterator {
- typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
- _Hashtable;
- typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
- _ExtractKey, _EqualKey, _Alloc>
- iterator;
- typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
- _ExtractKey, _EqualKey, _Alloc>
- const_iterator;
- typedef _Hashtable_node<_Val> _Node;
-
- typedef forward_iterator_tag iterator_category;
- typedef _Val value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef _Val& reference;
- typedef _Val* pointer;
-
- _Node* _M_cur;
- _Hashtable* _M_ht;
-
- _Hashtable_iterator(_Node* __n, _Hashtable* __tab)
- : _M_cur(__n), _M_ht(__tab) {}
- _Hashtable_iterator() {}
- reference operator*() const { return _M_cur->_M_val; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
- iterator& operator++();
- iterator operator++(int);
- bool operator==(const iterator& __it) const
- { return _M_cur == __it._M_cur; }
- bool operator!=(const iterator& __it) const
- { return _M_cur != __it._M_cur; }
-};
-
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_const_iterator {
- typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
- _Hashtable;
- typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
- _ExtractKey,_EqualKey,_Alloc>
- iterator;
- typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
- _ExtractKey, _EqualKey, _Alloc>
- const_iterator;
- typedef _Hashtable_node<_Val> _Node;
-
- typedef forward_iterator_tag iterator_category;
- typedef _Val value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef const _Val& reference;
- typedef const _Val* pointer;
-
- const _Node* _M_cur;
- const _Hashtable* _M_ht;
-
- _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
- : _M_cur(__n), _M_ht(__tab) {}
- _Hashtable_const_iterator() {}
- _Hashtable_const_iterator(const iterator& __it)
- : _M_cur(__it._M_cur), _M_ht(__it._M_ht) {}
- reference operator*() const { return _M_cur->_M_val; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
- const_iterator& operator++();
- const_iterator operator++(int);
- bool operator==(const const_iterator& __it) const
- { return _M_cur == __it._M_cur; }
- bool operator!=(const const_iterator& __it) const
- { return _M_cur != __it._M_cur; }
-};
-
-// Note: assumes long is at least 32 bits.
-static const int __stl_num_primes = 28;
-static const unsigned long __stl_prime_list[__stl_num_primes] =
-{
- 53ul, 97ul, 193ul, 389ul, 769ul,
- 1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
- 49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
- 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
- 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
- 1610612741ul, 3221225473ul, 4294967291ul
-};
-
-inline unsigned long __stl_next_prime(unsigned long __n)
-{
- const unsigned long* __first = __stl_prime_list;
- const unsigned long* __last = __stl_prime_list + __stl_num_primes;
- const unsigned long* pos = lower_bound(__first, __last, __n);
- return pos == __last ? *(__last - 1) : *pos;
-}
-
-// Forward declaration of operator==.
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-class hashtable;
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
- const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2);
-
-
-// Hashtables handle allocators a bit differently than other containers
-// do. If we're using standard-conforming allocators, then a hashtable
-// unconditionally has a member variable to hold its allocator, even if
-// it so happens that all instances of the allocator type are identical.
-// This is because, for hashtables, this extra storage is negligible.
-// Additionally, a base class wouldn't serve any other purposes; it
-// wouldn't, for example, simplify the exception-handling code.
-
-template <class _Val, class _Key, class _HashFcn,
- class _ExtractKey, class _EqualKey, class _Alloc>
-class hashtable {
-public:
- typedef _Key key_type;
- typedef _Val value_type;
- typedef _HashFcn hasher;
- typedef _EqualKey key_equal;
-
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
-
- hasher hash_funct() const { return _M_hash; }
- key_equal key_eq() const { return _M_equals; }
-
-private:
- typedef _Hashtable_node<_Val> _Node;
-
-#ifdef __STL_USE_STD_ALLOCATORS
-public:
- typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type;
- allocator_type get_allocator() const { return _M_node_allocator; }
-private:
- typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator;
- _Node* _M_get_node() { return _M_node_allocator.allocate(1); }
- void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); }
-# define __HASH_ALLOC_INIT(__a) _M_node_allocator(__a),
-#else /* __STL_USE_STD_ALLOCATORS */
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-private:
- typedef simple_alloc<_Node, _Alloc> _M_node_allocator_type;
- _Node* _M_get_node() { return _M_node_allocator_type::allocate(1); }
- void _M_put_node(_Node* __p) { _M_node_allocator_type::deallocate(__p, 1); }
-# define __HASH_ALLOC_INIT(__a)
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-private:
- hasher _M_hash;
- key_equal _M_equals;
- _ExtractKey _M_get_key;
- vector<_Node*,_Alloc> _M_buckets;
- size_type _M_num_elements;
-
-public:
- typedef _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
- iterator;
- typedef _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,
- _Alloc>
- const_iterator;
-
- friend struct
- _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
- friend struct
- _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
-
-public:
- hashtable(size_type __n,
- const _HashFcn& __hf,
- const _EqualKey& __eql,
- const _ExtractKey& __ext,
- const allocator_type& __a = allocator_type())
- : __HASH_ALLOC_INIT(__a)
- _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(__ext),
- _M_buckets(__a),
- _M_num_elements(0)
- {
- _M_initialize_buckets(__n);
- }
-
- hashtable(size_type __n,
- const _HashFcn& __hf,
- const _EqualKey& __eql,
- const allocator_type& __a = allocator_type())
- : __HASH_ALLOC_INIT(__a)
- _M_hash(__hf),
- _M_equals(__eql),
- _M_get_key(_ExtractKey()),
- _M_buckets(__a),
- _M_num_elements(0)
- {
- _M_initialize_buckets(__n);
- }
-
- hashtable(const hashtable& __ht)
- : __HASH_ALLOC_INIT(__ht.get_allocator())
- _M_hash(__ht._M_hash),
- _M_equals(__ht._M_equals),
- _M_get_key(__ht._M_get_key),
- _M_buckets(__ht.get_allocator()),
- _M_num_elements(0)
- {
- _M_copy_from(__ht);
- }
-
-#undef __HASH_ALLOC_INIT
-
- hashtable& operator= (const hashtable& __ht)
- {
- if (&__ht != this) {
- clear();
- _M_hash = __ht._M_hash;
- _M_equals = __ht._M_equals;
- _M_get_key = __ht._M_get_key;
- _M_copy_from(__ht);
- }
- return *this;
- }
-
- ~hashtable() { clear(); }
-
- size_type size() const { return _M_num_elements; }
- size_type max_size() const { return size_type(-1); }
- bool empty() const { return size() == 0; }
-
- void swap(hashtable& __ht)
- {
- __STD::swap(_M_hash, __ht._M_hash);
- __STD::swap(_M_equals, __ht._M_equals);
- __STD::swap(_M_get_key, __ht._M_get_key);
- _M_buckets.swap(__ht._M_buckets);
- __STD::swap(_M_num_elements, __ht._M_num_elements);
- }
-
- iterator begin()
- {
- for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
- if (_M_buckets[__n])
- return iterator(_M_buckets[__n], this);
- return end();
- }
-
- iterator end() { return iterator(0, this); }
-
- const_iterator begin() const
- {
- for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
- if (_M_buckets[__n])
- return const_iterator(_M_buckets[__n], this);
- return end();
- }
-
- const_iterator end() const { return const_iterator(0, this); }
-
- friend bool
- operator== __STL_NULL_TMPL_ARGS (const hashtable&, const hashtable&);
-
-public:
-
- size_type bucket_count() const { return _M_buckets.size(); }
-
- size_type max_bucket_count() const
- { return __stl_prime_list[__stl_num_primes - 1]; }
-
- size_type elems_in_bucket(size_type __bucket) const
- {
- size_type __result = 0;
- for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next)
- __result += 1;
- return __result;
- }
-
- pair<iterator, bool> insert_unique(const value_type& __obj)
- {
- resize(_M_num_elements + 1);
- return insert_unique_noresize(__obj);
- }
-
- iterator insert_equal(const value_type& __obj)
- {
- resize(_M_num_elements + 1);
- return insert_equal_noresize(__obj);
- }
-
- pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
- iterator insert_equal_noresize(const value_type& __obj);
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert_unique(_InputIterator __f, _InputIterator __l)
- {
- insert_unique(__f, __l, __ITERATOR_CATEGORY(__f));
- }
-
- template <class _InputIterator>
- void insert_equal(_InputIterator __f, _InputIterator __l)
- {
- insert_equal(__f, __l, __ITERATOR_CATEGORY(__f));
- }
-
- template <class _InputIterator>
- void insert_unique(_InputIterator __f, _InputIterator __l,
- input_iterator_tag)
- {
- for ( ; __f != __l; ++__f)
- insert_unique(*__f);
- }
-
- template <class _InputIterator>
- void insert_equal(_InputIterator __f, _InputIterator __l,
- input_iterator_tag)
- {
- for ( ; __f != __l; ++__f)
- insert_equal(*__f);
- }
-
- template <class _ForwardIterator>
- void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
- forward_iterator_tag)
- {
- size_type __n = 0;
- distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- template <class _ForwardIterator>
- void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
- forward_iterator_tag)
- {
- size_type __n = 0;
- distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
- void insert_unique(const value_type* __f, const value_type* __l)
- {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const value_type* __f, const value_type* __l)
- {
- size_type __n = __l - __f;
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-
- void insert_unique(const_iterator __f, const_iterator __l)
- {
- size_type __n = 0;
- distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_unique_noresize(*__f);
- }
-
- void insert_equal(const_iterator __f, const_iterator __l)
- {
- size_type __n = 0;
- distance(__f, __l, __n);
- resize(_M_num_elements + __n);
- for ( ; __n > 0; --__n, ++__f)
- insert_equal_noresize(*__f);
- }
-#endif /*__STL_MEMBER_TEMPLATES */
-
- reference find_or_insert(const value_type& __obj);
-
- iterator find(const key_type& __key)
- {
- size_type __n = _M_bkt_num_key(__key);
- _Node* __first;
- for ( __first = _M_buckets[__n];
- __first && !_M_equals(_M_get_key(__first->_M_val), __key);
- __first = __first->_M_next)
- {}
- return iterator(__first, this);
- }
-
- const_iterator find(const key_type& __key) const
- {
- size_type __n = _M_bkt_num_key(__key);
- const _Node* __first;
- for ( __first = _M_buckets[__n];
- __first && !_M_equals(_M_get_key(__first->_M_val), __key);
- __first = __first->_M_next)
- {}
- return const_iterator(__first, this);
- }
-
- size_type count(const key_type& __key) const
- {
- const size_type __n = _M_bkt_num_key(__key);
- size_type __result = 0;
-
- for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), __key))
- ++__result;
- return __result;
- }
-
- pair<iterator, iterator>
- equal_range(const key_type& __key);
-
- pair<const_iterator, const_iterator>
- equal_range(const key_type& __key) const;
-
- size_type erase(const key_type& __key);
- void erase(const iterator& __it);
- void erase(iterator __first, iterator __last);
-
- void erase(const const_iterator& __it);
- void erase(const_iterator __first, const_iterator __last);
-
- void resize(size_type __num_elements_hint);
- void clear();
-
-private:
- size_type _M_next_size(size_type __n) const
- { return __stl_next_prime(__n); }
-
- void _M_initialize_buckets(size_type __n)
- {
- const size_type __n_buckets = _M_next_size(__n);
- _M_buckets.reserve(__n_buckets);
- _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
- _M_num_elements = 0;
- }
-
- size_type _M_bkt_num_key(const key_type& __key) const
- {
- return _M_bkt_num_key(__key, _M_buckets.size());
- }
-
- size_type _M_bkt_num(const value_type& __obj) const
- {
- return _M_bkt_num_key(_M_get_key(__obj));
- }
-
- size_type _M_bkt_num_key(const key_type& __key, size_t __n) const
- {
- return _M_hash(__key) % __n;
- }
-
- size_type _M_bkt_num(const value_type& __obj, size_t __n) const
- {
- return _M_bkt_num_key(_M_get_key(__obj), __n);
- }
-
- _Node* _M_new_node(const value_type& __obj)
- {
- _Node* __n = _M_get_node();
- __n->_M_next = 0;
- __STL_TRY {
- construct(&__n->_M_val, __obj);
- return __n;
- }
- __STL_UNWIND(_M_put_node(__n));
- }
-
- void _M_delete_node(_Node* __n)
- {
- destroy(&__n->_M_val);
- _M_put_node(__n);
- }
-
- void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
- void _M_erase_bucket(const size_type __n, _Node* __last);
-
- void _M_copy_from(const hashtable& __ht);
-
-};
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
-{
- const _Node* __old = _M_cur;
- _M_cur = _M_cur->_M_next;
- if (!_M_cur) {
- size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
- while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
- _M_cur = _M_ht->_M_buckets[__bucket];
- }
- return *this;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
-{
- iterator __tmp = *this;
- ++*this;
- return __tmp;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
-{
- const _Node* __old = _M_cur;
- _M_cur = _M_cur->_M_next;
- if (!_M_cur) {
- size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
- while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
- _M_cur = _M_ht->_M_buckets[__bucket];
- }
- return *this;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
-{
- const_iterator __tmp = *this;
- ++*this;
- return __tmp;
-}
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline forward_iterator_tag
-iterator_category(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return forward_iterator_tag();
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Val*
-value_type(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (_Val*) 0;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*
-distance_type(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*) 0;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline forward_iterator_tag
-iterator_category(const _Hashtable_const_iterator<_Val,_Key,_HF,
- _ExK,_EqK,_All>&)
-{
- return forward_iterator_tag();
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline _Val*
-value_type(const _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (_Val*) 0;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
- class _All>
-inline hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*
-distance_type(const _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&)
-{
- return (hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*) 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
- const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2)
-{
- typedef typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::_Node _Node;
- if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
- return false;
- for (int __n = 0; __n < __ht1._M_buckets.size(); ++__n) {
- _Node* __cur1 = __ht1._M_buckets[__n];
- _Node* __cur2 = __ht2._M_buckets[__n];
- for ( ; __cur1 && __cur2 && __cur1->_M_val == __cur2->_M_val;
- __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
- {}
- if (__cur1 || __cur2)
- return false;
- }
- return true;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Val, class _Key, class _HF, class _Extract, class _EqKey,
- class _All>
-inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
- hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) {
- __ht1.swap(__ht2);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::insert_unique_noresize(const value_type& __obj)
-{
- const size_type __n = _M_bkt_num(__obj);
- _Node* __first = _M_buckets[__n];
-
- for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
- return pair<iterator, bool>(iterator(__cur, this), false);
-
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __first;
- _M_buckets[__n] = __tmp;
- ++_M_num_elements;
- return pair<iterator, bool>(iterator(__tmp, this), true);
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::insert_equal_noresize(const value_type& __obj)
-{
- const size_type __n = _M_bkt_num(__obj);
- _Node* __first = _M_buckets[__n];
-
- for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) {
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __cur->_M_next;
- __cur->_M_next = __tmp;
- ++_M_num_elements;
- return iterator(__tmp, this);
- }
-
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __first;
- _M_buckets[__n] = __tmp;
- ++_M_num_elements;
- return iterator(__tmp, this);
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
-{
- resize(_M_num_elements + 1);
-
- size_type __n = _M_bkt_num(__obj);
- _Node* __first = _M_buckets[__n];
-
- for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
- if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
- return __cur->_M_val;
-
- _Node* __tmp = _M_new_node(__obj);
- __tmp->_M_next = __first;
- _M_buckets[__n] = __tmp;
- ++_M_num_elements;
- return __tmp->_M_val;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator,
- typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
-{
- typedef pair<iterator, iterator> _Pii;
- const size_type __n = _M_bkt_num_key(__key);
-
- for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next)
- if (_M_equals(_M_get_key(__first->_M_val), __key)) {
- for (_Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next)
- if (!_M_equals(_M_get_key(__cur->_M_val), __key))
- return _Pii(iterator(__first, this), iterator(__cur, this));
- for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
- if (_M_buckets[__m])
- return _Pii(iterator(__first, this),
- iterator(_M_buckets[__m], this));
- return _Pii(iterator(__first, this), end());
- }
- return _Pii(end(), end());
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator,
- typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::equal_range(const key_type& __key) const
-{
- typedef pair<const_iterator, const_iterator> _Pii;
- const size_type __n = _M_bkt_num_key(__key);
-
- for (const _Node* __first = _M_buckets[__n] ;
- __first;
- __first = __first->_M_next) {
- if (_M_equals(_M_get_key(__first->_M_val), __key)) {
- for (const _Node* __cur = __first->_M_next;
- __cur;
- __cur = __cur->_M_next)
- if (!_M_equals(_M_get_key(__cur->_M_val), __key))
- return _Pii(const_iterator(__first, this),
- const_iterator(__cur, this));
- for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
- if (_M_buckets[__m])
- return _Pii(const_iterator(__first, this),
- const_iterator(_M_buckets[__m], this));
- return _Pii(const_iterator(__first, this), end());
- }
- }
- return _Pii(end(), end());
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key)
-{
- const size_type __n = _M_bkt_num_key(__key);
- _Node* __first = _M_buckets[__n];
- size_type __erased = 0;
-
- if (__first) {
- _Node* __cur = __first;
- _Node* __next = __cur->_M_next;
- while (__next) {
- if (_M_equals(_M_get_key(__next->_M_val), __key)) {
- __cur->_M_next = __next->_M_next;
- _M_delete_node(__next);
- __next = __cur->_M_next;
- ++__erased;
- --_M_num_elements;
- }
- else {
- __cur = __next;
- __next = __cur->_M_next;
- }
- }
- if (_M_equals(_M_get_key(__first->_M_val), __key)) {
- _M_buckets[__n] = __first->_M_next;
- _M_delete_node(__first);
- ++__erased;
- --_M_num_elements;
- }
- }
- return __erased;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const iterator& __it)
-{
- if (_Node* const __p = __it._M_cur) {
- const size_type __n = _M_bkt_num(__p->_M_val);
- _Node* __cur = _M_buckets[__n];
-
- if (__cur == __p) {
- _M_buckets[__n] = __cur->_M_next;
- _M_delete_node(__cur);
- --_M_num_elements;
- }
- else {
- _Node* __next = __cur->_M_next;
- while (__next) {
- if (__next == __p) {
- __cur->_M_next = __next->_M_next;
- _M_delete_node(__next);
- --_M_num_elements;
- break;
- }
- else {
- __cur = __next;
- __next = __cur->_M_next;
- }
- }
- }
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::erase(iterator __first, iterator __last)
-{
- size_type __f_bucket = __first._M_cur ?
- _M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size();
- size_type __l_bucket = __last._M_cur ?
- _M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size();
-
- if (__first._M_cur == __last._M_cur)
- return;
- else if (__f_bucket == __l_bucket)
- _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
- else {
- _M_erase_bucket(__f_bucket, __first._M_cur, 0);
- for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
- _M_erase_bucket(__n, 0);
- if (__l_bucket != _M_buckets.size())
- _M_erase_bucket(__l_bucket, __last._M_cur);
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline void
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const_iterator __first,
- const_iterator __last)
-{
- erase(iterator(const_cast<_Node*>(__first._M_cur),
- const_cast<hashtable*>(__first._M_ht)),
- iterator(const_cast<_Node*>(__last._M_cur),
- const_cast<hashtable*>(__last._M_ht)));
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline void
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const const_iterator& __it)
-{
- erase(iterator(const_cast<_Node*>(__it._M_cur),
- const_cast<hashtable*>(__it._M_ht)));
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::resize(size_type __num_elements_hint)
-{
- const size_type __old_n = _M_buckets.size();
- if (__num_elements_hint > __old_n) {
- const size_type __n = _M_next_size(__num_elements_hint);
- if (__n > __old_n) {
- vector<_Node*, _All> __tmp(__n, (_Node*)(0),
- _M_buckets.get_allocator());
- __STL_TRY {
- for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
- _Node* __first = _M_buckets[__bucket];
- while (__first) {
- size_type __new_bucket = _M_bkt_num(__first->_M_val, __n);
- _M_buckets[__bucket] = __first->_M_next;
- __first->_M_next = __tmp[__new_bucket];
- __tmp[__new_bucket] = __first;
- __first = _M_buckets[__bucket];
- }
- }
- _M_buckets.swap(__tmp);
- }
-# ifdef __STL_USE_EXCEPTIONS
- catch(...) {
- for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) {
- while (__tmp[__bucket]) {
- _Node* __next = __tmp[__bucket]->_M_next;
- _M_delete_node(__tmp[__bucket]);
- __tmp[__bucket] = __next;
- }
- }
- throw;
- }
-# endif /* __STL_USE_EXCEPTIONS */
- }
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
-{
- _Node* __cur = _M_buckets[__n];
- if (__cur == __first)
- _M_erase_bucket(__n, __last);
- else {
- _Node* __next;
- for (__next = __cur->_M_next;
- __next != __first;
- __cur = __next, __next = __cur->_M_next)
- ;
- while (__next) {
- __cur->_M_next = __next->_M_next;
- _M_delete_node(__next);
- __next = __cur->_M_next;
- --_M_num_elements;
- }
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::_M_erase_bucket(const size_type __n, _Node* __last)
-{
- _Node* __cur = _M_buckets[__n];
- while (__cur != __last) {
- _Node* __next = __cur->_M_next;
- _M_delete_node(__cur);
- __cur = __next;
- _M_buckets[__n] = __cur;
- --_M_num_elements;
- }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear()
-{
- for (size_type __i = 0; __i < _M_buckets.size(); ++__i) {
- _Node* __cur = _M_buckets[__i];
- while (__cur != 0) {
- _Node* __next = __cur->_M_next;
- _M_delete_node(__cur);
- __cur = __next;
- }
- _M_buckets[__i] = 0;
- }
- _M_num_elements = 0;
-}
-
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
- ::_M_copy_from(const hashtable& __ht)
-{
- _M_buckets.clear();
- _M_buckets.reserve(__ht._M_buckets.size());
- _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
- __STL_TRY {
- for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
- if (const _Node* __cur = __ht._M_buckets[__i]) {
- _Node* __copy = _M_new_node(__cur->_M_val);
- _M_buckets[__i] = __copy;
-
- for (_Node* __next = __cur->_M_next;
- __next;
- __cur = __next, __next = __cur->_M_next) {
- __copy->_M_next = _M_new_node(__next->_M_val);
- __copy = __copy->_M_next;
- }
- }
- }
- _M_num_elements = __ht._M_num_elements;
- }
- __STL_UNWIND(clear());
-}
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_heap.h b/contrib/libstdc++/stl/stl_heap.h
deleted file mode 100644
index 62f142e..0000000
--- a/contrib/libstdc++/stl/stl_heap.h
+++ /dev/null
@@ -1,281 +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.
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_HEAP_H
-#define __SGI_STL_INTERNAL_HEAP_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
-
-// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__push_heap(_RandomAccessIterator __first,
- _Distance __holeIndex, _Distance __topIndex, _Tp __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 _Distance, class _Tp>
-inline void
-__push_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Distance*, _Tp*)
-{
- __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
- _Tp(*(__last - 1)));
-}
-
-template <class _RandomAccessIterator>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __push_heap_aux(__first, __last,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp,
- class _Compare>
-void
-__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __topIndex, _Tp __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 _Distance, class _Tp>
-inline void
-__push_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp,
- _Distance*, _Tp*)
-{
- __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
- _Tp(*(__last - 1)), __comp);
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Compare __comp)
-{
- __push_heap_aux(__first, __last, __comp,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __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 _Tp, class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value);
-}
-
-template <class _RandomAccessIterator, class _Tp>
-inline void
-__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Tp*)
-{
- __pop_heap(__first, __last - 1, __last - 1,
- _Tp(*(__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 _Tp, class _Compare>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __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 _Tp, class _Compare,
- class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Compare __comp,
- _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
- __value, __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Compare>
-inline void
-__pop_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Tp*, _Compare __comp)
-{
- __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__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 _Tp, class _Distance>
-void
-__make_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Tp*, _Distance*)
-{
- if (__last - __first < 2) return;
- _Distance __len = __last - __first;
- _Distance __parent = (__len - 2)/2;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__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 _Tp, class _Distance>
-void
-__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Compare __comp, _Tp*, _Distance*)
-{
- if (__last - __first < 2) return;
- _Distance __len = __last - __first;
- _Distance __parent = (__len - 2)/2;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__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);
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_iterator.h b/contrib/libstdc++/stl/stl_iterator.h
deleted file mode 100644
index e2bd714..0000000
--- a/contrib/libstdc++/stl/stl_iterator.h
+++ /dev/null
@@ -1,915 +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.
- *
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_ITERATOR_H
-#define __SGI_STL_INTERNAL_ITERATOR_H
-
-__STL_BEGIN_NAMESPACE
-
-struct input_iterator_tag {};
-struct output_iterator_tag {};
-struct forward_iterator_tag : public input_iterator_tag {};
-struct bidirectional_iterator_tag : public forward_iterator_tag {};
-struct random_access_iterator_tag : public bidirectional_iterator_tag {};
-
-// The base classes input_iterator, output_iterator, forward_iterator,
-// bidirectional_iterator, and random_access_iterator are not part of
-// the C++ standard. (they have been replaced by struct iterator.)
-// They are included for backward compatibility with the HP STL.
-
-template <class _Tp, class _Distance> struct input_iterator {
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-struct output_iterator {
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-};
-
-template <class _Tp, class _Distance> struct forward_iterator {
- typedef forward_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-
-template <class _Tp, class _Distance> struct bidirectional_iterator {
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp, class _Distance> struct random_access_iterator {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-#ifdef __STL_USE_NAMESPACES
-template <class _Category, class _Tp, class _Distance = ptrdiff_t,
- class _Pointer = _Tp*, class _Reference = _Tp&>
-struct iterator {
- typedef _Category iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
-};
-#endif /* __STL_USE_NAMESPACES */
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Iterator>
-struct iterator_traits {
- typedef typename _Iterator::iterator_category iterator_category;
- typedef typename _Iterator::value_type value_type;
- typedef typename _Iterator::difference_type difference_type;
- typedef typename _Iterator::pointer pointer;
- typedef typename _Iterator::reference reference;
-};
-
-template <class _Tp>
-struct iterator_traits<_Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp>
-struct iterator_traits<const _Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-};
-
-// The overloaded functions iterator_category, distance_type, and
-// value_type are not part of the C++ standard. (They have been
-// replaced by struct iterator_traits.) They are included for
-// backward compatibility with the HP STL.
-
-// We introduce internal names for these functions.
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-__iterator_category(const _Iter&)
-{
- typedef typename iterator_traits<_Iter>::iterator_category _Category;
- return _Category();
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-__distance_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::difference_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-__value_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::value_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-iterator_category(const _Iter& __i) { return __iterator_category(__i); }
-
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-distance_type(const _Iter& __i) { return __distance_type(__i); }
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-value_type(const _Iter& __i) { return __value_type(__i); }
-
-#define __ITERATOR_CATEGORY(__i) __iterator_category(__i)
-#define __DISTANCE_TYPE(__i) __distance_type(__i)
-#define __VALUE_TYPE(__i) __value_type(__i)
-
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Tp, class _Distance>
-inline input_iterator_tag
-iterator_category(const input_iterator<_Tp, _Distance>&)
- { return input_iterator_tag(); }
-
-inline output_iterator_tag iterator_category(const output_iterator&)
- { return output_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline forward_iterator_tag
-iterator_category(const forward_iterator<_Tp, _Distance>&)
- { return forward_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline bidirectional_iterator_tag
-iterator_category(const bidirectional_iterator<_Tp, _Distance>&)
- { return bidirectional_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline random_access_iterator_tag
-iterator_category(const random_access_iterator<_Tp, _Distance>&)
- { return random_access_iterator_tag(); }
-
-template <class _Tp>
-inline random_access_iterator_tag iterator_category(const _Tp*)
- { return random_access_iterator_tag(); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const input_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const forward_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const bidirectional_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Tp* value_type(const random_access_iterator<_Tp, _Distance>&)
- { return (_Tp*)(0); }
-
-template <class _Tp>
-inline _Tp* value_type(const _Tp*) { return (_Tp*)(0); }
-
-template <class _Tp, class _Distance>
-inline _Distance* distance_type(const input_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp, class _Distance>
-inline _Distance* distance_type(const forward_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp, class _Distance>
-inline _Distance*
-distance_type(const bidirectional_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp, class _Distance>
-inline _Distance*
-distance_type(const random_access_iterator<_Tp, _Distance>&)
-{
- return (_Distance*)(0);
-}
-
-template <class _Tp>
-inline ptrdiff_t* distance_type(const _Tp*) { return (ptrdiff_t*)(0); }
-
-// Without partial specialization we can't use iterator_traits, so
-// we must keep the old iterator query functions around.
-
-#define __ITERATOR_CATEGORY(__i) iterator_category(__i)
-#define __DISTANCE_TYPE(__i) distance_type(__i)
-#define __VALUE_TYPE(__i) value_type(__i)
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIterator, class _Distance>
-inline void __distance(_InputIterator __first, _InputIterator __last,
- _Distance& __n, input_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));
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
-{
- typename iterator_traits<_InputIterator>::difference_type __n = 0;
- while (__first != __last) {
- ++__first; ++__n;
- }
- return __n;
-}
-
-template <class _RandomAccessIterator>
-inline typename iterator_traits<_RandomAccessIterator>::difference_type
-__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
- random_access_iterator_tag) {
- return __last - __first;
-}
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-distance(_InputIterator __first, _InputIterator __last) {
- typedef typename iterator_traits<_InputIterator>::iterator_category
- _Category;
- return __distance(__first, __last, _Category());
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIter, class _Distance>
-inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
- while (__n--) ++__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1183
-#endif
-
-template <class _BidirectionalIterator, class _Distance>
-inline void __advance(_BidirectionalIterator& __i, _Distance __n,
- bidirectional_iterator_tag) {
- if (__n >= 0)
- while (__n--) ++__i;
- else
- while (__n++) --__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1183
-#endif
-
-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 _Container>
-class back_insert_iterator {
-protected:
- _Container* container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- explicit back_insert_iterator(_Container& __x) : container(&__x) {}
- back_insert_iterator<_Container>&
- operator=(const typename _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; }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Container>
-inline output_iterator_tag
-iterator_category(const back_insert_iterator<_Container>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Container>
-inline back_insert_iterator<_Container> back_inserter(_Container& __x) {
- return back_insert_iterator<_Container>(__x);
-}
-
-template <class _Container>
-class front_insert_iterator {
-protected:
- _Container* container;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- explicit front_insert_iterator(_Container& __x) : container(&__x) {}
- front_insert_iterator<_Container>&
- operator=(const typename _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; }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Container>
-inline output_iterator_tag
-iterator_category(const front_insert_iterator<_Container>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Container>
-inline front_insert_iterator<_Container> front_inserter(_Container& __x) {
- return front_insert_iterator<_Container>(__x);
-}
-
-template <class _Container>
-class insert_iterator {
-protected:
- _Container* container;
- typename _Container::iterator iter;
-public:
- typedef _Container container_type;
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- insert_iterator(_Container& __x, typename _Container::iterator __i)
- : container(&__x), iter(__i) {}
- insert_iterator<_Container>&
- operator=(const typename _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; }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Container>
-inline output_iterator_tag
-iterator_category(const insert_iterator<_Container>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Container, class _Iterator>
-inline
-insert_iterator<_Container> inserter(_Container& __x, _Iterator __i)
-{
- typedef typename _Container::iterator __iter;
- return insert_iterator<_Container>(__x, __iter(__i));
-}
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _BidirectionalIterator, class _Tp, class _Reference = _Tp&,
- class _Distance = ptrdiff_t>
-#else
-template <class _BidirectionalIterator, class _Tp, class _Reference,
- class _Distance>
-#endif
-class reverse_bidirectional_iterator {
- typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
- _Reference, _Distance> _Self;
-protected:
- _BidirectionalIterator current;
-public:
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Reference reference;
-
- reverse_bidirectional_iterator() {}
- explicit reverse_bidirectional_iterator(_BidirectionalIterator __x)
- : current(__x) {}
- _BidirectionalIterator base() const { return current; }
- _Reference operator*() const {
- _BidirectionalIterator __tmp = current;
- return *--__tmp;
- }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
- _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;
- }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _BidirectionalIterator, class _Tp, class _Reference,
- class _Distance>
-inline bidirectional_iterator_tag
-iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator,
- _Tp, _Reference,
- _Distance>&)
-{
- return bidirectional_iterator_tag();
-}
-
-template <class _BidirectionalIterator, class _Tp, class _Reference,
- class _Distance>
-inline _Tp*
-value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp,
- _Reference, _Distance>&)
-{
- return (_Tp*) 0;
-}
-
-template <class _BidirectionalIterator, class _Tp, class _Reference,
- class _Distance>
-inline _Distance*
-distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator,
- _Tp,
- _Reference, _Distance>&)
-{
- return (_Distance*) 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _BiIter, class _Tp, class _Ref,
- class _Distance>
-inline bool operator==(
- const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x,
- const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y)
-{
- return __x.base() == __y.base();
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-// This is the new version of reverse_iterator, as defined in the
-// draft C++ standard. It relies on the iterator_traits template,
-// which in turn relies on partial specialization. The class
-// reverse_bidirectional_iterator is no longer part of the draft
-// standard, but it is retained for backward compatibility.
-
-template <class _Iterator>
-class reverse_iterator
-{
-protected:
- _Iterator current;
-public:
- typedef typename iterator_traits<_Iterator>::iterator_category
- iterator_category;
- typedef typename iterator_traits<_Iterator>::value_type
- value_type;
- typedef typename iterator_traits<_Iterator>::difference_type
- difference_type;
- typedef typename iterator_traits<_Iterator>::pointer
- pointer;
- typedef typename iterator_traits<_Iterator>::reference
- reference;
-
- typedef _Iterator iterator_type;
- typedef reverse_iterator<_Iterator> _Self;
-
-public:
- reverse_iterator() {}
- explicit reverse_iterator(iterator_type __x) : current(__x) {}
-
- reverse_iterator(const _Self& __x) : current(__x.current) {}
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Iter>
- reverse_iterator(const reverse_iterator<_Iter>& __x)
- : current(__x.base()) {}
-#endif /* __STL_MEMBER_TEMPLATES */
-
- iterator_type base() const { return current; }
- reference operator*() const {
- _Iterator __tmp = current;
- return *--__tmp;
- }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
-
- _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+(difference_type __n) const {
- return _Self(current - __n);
- }
- _Self& operator+=(difference_type __n) {
- current -= __n;
- return *this;
- }
- _Self operator-(difference_type __n) const {
- return _Self(current + __n);
- }
- _Self& operator-=(difference_type __n) {
- current += __n;
- return *this;
- }
- reference operator[](difference_type __n) const { return *(*this + __n); }
-};
-
-template <class _Iterator>
-inline bool operator==(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y) {
- return __x.base() == __y.base();
-}
-
-template <class _Iterator>
-inline bool operator<(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y) {
- return __y.base() < __x.base();
-}
-
-template <class _Iterator>
-inline typename reverse_iterator<_Iterator>::difference_type
-operator-(const reverse_iterator<_Iterator>& __x,
- const reverse_iterator<_Iterator>& __y) {
- return __y.base() - __x.base();
-}
-
-template <class _Iterator>
-inline reverse_iterator<_Iterator>
-operator+(typename reverse_iterator<_Iterator>::difference_type __n,
- const reverse_iterator<_Iterator>& __x) {
- return reverse_iterator<_Iterator>(__x.base() - __n);
-}
-
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// This is the old version of reverse_iterator, as found in the original
-// HP STL. It does not use partial specialization.
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _RandomAccessIterator, class _Tp, class _Reference = _Tp&,
- class _Distance = ptrdiff_t>
-#else
-template <class _RandomAccessIterator, class _Tp, class _Reference,
- class _Distance>
-#endif
-class reverse_iterator {
- typedef reverse_iterator<_RandomAccessIterator, _Tp, _Reference, _Distance>
- _Self;
-protected:
- _RandomAccessIterator current;
-public:
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Reference reference;
-
- reverse_iterator() {}
- explicit reverse_iterator(_RandomAccessIterator __x) : current(__x) {}
- _RandomAccessIterator base() const { return current; }
- _Reference operator*() const { return *(current - 1); }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
- _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) const { return *(*this + __n); }
-};
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline random_access_iterator_tag
-iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>&)
-{
- return random_access_iterator_tag();
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline _Tp* value_type(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>&)
-{
- return (_Tp*) 0;
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline _Distance*
-distance_type(const reverse_iterator<_RandomAccessIterator,
- _Tp, _Reference, _Distance>&)
-{
- return (_Distance*) 0;
-}
-
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator==(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y)
-{
- return __x.base() == __y.base();
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline bool
-operator<(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y)
-{
- return __y.base() < __x.base();
-}
-
-template <class _RandomAccessIterator, class _Tp,
- class _Reference, class _Distance>
-inline _Distance
-operator-(const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __x,
- const reverse_iterator<_RandomAccessIterator, _Tp,
- _Reference, _Distance>& __y)
-{
- return __y.base() - __x.base();
-}
-
-template <class _RandAccIter, class _Tp, class _Ref, class _Dist>
-inline reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>
-operator+(_Dist __n,
- const reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>& __x)
-{
- return reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>(__x.base() - __n);
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// When we have templatized iostreams, istream_iterator and ostream_iterator
-// must be rewritten.
-
-template <class _Tp, class _Dist = ptrdiff_t>
-class istream_iterator {
- friend bool operator== __STL_NULL_TMPL_ARGS (const istream_iterator&,
- const istream_iterator&);
-protected:
- istream* _M_stream;
- _Tp _M_value;
- bool _M_end_marker;
- void _M_read() {
- _M_end_marker = (*_M_stream) ? true : false;
- if (_M_end_marker) *_M_stream >> _M_value;
- _M_end_marker = (*_M_stream) ? true : false;
- }
-public:
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Dist difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-
- istream_iterator() : _M_stream(&cin), _M_end_marker(false) {}
- istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); }
- reference operator*() const { return _M_value; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
- istream_iterator<_Tp, _Dist>& operator++() {
- _M_read();
- return *this;
- }
- istream_iterator<_Tp, _Dist> operator++(int) {
- istream_iterator<_Tp, _Dist> __tmp = *this;
- _M_read();
- return __tmp;
- }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp, class _Dist>
-inline input_iterator_tag
-iterator_category(const istream_iterator<_Tp, _Dist>&)
-{
- return input_iterator_tag();
-}
-
-template <class _Tp, class _Dist>
-inline _Tp*
-value_type(const istream_iterator<_Tp, _Dist>&) { return (_Tp*) 0; }
-
-template <class _Tp, class _Dist>
-inline _Dist*
-distance_type(const istream_iterator<_Tp, _Dist>&) { return (_Dist*)0; }
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _Tp, class _Distance>
-inline bool operator==(const istream_iterator<_Tp, _Distance>& __x,
- const istream_iterator<_Tp, _Distance>& __y) {
- return (__x._M_stream == __y._M_stream &&
- __x._M_end_marker == __y._M_end_marker) ||
- __x._M_end_marker == false && __y._M_end_marker == false;
-}
-
-template <class _Tp>
-class ostream_iterator {
-protected:
- ostream* _M_stream;
- const char* _M_string;
-public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- ostream_iterator(ostream& __s) : _M_stream(&__s), _M_string(0) {}
- ostream_iterator(ostream& __s, const char* __c)
- : _M_stream(&__s), _M_string(__c) {}
- ostream_iterator<_Tp>& operator=(const _Tp& __value) {
- *_M_stream << __value;
- if (_M_string) *_M_stream << _M_string;
- return *this;
- }
- ostream_iterator<_Tp>& operator*() { return *this; }
- ostream_iterator<_Tp>& operator++() { return *this; }
- ostream_iterator<_Tp>& operator++(int) { return *this; }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp>
-inline output_iterator_tag
-iterator_category(const ostream_iterator<_Tp>&) {
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_ITERATOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_list.h b/contrib/libstdc++/stl/stl_list.h
deleted file mode 100644
index 5d95d64..0000000
--- a/contrib/libstdc++/stl/stl_list.h
+++ /dev/null
@@ -1,840 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_LIST_H
-#define __SGI_STL_INTERNAL_LIST_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-template <class _Tp>
-struct _List_node {
- typedef void* _Void_pointer;
- _Void_pointer _M_next;
- _Void_pointer _M_prev;
- _Tp _M_data;
-};
-
-template<class _Tp, class _Ref, class _Ptr>
-struct _List_iterator {
- typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator;
- typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
- typedef _List_iterator<_Tp,_Ref,_Ptr> _Self;
-
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Ptr pointer;
- typedef _Ref reference;
- typedef _List_node<_Tp> _Node;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- _Node* _M_node;
-
- _List_iterator(_Node* __x) : _M_node(__x) {}
- _List_iterator() {}
- _List_iterator(const iterator& __x) : _M_node(__x._M_node) {}
-
- bool operator==(const _Self& __x) const { return _M_node == __x._M_node; }
- bool operator!=(const _Self& __x) const { return _M_node != __x._M_node; }
- reference operator*() const { return (*_M_node)._M_data; }
-
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
-
- _Self& operator++() {
- _M_node = (_Node*)(_M_node->_M_next);
- return *this;
- }
- _Self operator++(int) {
- _Self __tmp = *this;
- ++*this;
- return __tmp;
- }
- _Self& operator--() {
- _M_node = (_Node*)(_M_node->_M_prev);
- return *this;
- }
- _Self operator--(int) {
- _Self __tmp = *this;
- --*this;
- return __tmp;
- }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp, class _Ref, class _Ptr>
-inline bidirectional_iterator_tag
-iterator_category(const _List_iterator<_Tp, _Ref, _Ptr>&)
-{
- return bidirectional_iterator_tag();
-}
-
-template <class _Tp, class _Ref, class _Ptr>
-inline _Tp*
-value_type(const _List_iterator<_Tp, _Ref, _Ptr>&)
-{
- return 0;
-}
-
-template <class _Tp, class _Ref, class _Ptr>
-inline ptrdiff_t*
-distance_type(const _List_iterator<_Tp, _Ref, _Ptr>&)
-{
- return 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-
-// Base class that encapsulates details of allocators. Three cases:
-// an ordinary standard-conforming allocator, a standard-conforming
-// allocator with no non-static data, and an SGI-style allocator.
-// This complexity is necessary only because we're worrying about backward
-// compatibility and because we want to avoid wasting storage on an
-// allocator instance if it isn't necessary.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-// Base for general standard-conforming allocators.
-template <class _Tp, class _Allocator, bool _IsStatic>
-class _List_alloc_base {
-public:
- typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _Node_allocator; }
-
- _List_alloc_base(const allocator_type& __a) : _Node_allocator(__a) {}
-
-protected:
- _List_node<_Tp>* _M_get_node()
- { return _Node_allocator.allocate(1); }
- void _M_put_node(_List_node<_Tp>* __p)
- { _Node_allocator.deallocate(__p, 1); }
-
-protected:
- typename _Alloc_traits<_List_node<_Tp>, _Allocator>::allocator_type
- _Node_allocator;
- _List_node<_Tp>* _M_node;
-};
-
-// Specialization for instanceless allocators.
-
-template <class _Tp, class _Allocator>
-class _List_alloc_base<_Tp, _Allocator, true> {
-public:
- typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _List_alloc_base(const allocator_type&) {}
-
-protected:
- typedef typename _Alloc_traits<_List_node<_Tp>, _Allocator>::_Alloc_type
- _Alloc_type;
- _List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
- void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
-
-protected:
- _List_node<_Tp>* _M_node;
-};
-
-template <class _Tp, class _Alloc>
-class _List_base
- : public _List_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
-{
-public:
- typedef _List_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
-
- _List_base(const allocator_type& __a) : _Base(__a) {
- _M_node = _M_get_node();
- _M_node->_M_next = _M_node;
- _M_node->_M_prev = _M_node;
- }
- ~_List_base() {
- clear();
- _M_put_node(_M_node);
- }
-
- void clear();
-};
-
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-class _List_base
-{
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _List_base(const allocator_type&) {
- _M_node = _M_get_node();
- _M_node->_M_next = _M_node;
- _M_node->_M_prev = _M_node;
- }
- ~_List_base() {
- clear();
- _M_put_node(_M_node);
- }
-
- void clear();
-
-protected:
- typedef simple_alloc<_List_node<_Tp>, _Alloc> _Alloc_type;
- _List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
- void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
-
-protected:
- _List_node<_Tp>* _M_node;
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-void
-_List_base<_Tp,_Alloc>::clear()
-{
- _List_node<_Tp>* __cur = (_List_node<_Tp>*) _M_node->_M_next;
- while (__cur != _M_node) {
- _List_node<_Tp>* __tmp = __cur;
- __cur = (_List_node<_Tp>*) __cur->_M_next;
- destroy(&__tmp->_M_data);
- _M_put_node(__tmp);
- }
- _M_node->_M_next = _M_node;
- _M_node->_M_prev = _M_node;
-}
-
-template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-class list : protected _List_base<_Tp, _Alloc> {
- typedef _List_base<_Tp, _Alloc> _Base;
-protected:
- typedef void* _Void_pointer;
-
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef _List_node<_Tp> _Node;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef typename _Base::allocator_type allocator_type;
- allocator_type get_allocator() const { return _Base::get_allocator(); }
-
-public:
- typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator;
- typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator;
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
- typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- 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;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-protected:
-#ifdef __STL_HAS_NAMESPACES
- using _Base::_M_node;
- using _Base::_M_put_node;
- using _Base::_M_get_node;
-#endif /* __STL_HAS_NAMESPACES */
-
-protected:
- _Node* _M_create_node(const _Tp& __x)
- {
- _Node* __p = _M_get_node();
- __STL_TRY {
- construct(&__p->_M_data, __x);
- }
- __STL_UNWIND(_M_put_node(__p));
- return __p;
- }
-
- _Node* _M_create_node()
- {
- _Node* __p = _M_get_node();
- __STL_TRY {
- construct(&__p->_M_data);
- }
- __STL_UNWIND(_M_put_node(__p));
- return __p;
- }
-
-public:
- explicit list(const allocator_type& __a = allocator_type()) : _Base(__a) {}
-
- iterator begin() { return (_Node*)(_M_node->_M_next); }
- const_iterator begin() const { return (_Node*)(_M_node->_M_next); }
-
- iterator end() { return _M_node; }
- const_iterator end() const { return _M_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 _M_node->_M_next == _M_node; }
- size_type size() const {
- size_type __result = 0;
- distance(begin(), end(), __result);
- return __result;
- }
- size_type max_size() const { return size_type(-1); }
-
- reference front() { return *begin(); }
- const_reference front() const { return *begin(); }
- reference back() { return *(--end()); }
- const_reference back() const { return *(--end()); }
-
- void swap(list<_Tp, _Alloc>& __x) { __STD::swap(_M_node, __x._M_node); }
-
- iterator insert(iterator __position, const _Tp& __x) {
- _Node* __tmp = _M_create_node(__x);
- __tmp->_M_next = __position._M_node;
- __tmp->_M_prev = __position._M_node->_M_prev;
- ((_Node*) (__position._M_node->_M_prev))->_M_next = __tmp;
- __position._M_node->_M_prev = __tmp;
- return __tmp;
- }
- iterator insert(iterator __position) { return insert(__position, _Tp()); }
-#ifdef __STL_MEMBER_TEMPLATES
- // Check whether it's an integral type. If so, it's not an iterator.
-
- template<class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
- __true_type) {
- insert(__pos, (size_type) __n, (_Tp) __x);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- __false_type);
-
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
- void insert(iterator __position, const _Tp* __first, const _Tp* __last);
- void insert(iterator __position,
- const_iterator __first, const_iterator __last);
-#endif /* __STL_MEMBER_TEMPLATES */
- void insert(iterator __pos, size_type __n, const _Tp& __x);
-
- void push_front(const _Tp& __x) { insert(begin(), __x); }
- void push_front() {insert(begin());}
- void push_back(const _Tp& __x) { insert(end(), __x); }
- void push_back() {insert(end());}
-
- iterator erase(iterator __position) {
- _Node* __next_node = (_Node*) (__position._M_node->_M_next);
- _Node* __prev_node = (_Node*) (__position._M_node->_M_prev);
- __prev_node->_M_next = __next_node;
- __next_node->_M_prev = __prev_node;
- destroy(&__position._M_node->_M_data);
- _M_put_node(__position._M_node);
- return iterator(__next_node);
- }
- iterator erase(iterator __first, iterator __last);
- void clear() { _Base::clear(); }
-
- void resize(size_type __new_size, const _Tp& __x);
- void resize(size_type __new_size) { resize(__new_size, _Tp()); }
-
- void pop_front() { erase(begin()); }
- void pop_back() {
- iterator __tmp = end();
- erase(--__tmp);
- }
- list(size_type __n, const _Tp& __value,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- { insert(begin(), __n, __value); }
- explicit list(size_type __n)
- : _Base(allocator_type())
- { insert(begin(), __n, _Tp()); }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- // We don't need any dispatching tricks here, because insert does all of
- // that anyway.
- template <class _InputIterator>
- list(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- { insert(begin(), __first, __last); }
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- list(const _Tp* __first, const _Tp* __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- { insert(begin(), __first, __last); }
- list(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- { insert(begin(), __first, __last); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
- list(const list<_Tp, _Alloc>& __x) : _Base(__x.get_allocator())
- { insert(begin(), __x.begin(), __x.end()); }
-
- ~list() { }
-
- list<_Tp, _Alloc>& operator=(const list<_Tp, _Alloc>& __x);
-
-public:
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_type __n, const _Tp& __val);
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { assign((size_type) __n, (_Tp) __val); }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- __false_type);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-protected:
- void transfer(iterator __position, iterator __first, iterator __last) {
- if (__position != __last) {
- // Remove [first, last) from its old position.
- ((_Node*) (__last._M_node->_M_prev))->_M_next = __position._M_node;
- ((_Node*) (__first._M_node->_M_prev))->_M_next = __last._M_node;
- ((_Node*) (__position._M_node->_M_prev))->_M_next = __first._M_node;
-
- // Splice [first, last) into its new position.
- _Node* __tmp = (_Node*) (__position._M_node->_M_prev);
- __position._M_node->_M_prev = __last._M_node->_M_prev;
- __last._M_node->_M_prev = __first._M_node->_M_prev;
- __first._M_node->_M_prev = __tmp;
- }
- }
-
-public:
- void splice(iterator __position, list& __x) {
- if (!__x.empty())
- transfer(__position, __x.begin(), __x.end());
- }
- void splice(iterator __position, list&, iterator __i) {
- iterator __j = __i;
- ++__j;
- if (__position == __i || __position == __j) return;
- transfer(__position, __i, __j);
- }
- void splice(iterator __position, list&, iterator __first, iterator __last) {
- if (__first != __last)
- transfer(__position, __first, __last);
- }
- void remove(const _Tp& __value);
- void unique();
- void merge(list& __x);
- void reverse();
- void sort();
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Predicate> void remove_if(_Predicate);
- template <class _BinaryPredicate> void unique(_BinaryPredicate);
- template <class _StrictWeakOrdering> void merge(list&, _StrictWeakOrdering);
- template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering);
-#endif /* __STL_MEMBER_TEMPLATES */
-
- friend bool operator== __STL_NULL_TMPL_ARGS (
- const list& __x, const list& __y);
-};
-
-template <class _Tp, class _Alloc>
-inline bool operator==(const list<_Tp,_Alloc>& __x,
- const list<_Tp,_Alloc>& __y)
-{
- typedef typename list<_Tp,_Alloc>::_Node _Node;
- _Node* __e1 = __x._M_node;
- _Node* __e2 = __y._M_node;
- _Node* __n1 = (_Node*) __e1->_M_next;
- _Node* __n2 = (_Node*) __e2->_M_next;
- for ( ; __n1 != __e1 && __n2 != __e2 ;
- __n1 = (_Node*) __n1->_M_next, __n2 = (_Node*) __n2->_M_next)
- if (__n1->_M_data != __n2->_M_data)
- return false;
- return __n1 == __e1 && __n2 == __e2;
-}
-
-template <class _Tp, class _Alloc>
-inline bool operator<(const list<_Tp,_Alloc>& __x,
- const list<_Tp,_Alloc>& __y)
-{
- return lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Tp, class _Alloc>
-inline void
-swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
-{
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc> template <class _InputIter>
-void
-list<_Tp, _Alloc>::_M_insert_dispatch(iterator __position,
- _InputIter __first, _InputIter __last,
- __false_type)
-{
- for ( ; __first != __last; ++__first)
- insert(__position, *__first);
-}
-
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::insert(iterator __position,
- const _Tp* __first, const _Tp* __last)
-{
- for ( ; __first != __last; ++__first)
- insert(__position, *__first);
-}
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::insert(iterator __position,
- const_iterator __first, const_iterator __last)
-{
- for ( ; __first != __last; ++__first)
- insert(__position, *__first);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void
-list<_Tp, _Alloc>::insert(iterator __position, size_type __n, const _Tp& __x)
-{
- for ( ; __n > 0; --__n)
- insert(__position, __x);
-}
-
-template <class _Tp, class _Alloc>
-list<_Tp,_Alloc>::iterator list<_Tp, _Alloc>::erase(iterator __first,
- iterator __last)
-{
- while (__first != __last)
- erase(__first++);
- return __last;
-}
-
-template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x)
-{
- iterator __i = begin();
- size_type __len = 0;
- for ( ; __i != end() && __len < __new_size; ++__i, ++__len)
- ;
- if (__len == __new_size)
- erase(__i, end());
- else // __i == end()
- insert(end(), __new_size - __len, __x);
-}
-
-template <class _Tp, class _Alloc>
-list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __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 _Tp, class _Alloc>
-void list<_Tp, _Alloc>::assign(size_type __n, const _Tp& __val) {
- iterator __i = begin();
- for ( ; __i != end() && __n > 0; ++__i, --__n)
- *__i = __val;
- if (__n > 0)
- insert(end(), __n, __val);
- else
- erase(__i, end());
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc> template <class _InputIter>
-void
-list<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first2, _InputIter __last2,
- __false_type)
-{
- iterator __first1 = begin();
- iterator __last1 = end();
- for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
- *__first1 = *__first2;
- if (__first2 == __last2)
- erase(__first1, __last1);
- else
- insert(__last1, __first2, __last2);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::remove(const _Tp& __value)
-{
- iterator __first = begin();
- iterator __last = end();
- while (__first != __last) {
- iterator __next = __first;
- ++__next;
- if (*__first == __value) erase(__first);
- __first = __next;
- }
-}
-
-template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::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 _Tp, class _Alloc>
-void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __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);
-}
-
-template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::reverse()
-{
- // Do nothing if the list has length 0 or 1.
- if (_M_node->_M_next != _M_node &&
- ((_Node*) (_M_node->_M_next))->_M_next != _M_node) {
- iterator __first = begin();
- ++__first;
- while (__first != end()) {
- iterator __old = __first;
- ++__first;
- transfer(begin(), __old, __first);
- }
- }
-}
-
-template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::sort()
-{
- // Do nothing if the list has length 0 or 1.
- if (_M_node->_M_next != _M_node &&
- ((_Node*) (_M_node->_M_next))->_M_next != _M_node) {
- list<_Tp, _Alloc> __carry;
- list<_Tp, _Alloc> __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]);
- }
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc> template <class _Predicate>
-void list<_Tp, _Alloc>::remove_if(_Predicate __pred)
-{
- iterator __first = begin();
- iterator __last = end();
- while (__first != __last) {
- iterator __next = __first;
- ++__next;
- if (__pred(*__first)) erase(__first);
- __first = __next;
- }
-}
-
-template <class _Tp, class _Alloc> template <class _BinaryPredicate>
-void list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
-{
- iterator __first = begin();
- iterator __last = end();
- if (__first == __last) return;
- iterator __next = __first;
- while (++__next != __last) {
- if (__binary_pred(*__first, *__next))
- erase(__next);
- else
- __first = __next;
- __next = __first;
- }
-}
-
-template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
-void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __x,
- _StrictWeakOrdering __comp)
-{
- iterator __first1 = begin();
- iterator __last1 = end();
- iterator __first2 = __x.begin();
- iterator __last2 = __x.end();
- while (__first1 != __last1 && __first2 != __last2)
- if (__comp(*__first2, *__first1)) {
- iterator __next = __first2;
- transfer(__first1, __first2, ++__next);
- __first2 = __next;
- }
- else
- ++__first1;
- if (__first2 != __last2) transfer(__last1, __first2, __last2);
-}
-
-template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
-void list<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp)
-{
- // Do nothing if the list has length 0 or 1.
- if (_M_node->_M_next != _M_node &&
- ((_Node*) (_M_node->_M_next))->_M_next != _M_node) {
- list<_Tp, _Alloc> __carry;
- list<_Tp, _Alloc> __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, __comp);
- __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], __comp);
- swap(__counter[__fill-1]);
- }
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_LIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_map.h b/contrib/libstdc++/stl/stl_map.h
deleted file mode 100644
index a702e80..0000000
--- a/contrib/libstdc++/stl/stl_map.h
+++ /dev/null
@@ -1,242 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_MAP_H
-#define __SGI_STL_INTERNAL_MAP_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Key, class _Tp, class _Compare = less<_Key>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#else
-template <class _Key, class _Tp, class _Compare,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#endif
-class map {
-public:
-
-// typedefs:
-
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
- typedef pair<const _Key, _Tp> value_type;
- typedef _Compare key_compare;
-
- class value_compare
- : public binary_function<value_type, value_type, bool> {
- friend class map<_Key,_Tp,_Compare,_Alloc>;
- protected :
- _Compare _M_comp;
- value_compare(_Compare __c) : _M_comp(__c) {}
- public:
- bool operator()(const value_type& __x, const value_type& __y) const {
- return _M_comp(__x.first, __y.first);
- }
- };
-
-private:
- typedef _Rb_tree<key_type, value_type,
- _Select1st<value_type>, key_compare, _Alloc> _Rep_type;
- _Rep_type _M_t; // red-black tree representing map
-public:
- typedef typename _Rep_type::pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
- // allocation/deallocation
-
- map() : _M_t(_Compare(), allocator_type()) {}
- explicit map(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- map(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- template <class _InputIterator>
- map(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#else
- map(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- map(const value_type* __first,
- const value_type* __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
- map(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- map(const_iterator __first, const_iterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- map(const map<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
- map<_Key,_Tp,_Compare,_Alloc>&
- operator=(const map<_Key, _Tp, _Compare, _Alloc>& __x)
- {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
-
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() { return _M_t.begin(); }
- const_iterator begin() const { return _M_t.begin(); }
- iterator end() { return _M_t.end(); }
- const_iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() { return _M_t.rbegin(); }
- const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
- reverse_iterator rend() { return _M_t.rend(); }
- const_reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- _Tp& operator[](const key_type& __k) {
- iterator __i = lower_bound(__k);
- // __i->first is greater than or equivalent to __k.
- if (__i == end() || key_comp()(__k, (*__i).first))
- __i = insert(__i, value_type(__k, _Tp()));
- return (*__i).second;
- }
- void swap(map<_Key,_Tp,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
-
- pair<iterator,bool> insert(const value_type& __x)
- { return _M_t.insert_unique(__x); }
- iterator insert(iterator position, const value_type& __x)
- { return _M_t.insert_unique(position, __x); }
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last) {
- _M_t.insert_unique(__first, __last);
- }
-#else
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_unique(__first, __last);
- }
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_unique(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void erase(iterator __position) { _M_t.erase(__position); }
- size_type erase(const key_type& __x) { return _M_t.erase(__x); }
- void erase(iterator __first, iterator __last)
- { _M_t.erase(__first, __last); }
- void clear() { _M_t.clear(); }
-
- // map operations:
-
- iterator find(const key_type& __x) { return _M_t.find(__x); }
- const_iterator find(const key_type& __x) const { return _M_t.find(__x); }
- size_type count(const key_type& __x) const { return _M_t.count(__x); }
- iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); }
- const_iterator lower_bound(const key_type& __x) const {
- return _M_t.lower_bound(__x);
- }
- iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); }
- const_iterator upper_bound(const key_type& __x) const {
- return _M_t.upper_bound(__x);
- }
-
- pair<iterator,iterator> equal_range(const key_type& __x) {
- return _M_t.equal_range(__x);
- }
- pair<const_iterator,const_iterator> equal_range(const key_type& __x) const {
- return _M_t.equal_range(__x);
- }
- friend bool operator== __STL_NULL_TMPL_ARGS (const map&, const map&);
- friend bool operator< __STL_NULL_TMPL_ARGS (const map&, const map&);
-};
-
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-inline bool operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x,
- const map<_Key,_Tp,_Compare,_Alloc>& __y) {
- return __x._M_t == __y._M_t;
-}
-
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-inline bool operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x,
- const map<_Key,_Tp,_Compare,_Alloc>& __y) {
- return __x._M_t < __y._M_t;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-inline void swap(map<_Key,_Tp,_Compare,_Alloc>& __x,
- map<_Key,_Tp,_Compare,_Alloc>& __y) {
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_MAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_multimap.h b/contrib/libstdc++/stl/stl_multimap.h
deleted file mode 100644
index b7d3b87..0000000
--- a/contrib/libstdc++/stl/stl_multimap.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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_MULTIMAP_H
-#define __SGI_STL_INTERNAL_MULTIMAP_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Key, class _Tp, class _Compare = less<_Key>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#else
-template <class _Key, class _Tp, class _Compare,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-#endif
-class multimap {
-public:
-
-// typedefs:
-
- typedef _Key key_type;
- typedef _Tp data_type;
- typedef _Tp mapped_type;
- typedef pair<const _Key, _Tp> value_type;
- typedef _Compare key_compare;
-
- class value_compare : public binary_function<value_type, value_type, bool> {
- friend class multimap<_Key,_Tp,_Compare,_Alloc>;
- protected:
- _Compare _M_comp;
- value_compare(_Compare __c) : _M_comp(__c) {}
- public:
- bool operator()(const value_type& __x, const value_type& __y) const {
- return _M_comp(__x.first, __y.first);
- }
- };
-
-private:
- typedef _Rb_tree<key_type, value_type,
- _Select1st<value_type>, key_compare, _Alloc> _Rep_type;
- _Rep_type _M_t; // red-black tree representing multimap
-public:
- typedef typename _Rep_type::pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
-// allocation/deallocation
-
- multimap() : _M_t(_Compare(), allocator_type()) { }
- explicit multimap(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- template <class _InputIterator>
- multimap(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#else
- multimap(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
- multimap(const value_type* __first, const value_type* __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
- multimap(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
- multimap(const_iterator __first, const_iterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- multimap(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) { }
- multimap<_Key,_Tp,_Compare,_Alloc>&
- operator=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
-
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return value_compare(_M_t.key_comp()); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() { return _M_t.begin(); }
- const_iterator begin() const { return _M_t.begin(); }
- iterator end() { return _M_t.end(); }
- const_iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() { return _M_t.rbegin(); }
- const_reverse_iterator rbegin() const { return _M_t.rbegin(); }
- reverse_iterator rend() { return _M_t.rend(); }
- const_reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
-
- iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); }
- iterator insert(iterator __position, const value_type& __x) {
- return _M_t.insert_equal(__position, __x);
- }
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last) {
- _M_t.insert_equal(__first, __last);
- }
-#else
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_equal(__first, __last);
- }
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_equal(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
- void erase(iterator __position) { _M_t.erase(__position); }
- size_type erase(const key_type& __x) { return _M_t.erase(__x); }
- void erase(iterator __first, iterator __last)
- { _M_t.erase(__first, __last); }
- void clear() { _M_t.clear(); }
-
- // multimap operations:
-
- iterator find(const key_type& __x) { return _M_t.find(__x); }
- const_iterator find(const key_type& __x) const { return _M_t.find(__x); }
- size_type count(const key_type& __x) const { return _M_t.count(__x); }
- iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); }
- const_iterator lower_bound(const key_type& __x) const {
- return _M_t.lower_bound(__x);
- }
- iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); }
- const_iterator upper_bound(const key_type& __x) const {
- return _M_t.upper_bound(__x);
- }
- pair<iterator,iterator> equal_range(const key_type& __x) {
- return _M_t.equal_range(__x);
- }
- pair<const_iterator,const_iterator> equal_range(const key_type& __x) const {
- return _M_t.equal_range(__x);
- }
- friend bool operator== __STL_NULL_TMPL_ARGS (const multimap&,
- const multimap&);
- friend bool operator< __STL_NULL_TMPL_ARGS (const multimap&,
- const multimap&);
-};
-
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
- const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
- return __x._M_t == __y._M_t;
-}
-
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,
- const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
- return __x._M_t < __y._M_t;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Key, class _Tp, class _Compare, class _Alloc>
-inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x,
- multimap<_Key,_Tp,_Compare,_Alloc>& __y) {
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_MULTIMAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_multiset.h b/contrib/libstdc++/stl/stl_multiset.h
deleted file mode 100644
index 7378e43..0000000
--- a/contrib/libstdc++/stl/stl_multiset.h
+++ /dev/null
@@ -1,224 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_MULTISET_H
-#define __SGI_STL_INTERNAL_MULTISET_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Key, class _Compare = less<_Key>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
-#else
-template <class _Key, class _Compare,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
-#endif
-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,
- _Identity<value_type>, key_compare, _Alloc> _Rep_type;
- _Rep_type _M_t; // red-black tree representing multiset
-public:
- typedef typename _Rep_type::const_pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::const_reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::const_iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
- // allocation/deallocation
-
- multiset() : _M_t(_Compare(), allocator_type()) {}
- explicit multiset(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- template <class _InputIterator>
- multiset(_InputIterator __first, _InputIterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
-#else
-
- multiset(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- multiset(const value_type* __first, const value_type* __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
- multiset(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_equal(__first, __last); }
-
- multiset(const_iterator __first, const_iterator __last,
- const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- multiset(const multiset<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
- multiset<_Key,_Compare,_Alloc>&
- operator=(const multiset<_Key,_Compare,_Alloc>& __x) {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
-
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return _M_t.key_comp(); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() const { return _M_t.begin(); }
- iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() const { return _M_t.rbegin(); }
- reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(multiset<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- iterator insert(const value_type& __x) {
- return _M_t.insert_equal(__x);
- }
- iterator insert(iterator __position, const value_type& __x) {
- typedef typename _Rep_type::iterator _Rep_iterator;
- return _M_t.insert_equal((_Rep_iterator&)__position, __x);
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last) {
- _M_t.insert_equal(__first, __last);
- }
-#else
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_equal(__first, __last);
- }
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_equal(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
- void erase(iterator __position) {
- typedef typename _Rep_type::iterator _Rep_iterator;
- _M_t.erase((_Rep_iterator&)__position);
- }
- size_type erase(const key_type& __x) {
- return _M_t.erase(__x);
- }
- void erase(iterator __first, iterator __last) {
- typedef typename _Rep_type::iterator _Rep_iterator;
- _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
- }
- void clear() { _M_t.clear(); }
-
- // multiset operations:
-
- iterator find(const key_type& __x) const { return _M_t.find(__x); }
- size_type count(const key_type& __x) const { return _M_t.count(__x); }
- iterator lower_bound(const key_type& __x) const {
- return _M_t.lower_bound(__x);
- }
- iterator upper_bound(const key_type& __x) const {
- return _M_t.upper_bound(__x);
- }
- pair<iterator,iterator> equal_range(const key_type& __x) const {
- return _M_t.equal_range(__x);
- }
- friend bool operator== __STL_NULL_TMPL_ARGS (const multiset&,
- const multiset&);
- friend bool operator< __STL_NULL_TMPL_ARGS (const multiset&,
- const multiset&);
-};
-
-template <class _Key, class _Compare, class _Alloc>
-inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x,
- const multiset<_Key,_Compare,_Alloc>& __y) {
- return __x._M_t == __y._M_t;
-}
-
-template <class _Key, class _Compare, class _Alloc>
-inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
- const multiset<_Key,_Compare,_Alloc>& __y) {
- return __x._M_t < __y._M_t;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Key, class _Compare, class _Alloc>
-inline void swap(multiset<_Key,_Compare,_Alloc>& __x,
- multiset<_Key,_Compare,_Alloc>& __y) {
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_MULTISET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_numeric.h b/contrib/libstdc++/stl/stl_numeric.h
deleted file mode 100644
index 392515a..0000000
--- a/contrib/libstdc++/stl/stl_numeric.h
+++ /dev/null
@@ -1,239 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-
-#ifndef __SGI_STL_INTERNAL_NUMERIC_H
-#define __SGI_STL_INTERNAL_NUMERIC_H
-
-__STL_BEGIN_NAMESPACE
-
-template <class _InputIterator, class _Tp>
-_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
-{
- for ( ; __first != __last; ++__first)
- __init = __init + *__first;
- return __init;
-}
-
-template <class _InputIterator, class _Tp, class _BinaryOperation>
-_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
- _BinaryOperation __binary_op)
-{
- for ( ; __first != __last; ++__first)
- __init = __binary_op(__init, *__first);
- return __init;
-}
-
-template <class _InputIterator1, class _InputIterator2, class _Tp>
-_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _Tp __init)
-{
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- __init = __init + (*__first1 * *__first2);
- return __init;
-}
-
-template <class _InputIterator1, class _InputIterator2, class _Tp,
- class _BinaryOperation1, class _BinaryOperation2>
-_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _Tp __init,
- _BinaryOperation1 __binary_op1,
- _BinaryOperation2 __binary_op2)
-{
- for ( ; __first1 != __last1; ++__first1, ++__first2)
- __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
- return __init;
-}
-
-template <class _InputIterator, class _OutputIterator, class _Tp>
-_OutputIterator
-__partial_sum(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Tp*)
-{
- _Tp __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 _Tp,
- class _BinaryOperation>
-_OutputIterator
-__partial_sum(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Tp*, _BinaryOperation __binary_op)
-{
- _Tp __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 _Tp>
-_OutputIterator
-__adjacent_difference(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Tp*)
-{
- _Tp __value = *__first;
- while (++__first != __last) {
- _Tp __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 _Tp,
- class _BinaryOperation>
-_OutputIterator
-__adjacent_difference(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result, _Tp*,
- _BinaryOperation __binary_op) {
- _Tp __value = *__first;
- while (++__first != __last) {
- _Tp __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);
-}
-
-// Returns __x ** __n, where __n >= 0. _Note that "multiplication"
-// is required to be associative, but not necessarily commutative.
-
-
-template <class _Tp, class _Integer, class _MonoidOperation>
-_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __oper)
-{
- if (__n == 0)
- return identity_element(__oper);
- else {
- while ((__n & 1) == 0) {
- __n >>= 1;
- __x = __oper(__x, __x);
- }
-
- _Tp __result = __x;
- __n >>= 1;
- while (__n != 0) {
- __x = __oper(__x, __x);
- if ((__n & 1) != 0)
- __result = __oper(__result, __x);
- __n >>= 1;
- }
- return __result;
- }
-}
-
-template <class _Tp, class _Integer>
-inline _Tp __power(_Tp __x, _Integer __n)
-{
- return __power(__x, __n, multiplies<_Tp>());
-}
-
-// Alias for the internal name __power. Note that power is an extension,
-// not part of the C++ standard.
-
-template <class _Tp, class _Integer, class _MonoidOperation>
-inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __oper)
-{
- return __power(__x, __n, __oper);
-}
-
-template <class _Tp, class _Integer>
-inline _Tp power(_Tp __x, _Integer __n)
-{
- return __power(__x, __n);
-}
-
-// iota is not part of the C++ standard. It is an extension.
-
-template <class _ForwardIterator, class _Tp>
-void
-iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
-{
- while (__first != __last)
- *__first++ = __value++;
-}
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_NUMERIC_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_pair.h b/contrib/libstdc++/stl/stl_pair.h
deleted file mode 100644
index 3aa290b..0000000
--- a/contrib/libstdc++/stl/stl_pair.h
+++ /dev/null
@@ -1,77 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_PAIR_H
-#define __SGI_STL_INTERNAL_PAIR_H
-
-__STL_BEGIN_NAMESPACE
-
-template <class _T1, class _T2>
-struct pair {
- typedef _T1 first_type;
- typedef _T2 second_type;
-
- _T1 first;
- _T2 second;
- pair() : first(_T1()), second(_T2()) {}
- pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _U1, class _U2>
- pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
-#endif
-};
-
-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);
-}
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_PAIR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_queue.h b/contrib/libstdc++/stl/stl_queue.h
deleted file mode 100644
index c1e2b69..0000000
--- a/contrib/libstdc++/stl/stl_queue.h
+++ /dev/null
@@ -1,202 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_QUEUE_H
-#define __SGI_STL_INTERNAL_QUEUE_H
-
-__STL_BEGIN_NAMESPACE
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Tp, class _Sequence = deque<_Tp> >
-#else
-template <class _Tp, class _Sequence>
-#endif
-class queue {
- friend bool operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&);
- friend bool operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&);
-public:
- typedef typename _Sequence::value_type value_type;
- typedef typename _Sequence::size_type size_type;
- typedef _Sequence container_type;
-
- typedef typename _Sequence::reference reference;
- typedef typename _Sequence::const_reference const_reference;
-protected:
- _Sequence c;
-public:
- queue() : c() {}
- explicit queue(const _Sequence& __c) : c(__c) {}
-
- bool empty() const { return c.empty(); }
- size_type size() const { return c.size(); }
- reference front() { return c.front(); }
- const_reference front() const { return c.front(); }
- reference back() { return c.back(); }
- const_reference back() const { return c.back(); }
- void push(const value_type& __x) { c.push_back(__x); }
- void pop() { c.pop_front(); }
-};
-
-template <class _Tp, class _Sequence>
-bool
-operator==(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
-{
- return __x.c == __y.c;
-}
-
-template <class _Tp, class _Sequence>
-bool
-operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
-{
- return __x.c < __y.c;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Tp, class _Sequence>
-bool
-operator!=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Tp, class _Sequence>
-bool
-operator>(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
-{
- return __y < __x;
-}
-
-template <class _Tp, class _Sequence>
-bool
-operator<=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
-{
- return !(__y < __x);
-}
-
-template <class _Tp, class _Sequence>
-bool
-operator>=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y)
-{
- return !(__x < __y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Tp, class _Sequence = vector<_Tp>,
- class _Compare = less<typename _Sequence::value_type> >
-#else
-template <class _Tp, class _Sequence, class _Compare>
-#endif
-class priority_queue {
-public:
- typedef typename _Sequence::value_type value_type;
- typedef typename _Sequence::size_type size_type;
- typedef _Sequence container_type;
-
- typedef typename _Sequence::reference reference;
- typedef typename _Sequence::const_reference const_reference;
-protected:
- _Sequence c;
- _Compare comp;
-public:
- priority_queue() : c() {}
- explicit priority_queue(const _Compare& __x) : c(), comp(__x) {}
- priority_queue(const _Compare& __x, const _Sequence& __s)
- : c(__s), comp(__x)
- { make_heap(c.begin(), c.end(), comp); }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- priority_queue(_InputIterator __first, _InputIterator __last)
- : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
-
- template <class _InputIterator>
- priority_queue(_InputIterator __first,
- _InputIterator __last, const _Compare& __x)
- : c(__first, __last), comp(__x)
- { make_heap(c.begin(), c.end(), comp); }
-
- template <class _InputIterator>
- priority_queue(_InputIterator __first, _InputIterator __last,
- const _Compare& __x, const _Sequence& __s)
- : c(__s), comp(__x)
- {
- c.insert(c.end(), __first, __last);
- make_heap(c.begin(), c.end(), comp);
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
- priority_queue(const value_type* __first, const value_type* __last)
- : c(__first, __last) { make_heap(c.begin(), c.end(), comp); }
-
- priority_queue(const value_type* __first, const value_type* __last,
- const _Compare& __x)
- : c(__first, __last), comp(__x)
- { make_heap(c.begin(), c.end(), comp); }
-
- priority_queue(const value_type* __first, const value_type* __last,
- const _Compare& __x, const _Sequence& __c)
- : c(__c), comp(__x)
- {
- c.insert(c.end(), __first, __last);
- make_heap(c.begin(), c.end(), comp);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- bool empty() const { return c.empty(); }
- size_type size() const { return c.size(); }
- const_reference top() const { return c.front(); }
- void push(const value_type& __x) {
- __STL_TRY {
- c.push_back(__x);
- push_heap(c.begin(), c.end(), comp);
- }
- __STL_UNWIND(c.clear());
- }
- void pop() {
- __STL_TRY {
- pop_heap(c.begin(), c.end(), comp);
- c.pop_back();
- }
- __STL_UNWIND(c.clear());
- }
-};
-
-// no equality is provided
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_QUEUE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_raw_storage_iter.h b/contrib/libstdc++/stl/stl_raw_storage_iter.h
deleted file mode 100644
index 6f3951c..0000000
--- a/contrib/libstdc++/stl/stl_raw_storage_iter.h
+++ /dev/null
@@ -1,81 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H
-#define __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H
-
-__STL_BEGIN_NAMESPACE
-
-template <class _ForwardIterator, class _Tp>
-class raw_storage_iterator {
-protected:
- _ForwardIterator _M_iter;
-public:
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-
- explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {}
- raw_storage_iterator& operator*() { return *this; }
- raw_storage_iterator& operator=(const _Tp& __element) {
- construct(&*_M_iter, __element);
- return *this;
- }
- raw_storage_iterator<_ForwardIterator, _Tp>& operator++() {
- ++_M_iter;
- return *this;
- }
- raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) {
- raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this;
- ++_M_iter;
- return __tmp;
- }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _ForwardIterator, class _Tp>
-inline output_iterator_tag
-iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&)
-{
- return output_iterator_tag();
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_relops.h b/contrib/libstdc++/stl/stl_relops.h
deleted file mode 100644
index 16cad1b..0000000
--- a/contrib/libstdc++/stl/stl_relops.h
+++ /dev/null
@@ -1,62 +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.
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_RELOPS
-#define __SGI_STL_INTERNAL_RELOPS
-
-__STL_BEGIN_RELOPS_NAMESPACE
-
-template <class _Tp>
-inline bool operator!=(const _Tp& __x, const _Tp& __y) {
- return !(__x == __y);
-}
-
-template <class _Tp>
-inline bool operator>(const _Tp& __x, const _Tp& __y) {
- return __y < __x;
-}
-
-template <class _Tp>
-inline bool operator<=(const _Tp& __x, const _Tp& __y) {
- return !(__y < __x);
-}
-
-template <class _Tp>
-inline bool operator>=(const _Tp& __x, const _Tp& __y) {
- return !(__x < __y);
-}
-
-__STL_END_RELOPS_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_RELOPS */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_rope.h b/contrib/libstdc++/stl/stl_rope.h
deleted file mode 100644
index fa1e848..0000000
--- a/contrib/libstdc++/stl/stl_rope.h
+++ /dev/null
@@ -1,2541 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-// rope<_CharT,_Alloc> is a sequence of _CharT.
-// Ropes appear to be mutable, but update operations
-// really copy enough of the data structure to leave the original
-// valid. Thus ropes can be logically copied by just copying
-// a pointer value.
-
-#ifndef __SGI_STL_INTERNAL_ROPE_H
-# define __SGI_STL_INTERNAL_ROPE_H
-
-# ifdef __GC
-# define __GC_CONST const
-# else
-# define __GC_CONST // constant except for deallocation
-# endif
-# ifdef __STL_SGI_THREADS
-# include <mutex.h>
-# endif
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#endif
-
-// The _S_eos function is used for those functions that
-// convert to/from C-like strings to detect the end of the string.
-
-// The end-of-C-string character.
-// This is what the draft standard says it should be.
-template <class _CharT>
-inline _CharT _S_eos(_CharT*) { return _CharT(); }
-
-// Test for basic character types.
-// For basic character types leaves having a trailing eos.
-template <class _CharT>
-inline bool _S_is_basic_char_type(_CharT*) { return false; }
-template <class _CharT>
-inline bool _S_is_one_byte_char_type(_CharT*) { return false; }
-
-inline bool _S_is_basic_char_type(char*) { return true; }
-inline bool _S_is_one_byte_char_type(char*) { return true; }
-inline bool _S_is_basic_char_type(wchar_t*) { return true; }
-
-// Store an eos iff _CharT is a basic character type.
-// Do not reference _S_eos if it isn't.
-template <class _CharT>
-inline void _S_cond_store_eos(_CharT&) {}
-
-inline void _S_cond_store_eos(char& __c) { __c = 0; }
-inline void _S_cond_store_eos(wchar_t& __c) { __c = 0; }
-
-// char_producers are logically functions that generate a section of
-// a string. These can be convereted to ropes. The resulting rope
-// invokes the char_producer on demand. This allows, for example,
-// files to be viewed as ropes without reading the entire file.
-template <class _CharT>
-class char_producer {
- public:
- virtual ~char_producer() {};
- virtual void operator()(size_t __start_pos, size_t __len,
- _CharT* __buffer) = 0;
- // Buffer should really be an arbitrary output iterator.
- // That way we could flatten directly into an ostream, etc.
- // This is thoroughly impossible, since iterator types don't
- // have runtime descriptions.
-};
-
-// Sequence buffers:
-//
-// Sequence must provide an append operation that appends an
-// array to the sequence. Sequence buffers are useful only if
-// appending an entire array is cheaper than appending element by element.
-// This is true for many string representations.
-// This should perhaps inherit from ostream<sequence::value_type>
-// and be implemented correspondingly, so that they can be used
-// for formatted. For the sake of portability, we don't do this yet.
-//
-// For now, sequence buffers behave as output iterators. But they also
-// behave a little like basic_ostringstream<sequence::value_type> and a
-// little like containers.
-
-template<class _Sequence, size_t _Buf_sz = 100
-# if defined(__sgi) && !defined(__GNUC__)
-# define __TYPEDEF_WORKAROUND
- ,class _V = typename _Sequence::value_type
-# endif
- >
-// The 3rd parameter works around a common compiler bug.
-class sequence_buffer : public output_iterator {
- public:
-# ifndef __TYPEDEF_WORKAROUND
- typedef typename _Sequence::value_type value_type;
-# else
- typedef _V value_type;
-# endif
- protected:
- _Sequence* _M_prefix;
- value_type _M_buffer[_Buf_sz];
- size_t _M_buf_count;
- public:
- void flush() {
- _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
- _M_buf_count = 0;
- }
- ~sequence_buffer() { flush(); }
- sequence_buffer() : _M_prefix(0), _M_buf_count(0) {}
- sequence_buffer(const sequence_buffer& __x) {
- _M_prefix = __x._M_prefix;
- _M_buf_count = __x._M_buf_count;
- copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
- }
- sequence_buffer(sequence_buffer& __x) {
- __x.flush();
- _M_prefix = __x._M_prefix;
- _M_buf_count = 0;
- }
- sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {}
- sequence_buffer& operator= (sequence_buffer& __x) {
- __x.flush();
- _M_prefix = __x._M_prefix;
- _M_buf_count = 0;
- return *this;
- }
- sequence_buffer& operator= (const sequence_buffer& __x) {
- _M_prefix = __x._M_prefix;
- _M_buf_count = __x._M_buf_count;
- copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
- return *this;
- }
- void push_back(value_type __x)
- {
- if (_M_buf_count < _Buf_sz) {
- _M_buffer[_M_buf_count] = __x;
- ++_M_buf_count;
- } else {
- flush();
- _M_buffer[0] = __x;
- _M_buf_count = 1;
- }
- }
- void append(value_type* __s, size_t __len)
- {
- if (__len + _M_buf_count <= _Buf_sz) {
- size_t __i = _M_buf_count;
- size_t __j = 0;
- for (; __j < __len; __i++, __j++) {
- _M_buffer[__i] = __s[__j];
- }
- _M_buf_count += __len;
- } else if (0 == _M_buf_count) {
- _M_prefix->append(__s, __s + __len);
- } else {
- flush();
- append(__s, __len);
- }
- }
- sequence_buffer& write(value_type* __s, size_t __len)
- {
- append(__s, __len);
- return *this;
- }
- sequence_buffer& put(value_type __x)
- {
- push_back(__x);
- return *this;
- }
- sequence_buffer& operator=(const value_type& __rhs)
- {
- push_back(__rhs);
- return *this;
- }
- sequence_buffer& operator*() { return *this; }
- sequence_buffer& operator++() { return *this; }
- sequence_buffer& operator++(int) { return *this; }
-};
-
-// The following should be treated as private, at least for now.
-template<class _CharT>
-class _Rope_char_consumer {
- public:
- // If we had member templates, these should not be virtual.
- // For now we need to use run-time parametrization where
- // compile-time would do. _Hence this should all be private
- // for now.
- // The symmetry with char_producer is accidental and temporary.
- virtual ~_Rope_char_consumer() {};
- virtual bool operator()(const _CharT* __buffer, size_t __len) = 0;
-};
-
-//
-// What follows should really be local to rope. Unfortunately,
-// that doesn't work, since it makes it impossible to define generic
-// equality on rope iterators. According to the draft standard, the
-// template parameters for such an equality operator cannot be inferred
-// from the occurence of a member class as a parameter.
-// (SGI compilers in fact allow this, but the __result wouldn't be
-// portable.)
-// Similarly, some of the static member functions are member functions
-// only to avoid polluting the global namespace, and to circumvent
-// restrictions on type inference for template functions.
-//
-
-template<class _CharT, class _Alloc=__STL_DEFAULT_ALLOCATOR(_CharT)> class rope;
-template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
-template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
-template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
-template<class _CharT, class _Alloc> struct _Rope_RopeSubstring;
-template<class _CharT, class _Alloc> class _Rope_iterator;
-template<class _CharT, class _Alloc> class _Rope_const_iterator;
-template<class _CharT, class _Alloc> class _Rope_char_ref_proxy;
-template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy;
-
-//
-// The internal data structure for representing a rope. This is
-// private to the implementation. A rope is really just a pointer
-// to one of these.
-//
-// A few basic functions for manipulating this data structure
-// are members of _RopeRep. Most of the more complex algorithms
-// are implemented as rope members.
-//
-// Some of the static member functions of _RopeRep have identically
-// named functions in rope that simply invoke the _RopeRep versions.
-//
-// A macro to introduce various allocation and deallocation functions
-// These need to be defined differently depending on whether or not
-// we are using standard conforming allocators, and whether the allocator
-// instances have real state. Thus this macro is invoked repeatedly
-// with different definitions of __ROPE_DEFINE_ALLOC.
-// __ROPE_DEFINE_ALLOC(type,name) defines
-// type * name_allocate(size_t) and
-// void name_deallocate(tipe *, size_t)
-// Both functions may or may not be static.
-
-#define __ROPE_DEFINE_ALLOCS(__a) \
- __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \
- typedef _Rope_RopeConcatenation<_CharT,__a> __C; \
- __ROPE_DEFINE_ALLOC(__C,_C) \
- typedef _Rope_RopeLeaf<_CharT,__a> __L; \
- __ROPE_DEFINE_ALLOC(__L,_L) \
- typedef _Rope_RopeFunction<_CharT,__a> __F; \
- __ROPE_DEFINE_ALLOC(__F,_F) \
- typedef _Rope_RopeSubstring<_CharT,__a> __S; \
- __ROPE_DEFINE_ALLOC(__S,_S)
-
-// Internal rope nodes potentially store a copy of the allocator
-// instance used to allocate them. This is mostly redundant.
-// But the alternative would be to pass allocator instances around
-// in some form to nearly all internal functions, since any pointer
-// assignment may result in a zero reference count and thus require
-// deallocation.
-// The _Rope_rep_base class encapsulates
-// the differences between SGI-style allocators and standard-conforming
-// allocators.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-#define __STATIC_IF_SGI_ALLOC /* not static */
-
-// Base class for ordinary allocators.
-template <class _CharT, class _Allocator, bool _IsStatic>
-class _Rope_rep_alloc_base {
-public:
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _M_data_allocator; }
- _Rope_rep_alloc_base(size_t __size, const allocator_type& __a)
- : _M_size(__size), _M_data_allocator(__a) {}
- size_t _M_size; // This is here only to avoid wasting space
- // for an otherwise empty base class.
-
-
-protected:
- allocator_type _M_data_allocator;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- /*static*/ _Tp * __name##_allocate(size_t __n) \
- { return __name##Allocator(_M_data_allocator).allocate(__n); } \
- void __name##_deallocate(_Tp* __p, size_t __n) \
- { __name##Allocator(_M_data_allocator).deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator);
-# undef __ROPE_DEFINE_ALLOC
-};
-
-// Specialization for allocators that have the property that we don't
-// actually have to store an allocator object.
-template <class _CharT, class _Allocator>
-class _Rope_rep_alloc_base<_CharT,_Allocator,true> {
-public:
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
- _Rope_rep_alloc_base(size_t __size, const allocator_type&)
- : _M_size(__size) {}
- size_t _M_size;
-
-protected:
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- void __name##_deallocate(_Tp *__p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator);
-# undef __ROPE_DEFINE_ALLOC
-};
-
-template <class _CharT, class _Alloc>
-struct _Rope_rep_base
- : public _Rope_rep_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
-{
- typedef _Rope_rep_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
- _Rope_rep_base(size_t __size, const allocator_type& __a)
- : _Base(__size, __a) {}
-};
-
-#else /* !__STL_USE_STD_ALLOCATORS */
-
-#define __STATIC_IF_SGI_ALLOC static
-
-template <class _CharT, class _Alloc>
-class _Rope_rep_base {
-public:
- typedef _Alloc allocator_type;
- static allocator_type get_allocator() { return allocator_type(); }
- _Rope_rep_base(size_t __size, const allocator_type&) : _M_size(__size) {}
- size_t _M_size;
-
-protected:
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef simple_alloc<_Tp, _Alloc> __name##Alloc; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- static void __name##_deallocate(_Tp* __p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Alloc);
-# undef __ROPE_DEFINE_ALLOC
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc> {
- public:
- enum { _S_max_rope_depth = 45 };
- enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
- _Tag _M_tag:8;
- bool _M_is_balanced:8;
- unsigned char _M_depth;
- __GC_CONST _CharT* _M_c_string;
- /* Flattened version of string, if needed. */
- /* typically 0. */
- /* If it's not 0, then the memory is owned */
- /* by this node. */
- /* In the case of a leaf, this may point to */
- /* the same memory as the data field. */
- typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type;
- _Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size,
- allocator_type __a)
- : _Rope_rep_base<_CharT,_Alloc>(__size, __a),
- _M_tag(__t), _M_depth(__d), _M_is_balanced(__b), _M_c_string(0)
- {
-# ifndef __GC
- _M_refcount = 1;
- _M_init_refcount_lock();
-# endif
- }
-# ifndef __GC
-# if defined(__STL_WIN32THREADS)
- long _M_refcount; // InterlockedIncrement wants a long *
-# else
- size_t _M_refcount;
-# endif
- // We count references from rope instances
- // and references from other rope nodes. We
- // do not count const_iterator references.
- // Iterator references are counted so that rope modifications
- // can be detected after the fact.
- // Generally function results are counted, i.__e.
- // a pointer returned by a function is included at the
- // point at which the pointer is returned.
- // The recipient should decrement the count if the
- // __result is not needed.
- // Generally function arguments are not reflected
- // in the reference count. The callee should increment
- // the count before saving the argument someplace that
- // will outlive the call.
-# endif
-# ifndef __GC
-# ifdef __STL_SGI_THREADS
- // Reference counting with multiple threads and no
- // hardware or thread package support is pretty awful.
- // Mutexes are normally too expensive.
- // We'll assume a COMPARE_AND_SWAP(destp, __old, new)
- // operation, which might be cheaper.
-# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
-# define __add_and_fetch(l,v) add_then_test((unsigned long*)l,v)
-# endif
- void _M_init_refcount_lock() {}
- void _M_incr_refcount ()
- {
- __add_and_fetch(&_M_refcount, 1);
- }
- size_t _M_decr_refcount ()
- {
- return __add_and_fetch(&_M_refcount, (size_t)(-1));
- }
-# elif defined(__STL_WIN32THREADS)
- void _M_init_refcount_lock() {}
- void _M_incr_refcount ()
- {
- InterlockedIncrement(&_M_refcount);
- }
- size_t _M_decr_refcount ()
- {
- return InterlockedDecrement(&_M_refcount);
- }
-# elif defined(__STL_PTHREADS)
- // This should be portable, but performance is expected
- // to be quite awful. This really needs platform specific
- // code.
- pthread_mutex_t _M_refcount_lock;
- void _M_init_refcount_lock() {
- pthread_mutex_init(&_M_refcount_lock, 0);
- }
- void _M_incr_refcount ()
- {
- pthread_mutex_lock(&_M_refcount_lock);
- ++_M_refcount;
- pthread_mutex_unlock(&_M_refcount_lock);
- }
- size_t _M_decr_refcount ()
- {
- size_t __result;
- pthread_mutex_lock(&_M_refcount_lock);
- __result = --_M_refcount;
- pthread_mutex_unlock(&_M_refcount_lock);
- return __result;
- }
-# else
- void _M_init_refcount_lock() {}
- void _M_incr_refcount ()
- {
- ++_M_refcount;
- }
- size_t _M_decr_refcount ()
- {
- --_M_refcount;
- return _M_refcount;
- }
-# endif
-# else
- void _M_incr_refcount () {}
-# endif
-# ifdef __STL_USE_STD_ALLOCATORS
- static void _S_free_string(__GC_CONST _CharT*, size_t __len,
- allocator_type __a);
-# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
-# else
- static void _S_free_string(__GC_CONST _CharT*, size_t __len);
-# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l);
-# endif
- // Deallocate data section of a leaf.
- // This shouldn't be a member function.
- // But its hard to do anything else at the
- // moment, because it's templatized w.r.t.
- // an allocator.
- // Does nothing if __GC is defined.
-# ifndef __GC
- void _M_free_c_string();
- void _M_free_tree();
- // Deallocate t. Assumes t is not 0.
- void _M_unref_nonnil()
- {
- if (0 == _M_decr_refcount()) _M_free_tree();
- }
- void _M_ref_nonnil()
- {
- _M_incr_refcount();
- }
- static void _S_unref(_Rope_RopeRep* __t)
- {
- if (0 != __t) {
- __t->_M_unref_nonnil();
- }
- }
- static void _S_ref(_Rope_RopeRep* __t)
- {
- if (0 != __t) __t->_M_incr_refcount();
- }
- static void _S_free_if_unref(_Rope_RopeRep* __t)
- {
- if (0 != __t && 0 == __t->_M_refcount) __t->_M_free_tree();
- }
-# else /* __GC */
- void _M_unref_nonnil() {}
- void _M_ref_nonnil() {}
- static void _S_unref(_Rope_RopeRep*) {}
- static void _S_ref(_Rope_RopeRep*) {}
- static void _S_free_if_unref(_Rope_RopeRep*) {}
-# endif
-
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
- public:
- // Apparently needed by VC++
- // The data fields of leaves are allocated with some
- // extra space, to accomodate future growth and for basic
- // character types, to hold a trailing eos character.
- enum { _S_alloc_granularity = 8 };
- static size_t _S_rounded_up_size(size_t __n) {
- size_t __size_with_eos;
-
- if (_S_is_basic_char_type((_CharT*)0)) {
- __size_with_eos = __n + 1;
- } else {
- __size_with_eos = __n;
- }
-# ifdef __GC
- return __size_with_eos;
-# else
- // Allow slop for in-place expansion.
- return (__size_with_eos + _S_alloc_granularity-1)
- &~ (_S_alloc_granularity-1);
-# endif
- }
- __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */
- /* The allocated size is */
- /* _S_rounded_up_size(size), except */
- /* in the GC case, in which it */
- /* doesn't matter. */
- typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type;
- _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, allocator_type __a)
- : _Rope_RopeRep<_CharT,_Alloc>(_S_leaf, 0, true, __size, __a),
- _M_data(__d)
- {
- __stl_assert(__size > 0);
- if (_S_is_basic_char_type((_CharT *)0)) {
- // already eos terminated.
- _M_c_string = __d;
- }
- }
- // The constructor assumes that d has been allocated with
- // the proper allocator and the properly padded size.
- // In contrast, the destructor deallocates the data:
-# ifndef __GC
- ~_Rope_RopeLeaf() {
- if (_M_data != _M_c_string) {
- _M_free_c_string();
- }
- __STL_FREE_STRING(_M_data, _M_size, get_allocator());
- }
-# endif
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> {
- public:
- _Rope_RopeRep<_CharT,_Alloc>* _M_left;
- _Rope_RopeRep<_CharT,_Alloc>* _M_right;
- typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type;
- _Rope_RopeConcatenation(_Rope_RopeRep<_CharT,_Alloc>* __l,
- _Rope_RopeRep<_CharT,_Alloc>* __r,
- allocator_type __a)
- : _Rope_RopeRep<_CharT,_Alloc>(
- _S_concat, max(__l->_M_depth, __r->_M_depth) + 1, false,
- __l->_M_size + __r->_M_size, __a),
- _M_left(__l), _M_right(__r)
- {}
-# ifndef __GC
- ~_Rope_RopeConcatenation() {
- _M_free_c_string();
- _M_left->_M_unref_nonnil();
- _M_right->_M_unref_nonnil();
- }
-# endif
-};
-
-template<class _CharT, class _Alloc>
-struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> {
- public:
- char_producer<_CharT>* _M_fn;
-# ifndef __GC
- bool _M_delete_when_done; // Char_producer is owned by the
- // rope and should be explicitly
- // deleted when the rope becomes
- // inaccessible.
-# else
- // In the GC case, we either register the rope for
- // finalization, or not. Thus the field is unnecessary;
- // the information is stored in the collector data structures.
- // We do need a finalization procedure to be invoked by the
- // collector.
- static void _S_fn_finalization_proc(void * __tree, void *) {
- delete ((_Rope_RopeFunction *)__tree) -> _M_fn;
- }
-# endif
- typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type;
- _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
- bool __d, allocator_type __a)
- :_Rope_RopeRep<_CharT,_Alloc>(_S_function, 0, true, __size, __a),
- _M_fn(__f)
-# ifndef __GC
- , _M_delete_when_done(__d)
-# endif
- {
- __stl_assert(__size > 0);
-# ifdef __GC
- if (__d) {
- GC_REGISTER_FINALIZER(
- this, _Rope_RopeFunction::_S_fn_finalization_proc, 0, 0, 0);
- }
-# endif
- }
-# ifndef __GC
- ~_Rope_RopeFunction() {
- _M_free_c_string();
- if (_M_delete_when_done) {
- delete _M_fn;
- }
- }
-# endif
-};
-// Substring results are usually represented using just
-// concatenation nodes. But in the case of very long flat ropes
-// or ropes with a functional representation that isn't practical.
-// In that case, we represent the __result as a special case of
-// RopeFunction, whose char_producer points back to the rope itself.
-// In all cases except repeated substring operations and
-// deallocation, we treat the __result as a RopeFunction.
-template<class _CharT, class _Alloc>
-struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>,
- public char_producer<_CharT> {
- public:
- // XXX this whole class should be rewritten.
- _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0
- size_t _M_start;
- virtual void operator()(size_t __start_pos, size_t __req_len,
- _CharT* __buffer) {
- switch(_M_base->_M_tag) {
- case _S_function:
- case _S_substringfn:
- {
- char_producer<_CharT>* __fn =
- ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
- __stl_assert(__start_pos + __req_len <= _M_size);
- __stl_assert(_M_start + _M_size <= _M_base->_M_size);
- (*__fn)(__start_pos + _M_start, __req_len, __buffer);
- }
- break;
- case _S_leaf:
- {
- __GC_CONST _CharT* __s =
- ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
- uninitialized_copy_n(__s + __start_pos + _M_start, __req_len,
- __buffer);
- }
- break;
- default:
- __stl_assert(false);
- }
- }
- typedef _Rope_rep_base<_CharT,_Alloc>::allocator_type allocator_type;
- _Rope_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
- size_t __l, allocator_type __a)
- : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a), _M_base(__b)
- , _M_start(__s)
- {
- __stl_assert(__l > 0);
- __stl_assert(__s + __l <= __b->_M_size);
-# ifndef __GC
- _M_base->_M_ref_nonnil();
-# endif
- _M_tag = _S_substringfn;
- }
- virtual ~_Rope_RopeSubstring()
- {
-# ifndef __GC
- _M_base->_M_unref_nonnil();
- // _M_free_c_string(); -- done by parent class
-# endif
- }
-};
-
-
-// Self-destructing pointers to Rope_rep.
-// These are not conventional smart pointers. Their
-// only purpose in life is to ensure that unref is called
-// on the pointer either at normal exit or if an exception
-// is raised. It is the caller's responsibility to
-// adjust reference counts when these pointers are initialized
-// or assigned to. (This convention significantly reduces
-// the number of potentially expensive reference count
-// updates.)
-#ifndef __GC
- template<class _CharT, class _Alloc>
- struct _Rope_self_destruct_ptr {
- _Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
- ~_Rope_self_destruct_ptr()
- { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
-# ifdef __STL_USE_EXCEPTIONS
- _Rope_self_destruct_ptr() : _M_ptr(0) {};
-# else
- _Rope_self_destruct_ptr() {};
-# endif
- _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {}
- _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; }
- _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; }
- operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; }
- _Rope_self_destruct_ptr& operator= (_Rope_RopeRep<_CharT,_Alloc>* __x)
- { _M_ptr = __x; return *this; }
- };
-#endif
-
-// Dereferencing a nonconst iterator has to return something
-// that behaves almost like a reference. It's not possible to
-// return an actual reference since assignment requires extra
-// work. And we would get into the same problems as with the
-// CD2 version of basic_string.
-template<class _CharT, class _Alloc>
-class _Rope_char_ref_proxy {
- friend class rope<_CharT,_Alloc>;
- friend class _Rope_iterator<_CharT,_Alloc>;
- friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
-# ifdef __GC
- typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr;
-# else
- typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
-# endif
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- typedef rope<_CharT,_Alloc> _My_rope;
- size_t _M_pos;
- _CharT _M_current;
- bool _M_current_valid;
- _My_rope* _M_root; // The whole rope.
- public:
- _Rope_char_ref_proxy(_My_rope* __r, size_t __p) :
- _M_pos(__p), _M_current_valid(false), _M_root(__r) {}
- _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x) :
- _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {}
- // Don't preserve cache if the reference can outlive the
- // expression. We claim that's not possible without calling
- // a copy constructor or generating reference to a proxy
- // reference. We declare the latter to have undefined semantics.
- _Rope_char_ref_proxy(_My_rope* __r, size_t __p,
- _CharT __c) :
- _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
- inline operator _CharT () const;
- _Rope_char_ref_proxy& operator= (_CharT __c);
- _Rope_char_ptr_proxy<_CharT,_Alloc> operator& () const;
- _Rope_char_ref_proxy& operator= (const _Rope_char_ref_proxy& __c) {
- return operator=((_CharT)__c);
- }
-};
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
- template<class _CharT, class __Alloc>
- inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
- _Rope_char_ref_proxy <_CharT, __Alloc > __b) {
- _CharT __tmp = __a;
- __a = __b;
- __b = __tmp;
- }
-#else
-// There is no really acceptable way to handle this. The default
-// definition of swap doesn't work for proxy references.
-// It can't really be made to work, even with ugly hacks, since
-// the only unusual operation it uses is the copy constructor, which
-// is needed for other purposes. We provide a macro for
-// full specializations, and instantiate the most common case.
-# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \
- inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \
- _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \
- _CharT __tmp = __a; \
- __a = __b; \
- __b = __tmp; \
- }
-
-_ROPE_SWAP_SPECIALIZATION(char,__STL_DEFAULT_ALLOCATOR(char))
-
-#endif /* !__STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-template<class _CharT, class _Alloc>
-class _Rope_char_ptr_proxy {
- // XXX this class should be rewritten.
- friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
- size_t _M_pos;
- rope<_CharT,_Alloc>* _M_root; // The whole rope.
- public:
- _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
- _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
- _Rope_char_ptr_proxy() {}
- _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) {
- __stl_assert(0 == __x);
- }
- _Rope_char_ptr_proxy&
- operator= (const _Rope_char_ptr_proxy& __x) {
- _M_pos = __x._M_pos;
- _M_root = __x._M_root;
- return *this;
- }
- friend bool operator== __STL_NULL_TMPL_ARGS
- (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y);
-
- _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos);
- }
-};
-
-
-// Rope iterators:
-// Unlike in the C version, we cache only part of the stack
-// for rope iterators, since they must be efficiently copyable.
-// When we run out of cache, we have to reconstruct the iterator
-// value.
-// Pointers from iterators are not included in reference counts.
-// Iterators are assumed to be thread private. Ropes can
-// be shared.
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1375
-#endif
-
-template<class _CharT, class _Alloc>
-class _Rope_iterator_base
- : public random_access_iterator<_CharT, ptrdiff_t> {
- friend class rope<_CharT,_Alloc>;
- public:
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- // Borland doesnt want this to be protected.
- protected:
- enum { _S_path_cache_len = 4 }; // Must be <= 9.
- enum { _S_iterator_buf_len = 15 };
- size_t _M_current_pos;
- _RopeRep* _M_root; // The whole rope.
- size_t _M_leaf_pos; // Starting position for current leaf
- __GC_CONST _CharT* _M_buf_start;
- // Buffer possibly
- // containing current char.
- __GC_CONST _CharT* _M_buf_ptr;
- // Pointer to current char in buffer.
- // != 0 ==> buffer valid.
- __GC_CONST _CharT* _M_buf_end;
- // One past __last valid char in buffer.
- // What follows is the path cache. We go out of our
- // way to make this compact.
- // Path_end contains the bottom section of the path from
- // the root to the current leaf.
- const _RopeRep* _M_path_end[_S_path_cache_len];
- int _M_leaf_index; // Last valid __pos in path_end;
- // _M_path_end[0] ... _M_path_end[leaf_index-1]
- // point to concatenation nodes.
- unsigned char _M_path_directions;
- // (path_directions >> __i) & 1 is 1
- // iff we got from _M_path_end[leaf_index - __i - 1]
- // to _M_path_end[leaf_index - __i] by going to the
- // __right. Assumes path_cache_len <= 9.
- _CharT _M_tmp_buf[_S_iterator_buf_len];
- // Short buffer for surrounding chars.
- // This is useful primarily for
- // RopeFunctions. We put the buffer
- // here to avoid locking in the
- // multithreaded case.
- // The cached path is generally assumed to be valid
- // only if the buffer is valid.
- static void _S_setbuf(_Rope_iterator_base& __x);
- // Set buffer contents given
- // path cache.
- static void _S_setcache(_Rope_iterator_base& __x);
- // Set buffer contents and
- // path cache.
- static void _S_setcache_for_incr(_Rope_iterator_base& __x);
- // As above, but assumes path
- // cache is valid for previous posn.
- _Rope_iterator_base() {}
- _Rope_iterator_base(_RopeRep* __root, size_t __pos)
- : _M_root(__root), _M_current_pos(__pos), _M_buf_ptr(0) {}
- void _M_incr(size_t __n);
- void _M_decr(size_t __n);
- public:
- size_t index() const { return _M_current_pos; }
- _Rope_iterator_base(const _Rope_iterator_base& __x) {
- if (0 != __x._M_buf_ptr) {
- *this = __x;
- } else {
- _M_current_pos = __x._M_current_pos;
- _M_root = __x._M_root;
- _M_buf_ptr = 0;
- }
- }
-};
-
-template<class _CharT, class _Alloc> class _Rope_iterator;
-
-template<class _CharT, class _Alloc>
-class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
- friend class rope<_CharT,_Alloc>;
- protected:
- _Rope_const_iterator(const _RopeRep* __root, size_t __pos):
- _Rope_iterator_base<_CharT,_Alloc>(
- const_cast<_RopeRep*>(__root), __pos)
- // Only nonconst iterators modify root ref count
- {}
- public:
- typedef _CharT reference; // Really a value. Returning a reference
- // Would be a mess, since it would have
- // to be included in refcount.
- typedef const _CharT* pointer;
-
- public:
- _Rope_const_iterator() {};
- _Rope_const_iterator(const _Rope_const_iterator& __x) :
- _Rope_iterator_base<_CharT,_Alloc>(__x) { }
- _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x);
- _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) :
- _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) {}
- _Rope_const_iterator& operator= (const _Rope_const_iterator& __x) {
- if (0 != __x._M_buf_ptr) {
- *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x;
- } else {
- _M_current_pos = __x._M_current_pos;
- _M_root = __x._M_root;
- _M_buf_ptr = 0;
- }
- return(*this);
- }
- reference operator*() {
- if (0 == _M_buf_ptr) _S_setcache(*this);
- return *_M_buf_ptr;
- }
- _Rope_const_iterator& operator++() {
- __GC_CONST _CharT* __next;
- if (0 != _M_buf_ptr && (__next = _M_buf_ptr + 1) < _M_buf_end) {
- _M_buf_ptr = __next;
- ++_M_current_pos;
- } else {
- _M_incr(1);
- }
- return *this;
- }
- _Rope_const_iterator& operator+=(ptrdiff_t __n) {
- if (__n >= 0) {
- _M_incr(__n);
- } else {
- _M_decr(-__n);
- }
- return *this;
- }
- _Rope_const_iterator& operator--() {
- _M_decr(1);
- return *this;
- }
- _Rope_const_iterator& operator-=(ptrdiff_t __n) {
- if (__n >= 0) {
- _M_decr(__n);
- } else {
- _M_incr(-__n);
- }
- return *this;
- }
- _Rope_const_iterator operator++(int) {
- size_t __old_pos = _M_current_pos;
- _M_incr(1);
- return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos);
- // This makes a subsequent dereference expensive.
- // Perhaps we should instead copy the iterator
- // if it has a valid cache?
- }
- _Rope_const_iterator operator--(int) {
- size_t __old_pos = _M_current_pos;
- _M_decr(1);
- return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos);
- }
- friend _Rope_const_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (ptrdiff_t __n,
- const _Rope_const_iterator<_CharT,_Alloc>& __x);
- reference operator[](size_t __n) {
- return rope<_CharT,_Alloc>::_S_fetch(_M_root, _M_current_pos + __n);
- }
- friend bool operator== __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
- friend bool operator< __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
- friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS
- (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y);
-};
-
-template<class _CharT, class _Alloc>
-class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
- friend class rope<_CharT,_Alloc>;
- protected:
- rope<_CharT,_Alloc>* _M_root_rope;
- // root is treated as a cached version of this,
- // and is used to detect changes to the underlying
- // rope.
- // Root is included in the reference count.
- // This is necessary so that we can detect changes reliably.
- // Unfortunately, it requires careful bookkeeping for the
- // nonGC case.
- _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos)
- : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr, __pos),
- _M_root_rope(__r)
- { _RopeRep::_S_ref(_M_root); }
-
- void _M_check();
- public:
- typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
- typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer;
-
- public:
- rope<_CharT,_Alloc>& container() { return *_M_root_rope; }
- _Rope_iterator() {
- _M_root = 0; // Needed for reference counting.
- };
- _Rope_iterator(const _Rope_iterator& __x) :
- _Rope_iterator_base<_CharT,_Alloc>(__x) {
- _M_root_rope = __x._M_root_rope;
- _RopeRep::_S_ref(_M_root);
- }
- _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos);
- ~_Rope_iterator() {
- _RopeRep::_S_unref(_M_root);
- }
- _Rope_iterator& operator= (const _Rope_iterator& __x) {
- _RopeRep* __old = _M_root;
-
- _RopeRep::_S_ref(__x._M_root);
- if (0 != __x._M_buf_ptr) {
- _M_root_rope = __x._M_root_rope;
- *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x;
- } else {
- _M_current_pos = __x._M_current_pos;
- _M_root = __x._M_root;
- _M_root_rope = __x._M_root_rope;
- _M_buf_ptr = 0;
- }
- _RopeRep::_S_unref(__old);
- return(*this);
- }
- reference operator*() {
- _M_check();
- if (0 == _M_buf_ptr) {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(
- _M_root_rope, _M_current_pos);
- } else {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(
- _M_root_rope, _M_current_pos, *_M_buf_ptr);
- }
- }
- _Rope_iterator& operator++() {
- _M_incr(1);
- return *this;
- }
- _Rope_iterator& operator+=(difference_type __n) {
- if (__n >= 0) {
- _M_incr(__n);
- } else {
- _M_decr(-__n);
- }
- return *this;
- }
- _Rope_iterator& operator--() {
- _M_decr(1);
- return *this;
- }
- _Rope_iterator& operator-=(difference_type __n) {
- if (__n >= 0) {
- _M_decr(__n);
- } else {
- _M_incr(-__n);
- }
- return *this;
- }
- _Rope_iterator operator++(int) {
- size_t __old_pos = _M_current_pos;
- _M_incr(1);
- return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
- }
- _Rope_iterator operator--(int) {
- size_t __old_pos = _M_current_pos;
- _M_decr(1);
- return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
- }
- reference operator[](ptrdiff_t __n) {
- return _Rope_char_ref_proxy<_CharT,_Alloc>(
- _M_root_rope, _M_current_pos + __n);
- }
- friend bool operator== __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
- friend bool operator< __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
- friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y);
- friend _Rope_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n);
- friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS
- (ptrdiff_t __n,
- const _Rope_iterator<_CharT,_Alloc>& __x);
-
-};
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1375
-#endif
-
-// The rope base class encapsulates
-// the differences between SGI-style allocators and standard-conforming
-// allocators.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-// Base class for ordinary allocators.
-template <class _CharT, class _Allocator, bool _IsStatic>
-class _Rope_alloc_base {
-public:
- typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep;
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _M_data_allocator; }
- _Rope_alloc_base(_RopeRep *__t, const allocator_type& __a)
- : _M_tree_ptr(__t), _M_data_allocator(__a) {}
- _Rope_alloc_base(const allocator_type& __a)
- : _M_data_allocator(__a) {}
-
-protected:
- // The only data members of a rope:
- allocator_type _M_data_allocator;
- _RopeRep* _M_tree_ptr;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- _Tp* __name##_allocate(size_t __n) const \
- { return __name##Allocator(_M_data_allocator).allocate(__n); } \
- void __name##_deallocate(_Tp *__p, size_t __n) const \
- { __name##Allocator(_M_data_allocator).deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator)
-# undef __ROPE_DEFINE_ALLOC
-};
-
-// Specialization for allocators that have the property that we don't
-// actually have to store an allocator object.
-template <class _CharT, class _Allocator>
-class _Rope_alloc_base<_CharT,_Allocator,true> {
-public:
- typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep;
- typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
- _Rope_alloc_base(_RopeRep *__t, const allocator_type&)
- : _M_tree_ptr(__t) {}
- _Rope_alloc_base(const allocator_type&) {}
-
-protected:
- // The only data member of a rope:
- _RopeRep *_M_tree_ptr;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \
- typedef typename \
- _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- static void __name##_deallocate(_Tp *__p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Allocator)
-# undef __ROPE_DEFINE_ALLOC
-};
-
-template <class _CharT, class _Alloc>
-struct _Rope_base
- : public _Rope_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
-{
- typedef _Rope_alloc_base<_CharT,_Alloc,
- _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
- _Rope_base(_RopeRep* __t, const allocator_type& __a) : _Base(__t, __a) {}
- _Rope_base(const allocator_type& __a) : _Base(__a) {}
-};
-
-#else /* !__STL_USE_STD_ALLOCATORS */
-
-template <class _CharT, class _Alloc>
-class _Rope_base {
-public:
- typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
- typedef _Alloc allocator_type;
- static allocator_type get_allocator() { return allocator_type(); }
- _Rope_base(_RopeRep * __t, const allocator_type&) : _M_tree_ptr(__t) {}
- _Rope_base(const allocator_type&) {}
-
-protected:
- // The only data member of a rope:
- _RopeRep* _M_tree_ptr;
-
-# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
- typedef simple_alloc<_Tp, _Alloc> __name##Alloc; \
- static _Tp* __name##_allocate(size_t __n) \
- { return __name##Alloc::allocate(__n); } \
- static void __name##_deallocate(_Tp *__p, size_t __n) \
- { __name##Alloc::deallocate(__p, __n); }
- __ROPE_DEFINE_ALLOCS(_Alloc)
-# undef __ROPE_DEFINE_ALLOC
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-
-template <class _CharT, class _Alloc>
-class rope : public _Rope_base<_CharT,_Alloc> {
- public:
- typedef _CharT value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
- typedef _CharT const_reference;
- typedef const _CharT* const_pointer;
- typedef _Rope_iterator<_CharT,_Alloc> iterator;
- typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator;
- typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference;
- typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer;
-
- friend class _Rope_iterator<_CharT,_Alloc>;
- friend class _Rope_const_iterator<_CharT,_Alloc>;
- friend struct _Rope_RopeRep<_CharT,_Alloc>;
- friend class _Rope_iterator_base<_CharT,_Alloc>;
- friend class _Rope_char_ptr_proxy<_CharT,_Alloc>;
- friend class _Rope_char_ref_proxy<_CharT,_Alloc>;
- friend struct _Rope_RopeSubstring<_CharT,_Alloc>;
-
- protected:
- typedef _Rope_base<_CharT,_Alloc> _Base;
- typedef typename _Base::allocator_type allocator_type;
-# ifdef __STL_USE_NAMESPACES
- using _Base::_M_tree_ptr;
-# endif
- typedef __GC_CONST _CharT* _Cstrptr;
-# ifdef __STL_SGI_THREADS
- static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) {
-# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64))
- return (_Cstrptr) test_and_set((unsigned long*)__p,
- (unsigned long)__q);
-# else
- return (_Cstrptr) __test_and_set((unsigned long*)__p,
- (unsigned long)__q);
-# endif
- }
-# elif defined(__STL_WIN32THREADS)
- static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) {
- return (_Cstrptr) InterlockedExchange(
- (LPLONG)__p, (LONG)__q);
- }
-# elif defined(__STL_PTHREADS)
- // This should be portable, but performance is expected
- // to be quite awful. This really needs platform specific
- // code.
- static pthread_mutex_t _S_swap_lock;
- static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) {
- pthread_mutex_lock(&_S_swap_lock);
- _Cstrptr __result = *__p;
- *__p = __q;
- pthread_mutex_unlock(&_S_swap_lock);
- return __result;
- }
-# else
- static _Cstrptr _S_atomic_swap(_Cstrptr* __p, _Cstrptr __q) {
- _Cstrptr __result = *__p;
- *__p = __q;
- return __result;
- }
-# endif
-
- static _CharT _S_empty_c_str[1];
-
- static bool _S_is0(_CharT __c) { return __c == _S_eos((_CharT*)0); }
- enum { _S_copy_max = 23 };
- // For strings shorter than _S_copy_max, we copy to
- // concatenate.
-
- typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep;
- typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
- typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
- typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
- typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring;
-
- // Retrieve a character at the indicated position.
- static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
-
-# ifndef __GC
- // Obtain a pointer to the character at the indicated position.
- // The pointer can be used to change the character.
- // If such a pointer cannot be produced, as is frequently the
- // case, 0 is returned instead.
- // (Returns nonzero only if all nodes in the path have a refcount
- // of 1.)
- static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
-# endif
-
- static bool _S_apply_to_pieces(
- // should be template parameter
- _Rope_char_consumer<_CharT>& __c,
- const _RopeRep* __r,
- size_t __begin, size_t __end);
- // begin and end are assumed to be in range.
-
-# ifndef __GC
- static void _S_unref(_RopeRep* __t)
- {
- _RopeRep::_S_unref(__t);
- }
- static void _S_ref(_RopeRep* __t)
- {
- _RopeRep::_S_ref(__t);
- }
-# else /* __GC */
- static void _S_unref(_RopeRep*) {}
- static void _S_ref(_RopeRep*) {}
-# endif
-
-
-# ifdef __GC
- typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr;
-# else
- typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr;
-# endif
-
- // _Result is counted in refcount.
- static _RopeRep* _S_substring(_RopeRep* __base,
- size_t __start, size_t __endp1);
-
- static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
- const _CharT* __iter, size_t __slen);
- // Concatenate rope and char ptr, copying __s.
- // Should really take an arbitrary iterator.
- // Result is counted in refcount.
- static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
- const _CharT* __iter, size_t __slen)
- // As above, but one reference to __r is about to be
- // destroyed. Thus the pieces may be recycled if all
- // relevent reference counts are 1.
-# ifdef __GC
- // We can't really do anything since refcounts are unavailable.
- { return _S_concat_char_iter(__r, __iter, __slen); }
-# else
- ;
-# endif
-
- static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right);
- // General concatenation on _RopeRep. _Result
- // has refcount of 1. Adjusts argument refcounts.
-
- public:
- void apply_to_pieces( size_t __begin, size_t __end,
- _Rope_char_consumer<_CharT>& __c) const {
- _S_apply_to_pieces(__c, _M_tree_ptr, __begin, __end);
- }
-
-
- protected:
-
- static size_t _S_rounded_up_size(size_t __n) {
- return _RopeLeaf::_S_rounded_up_size(__n);
- }
-
- static size_t _S_allocated_capacity(size_t __n) {
- if (_S_is_basic_char_type((_CharT*)0)) {
- return _S_rounded_up_size(__n) - 1;
- } else {
- return _S_rounded_up_size(__n);
- }
- }
-
- // Allocate and construct a RopeLeaf using the supplied allocator
- // Takes ownership of s instead of copying.
- static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s,
- size_t __size, allocator_type __a)
- {
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeLeaf* __space = _LAllocator(__a).allocate(1);
-# else
- _RopeLeaf* __space = _L_allocate(1);
-# endif
- return new(__space) _RopeLeaf(__s, __size, __a);
- }
-
- static _RopeConcatenation* _S_new_RopeConcatenation(
- _RopeRep* __left, _RopeRep* __right,
- allocator_type __a)
- {
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeConcatenation* __space = _CAllocator(__a).allocate(1);
-# else
- _RopeConcatenation* __space = _C_allocate(1);
-# endif
- return new(__space) _RopeConcatenation(__left, __right, __a);
- }
-
- static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f,
- size_t __size, bool __d, allocator_type __a)
- {
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeFunction* __space = _FAllocator(__a).allocate(1);
-# else
- _RopeFunction* __space = _F_allocate(1);
-# endif
- return new(__space) _RopeFunction(__f, __size, __d, __a);
- }
-
- static _RopeSubstring* _S_new_RopeSubstring(
- _Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
- size_t __l, allocator_type __a)
- {
-# ifdef __STL_USE_STD_ALLOCATORS
- _RopeSubstring* __space = _SAllocator(__a).allocate(1);
-# else
- _RopeSubstring* __space = _S_allocate(1);
-# endif
- return new(__space) _RopeSubstring(__b, __s, __l, __a);
- }
-
-# ifdef __STL_USE_STD_ALLOCATORS
- static
- _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
- size_t __size, allocator_type __a)
-# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
- _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
-# else
- static
- _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr2(const _CharT* __s,
- size_t __size)
-# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
- _S_RopeLeaf_from_unowned_char_ptr2(__s, __size)
-# endif
- {
- if (0 == __size) return 0;
-# ifdef __STL_USE_STD_ALLOCATORS
- _CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
-# else
- _CharT* __buf = _Data_allocate(_S_rounded_up_size(__size));
- allocator_type __a = allocator_type();
-# endif
-
- uninitialized_copy_n(__s, __size, __buf);
- _S_cond_store_eos(__buf[__size]);
- __STL_TRY {
- return _S_new_RopeLeaf(__buf, __size, __a);
- }
- __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, __size, __a))
- }
-
-
- // Concatenation of nonempty strings.
- // Always builds a concatenation node.
- // Rebalances if the result is too deep.
- // Result has refcount 1.
- // Does not increment left and right ref counts even though
- // they are referenced.
- static _RopeRep*
- _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
-
- // Concatenation helper functions
- static _RopeLeaf*
- _S_leaf_concat_char_iter(_RopeLeaf* __r,
- const _CharT* __iter, size_t __slen);
- // Concatenate by copying leaf.
- // should take an arbitrary iterator
- // result has refcount 1.
-# ifndef __GC
- static _RopeLeaf* _S_destr_leaf_concat_char_iter
- (_RopeLeaf* __r, const _CharT* __iter, size_t __slen);
- // A version that potentially clobbers __r if __r->_M_refcount == 1.
-# endif
-
- // A helper function for exponentiating strings.
- // This uses a nonstandard refcount convention.
- // The result has refcount 0.
- struct _Concat_fn
- : public binary_function<rope<_CharT,_Alloc>,
- rope<_CharT,_Alloc>,
- rope<_CharT,_Alloc> > {
- rope operator() (const rope& __x, const rope& __y) {
- return __x + __y;
- }
- };
-
- // Needed by the call to "power" used to build ropes
- // consisting of n copies of a character.
- friend rope identity_element(_Concat_fn)
- { return rope<_CharT,_Alloc>(); }
-
- static size_t _S_char_ptr_len(const _CharT* __s);
- // slightly generalized strlen
-
- rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
- : _Base(__t,__a) { }
-
-
- // Copy __r to the _CharT buffer.
- // Returns __buffer + __r->_M_size.
- // Assumes that buffer is uninitialized.
- static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
-
- // Again, with explicit starting position and length.
- // Assumes that buffer is uninitialized.
- static _CharT* _S_flatten(_RopeRep* __r,
- size_t __start, size_t __len,
- _CharT* __buffer);
-
- static const unsigned long
- _S_min_len[_RopeRep::_S_max_rope_depth + 1];
-
- static bool _S_is_balanced(_RopeRep* __r)
- { return (__r->_M_size >= _S_min_len[__r->_M_depth]); }
-
- static bool _S_is_almost_balanced(_RopeRep* __r)
- { return (__r->_M_depth == 0 ||
- __r->_M_size >= _S_min_len[__r->_M_depth - 1]); }
-
- static bool _S_is_roughly_balanced(_RopeRep* __r)
- { return (__r->_M_depth <= 1 ||
- __r->_M_size >= _S_min_len[__r->_M_depth - 2]); }
-
- // Assumes the result is not empty.
- static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left,
- _RopeRep* __right)
- {
- _RopeRep* __result = _S_concat(__left, __right);
- if (_S_is_balanced(__result)) __result->_M_is_balanced = true;
- return __result;
- }
-
- // The basic rebalancing operation. Logically copies the
- // rope. The result has refcount of 1. The client will
- // usually decrement the reference count of __r.
- // The result is within height 2 of balanced by the above
- // definition.
- static _RopeRep* _S_balance(_RopeRep* __r);
-
- // Add all unbalanced subtrees to the forest of balanceed trees.
- // Used only by balance.
- static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
-
- // Add __r to forest, assuming __r is already balanced.
- static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
-
- // Print to stdout, exposing structure
- static void _S_dump(_RopeRep* __r, int __indent = 0);
-
- // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.
- static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);
-
- public:
- bool empty() const { return 0 == _M_tree_ptr; }
-
- // Comparison member function. This is public only for those
- // clients that need a ternary comparison. Others
- // should use the comparison operators below.
- int compare(const rope& __y) const {
- return _S_compare(_M_tree_ptr, __y._M_tree_ptr);
- }
-
- rope(const _CharT* __s, const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
- __a),__a)
- { }
-
- rope(const _CharT* __s, size_t __len,
- const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, __a), __a)
- { }
-
- // Should perhaps be templatized with respect to the iterator type
- // and use Sequence_buffer. (It should perhaps use sequence_buffer
- // even now.)
- rope(const _CharT *__s, const _CharT *__e,
- const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, __a), __a)
- { }
-
- rope(const const_iterator& __s, const const_iterator& __e,
- const allocator_type& __a = allocator_type())
- : _Base(_S_substring(__s._M_root, __s._M_current_pos,
- __e._M_current_pos), __a)
- { }
-
- rope(const iterator& __s, const iterator& __e,
- const allocator_type& __a = allocator_type())
- : _Base(_S_substring(__s._M_root, __s._M_current_pos,
- __e._M_current_pos), __a)
- { }
-
- rope(_CharT __c, const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- _CharT* __buf = _Data_allocate(_S_rounded_up_size(1));
-
- construct(__buf, __c);
- __STL_TRY {
- _M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a);
- }
- __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, 1, __a))
- }
-
- rope(size_t __n, _CharT __c,
- const allocator_type& __a = allocator_type());
-
- rope(const allocator_type& __a = allocator_type())
- : _Base(0, __a) {}
-
- // Construct a rope from a function that can compute its members
- rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
- const allocator_type& __a = allocator_type())
- : _Base(__a)
- {
- _M_tree_ptr = (0 == __len) ?
- 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
- }
-
- rope(const rope& __x, const allocator_type& __a = allocator_type())
- : _Base(__x._M_tree_ptr, __a)
- {
- _S_ref(_M_tree_ptr);
- }
-
- ~rope()
- {
- _S_unref(_M_tree_ptr);
- }
-
- rope& operator=(const rope& __x)
- {
- _RopeRep* __old = _M_tree_ptr;
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __x.get_allocator());
-# endif
- _M_tree_ptr = __x._M_tree_ptr;
- _S_ref(_M_tree_ptr);
- _S_unref(__old);
- return(*this);
- }
-
- void push_back(_CharT __x)
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr = _S_concat_char_iter(_M_tree_ptr, &__x, 1);
- _S_unref(__old);
- }
-
- void pop_back()
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr =
- _S_substring(_M_tree_ptr, 0, _M_tree_ptr->_M_size - 1);
- _S_unref(__old);
- }
-
- _CharT back() const
- {
- return _S_fetch(_M_tree_ptr, _M_tree_ptr->_M_size - 1);
- }
-
- void push_front(_CharT __x)
- {
- _RopeRep* __old = _M_tree_ptr;
- _RopeRep* __left =
- __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator());
- __STL_TRY {
- _M_tree_ptr = _S_concat(__left, _M_tree_ptr);
- _S_unref(__old);
- _S_unref(__left);
- }
- __STL_UNWIND(_S_unref(__left))
- }
-
- void pop_front()
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr = _S_substring(_M_tree_ptr, 1, _M_tree_ptr->_M_size);
- _S_unref(__old);
- }
-
- _CharT front() const
- {
- return _S_fetch(_M_tree_ptr, 0);
- }
-
- void balance()
- {
- _RopeRep* __old = _M_tree_ptr;
- _M_tree_ptr = _S_balance(_M_tree_ptr);
- _S_unref(__old);
- }
-
- void copy(_CharT* __buffer) const {
- destroy(__buffer, __buffer + size());
- _S_flatten(_M_tree_ptr, __buffer);
- }
-
- // This is the copy function from the standard, but
- // with the arguments reordered to make it consistent with the
- // rest of the interface.
- // Note that this guaranteed not to compile if the draft standard
- // order is assumed.
- size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const
- {
- size_t __size = size();
- size_t __len = (__pos + __n > __size? __size - __pos : __n);
-
- destroy(__buffer, __buffer + __len);
- _S_flatten(_M_tree_ptr, __pos, __len, __buffer);
- return __len;
- }
-
- // Print to stdout, exposing structure. May be useful for
- // performance debugging.
- void dump() {
- _S_dump(_M_tree_ptr);
- }
-
- // Convert to 0 terminated string in new allocated memory.
- // Embedded 0s in the input do not terminate the copy.
- const _CharT* c_str() const;
-
- // As above, but lso use the flattened representation as the
- // the new rope representation.
- const _CharT* replace_with_c_str();
-
- // Reclaim memory for the c_str generated flattened string.
- // Intentionally undocumented, since it's hard to say when this
- // is safe for multiple threads.
- void delete_c_str () {
- if (0 == _M_tree_ptr) return;
- if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag &&
- ((_RopeLeaf*)_M_tree_ptr)->_M_data ==
- _M_tree_ptr->_M_c_string) {
- // Representation shared
- return;
- }
-# ifndef __GC
- _M_tree_ptr->_M_free_c_string();
-# endif
- _M_tree_ptr->_M_c_string = 0;
- }
-
- _CharT operator[] (size_type __pos) const {
- return _S_fetch(_M_tree_ptr, __pos);
- }
-
- _CharT at(size_type __pos) const {
- // if (__pos >= size()) throw out_of_range; // XXX
- return (*this)[__pos];
- }
-
- const_iterator begin() const {
- return(const_iterator(_M_tree_ptr, 0));
- }
-
- // An easy way to get a const iterator from a non-const container.
- const_iterator const_begin() const {
- return(const_iterator(_M_tree_ptr, 0));
- }
-
- const_iterator end() const {
- return(const_iterator(_M_tree_ptr, size()));
- }
-
- const_iterator const_end() const {
- return(const_iterator(_M_tree_ptr, size()));
- }
-
- size_type size() const {
- return(0 == _M_tree_ptr? 0 : _M_tree_ptr->_M_size);
- }
-
- size_type length() const {
- return size();
- }
-
- size_type max_size() const {
- return _S_min_len[_RopeRep::_S_max_rope_depth-1] - 1;
- // Guarantees that the result can be sufficirntly
- // balanced. Longer ropes will probably still work,
- // but it's harder to make guarantees.
- }
-
-# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
-# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_iterator<const_iterator, value_type, const_reference,
- difference_type> const_reverse_iterator;
-# endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
-
- const_reverse_iterator const_rbegin() const {
- return const_reverse_iterator(end());
- }
-
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
-
- const_reverse_iterator const_rend() const {
- return const_reverse_iterator(begin());
- }
-
- friend rope<_CharT,_Alloc>
- operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right);
-
- friend rope<_CharT,_Alloc>
- operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
- const _CharT* __right);
-
- friend rope<_CharT,_Alloc>
- operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left,
- _CharT __right);
-
- // The symmetric cases are intentionally omitted, since they're presumed
- // to be less common, and we don't handle them as well.
-
- // The following should really be templatized.
- // The first argument should be an input iterator or
- // forward iterator with value_type _CharT.
- rope& append(const _CharT* __iter, size_t __n) {
- _RopeRep* __result =
- _S_destr_concat_char_iter(_M_tree_ptr, __iter, __n);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(const _CharT* __c_string) {
- size_t __len = _S_char_ptr_len(__c_string);
- append(__c_string, __len);
- return(*this);
- }
-
- rope& append(const _CharT* __s, const _CharT* __e) {
- _RopeRep* __result =
- _S_destr_concat_char_iter(_M_tree_ptr, __s, __e - __s);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(const_iterator __s, const_iterator __e) {
- __stl_assert(__s._M_root == __e._M_root);
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __s._M_root->get_allocator());
-# endif
- _Self_destruct_ptr __appendee(_S_substring(
- __s._M_root, __s._M_current_pos, __e._M_current_pos));
- _RopeRep* __result =
- _S_concat(_M_tree_ptr, (_RopeRep*)__appendee);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(_CharT __c) {
- _RopeRep* __result =
- _S_destr_concat_char_iter(_M_tree_ptr, &__c, 1);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append() { return append(_CharT()); } // XXX why?
-
- rope& append(const rope& __y) {
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(__y.get_allocator() == get_allocator());
-# endif
- _RopeRep* __result = _S_concat(_M_tree_ptr, __y._M_tree_ptr);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- return *this;
- }
-
- rope& append(size_t __n, _CharT __c) {
- rope<_CharT,_Alloc> __last(__n, __c);
- return append(__last);
- }
-
- void swap(rope& __b) {
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __b.get_allocator());
-# endif
- _RopeRep* __tmp = _M_tree_ptr;
- _M_tree_ptr = __b._M_tree_ptr;
- __b._M_tree_ptr = __tmp;
- }
-
-
- protected:
- // Result is included in refcount.
- static _RopeRep* replace(_RopeRep* __old, size_t __pos1,
- size_t __pos2, _RopeRep* __r) {
- if (0 == __old) { _S_ref(__r); return __r; }
- _Self_destruct_ptr __left(
- _S_substring(__old, 0, __pos1));
- _Self_destruct_ptr __right(
- _S_substring(__old, __pos2, __old->_M_size));
- _RopeRep* __result;
-
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(__old->get_allocator() == __r->get_allocator());
-# endif
- if (0 == __r) {
- __result = _S_concat(__left, __right);
- } else {
- _Self_destruct_ptr __left_result(_S_concat(__left, __r));
- __result = _S_concat(__left_result, __right);
- }
- return __result;
- }
-
- public:
- void insert(size_t __p, const rope& __r) {
- _RopeRep* __result =
- replace(_M_tree_ptr, __p, __p, __r._M_tree_ptr);
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(get_allocator() == __r.get_allocator());
-# endif
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- void insert(size_t __p, size_t __n, _CharT __c) {
- rope<_CharT,_Alloc> __r(__n,__c);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const _CharT* __i, size_t __n) {
- _Self_destruct_ptr __left(_S_substring(_M_tree_ptr, 0, __p));
- _Self_destruct_ptr __right(_S_substring(_M_tree_ptr, __p, size()));
- _Self_destruct_ptr __left_result(
- _S_concat_char_iter(__left, __i, __n));
- _RopeRep* __result = _S_concat(__left_result, __right);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- void insert(size_t __p, const _CharT* __c_string) {
- insert(__p, __c_string, _S_char_ptr_len(__c_string));
- }
-
- void insert(size_t __p, _CharT __c) {
- insert(__p, &__c, 1);
- }
-
- void insert(size_t __p) {
- _CharT __c = _CharT();
- insert(__p, &__c, 1);
- }
-
- void insert(size_t __p, const _CharT* __i, const _CharT* __j) {
- rope __r(__i, __j);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const const_iterator& __i,
- const const_iterator& __j) {
- rope __r(__i, __j);
- insert(__p, __r);
- }
-
- void insert(size_t __p, const iterator& __i,
- const iterator& __j) {
- rope __r(__i, __j);
- insert(__p, __r);
- }
-
- // (position, length) versions of replace operations:
-
- void replace(size_t __p, size_t __n, const rope& __r) {
- _RopeRep* __result =
- replace(_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- void replace(size_t __p, size_t __n,
- const _CharT* __i, size_t __i_len) {
- rope __r(__i, __i_len);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n, _CharT __c) {
- rope __r(__c);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n, const _CharT* __c_string) {
- rope __r(__c_string);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const _CharT* __i, const _CharT* __j) {
- rope __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const const_iterator& __i, const const_iterator& __j) {
- rope __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- void replace(size_t __p, size_t __n,
- const iterator& __i, const iterator& __j) {
- rope __r(__i, __j);
- replace(__p, __n, __r);
- }
-
- // Single character variants:
- void replace(size_t __p, _CharT __c) {
- iterator __i(this, __p);
- *__i = __c;
- }
-
- void replace(size_t __p, const rope& __r) {
- replace(__p, 1, __r);
- }
-
- void replace(size_t __p, const _CharT* __i, size_t __i_len) {
- replace(__p, 1, __i, __i_len);
- }
-
- void replace(size_t __p, const _CharT* __c_string) {
- replace(__p, 1, __c_string);
- }
-
- void replace(size_t __p, const _CharT* __i, const _CharT* __j) {
- replace(__p, 1, __i, __j);
- }
-
- void replace(size_t __p, const const_iterator& __i,
- const const_iterator& __j) {
- replace(__p, 1, __i, __j);
- }
-
- void replace(size_t __p, const iterator& __i,
- const iterator& __j) {
- replace(__p, 1, __i, __j);
- }
-
- // Erase, (position, size) variant.
- void erase(size_t __p, size_t __n) {
- _RopeRep* __result = replace(_M_tree_ptr, __p, __p + __n, 0);
- _S_unref(_M_tree_ptr);
- _M_tree_ptr = __result;
- }
-
- // Erase, single character
- void erase(size_t __p) {
- erase(__p, __p + 1);
- }
-
- // Insert, iterator variants.
- iterator insert(const iterator& __p, const rope& __r)
- { insert(__p.index(), __r); return __p; }
- iterator insert(const iterator& __p, size_t __n, _CharT __c)
- { insert(__p.index(), __n, __c); return __p; }
- iterator insert(const iterator& __p, _CharT __c)
- { insert(__p.index(), __c); return __p; }
- iterator insert(const iterator& __p )
- { insert(__p.index()); return __p; }
- iterator insert(const iterator& __p, const _CharT* c_string)
- { insert(__p.index(), c_string); return __p; }
- iterator insert(const iterator& __p, const _CharT* __i, size_t __n)
- { insert(__p.index(), __i, __n); return __p; }
- iterator insert(const iterator& __p, const _CharT* __i,
- const _CharT* __j)
- { insert(__p.index(), __i, __j); return __p; }
- iterator insert(const iterator& __p,
- const const_iterator& __i, const const_iterator& __j)
- { insert(__p.index(), __i, __j); return __p; }
- iterator insert(const iterator& __p,
- const iterator& __i, const iterator& __j)
- { insert(__p.index(), __i, __j); return __p; }
-
- // Replace, range variants.
- void replace(const iterator& __p, const iterator& __q,
- const rope& __r)
- { replace(__p.index(), __q.index() - __p.index(), __r); }
- void replace(const iterator& __p, const iterator& __q, _CharT __c)
- { replace(__p.index(), __q.index() - __p.index(), __c); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __c_string)
- { replace(__p.index(), __q.index() - __p.index(), __c_string); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __i, size_t __n)
- { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
- void replace(const iterator& __p, const iterator& __q,
- const _CharT* __i, const _CharT* __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
- void replace(const iterator& __p, const iterator& __q,
- const const_iterator& __i, const const_iterator& __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
- void replace(const iterator& __p, const iterator& __q,
- const iterator& __i, const iterator& __j)
- { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
-
- // Replace, iterator variants.
- void replace(const iterator& __p, const rope& __r)
- { replace(__p.index(), __r); }
- void replace(const iterator& __p, _CharT __c)
- { replace(__p.index(), __c); }
- void replace(const iterator& __p, const _CharT* __c_string)
- { replace(__p.index(), __c_string); }
- void replace(const iterator& __p, const _CharT* __i, size_t __n)
- { replace(__p.index(), __i, __n); }
- void replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
- { replace(__p.index(), __i, __j); }
- void replace(const iterator& __p, const_iterator __i,
- const_iterator __j)
- { replace(__p.index(), __i, __j); }
- void replace(const iterator& __p, iterator __i, iterator __j)
- { replace(__p.index(), __i, __j); }
-
- // Iterator and range variants of erase
- iterator erase(const iterator& __p, const iterator& __q) {
- size_t __p_index = __p.index();
- erase(__p_index, __q.index() - __p_index);
- return iterator(this, __p_index);
- }
- iterator erase(const iterator& __p) {
- size_t __p_index = __p.index();
- erase(__p_index, 1);
- return iterator(this, __p_index);
- }
-
- rope substr(size_t __start, size_t __len = 1) const {
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __start, __start + __len));
- }
-
- rope substr(iterator __start, iterator __end) const {
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __start.index(), __end.index()));
- }
-
- rope substr(iterator __start) const {
- size_t __pos = __start.index();
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __pos, __pos + 1));
- }
-
- rope substr(const_iterator __start, const_iterator __end) const {
- // This might eventually take advantage of the cache in the
- // iterator.
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __start.index(), __end.index()));
- }
-
- rope<_CharT,_Alloc> substr(const_iterator __start) {
- size_t __pos = __start.index();
- return rope<_CharT,_Alloc>(
- _S_substring(_M_tree_ptr, __pos, __pos + 1));
- }
-
- static const size_type npos;
-
- size_type find(_CharT __c, size_type __pos = 0) const;
- size_type find(_CharT* __s, size_type __pos = 0) const {
- size_type __result_pos;
- const_iterator __result = search(const_begin() + __pos, const_end(),
- __s, __s + _S_char_ptr_len(__s));
- __result_pos = __result.index();
-# ifndef __STL_OLD_ROPE_SEMANTICS
- if (__result_pos == size()) __result_pos = npos;
-# endif
- return __result_pos;
- }
-
- iterator mutable_begin() {
- return(iterator(this, 0));
- }
-
- iterator mutable_end() {
- return(iterator(this, size()));
- }
-
-# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<iterator> reverse_iterator;
-# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- typedef reverse_iterator<iterator, value_type, reference,
- difference_type> reverse_iterator;
-# endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
- reverse_iterator mutable_rbegin() {
- return reverse_iterator(mutable_end());
- }
-
- reverse_iterator mutable_rend() {
- return reverse_iterator(mutable_begin());
- }
-
- reference mutable_reference_at(size_type __pos) {
- return reference(this, __pos);
- }
-
-# ifdef __STD_STUFF
- reference operator[] (size_type __pos) {
- return _char_ref_proxy(this, __pos);
- }
-
- reference at(size_type __pos) {
- // if (__pos >= size()) throw out_of_range; // XXX
- return (*this)[__pos];
- }
-
- void resize(size_type __n, _CharT __c) {}
- void resize(size_type __n) {}
- void reserve(size_type __res_arg = 0) {}
- size_type capacity() const {
- return max_size();
- }
-
- // Stuff below this line is dangerous because it's error prone.
- // I would really like to get rid of it.
- // copy function with funny arg ordering.
- size_type copy(_CharT* __buffer, size_type __n,
- size_type __pos = 0) const {
- return copy(__pos, __n, __buffer);
- }
-
- iterator end() { return mutable_end(); }
-
- iterator begin() { return mutable_begin(); }
-
- reverse_iterator rend() { return mutable_rend(); }
-
- reverse_iterator rbegin() { return mutable_rbegin(); }
-
-# else
-
- const_iterator end() { return const_end(); }
-
- const_iterator begin() { return const_begin(); }
-
- const_reverse_iterator rend() { return const_rend(); }
-
- const_reverse_iterator rbegin() { return const_rbegin(); }
-
-# endif
-
-};
-
-template <class _CharT, class _Alloc>
-const rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos =
- (size_type)(-1);
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos == __y._M_current_pos &&
- __x._M_root == __y._M_root);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos < __y._M_current_pos);
-}
-
-template <class _CharT, class _Alloc>
-inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x,
- const _Rope_const_iterator<_CharT,_Alloc>& __y) {
- return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos;
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) {
- return _Rope_const_iterator<_CharT,_Alloc>(
- __x._M_root, __x._M_current_pos - __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) {
- return _Rope_const_iterator<_CharT,_Alloc>(
- __x._M_root, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_const_iterator<_CharT,_Alloc>
-operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) {
- return _Rope_const_iterator<_CharT,_Alloc>(
- __x._M_root, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos == __y._M_current_pos &&
- __x._M_root_rope == __y._M_root_rope);
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return (__x._M_current_pos < __y._M_current_pos);
-}
-
-template <class _CharT, class _Alloc>
-inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
- const _Rope_iterator<_CharT,_Alloc>& __y) {
- return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos;
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator-(const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n) {
- return _Rope_iterator<_CharT,_Alloc>(
- __x._M_root_rope, __x._M_current_pos - __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator+(const _Rope_iterator<_CharT,_Alloc>& __x,
- ptrdiff_t __n) {
- return _Rope_iterator<_CharT,_Alloc>(
- __x._M_root_rope, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline _Rope_iterator<_CharT,_Alloc>
-operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) {
- return _Rope_iterator<_CharT,_Alloc>(
- __x._M_root_rope, __x._M_current_pos + __n);
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right)
-{
-# ifdef __STL_USE_STD_ALLOCATORS
- __stl_assert(__left.get_allocator() == __right.get_allocator());
-# endif
- return rope<_CharT,_Alloc>(
- rope<_CharT,_Alloc>::_S_concat(__left._M_tree_ptr, __right._M_tree_ptr));
- // Inlining this should make it possible to keep __left and
- // __right in registers.
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right)
-{
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left,
- const _CharT* __right) {
- size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
- return rope<_CharT,_Alloc>(
- rope<_CharT,_Alloc>::_S_concat_char_iter(
- __left._M_tree_ptr, __right, __rlen));
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left,
- const _CharT* __right) {
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>
-operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) {
- return rope<_CharT,_Alloc>(
- rope<_CharT,_Alloc>::_S_concat_char_iter(
- __left._M_tree_ptr, &__right, 1));
-}
-
-template <class _CharT, class _Alloc>
-inline
-rope<_CharT,_Alloc>&
-operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) {
- __left.append(__right);
- return __left;
-}
-
-template <class _CharT, class _Alloc>
-bool
-operator< (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- return __left.compare(__right) < 0;
-}
-
-template <class _CharT, class _Alloc>
-bool
-operator== (const rope<_CharT,_Alloc>& __left,
- const rope<_CharT,_Alloc>& __right) {
- return __left.compare(__right) == 0;
-}
-
-template <class _CharT, class _Alloc>
-inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x,
- const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) {
- return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root);
-}
-
-template<class _CharT, class _Alloc>
-ostream& operator<< (ostream& __o, const rope<_CharT,_Alloc>& __r);
-
-typedef rope<char> crope;
-typedef rope<wchar_t> wrope;
-
-inline crope::reference __mutable_reference_at(crope& __c, size_t __i)
-{
- return __c.mutable_reference_at(__i);
-}
-
-inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i)
-{
- return __c.mutable_reference_at(__i);
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _CharT, class _Alloc>
-inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y) {
- __x.swap(__y);
-}
-
-#else
-
-inline void swap(crope __x, crope __y) { __x.swap(__y); }
-inline void swap(wrope __x, wrope __y) { __x.swap(__y); }
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-// Hash functions should probably be revisited later:
-__STL_TEMPLATE_NULL struct hash<crope>
-{
- size_t operator()(const crope& __str) const
- {
- size_t __size = __str.size();
-
- if (0 == __size) return 0;
- return 13*__str[0] + 5*__str[__size - 1] + __size;
- }
-};
-
-
-__STL_TEMPLATE_NULL struct hash<wrope>
-{
- size_t operator()(const wrope& __str) const
- {
- size_t __size = __str.size();
-
- if (0 == __size) return 0;
- return 13*__str[0] + 5*__str[__size - 1] + __size;
- }
-};
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#endif
-
-__STL_END_NAMESPACE
-
-# include <ropeimpl.h>
-
-# endif /* __SGI_STL_INTERNAL_ROPE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_set.h b/contrib/libstdc++/stl/stl_set.h
deleted file mode 100644
index 003069c..0000000
--- a/contrib/libstdc++/stl/stl_set.h
+++ /dev/null
@@ -1,216 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_SET_H
-#define __SGI_STL_INTERNAL_SET_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Key, class _Compare = less<_Key>,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
-#else
-template <class _Key, class _Compare,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
-#endif
-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,
- _Identity<value_type>, key_compare, _Alloc> _Rep_type;
- _Rep_type _M_t; // red-black tree representing set
-public:
- typedef typename _Rep_type::const_pointer pointer;
- typedef typename _Rep_type::const_pointer const_pointer;
- typedef typename _Rep_type::const_reference reference;
- typedef typename _Rep_type::const_reference const_reference;
- typedef typename _Rep_type::const_iterator iterator;
- typedef typename _Rep_type::const_iterator const_iterator;
- typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
- typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
- typedef typename _Rep_type::size_type size_type;
- typedef typename _Rep_type::difference_type difference_type;
- typedef typename _Rep_type::allocator_type allocator_type;
-
- // allocation/deallocation
-
- set() : _M_t(_Compare(), allocator_type()) {}
- explicit set(const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- template <class _InputIterator>
- set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#else
- set(const value_type* __first, const value_type* __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- set(const value_type* __first,
- const value_type* __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-
- set(const_iterator __first, const_iterator __last)
- : _M_t(_Compare(), allocator_type())
- { _M_t.insert_unique(__first, __last); }
-
- set(const_iterator __first, const_iterator __last, const _Compare& __comp,
- const allocator_type& __a = allocator_type())
- : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- set(const set<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
- set<_Key,_Compare,_Alloc>& operator=(const set<_Key, _Compare, _Alloc>& __x)
- {
- _M_t = __x._M_t;
- return *this;
- }
-
- // accessors:
-
- key_compare key_comp() const { return _M_t.key_comp(); }
- value_compare value_comp() const { return _M_t.key_comp(); }
- allocator_type get_allocator() const { return _M_t.get_allocator(); }
-
- iterator begin() const { return _M_t.begin(); }
- iterator end() const { return _M_t.end(); }
- reverse_iterator rbegin() const { return _M_t.rbegin(); }
- reverse_iterator rend() const { return _M_t.rend(); }
- bool empty() const { return _M_t.empty(); }
- size_type size() const { return _M_t.size(); }
- size_type max_size() const { return _M_t.max_size(); }
- void swap(set<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
-
- // insert/erase
- pair<iterator,bool> insert(const value_type& __x) {
- pair<typename _Rep_type::iterator, bool> __p = _M_t.insert_unique(__x);
- return pair<iterator, bool>(__p.first, __p.second);
- }
- iterator insert(iterator __position, const value_type& __x) {
- typedef typename _Rep_type::iterator _Rep_iterator;
- return _M_t.insert_unique((_Rep_iterator&)__position, __x);
- }
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert(_InputIterator __first, _InputIterator __last) {
- _M_t.insert_unique(__first, __last);
- }
-#else
- void insert(const_iterator __first, const_iterator __last) {
- _M_t.insert_unique(__first, __last);
- }
- void insert(const value_type* __first, const value_type* __last) {
- _M_t.insert_unique(__first, __last);
- }
-#endif /* __STL_MEMBER_TEMPLATES */
- void erase(iterator __position) {
- typedef typename _Rep_type::iterator _Rep_iterator;
- _M_t.erase((_Rep_iterator&)__position);
- }
- size_type erase(const key_type& __x) {
- return _M_t.erase(__x);
- }
- void erase(iterator __first, iterator __last) {
- typedef typename _Rep_type::iterator _Rep_iterator;
- _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
- }
- void clear() { _M_t.clear(); }
-
- // set operations:
-
- iterator find(const key_type& __x) const { return _M_t.find(__x); }
- size_type count(const key_type& __x) const { return _M_t.count(__x); }
- iterator lower_bound(const key_type& __x) const {
- return _M_t.lower_bound(__x);
- }
- iterator upper_bound(const key_type& __x) const {
- return _M_t.upper_bound(__x);
- }
- pair<iterator,iterator> equal_range(const key_type& __x) const {
- return _M_t.equal_range(__x);
- }
- friend bool operator== __STL_NULL_TMPL_ARGS (const set&, const set&);
- friend bool operator< __STL_NULL_TMPL_ARGS (const set&, const set&);
-};
-
-template <class _Key, class _Compare, class _Alloc>
-inline bool operator==(const set<_Key,_Compare,_Alloc>& __x,
- const set<_Key,_Compare,_Alloc>& __y) {
- return __x._M_t == __y._M_t;
-}
-
-template <class _Key, class _Compare, class _Alloc>
-inline bool operator<(const set<_Key,_Compare,_Alloc>& __x,
- const set<_Key,_Compare,_Alloc>& __y) {
- return __x._M_t < __y._M_t;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Key, class _Compare, class _Alloc>
-inline void swap(set<_Key,_Compare,_Alloc>& __x,
- set<_Key,_Compare,_Alloc>& __y) {
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_SET_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_slist.h b/contrib/libstdc++/stl/stl_slist.h
deleted file mode 100644
index 6da234d..0000000
--- a/contrib/libstdc++/stl/stl_slist.h
+++ /dev/null
@@ -1,945 +0,0 @@
-/*
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_SLIST_H
-#define __SGI_STL_INTERNAL_SLIST_H
-
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-struct _Slist_node_base
-{
- _Slist_node_base* _M_next;
-};
-
-inline _Slist_node_base*
-__slist_make_link(_Slist_node_base* __prev_node,
- _Slist_node_base* __new_node)
-{
- __new_node->_M_next = __prev_node->_M_next;
- __prev_node->_M_next = __new_node;
- return __new_node;
-}
-
-inline _Slist_node_base*
-__slist_previous(_Slist_node_base* __head,
- const _Slist_node_base* __node)
-{
- while (__head && __head->_M_next != __node)
- __head = __head->_M_next;
- return __head;
-}
-
-inline const _Slist_node_base*
-__slist_previous(const _Slist_node_base* __head,
- const _Slist_node_base* __node)
-{
- while (__head && __head->_M_next != __node)
- __head = __head->_M_next;
- return __head;
-}
-
-inline void __slist_splice_after(_Slist_node_base* __pos,
- _Slist_node_base* __before_first,
- _Slist_node_base* __before_last)
-{
- if (__pos != __before_first && __pos != __before_last) {
- _Slist_node_base* __first = __before_first->_M_next;
- _Slist_node_base* __after = __pos->_M_next;
- __before_first->_M_next = __before_last->_M_next;
- __pos->_M_next = __first;
- __before_last->_M_next = __after;
- }
-}
-
-inline _Slist_node_base* __slist_reverse(_Slist_node_base* __node)
-{
- _Slist_node_base* __result = __node;
- __node = __node->_M_next;
- __result->_M_next = 0;
- while(__node) {
- _Slist_node_base* __next = __node->_M_next;
- __node->_M_next = __result;
- __result = __node;
- __node = __next;
- }
- return __result;
-}
-
-inline size_t __slist_size(_Slist_node_base* __node)
-{
- size_t __result = 0;
- for ( ; __node != 0; __node = __node->_M_next)
- ++__result;
- return __result;
-}
-
-template <class _Tp>
-struct _Slist_node : public _Slist_node_base
-{
- _Tp _M_data;
-};
-
-struct _Slist_iterator_base
-{
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef forward_iterator_tag iterator_category;
-
- _Slist_node_base* _M_node;
-
- _Slist_iterator_base(_Slist_node_base* __x) : _M_node(__x) {}
- void _M_incr() { _M_node = _M_node->_M_next; }
-
- bool operator==(const _Slist_iterator_base& __x) const {
- return _M_node == __x._M_node;
- }
- bool operator!=(const _Slist_iterator_base& __x) const {
- return _M_node != __x._M_node;
- }
-};
-
-template <class _Tp, class _Ref, class _Ptr>
-struct _Slist_iterator : public _Slist_iterator_base
-{
- typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
- typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
- typedef _Slist_iterator<_Tp, _Ref, _Ptr> _Self;
-
- typedef _Tp value_type;
- typedef _Ptr pointer;
- typedef _Ref reference;
- typedef _Slist_node<_Tp> _Node;
-
- _Slist_iterator(_Node* __x) : _Slist_iterator_base(__x) {}
- _Slist_iterator() : _Slist_iterator_base(0) {}
- _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {}
-
- reference operator*() const { return ((_Node*) _M_node)->_M_data; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
-
- _Self& operator++()
- {
- _M_incr();
- return *this;
- }
- _Self operator++(int)
- {
- _Self __tmp = *this;
- _M_incr();
- return __tmp;
- }
-};
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-inline ptrdiff_t* distance_type(const _Slist_iterator_base&) {
- return 0;
-}
-
-inline forward_iterator_tag iterator_category(const _Slist_iterator_base&) {
- return forward_iterator_tag();
-}
-
-template <class _Tp, class _Ref, class _Ptr>
-inline _Tp* value_type(const _Slist_iterator<_Tp, _Ref, _Ptr>&) {
- return 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-// Base class that encapsulates details of allocators. Three cases:
-// an ordinary standard-conforming allocator, a standard-conforming
-// allocator with no non-static data, and an SGI-style allocator.
-// This complexity is necessary only because we're worrying about backward
-// compatibility and because we want to avoid wasting storage on an
-// allocator instance if it isn't necessary.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-// Base for general standard-conforming allocators.
-template <class _Tp, class _Allocator, bool _IsStatic>
-class _Slist_alloc_base {
-public:
- typedef typename _Alloc_traits<_Tp,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _M_node_allocator; }
-
- _Slist_alloc_base(const allocator_type& __a) : _M_node_allocator(__a) {}
-
-protected:
- _Slist_node<_Tp>* _M_get_node()
- { return _M_node_allocator.allocate(1); }
- void _M_put_node(_Slist_node<_Tp>* __p)
- { _M_node_allocator.deallocate(__p, 1); }
-
-protected:
- typename _Alloc_traits<_Slist_node<_Tp>,_Allocator>::allocator_type
- _M_node_allocator;
- _Slist_node_base _M_head;
-};
-
-// Specialization for instanceless allocators.
-template <class _Tp, class _Allocator>
-class _Slist_alloc_base<_Tp,_Allocator, true> {
-public:
- typedef typename _Alloc_traits<_Tp,_Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Slist_alloc_base(const allocator_type&) {}
-
-protected:
- typedef typename _Alloc_traits<_Slist_node<_Tp>, _Allocator>::_Alloc_type
- _Alloc_type;
- _Slist_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
- void _M_put_node(_Slist_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
-
-protected:
- _Slist_node_base _M_head;
-};
-
-
-template <class _Tp, class _Alloc>
-struct _Slist_base
- : public _Slist_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
-{
- typedef _Slist_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
-
- _Slist_base(const allocator_type& __a) : _Base(__a) { _M_head._M_next = 0; }
- ~_Slist_base() { _M_erase_after(&_M_head, 0); }
-
-protected:
-
- _Slist_node_base* _M_erase_after(_Slist_node_base* __pos)
- {
- _Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next);
- _Slist_node_base* __next_next = __next->_M_next;
- __pos->_M_next = __next_next;
- destroy(&__next->_M_data);
- _M_put_node(__next);
- return __next_next;
- }
- _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
-};
-
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-struct _Slist_base {
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Slist_base(const allocator_type&) { _M_head._M_next = 0; }
- ~_Slist_base() { _M_erase_after(&_M_head, 0); }
-
-protected:
- typedef simple_alloc<_Slist_node<_Tp>, _Alloc> _Alloc_type;
- _Slist_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); }
- void _M_put_node(_Slist_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); }
-
- _Slist_node_base* _M_erase_after(_Slist_node_base* __pos)
- {
- _Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next);
- _Slist_node_base* __next_next = __next->_M_next;
- __pos->_M_next = __next_next;
- destroy(&__next->_M_data);
- _M_put_node(__next);
- return __next_next;
- }
- _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
-
-protected:
- _Slist_node_base _M_head;
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-_Slist_node_base*
-_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
- _Slist_node_base* __last_node) {
- _Slist_node<_Tp>* __cur = (_Slist_node<_Tp>*) (__before_first->_M_next);
- while (__cur != __last_node) {
- _Slist_node<_Tp>* __tmp = __cur;
- __cur = (_Slist_node<_Tp>*) __cur->_M_next;
- destroy(&__tmp->_M_data);
- _M_put_node(__tmp);
- }
- __before_first->_M_next = __last_node;
- return __last_node;
-}
-
-template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-class slist : private _Slist_base<_Tp,_Alloc>
-{
-private:
- typedef _Slist_base<_Tp,_Alloc> _Base;
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
- typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
-
- typedef typename _Base::allocator_type allocator_type;
- allocator_type get_allocator() const { return _Base::get_allocator(); }
-
-private:
- typedef _Slist_node<_Tp> _Node;
- typedef _Slist_node_base _Node_base;
- typedef _Slist_iterator_base _Iterator_base;
-
- _Node* _M_create_node(const value_type& __x) {
- _Node* __node = _M_get_node();
- __STL_TRY {
- construct(&__node->_M_data, __x);
- __node->_M_next = 0;
- }
- __STL_UNWIND(_M_put_node(__node));
- return __node;
- }
-
- _Node* _M_create_node() {
- _Node* __node = _M_get_node();
- __STL_TRY {
- construct(&__node->_M_data);
- __node->_M_next = 0;
- }
- __STL_UNWIND(_M_put_node(__node));
- return __node;
- }
-
-private:
-#ifdef __STL_USE_NAMESPACES
- using _Base::_M_get_node;
- using _Base::_M_put_node;
- using _Base::_M_erase_after;
- using _Base::_M_head;
-#endif /* __STL_USE_NAMESPACES */
-
-public:
- explicit slist(const allocator_type& __a = allocator_type()) : _Base(__a) {}
-
- slist(size_type __n, const value_type& __x,
- const allocator_type& __a = allocator_type()) : _Base(__a)
- { _M_insert_after_fill(&_M_head, __n, __x); }
-
- explicit slist(size_type __n) : _Base(allocator_type())
- { _M_insert_after_fill(&_M_head, __n, value_type()); }
-
-#ifdef __STL_MEMBER_TEMPLATES
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InputIterator>
- slist(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a = allocator_type()) : _Base(__a)
- { _M_insert_after_range(&_M_head, __first, __last); }
-
-#else /* __STL_MEMBER_TEMPLATES */
- slist(const_iterator __first, const_iterator __last,
- const allocator_type& __a = allocator_type()) : _Base(__a)
- { _M_insert_after_range(&_M_head, __first, __last); }
- slist(const value_type* __first, const value_type* __last,
- const allocator_type& __a = allocator_type()) : _Base(__a)
- { _M_insert_after_range(&_M_head, __first, __last); }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- slist(const slist& __x) : _Base(__x.get_allocator())
- { _M_insert_after_range(&_M_head, __x.begin(), __x.end()); }
-
- slist& operator= (const slist& __x);
-
- ~slist() {}
-
-public:
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_type __n, const _Tp& __val);
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { assign((size_type) __n, (_Tp) __val); }
-
- template <class _InputIterator>
- void _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- __false_type);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-public:
-
- iterator begin() { return iterator((_Node*)_M_head._M_next); }
- const_iterator begin() const
- { return const_iterator((_Node*)_M_head._M_next);}
-
- iterator end() { return iterator(0); }
- const_iterator end() const { return const_iterator(0); }
-
- size_type size() const { return __slist_size(_M_head._M_next); }
-
- size_type max_size() const { return size_type(-1); }
-
- bool empty() const { return _M_head._M_next == 0; }
-
- void swap(slist& __x) { __STD::swap(_M_head._M_next, __x._M_head._M_next); }
-
-public:
- friend bool operator== __STL_NULL_TMPL_ARGS (const slist<_Tp,_Alloc>& _SL1,
- const slist<_Tp,_Alloc>& _SL2);
-
-public:
-
- reference front() { return ((_Node*) _M_head._M_next)->_M_data; }
- const_reference front() const
- { return ((_Node*) _M_head._M_next)->_M_data; }
- void push_front(const value_type& __x) {
- __slist_make_link(&_M_head, _M_create_node(__x));
- }
- void push_front() { __slist_make_link(&_M_head, _M_create_node());}
- void pop_front() {
- _Node* __node = (_Node*) _M_head._M_next;
- _M_head._M_next = __node->_M_next;
- destroy(&__node->_M_data);
- _M_put_node(__node);
- }
-
- iterator previous(const_iterator __pos) {
- return iterator((_Node*) __slist_previous(&_M_head, __pos._M_node));
- }
- const_iterator previous(const_iterator __pos) const {
- return const_iterator((_Node*) __slist_previous(&_M_head, __pos._M_node));
- }
-
-private:
- _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) {
- return (_Node*) (__slist_make_link(__pos, _M_create_node(__x)));
- }
-
- _Node* _M_insert_after(_Node_base* __pos) {
- return (_Node*) (__slist_make_link(__pos, _M_create_node()));
- }
-
- void _M_insert_after_fill(_Node_base* __pos,
- size_type __n, const value_type& __x) {
- for (size_type __i = 0; __i < __n; ++__i)
- __pos = __slist_make_link(__pos, _M_create_node(__x));
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InIter>
- void _M_insert_after_range(_Node_base* __pos,
- _InIter __first, _InIter __last) {
- typedef typename _Is_integer<_InIter>::_Integral _Integral;
- _M_insert_after_range(__pos, __first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
- __true_type) {
- _M_insert_after_fill(__pos, __n, __x);
- }
-
- template <class _InIter>
- void _M_insert_after_range(_Node_base* __pos,
- _InIter __first, _InIter __last,
- __false_type) {
- while (__first != __last) {
- __pos = __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- void _M_insert_after_range(_Node_base* __pos,
- const_iterator __first, const_iterator __last) {
- while (__first != __last) {
- __pos = __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
- void _M_insert_after_range(_Node_base* __pos,
- const value_type* __first,
- const value_type* __last) {
- while (__first != __last) {
- __pos = __slist_make_link(__pos, _M_create_node(*__first));
- ++__first;
- }
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-public:
-
- iterator insert_after(iterator __pos, const value_type& __x) {
- return iterator(_M_insert_after(__pos._M_node, __x));
- }
-
- iterator insert_after(iterator __pos) {
- return insert_after(__pos, value_type());
- }
-
- void insert_after(iterator __pos, size_type __n, const value_type& __x) {
- _M_insert_after_fill(__pos._M_node, __n, __x);
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InIter>
- void insert_after(iterator __pos, _InIter __first, _InIter __last) {
- _M_insert_after_range(__pos._M_node, __first, __last);
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- void insert_after(iterator __pos,
- const_iterator __first, const_iterator __last) {
- _M_insert_after_range(__pos._M_node, __first, __last);
- }
- void insert_after(iterator __pos,
- const value_type* __first, const value_type* __last) {
- _M_insert_after_range(__pos._M_node, __first, __last);
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- iterator insert(iterator __pos, const value_type& __x) {
- return iterator(_M_insert_after(__slist_previous(&_M_head, __pos._M_node),
- __x));
- }
-
- iterator insert(iterator __pos) {
- return iterator(_M_insert_after(__slist_previous(&_M_head, __pos._M_node),
- value_type()));
- }
-
- void insert(iterator __pos, size_type __n, const value_type& __x) {
- _M_insert_after_fill(__slist_previous(&_M_head, __pos._M_node), __n, __x);
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- // We don't need any dispatching tricks here, because _M_insert_after_range
- // already does them.
- template <class _InIter>
- void insert(iterator __pos, _InIter __first, _InIter __last) {
- _M_insert_after_range(__slist_previous(&_M_head, __pos._M_node),
- __first, __last);
- }
-
-#else /* __STL_MEMBER_TEMPLATES */
-
- void insert(iterator __pos, const_iterator __first, const_iterator __last) {
- _M_insert_after_range(__slist_previous(&_M_head, __pos._M_node),
- __first, __last);
- }
- void insert(iterator __pos, const value_type* __first,
- const value_type* __last) {
- _M_insert_after_range(__slist_previous(&_M_head, __pos._M_node),
- __first, __last);
- }
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-
-public:
- iterator erase_after(iterator __pos) {
- return iterator((_Node*) _M_erase_after(__pos._M_node));
- }
- iterator erase_after(iterator __before_first, iterator __last) {
- return iterator((_Node*) _M_erase_after(__before_first._M_node,
- __last._M_node));
- }
-
- iterator erase(iterator __pos) {
- return (_Node*) _M_erase_after(__slist_previous(&_M_head,
- __pos._M_node));
- }
- iterator erase(iterator __first, iterator __last) {
- return (_Node*) _M_erase_after(
- __slist_previous(&_M_head, __first._M_node), __last._M_node);
- }
-
- void resize(size_type new_size, const _Tp& __x);
- void resize(size_type new_size) { resize(new_size, _Tp()); }
- void clear() { _M_erase_after(&_M_head, 0); }
-
-public:
- // Moves the range [__before_first + 1, __before_last + 1) to *this,
- // inserting it immediately after __pos. This is constant time.
- void splice_after(iterator __pos,
- iterator __before_first, iterator __before_last)
- {
- if (__before_first != __before_last)
- __slist_splice_after(__pos._M_node, __before_first._M_node,
- __before_last._M_node);
- }
-
- // Moves the element that follows __prev to *this, inserting it immediately
- // after __pos. This is constant time.
- void splice_after(iterator __pos, iterator __prev)
- {
- __slist_splice_after(__pos._M_node,
- __prev._M_node, __prev._M_node->_M_next);
- }
-
-
- // Linear in distance(begin(), __pos), and linear in __x.size().
- void splice(iterator __pos, slist& __x) {
- if (__x._M_head._M_next)
- __slist_splice_after(__slist_previous(&_M_head, __pos._M_node),
- &__x._M_head, __slist_previous(&__x._M_head, 0));
- }
-
- // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).
- void splice(iterator __pos, slist& __x, iterator __i) {
- __slist_splice_after(__slist_previous(&_M_head, __pos._M_node),
- __slist_previous(&__x._M_head, __i._M_node),
- __i._M_node);
- }
-
- // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),
- // and in distance(__first, __last).
- void splice(iterator __pos, slist& __x, iterator __first, iterator __last)
- {
- if (__first != __last)
- __slist_splice_after(__slist_previous(&_M_head, __pos._M_node),
- __slist_previous(&__x._M_head, __first._M_node),
- __slist_previous(__first._M_node, __last._M_node));
- }
-
-public:
- void reverse() {
- if (_M_head._M_next)
- _M_head._M_next = __slist_reverse(_M_head._M_next);
- }
-
- void remove(const _Tp& __val);
- void unique();
- void merge(slist& __x);
- void sort();
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Predicate>
- void remove_if(_Predicate __pred);
-
- template <class _BinaryPredicate>
- void unique(_BinaryPredicate __pred);
-
- template <class _StrictWeakOrdering>
- void merge(slist&, _StrictWeakOrdering);
-
- template <class _StrictWeakOrdering>
- void sort(_StrictWeakOrdering __comp);
-#endif /* __STL_MEMBER_TEMPLATES */
-};
-
-template <class _Tp, class _Alloc>
-slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x)
-{
- if (&__x != this) {
- _Node_base* __p1 = &_M_head;
- _Node* __n1 = (_Node*) _M_head._M_next;
- const _Node* __n2 = (const _Node*) __x._M_head._M_next;
- while (__n1 && __n2) {
- __n1->_M_data = __n2->_M_data;
- __p1 = __n1;
- __n1 = (_Node*) __n1->_M_next;
- __n2 = (const _Node*) __n2->_M_next;
- }
- if (__n2 == 0)
- _M_erase_after(__p1, 0);
- else
- _M_insert_after_range(__p1, const_iterator((_Node*)__n2),
- const_iterator(0));
- }
- return *this;
-}
-
-template <class _Tp, class _Alloc>
-void slist<_Tp, _Alloc>::assign(size_type __n, const _Tp& __val) {
- _Node_base* __prev = &_M_head;
- _Node* __node = (_Node*) _M_head._M_next;
- for ( ; __node != 0 && __n > 0 ; --__n) {
- __node->_M_data = __val;
- __prev = __node;
- __node = (_Node*) __node->_M_next;
- }
- if (__n > 0)
- _M_insert_after_fill(__prev, __n, __val);
- else
- _M_erase_after(__prev, 0);
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc> template <class _InputIter>
-void
-slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first, _InputIter __last,
- __false_type)
-{
- _Node_base* __prev = &_M_head;
- _Node* __node = (_Node*) _M_head._M_next;
- while (__node != 0 && __first != __last) {
- __node->_M_data = *__first;
- __prev = __node;
- __node = (_Node*) __node->_M_next;
- ++__first;
- }
- if (__first != __last)
- _M_insert_after_range(__prev, __first, __last);
- else
- _M_erase_after(__prev, 0);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-inline bool
-operator==(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2)
-{
- typedef typename slist<_Tp,_Alloc>::_Node _Node;
- _Node* __n1 = (_Node*) _SL1._M_head._M_next;
- _Node* __n2 = (_Node*) _SL2._M_head._M_next;
- while (__n1 && __n2 && __n1->_M_data == __n2->_M_data) {
- __n1 = (_Node*) __n1->_M_next;
- __n2 = (_Node*) __n2->_M_next;
- }
- return __n1 == 0 && __n2 == 0;
-}
-
-template <class _Tp, class _Alloc>
-inline bool operator<(const slist<_Tp,_Alloc>& _SL1,
- const slist<_Tp,_Alloc>& _SL2)
-{
- return lexicographical_compare(_SL1.begin(), _SL1.end(),
- _SL2.begin(), _SL2.end());
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Tp, class _Alloc>
-inline void swap(slist<_Tp,_Alloc>& __x, slist<_Tp,_Alloc>& __y) {
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-template <class _Tp, class _Alloc>
-void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x)
-{
- _Node_base* __cur = &_M_head;
- while (__cur->_M_next != 0 && __len > 0) {
- --__len;
- __cur = __cur->_M_next;
- }
- if (__cur->_M_next)
- _M_erase_after(__cur, 0);
- else
- _M_insert_after_fill(__cur, __len, __x);
-}
-
-template <class _Tp, class _Alloc>
-void slist<_Tp,_Alloc>::remove(const _Tp& __val)
-{
- _Node_base* __cur = &_M_head;
- while (__cur && __cur->_M_next) {
- if (((_Node*) __cur->_M_next)->_M_data == __val)
- _M_erase_after(__cur);
- else
- __cur = __cur->_M_next;
- }
-}
-
-template <class _Tp, class _Alloc>
-void slist<_Tp,_Alloc>::unique()
-{
- _Node_base* __cur = _M_head._M_next;
- if (__cur) {
- while (__cur->_M_next) {
- if (((_Node*)__cur)->_M_data ==
- ((_Node*)(__cur->_M_next))->_M_data)
- _M_erase_after(__cur);
- else
- __cur = __cur->_M_next;
- }
- }
-}
-
-template <class _Tp, class _Alloc>
-void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x)
-{
- _Node_base* __n1 = &_M_head;
- while (__n1->_M_next && __x._M_head._M_next) {
- if (((_Node*) __x._M_head._M_next)->_M_data <
- ((_Node*) __n1->_M_next)->_M_data)
- __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);
- __n1 = __n1->_M_next;
- }
- if (__x._M_head._M_next) {
- __n1->_M_next = __x._M_head._M_next;
- __x._M_head._M_next = 0;
- }
-}
-
-template <class _Tp, class _Alloc>
-void slist<_Tp,_Alloc>::sort()
-{
- if (_M_head._M_next && _M_head._M_next->_M_next) {
- slist __carry;
- slist __counter[64];
- int __fill = 0;
- while (!empty()) {
- __slist_splice_after(&__carry._M_head, &_M_head, _M_head._M_next);
- int __i = 0;
- while (__i < __fill && !__counter[__i].empty()) {
- __counter[__i].merge(__carry);
- __carry.swap(__counter[__i]);
- ++__i;
- }
- __carry.swap(__counter[__i]);
- if (__i == __fill)
- ++__fill;
- }
-
- for (int __i = 1; __i < __fill; ++__i)
- __counter[__i].merge(__counter[__i-1]);
- this->swap(__counter[__fill-1]);
- }
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc>
-template <class _Predicate>
-void slist<_Tp,_Alloc>::remove_if(_Predicate __pred)
-{
- _Node_base* __cur = &_M_head;
- while (__cur->_M_next) {
- if (__pred(((_Node*) __cur->_M_next)->_M_data))
- _M_erase_after(__cur);
- else
- __cur = __cur->_M_next;
- }
-}
-
-template <class _Tp, class _Alloc> template <class _BinaryPredicate>
-void slist<_Tp,_Alloc>::unique(_BinaryPredicate __pred)
-{
- _Node* __cur = (_Node*) _M_head._M_next;
- if (__cur) {
- while (__cur->_M_next) {
- if (__pred(((_Node*)__cur)->_M_data,
- ((_Node*)(__cur->_M_next))->_M_data))
- _M_erase_after(__cur);
- else
- __cur = (_Node*) __cur->_M_next;
- }
- }
-}
-
-template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
-void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x,
- _StrictWeakOrdering __comp)
-{
- _Node_base* __n1 = &_M_head;
- while (__n1->_M_next && __x._M_head._M_next) {
- if (__comp(((_Node*) __x._M_head._M_next)->_M_data,
- ((_Node*) __n1->_M_next)->_M_data))
- __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);
- __n1 = __n1->_M_next;
- }
- if (__x._M_head._M_next) {
- __n1->_M_next = __x._M_head._M_next;
- __x._M_head._M_next = 0;
- }
-}
-
-template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
-void slist<_Tp,_Alloc>::sort(_StrictWeakOrdering __comp)
-{
- if (_M_head._M_next && _M_head._M_next->_M_next) {
- slist __carry;
- slist __counter[64];
- int __fill = 0;
- while (!empty()) {
- __slist_splice_after(&__carry._M_head, &_M_head, _M_head._M_next);
- int __i = 0;
- while (__i < __fill && !__counter[__i].empty()) {
- __counter[__i].merge(__carry, __comp);
- __carry.swap(__counter[__i]);
- ++__i;
- }
- __carry.swap(__counter[__i]);
- if (__i == __fill)
- ++__fill;
- }
-
- for (int __i = 1; __i < __fill; ++__i)
- __counter[__i].merge(__counter[__i-1], __comp);
- this->swap(__counter[__fill-1]);
- }
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_SLIST_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_stack.h b/contrib/libstdc++/stl/stl_stack.h
deleted file mode 100644
index 2a04b21..0000000
--- a/contrib/libstdc++/stl/stl_stack.h
+++ /dev/null
@@ -1,111 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_STACK_H
-#define __SGI_STL_INTERNAL_STACK_H
-
-__STL_BEGIN_NAMESPACE
-
-#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
-template <class _Tp, class _Sequence = deque<_Tp> >
-#else
-template <class _Tp, class _Sequence>
-#endif
-class stack {
- friend bool operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&);
- friend bool operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&);
-public:
- typedef typename _Sequence::value_type value_type;
- typedef typename _Sequence::size_type size_type;
- typedef _Sequence container_type;
-
- typedef typename _Sequence::reference reference;
- typedef typename _Sequence::const_reference const_reference;
-protected:
- _Sequence _M_c;
-public:
- stack() : _M_c() {}
- explicit stack(const _Sequence& __s) : _M_c(__s) {}
-
- bool empty() const { return _M_c.empty(); }
- size_type size() const { return _M_c.size(); }
- reference top() { return _M_c.back(); }
- const_reference top() const { return _M_c.back(); }
- void push(const value_type& __x) { _M_c.push_back(__x); }
- void pop() { _M_c.pop_back(); }
-};
-
-template <class _Tp, class _Seq>
-bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
-{
- return __x._M_c == __y._M_c;
-}
-
-template <class _Tp, class _Seq>
-bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
-{
- return __x._M_c < __y._M_c;
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Tp, class _Seq>
-bool operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
-{
- return !(__x == __y);
-}
-
-template <class _Tp, class _Seq>
-bool operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
-{
- return __y < __x;
-}
-
-template <class _Tp, class _Seq>
-bool operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
-{
- return !(__y < __x);
-}
-
-template <class _Tp, class _Seq>
-bool operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y)
-{
- return !(__x < __y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_STACK_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_tempbuf.h b/contrib/libstdc++/stl/stl_tempbuf.h
deleted file mode 100644
index e1b2ead..0000000
--- a/contrib/libstdc++/stl/stl_tempbuf.h
+++ /dev/null
@@ -1,156 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_TEMPBUF_H
-#define __SGI_STL_INTERNAL_TEMPBUF_H
-
-
-__STL_BEGIN_NAMESPACE
-
-template <class _Tp>
-pair<_Tp*, ptrdiff_t>
-__get_temporary_buffer(ptrdiff_t __len, _Tp*)
-{
- if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
- __len = INT_MAX / sizeof(_Tp);
-
- while (__len > 0) {
- _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp));
- if (__tmp != 0)
- return pair<_Tp*, ptrdiff_t>(__tmp, __len);
- __len /= 2;
- }
-
- return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
-}
-
-#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-
-template <class _Tp>
-inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) {
- return __get_temporary_buffer(__len, (_Tp*) 0);
-}
-
-#endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */
-
-// This overload is not required by the standard; it is an extension.
-// It is supported for backward compatibility with the HP STL, and
-// because not all compilers support the language feature (explicit
-// function template arguments) that is required for the standard
-// version of get_temporary_buffer.
-template <class _Tp>
-inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len, _Tp*) {
- return __get_temporary_buffer(__len, (_Tp*) 0);
-}
-
-template <class _Tp>
-void return_temporary_buffer(_Tp* __p) {
- free(__p);
-}
-
-template <class _ForwardIterator, class _Tp>
-class _Temporary_buffer {
-private:
- ptrdiff_t _M_original_len;
- ptrdiff_t _M_len;
- _Tp* _M_buffer;
-
- void _M_allocate_buffer() {
- _M_original_len = _M_len;
- _M_buffer = 0;
-
- if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
- _M_len = INT_MAX / sizeof(_Tp);
-
- while (_M_len > 0) {
- _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
- if (_M_buffer)
- break;
- _M_len /= 2;
- }
- }
-
- void _M_initialize_buffer(const _Tp&, __true_type) {}
- void _M_initialize_buffer(const _Tp& val, __false_type) {
- uninitialized_fill_n(_M_buffer, _M_len, val);
- }
-
-public:
- ptrdiff_t size() const { return _M_len; }
- ptrdiff_t requested_size() const { return _M_original_len; }
- _Tp* begin() { return _M_buffer; }
- _Tp* end() { return _M_buffer + _M_len; }
-
- _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
- typedef typename __type_traits<_Tp>::has_trivial_default_constructor
- _Trivial;
- __STL_TRY {
- _M_len = 0;
- distance(__first, __last, _M_len);
- _M_allocate_buffer();
- if (_M_len > 0)
- _M_initialize_buffer(*__first, _Trivial());
- }
- __STL_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0);
- }
-
- ~_Temporary_buffer() {
- destroy(_M_buffer, _M_buffer + _M_len);
- free(_M_buffer);
- }
-
-private:
- // Disable copy constructor and assignment operator.
- _Temporary_buffer(const _Temporary_buffer&) {}
- void operator=(const _Temporary_buffer&) {}
-};
-
-// Class temporary_buffer is not part of the standard. It is an extension.
-
-template <class _ForwardIterator,
- class _Tp
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- = typename iterator_traits<_ForwardIterator>::value_type
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- >
-struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
-{
- temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
- : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {}
- ~temporary_buffer() {}
-};
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_TEMPBUF_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_tree.h b/contrib/libstdc++/stl/stl_tree.h
deleted file mode 100644
index c82943f..0000000
--- a/contrib/libstdc++/stl/stl_tree.h
+++ /dev/null
@@ -1,1333 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_TREE_H
-#define __SGI_STL_INTERNAL_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 <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_function.h>
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1375
-#endif
-
-typedef bool _Rb_tree_Color_type;
-const _Rb_tree_Color_type _S_rb_tree_red = false;
-const _Rb_tree_Color_type _S_rb_tree_black = true;
-
-struct _Rb_tree_node_base
-{
- typedef _Rb_tree_Color_type _Color_type;
- typedef _Rb_tree_node_base* _Base_ptr;
-
- _Color_type _M_color;
- _Base_ptr _M_parent;
- _Base_ptr _M_left;
- _Base_ptr _M_right;
-
- static _Base_ptr _S_minimum(_Base_ptr __x)
- {
- while (__x->_M_left != 0) __x = __x->_M_left;
- return __x;
- }
-
- static _Base_ptr _S_maximum(_Base_ptr __x)
- {
- while (__x->_M_right != 0) __x = __x->_M_right;
- return __x;
- }
-};
-
-template <class _Value>
-struct _Rb_tree_node : public _Rb_tree_node_base
-{
- typedef _Rb_tree_node<_Value>* _Link_type;
- _Value _M_value_field;
-};
-
-
-struct _Rb_tree_base_iterator
-{
- typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
- typedef bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
- _Base_ptr _M_node;
-
- void _M_increment()
- {
- if (_M_node->_M_right != 0) {
- _M_node = _M_node->_M_right;
- while (_M_node->_M_left != 0)
- _M_node = _M_node->_M_left;
- }
- else {
- _Base_ptr __y = _M_node->_M_parent;
- while (_M_node == __y->_M_right) {
- _M_node = __y;
- __y = __y->_M_parent;
- }
- if (_M_node->_M_right != __y)
- _M_node = __y;
- }
- }
-
- void _M_decrement()
- {
- if (_M_node->_M_color == _S_rb_tree_red &&
- _M_node->_M_parent->_M_parent == _M_node)
- _M_node = _M_node->_M_right;
- else if (_M_node->_M_left != 0) {
- _Base_ptr __y = _M_node->_M_left;
- while (__y->_M_right != 0)
- __y = __y->_M_right;
- _M_node = __y;
- }
- else {
- _Base_ptr __y = _M_node->_M_parent;
- while (_M_node == __y->_M_left) {
- _M_node = __y;
- __y = __y->_M_parent;
- }
- _M_node = __y;
- }
- }
-};
-
-template <class _Value, class _Ref, class _Ptr>
-struct _Rb_tree_iterator : public _Rb_tree_base_iterator
-{
- typedef _Value value_type;
- typedef _Ref reference;
- typedef _Ptr pointer;
- typedef _Rb_tree_iterator<_Value, _Value&, _Value*>
- iterator;
- typedef _Rb_tree_iterator<_Value, const _Value&, const _Value*>
- const_iterator;
- typedef _Rb_tree_iterator<_Value, _Ref, _Ptr>
- _Self;
- typedef _Rb_tree_node<_Value>* _Link_type;
-
- _Rb_tree_iterator() {}
- _Rb_tree_iterator(_Link_type __x) { _M_node = __x; }
- _Rb_tree_iterator(const iterator& __it) { _M_node = __it._M_node; }
-
- reference operator*() const { return _Link_type(_M_node)->_M_value_field; }
-#ifndef __SGI_STL_NO_ARROW_OPERATOR
- pointer operator->() const { return &(operator*()); }
-#endif /* __SGI_STL_NO_ARROW_OPERATOR */
-
- _Self& operator++() { _M_increment(); return *this; }
- _Self operator++(int) {
- _Self __tmp = *this;
- _M_increment();
- return __tmp;
- }
-
- _Self& operator--() { _M_decrement(); return *this; }
- _Self operator--(int) {
- _Self __tmp = *this;
- _M_decrement();
- return __tmp;
- }
-};
-
-inline bool operator==(const _Rb_tree_base_iterator& __x,
- const _Rb_tree_base_iterator& __y) {
- return __x._M_node == __y._M_node;
-}
-
-inline bool operator!=(const _Rb_tree_base_iterator& __x,
- const _Rb_tree_base_iterator& __y) {
- return __x._M_node != __y._M_node;
-}
-
-#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-inline bidirectional_iterator_tag
-iterator_category(const _Rb_tree_base_iterator&) {
- return bidirectional_iterator_tag();
-}
-
-inline _Rb_tree_base_iterator::difference_type*
-distance_type(const _Rb_tree_base_iterator&) {
- return (_Rb_tree_base_iterator::difference_type*) 0;
-}
-
-template <class _Value, class _Ref, class _Ptr>
-inline _Value* value_type(const _Rb_tree_iterator<_Value, _Ref, _Ptr>&) {
- return (_Value*) 0;
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-inline void
-_Rb_tree_rotate_left(_Rb_tree_node_base* __x, _Rb_tree_node_base*& __root)
-{
- _Rb_tree_node_base* __y = __x->_M_right;
- __x->_M_right = __y->_M_left;
- if (__y->_M_left !=0)
- __y->_M_left->_M_parent = __x;
- __y->_M_parent = __x->_M_parent;
-
- if (__x == __root)
- __root = __y;
- else if (__x == __x->_M_parent->_M_left)
- __x->_M_parent->_M_left = __y;
- else
- __x->_M_parent->_M_right = __y;
- __y->_M_left = __x;
- __x->_M_parent = __y;
-}
-
-inline void
-_Rb_tree_rotate_right(_Rb_tree_node_base* __x, _Rb_tree_node_base*& __root)
-{
- _Rb_tree_node_base* __y = __x->_M_left;
- __x->_M_left = __y->_M_right;
- if (__y->_M_right != 0)
- __y->_M_right->_M_parent = __x;
- __y->_M_parent = __x->_M_parent;
-
- if (__x == __root)
- __root = __y;
- else if (__x == __x->_M_parent->_M_right)
- __x->_M_parent->_M_right = __y;
- else
- __x->_M_parent->_M_left = __y;
- __y->_M_right = __x;
- __x->_M_parent = __y;
-}
-
-inline void
-_Rb_tree_rebalance(_Rb_tree_node_base* __x, _Rb_tree_node_base*& __root)
-{
- __x->_M_color = _S_rb_tree_red;
- while (__x != __root && __x->_M_parent->_M_color == _S_rb_tree_red) {
- if (__x->_M_parent == __x->_M_parent->_M_parent->_M_left) {
- _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_right;
- if (__y && __y->_M_color == _S_rb_tree_red) {
- __x->_M_parent->_M_color = _S_rb_tree_black;
- __y->_M_color = _S_rb_tree_black;
- __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
- __x = __x->_M_parent->_M_parent;
- }
- else {
- if (__x == __x->_M_parent->_M_right) {
- __x = __x->_M_parent;
- _Rb_tree_rotate_left(__x, __root);
- }
- __x->_M_parent->_M_color = _S_rb_tree_black;
- __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
- _Rb_tree_rotate_right(__x->_M_parent->_M_parent, __root);
- }
- }
- else {
- _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_left;
- if (__y && __y->_M_color == _S_rb_tree_red) {
- __x->_M_parent->_M_color = _S_rb_tree_black;
- __y->_M_color = _S_rb_tree_black;
- __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
- __x = __x->_M_parent->_M_parent;
- }
- else {
- if (__x == __x->_M_parent->_M_left) {
- __x = __x->_M_parent;
- _Rb_tree_rotate_right(__x, __root);
- }
- __x->_M_parent->_M_color = _S_rb_tree_black;
- __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red;
- _Rb_tree_rotate_left(__x->_M_parent->_M_parent, __root);
- }
- }
- }
- __root->_M_color = _S_rb_tree_black;
-}
-
-inline _Rb_tree_node_base*
-_Rb_tree_rebalance_for_erase(_Rb_tree_node_base* __z,
- _Rb_tree_node_base*& __root,
- _Rb_tree_node_base*& __leftmost,
- _Rb_tree_node_base*& __rightmost)
-{
- _Rb_tree_node_base* __y = __z;
- _Rb_tree_node_base* __x = 0;
- _Rb_tree_node_base* __x_parent = 0;
- if (__y->_M_left == 0) // __z has at most one non-null child. y == z.
- __x = __y->_M_right; // __x might be null.
- else
- if (__y->_M_right == 0) // __z has exactly one non-null child. y == z.
- __x = __y->_M_left; // __x is not null.
- else { // __z has two non-null children. Set __y to
- __y = __y->_M_right; // __z's successor. __x might be null.
- while (__y->_M_left != 0)
- __y = __y->_M_left;
- __x = __y->_M_right;
- }
- if (__y != __z) { // relink y in place of z. y is z's successor
- __z->_M_left->_M_parent = __y;
- __y->_M_left = __z->_M_left;
- if (__y != __z->_M_right) {
- __x_parent = __y->_M_parent;
- if (__x) __x->_M_parent = __y->_M_parent;
- __y->_M_parent->_M_left = __x; // __y must be a child of _M_left
- __y->_M_right = __z->_M_right;
- __z->_M_right->_M_parent = __y;
- }
- else
- __x_parent = __y;
- if (__root == __z)
- __root = __y;
- else if (__z->_M_parent->_M_left == __z)
- __z->_M_parent->_M_left = __y;
- else
- __z->_M_parent->_M_right = __y;
- __y->_M_parent = __z->_M_parent;
- __STD::swap(__y->_M_color, __z->_M_color);
- __y = __z;
- // __y now points to node to be actually deleted
- }
- else { // __y == __z
- __x_parent = __y->_M_parent;
- if (__x) __x->_M_parent = __y->_M_parent;
- if (__root == __z)
- __root = __x;
- else
- if (__z->_M_parent->_M_left == __z)
- __z->_M_parent->_M_left = __x;
- else
- __z->_M_parent->_M_right = __x;
- if (__leftmost == __z)
- if (__z->_M_right == 0) // __z->_M_left must be null also
- __leftmost = __z->_M_parent;
- // makes __leftmost == _M_header if __z == __root
- else
- __leftmost = _Rb_tree_node_base::_S_minimum(__x);
- if (__rightmost == __z)
- if (__z->_M_left == 0) // __z->_M_right must be null also
- __rightmost = __z->_M_parent;
- // makes __rightmost == _M_header if __z == __root
- else // __x == __z->_M_left
- __rightmost = _Rb_tree_node_base::_S_maximum(__x);
- }
- if (__y->_M_color != _S_rb_tree_red) {
- while (__x != __root && (__x == 0 || __x->_M_color == _S_rb_tree_black))
- if (__x == __x_parent->_M_left) {
- _Rb_tree_node_base* __w = __x_parent->_M_right;
- if (__w->_M_color == _S_rb_tree_red) {
- __w->_M_color = _S_rb_tree_black;
- __x_parent->_M_color = _S_rb_tree_red;
- _Rb_tree_rotate_left(__x_parent, __root);
- __w = __x_parent->_M_right;
- }
- if ((__w->_M_left == 0 ||
- __w->_M_left->_M_color == _S_rb_tree_black) &&
- (__w->_M_right == 0 ||
- __w->_M_right->_M_color == _S_rb_tree_black)) {
- __w->_M_color = _S_rb_tree_red;
- __x = __x_parent;
- __x_parent = __x_parent->_M_parent;
- } else {
- if (__w->_M_right == 0 ||
- __w->_M_right->_M_color == _S_rb_tree_black) {
- if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black;
- __w->_M_color = _S_rb_tree_red;
- _Rb_tree_rotate_right(__w, __root);
- __w = __x_parent->_M_right;
- }
- __w->_M_color = __x_parent->_M_color;
- __x_parent->_M_color = _S_rb_tree_black;
- if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black;
- _Rb_tree_rotate_left(__x_parent, __root);
- break;
- }
- } else { // same as above, with _M_right <-> _M_left.
- _Rb_tree_node_base* __w = __x_parent->_M_left;
- if (__w->_M_color == _S_rb_tree_red) {
- __w->_M_color = _S_rb_tree_black;
- __x_parent->_M_color = _S_rb_tree_red;
- _Rb_tree_rotate_right(__x_parent, __root);
- __w = __x_parent->_M_left;
- }
- if ((__w->_M_right == 0 ||
- __w->_M_right->_M_color == _S_rb_tree_black) &&
- (__w->_M_left == 0 ||
- __w->_M_left->_M_color == _S_rb_tree_black)) {
- __w->_M_color = _S_rb_tree_red;
- __x = __x_parent;
- __x_parent = __x_parent->_M_parent;
- } else {
- if (__w->_M_left == 0 ||
- __w->_M_left->_M_color == _S_rb_tree_black) {
- if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black;
- __w->_M_color = _S_rb_tree_red;
- _Rb_tree_rotate_left(__w, __root);
- __w = __x_parent->_M_left;
- }
- __w->_M_color = __x_parent->_M_color;
- __x_parent->_M_color = _S_rb_tree_black;
- if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black;
- _Rb_tree_rotate_right(__x_parent, __root);
- break;
- }
- }
- if (__x) __x->_M_color = _S_rb_tree_black;
- }
- return __y;
-}
-
-// Base class to encapsulate the differences between old SGI-style
-// allocators and standard-conforming allocators. In order to avoid
-// having an empty base class, we arbitrarily move one of rb_tree's
-// data members into the base class.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-// _Base for general standard-conforming allocators.
-template <class _Tp, class _Alloc, bool _S_instanceless>
-class _Rb_tree_alloc_base {
-public:
- typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
- allocator_type get_allocator() const { return _M_node_allocator; }
-
- _Rb_tree_alloc_base(const allocator_type& __a)
- : _M_node_allocator(__a), _M_header(0) {}
-
-protected:
- typename _Alloc_traits<_Rb_tree_node<_Tp>, _Alloc>::allocator_type
- _M_node_allocator;
- _Rb_tree_node<_Tp>* _M_header;
-
- _Rb_tree_node<_Tp>* _M_get_node()
- { return _M_node_allocator.allocate(1); }
- void _M_put_node(_Rb_tree_node<_Tp>* __p)
- { _M_node_allocator.deallocate(__p, 1); }
-};
-
-// Specialization for instanceless allocators.
-template <class _Tp, class _Alloc>
-class _Rb_tree_alloc_base<_Tp, _Alloc, true> {
-public:
- typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Rb_tree_alloc_base(const allocator_type&) : _M_header(0) {}
-
-protected:
- _Rb_tree_node<_Tp>* _M_header;
-
- typedef typename _Alloc_traits<_Rb_tree_node<_Tp>, _Alloc>::_Alloc_type
- _Alloc_type;
-
- _Rb_tree_node<_Tp>* _M_get_node()
- { return _Alloc_type::allocate(1); }
- void _M_put_node(_Rb_tree_node<_Tp>* __p)
- { _Alloc_type::deallocate(__p, 1); }
-};
-
-template <class _Tp, class _Alloc>
-struct _Rb_tree_base
- : public _Rb_tree_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
-{
- typedef _Rb_tree_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
-
- _Rb_tree_base(const allocator_type& __a)
- : _Base(__a) { _M_header = _M_get_node(); }
- ~_Rb_tree_base() { _M_put_node(_M_header); }
-
-};
-
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-struct _Rb_tree_base
-{
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Rb_tree_base(const allocator_type&)
- : _M_header(0) { _M_header = _M_get_node(); }
- ~_Rb_tree_base() { _M_put_node(_M_header); }
-
-protected:
- _Rb_tree_node<_Tp>* _M_header;
-
- typedef simple_alloc<_Rb_tree_node<_Tp>, _Alloc> _Alloc_type;
-
- _Rb_tree_node<_Tp>* _M_get_node()
- { return _Alloc_type::allocate(1); }
- void _M_put_node(_Rb_tree_node<_Tp>* __p)
- { _Alloc_type::deallocate(__p, 1); }
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Key, class _Value, class _KeyOfValue, class _Compare,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
-class _Rb_tree : protected _Rb_tree_base<_Value, _Alloc> {
- typedef _Rb_tree_base<_Value, _Alloc> _Base;
-protected:
- typedef _Rb_tree_node_base* _Base_ptr;
- typedef _Rb_tree_node<_Value> _Rb_tree_node;
- typedef _Rb_tree_Color_type _Color_type;
-public:
- typedef _Key key_type;
- typedef _Value value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef _Rb_tree_node* _Link_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef typename _Base::allocator_type allocator_type;
- allocator_type get_allocator() const { return _Base::get_allocator(); }
-
-protected:
-#ifdef __STL_USE_NAMESPACES
- using _Base::_M_get_node;
- using _Base::_M_put_node;
- using _Base::_M_header;
-#endif /* __STL_USE_NAMESPACES */
-
-protected:
-
- _Link_type _M_create_node(const value_type& __x)
- {
- _Link_type __tmp = _M_get_node();
- __STL_TRY {
- construct(&__tmp->_M_value_field, __x);
- }
- __STL_UNWIND(_M_put_node(__tmp));
- return __tmp;
- }
-
- _Link_type _M_clone_node(_Link_type __x)
- {
- _Link_type __tmp = _M_create_node(__x->_M_value_field);
- __tmp->_M_color = __x->_M_color;
- __tmp->_M_left = 0;
- __tmp->_M_right = 0;
- return __tmp;
- }
-
- void destroy_node(_Link_type __p)
- {
- destroy(&__p->_M_value_field);
- _M_put_node(__p);
- }
-
-protected:
- size_type _M_node_count; // keeps track of size of tree
- _Compare _M_key_compare;
-
- _Link_type& _M_root() const
- { return (_Link_type&) _M_header->_M_parent; }
- _Link_type& _M_leftmost() const
- { return (_Link_type&) _M_header->_M_left; }
- _Link_type& _M_rightmost() const
- { return (_Link_type&) _M_header->_M_right; }
-
- static _Link_type& _S_left(_Link_type __x)
- { return (_Link_type&)(__x->_M_left); }
- static _Link_type& _S_right(_Link_type __x)
- { return (_Link_type&)(__x->_M_right); }
- static _Link_type& _S_parent(_Link_type __x)
- { return (_Link_type&)(__x->_M_parent); }
- static reference _S_value(_Link_type __x)
- { return __x->_M_value_field; }
- static const _Key& _S_key(_Link_type __x)
- { return _KeyOfValue()(_S_value(__x)); }
- static _Color_type& _S_color(_Link_type __x)
- { return (_Color_type&)(__x->_M_color); }
-
- static _Link_type& _S_left(_Base_ptr __x)
- { return (_Link_type&)(__x->_M_left); }
- static _Link_type& _S_right(_Base_ptr __x)
- { return (_Link_type&)(__x->_M_right); }
- static _Link_type& _S_parent(_Base_ptr __x)
- { return (_Link_type&)(__x->_M_parent); }
- static reference _S_value(_Base_ptr __x)
- { return ((_Link_type)__x)->_M_value_field; }
- static const _Key& _S_key(_Base_ptr __x)
- { return _KeyOfValue()(_S_value(_Link_type(__x)));}
- static _Color_type& _S_color(_Base_ptr __x)
- { return (_Color_type&)(_Link_type(__x)->_M_color); }
-
- static _Link_type _S_minimum(_Link_type __x)
- { return (_Link_type) _Rb_tree_node_base::_S_minimum(__x); }
-
- static _Link_type _S_maximum(_Link_type __x)
- { return (_Link_type) _Rb_tree_node_base::_S_maximum(__x); }
-
-public:
- typedef _Rb_tree_iterator<value_type, reference, pointer> iterator;
- typedef _Rb_tree_iterator<value_type, const_reference, const_pointer>
- const_iterator;
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
- typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- 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;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-private:
- iterator _M_insert(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
- _Link_type _M_copy(_Link_type __x, _Link_type __p);
- void _M_erase(_Link_type __x);
-
-public:
- // allocation/deallocation
- _Rb_tree()
- : _Base(allocator_type()), _M_node_count(0), _M_key_compare()
- { _M_empty_initialize(); }
-
- _Rb_tree(const _Compare& __comp)
- : _Base(allocator_type()), _M_node_count(0), _M_key_compare(__comp)
- { _M_empty_initialize(); }
-
- _Rb_tree(const _Compare& __comp, const allocator_type& __a)
- : _Base(__a), _M_node_count(0), _M_key_compare(__comp)
- { _M_empty_initialize(); }
-
- _Rb_tree(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x)
- : _Base(__x.get_allocator()),
- _M_node_count(0), _M_key_compare(__x._M_key_compare)
- {
- if (__x._M_root() == 0)
- _M_empty_initialize();
- else {
- _S_color(_M_header) = _S_rb_tree_red;
- _M_root() = _M_copy(__x._M_root(), _M_header);
- _M_leftmost() = _S_minimum(_M_root());
- _M_rightmost() = _S_maximum(_M_root());
- }
- _M_node_count = __x._M_node_count;
- }
- ~_Rb_tree() { clear(); }
- _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>&
- operator=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x);
-
-private:
- void _M_empty_initialize() {
- _S_color(_M_header) = _S_rb_tree_red; // used to distinguish header from
- // __root, in iterator.operator++
- _M_root() = 0;
- _M_leftmost() = _M_header;
- _M_rightmost() = _M_header;
- }
-
-public:
- // accessors:
- _Compare key_comp() const { return _M_key_compare; }
- iterator begin() { return _M_leftmost(); }
- const_iterator begin() const { return _M_leftmost(); }
- iterator end() { return _M_header; }
- const_iterator end() const { return _M_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 _M_node_count == 0; }
- size_type size() const { return _M_node_count; }
- size_type max_size() const { return size_type(-1); }
-
- void swap(_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __t) {
- __STD::swap(_M_header, __t._M_header);
- __STD::swap(_M_node_count, __t._M_node_count);
- __STD::swap(_M_key_compare, __t._M_key_compare);
- }
-
-public:
- // insert/erase
- pair<iterator,bool> insert_unique(const value_type& __x);
- iterator insert_equal(const value_type& __x);
-
- iterator insert_unique(iterator __position, const value_type& __x);
- iterator insert_equal(iterator __position, const value_type& __x);
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void insert_unique(_InputIterator __first, _InputIterator __last);
- template <class _InputIterator>
- void insert_equal(_InputIterator __first, _InputIterator __last);
-#else /* __STL_MEMBER_TEMPLATES */
- void insert_unique(const_iterator __first, const_iterator __last);
- void insert_unique(const value_type* __first, const value_type* __last);
- void insert_equal(const_iterator __first, const_iterator __last);
- void insert_equal(const value_type* __first, const value_type* __last);
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void erase(iterator __position);
- size_type erase(const key_type& __x);
- void erase(iterator __first, iterator __last);
- void erase(const key_type* __first, const key_type* __last);
- void clear() {
- if (_M_node_count != 0) {
- _M_erase(_M_root());
- _M_leftmost() = _M_header;
- _M_root() = 0;
- _M_rightmost() = _M_header;
- _M_node_count = 0;
- }
- }
-
-public:
- // set operations:
- 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;
- pair<iterator,iterator> equal_range(const key_type& __x);
- pair<const_iterator, const_iterator> equal_range(const key_type& __x) const;
-
-public:
- // Debugging.
- bool __rb_verify() const;
-};
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-inline bool
-operator==(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y)
-{
- return __x.size() == __y.size() &&
- equal(__x.begin(), __x.end(), __y.begin());
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-inline bool
-operator<(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x,
- const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y)
-{
- return lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-inline void
-swap(_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x,
- _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y)
-{
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>&
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::operator=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x)
-{
- if (this != &__x) {
- // Note that _Key may be a constant type.
- clear();
- _M_node_count = 0;
- _M_key_compare = __x._M_key_compare;
- if (__x._M_root() == 0) {
- _M_root() = 0;
- _M_leftmost() = _M_header;
- _M_rightmost() = _M_header;
- }
- else {
- _M_root() = _M_copy(__x._M_root(), _M_header);
- _M_leftmost() = _S_minimum(_M_root());
- _M_rightmost() = _S_maximum(_M_root());
- _M_node_count = __x._M_node_count;
- }
- }
- return *this;
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::_M_insert(_Base_ptr __x_, _Base_ptr __y_, const _Value& __v)
-{
- _Link_type __x = (_Link_type) __x_;
- _Link_type __y = (_Link_type) __y_;
- _Link_type __z;
-
- if (__y == _M_header || __x != 0 ||
- _M_key_compare(_KeyOfValue()(__v), _S_key(__y))) {
- __z = _M_create_node(__v);
- _S_left(__y) = __z; // also makes _M_leftmost() = __z
- // when __y == _M_header
- if (__y == _M_header) {
- _M_root() = __z;
- _M_rightmost() = __z;
- }
- else if (__y == _M_leftmost())
- _M_leftmost() = __z; // maintain _M_leftmost() pointing to min node
- }
- else {
- __z = _M_create_node(__v);
- _S_right(__y) = __z;
- if (__y == _M_rightmost())
- _M_rightmost() = __z; // maintain _M_rightmost() pointing to max node
- }
- _S_parent(__z) = __y;
- _S_left(__z) = 0;
- _S_right(__z) = 0;
- _Rb_tree_rebalance(__z, _M_header->_M_parent);
- ++_M_node_count;
- return iterator(__z);
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::insert_equal(const _Value& __v)
-{
- _Link_type __y = _M_header;
- _Link_type __x = _M_root();
- while (__x != 0) {
- __y = __x;
- __x = _M_key_compare(_KeyOfValue()(__v), _S_key(__x)) ?
- _S_left(__x) : _S_right(__x);
- }
- return _M_insert(__x, __y, __v);
-}
-
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-pair<typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator,
- bool>
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::insert_unique(const _Value& __v)
-{
- _Link_type __y = _M_header;
- _Link_type __x = _M_root();
- bool __comp = true;
- while (__x != 0) {
- __y = __x;
- __comp = _M_key_compare(_KeyOfValue()(__v), _S_key(__x));
- __x = __comp ? _S_left(__x) : _S_right(__x);
- }
- iterator __j = iterator(__y);
- if (__comp)
- if (__j == begin())
- return pair<iterator,bool>(_M_insert(__x, __y, __v), true);
- else
- --__j;
- if (_M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))
- return pair<iterator,bool>(_M_insert(__x, __y, __v), true);
- return pair<iterator,bool>(__j, false);
-}
-
-
-template <class _Key, class _Val, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
-_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>
- ::insert_unique(iterator __position, const _Val& __v)
-{
- if (__position._M_node == _M_header->_M_left) { // begin()
- if (size() > 0 &&
- _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node)))
- return _M_insert(__position._M_node, __position._M_node, __v);
- // first argument just needs to be non-null
- else
- return insert_unique(__v).first;
- } else if (__position._M_node == _M_header) { // end()
- if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__v)))
- return _M_insert(0, _M_rightmost(), __v);
- else
- return insert_unique(__v).first;
- } else {
- iterator __before = __position;
- --__before;
- if (_M_key_compare(_S_key(__before._M_node), _KeyOfValue()(__v))
- && _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) {
- if (_S_right(__before._M_node) == 0)
- return _M_insert(0, __before._M_node, __v);
- else
- return _M_insert(__position._M_node, __position._M_node, __v);
- // first argument just needs to be non-null
- } else
- return insert_unique(__v).first;
- }
-}
-
-template <class _Key, class _Val, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator
-_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>
- ::insert_equal(iterator __position, const _Val& __v)
-{
- if (__position._M_node == _M_header->_M_left) { // begin()
- if (size() > 0 &&
- _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node)))
- return _M_insert(__position._M_node, __position._M_node, __v);
- // first argument just needs to be non-null
- else
- return insert_equal(__v);
- } else if (__position._M_node == _M_header) {// end()
- if (!_M_key_compare(_KeyOfValue()(__v), _S_key(_M_rightmost())))
- return _M_insert(0, _M_rightmost(), __v);
- else
- return insert_equal(__v);
- } else {
- iterator __before = __position;
- --__before;
- if (!_M_key_compare(_KeyOfValue()(__v), _S_key(__before._M_node))
- && !_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) {
- if (_S_right(__before._M_node) == 0)
- return _M_insert(0, __before._M_node, __v);
- else
- return _M_insert(__position._M_node, __position._M_node, __v);
- // first argument just needs to be non-null
- } else
- return insert_equal(__v);
- }
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
- template<class _II>
-void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_equal(_II __first, _II __last)
-{
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
-}
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
- template<class _II>
-void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_unique(_II __first, _II __last) {
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
-}
-
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void
-_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_equal(const _Val* __first, const _Val* __last)
-{
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
-}
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void
-_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_equal(const_iterator __first, const_iterator __last)
-{
- for ( ; __first != __last; ++__first)
- insert_equal(*__first);
-}
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void
-_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_unique(const _Val* __first, const _Val* __last)
-{
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
-}
-
-template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc>
-void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc>
- ::insert_unique(const_iterator __first, const_iterator __last)
-{
- for ( ; __first != __last; ++__first)
- insert_unique(*__first);
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-inline void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::erase(iterator __position)
-{
- _Link_type __y =
- (_Link_type) _Rb_tree_rebalance_for_erase(__position._M_node,
- _M_header->_M_parent,
- _M_header->_M_left,
- _M_header->_M_right);
- destroy_node(__y);
- --_M_node_count;
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::size_type
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::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 _Val, class _KoV, class _Compare, class _Alloc>
-typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
-_Rb_tree<_Key,_Val,_KoV,_Compare,_Alloc>
- ::_M_copy(_Link_type __x, _Link_type __p)
-{
- // structural copy. __x and __p must be non-null.
- _Link_type __top = _M_clone_node(__x);
- __top->_M_parent = __p;
-
- __STL_TRY {
- if (__x->_M_right)
- __top->_M_right = _M_copy(_S_right(__x), __top);
- __p = __top;
- __x = _S_left(__x);
-
- while (__x != 0) {
- _Link_type __y = _M_clone_node(__x);
- __p->_M_left = __y;
- __y->_M_parent = __p;
- if (__x->_M_right)
- __y->_M_right = _M_copy(_S_right(__x), __y);
- __p = __y;
- __x = _S_left(__x);
- }
- }
- __STL_UNWIND(_M_erase(__top));
-
- return __top;
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::_M_erase(_Link_type __x)
-{
- // erase without rebalancing
- while (__x != 0) {
- _M_erase(_S_right(__x));
- _Link_type __y = _S_left(__x);
- destroy_node(__x);
- __x = __y;
- }
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::erase(iterator __first, iterator __last)
-{
- if (__first == begin() && __last == end())
- clear();
- else
- while (__first != __last) erase(__first++);
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::erase(const _Key* __first, const _Key* __last)
-{
- while (__first != __last) erase(*__first++);
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k)
-{
- _Link_type __y = _M_header; // Last node which is not less than __k.
- _Link_type __x = _M_root(); // Current node.
-
- while (__x != 0)
- if (!_M_key_compare(_S_key(__x), __k))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- iterator __j = iterator(__y);
- return (__j == end() || _M_key_compare(__k, _S_key(__j._M_node))) ?
- end() : __j;
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::const_iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k) const
-{
- _Link_type __y = _M_header; /* Last node which is not less than __k. */
- _Link_type __x = _M_root(); /* Current node. */
-
- while (__x != 0) {
- if (!_M_key_compare(_S_key(__x), __k))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
- }
- const_iterator __j = const_iterator(__y);
- return (__j == end() || _M_key_compare(__k, _S_key(__j._M_node))) ?
- end() : __j;
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::size_type
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::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, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::lower_bound(const _Key& __k)
-{
- _Link_type __y = _M_header; /* Last node which is not less than __k. */
- _Link_type __x = _M_root(); /* Current node. */
-
- while (__x != 0)
- if (!_M_key_compare(_S_key(__x), __k))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- return iterator(__y);
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::const_iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::lower_bound(const _Key& __k) const
-{
- _Link_type __y = _M_header; /* Last node which is not less than __k. */
- _Link_type __x = _M_root(); /* Current node. */
-
- while (__x != 0)
- if (!_M_key_compare(_S_key(__x), __k))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- return const_iterator(__y);
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::upper_bound(const _Key& __k)
-{
- _Link_type __y = _M_header; /* Last node which is greater than __k. */
- _Link_type __x = _M_root(); /* Current node. */
-
- while (__x != 0)
- if (_M_key_compare(__k, _S_key(__x)))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- return iterator(__y);
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::const_iterator
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::upper_bound(const _Key& __k) const
-{
- _Link_type __y = _M_header; /* Last node which is greater than __k. */
- _Link_type __x = _M_root(); /* Current node. */
-
- while (__x != 0)
- if (_M_key_compare(__k, _S_key(__x)))
- __y = __x, __x = _S_left(__x);
- else
- __x = _S_right(__x);
-
- return const_iterator(__y);
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-inline
-pair<typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator,
- typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator>
-_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
- ::equal_range(const _Key& __k)
-{
- return pair<iterator, iterator>(lower_bound(__k), upper_bound(__k));
-}
-
-template <class _Key, class _Value, class _KoV, class _Compare, class _Alloc>
-inline
-pair<typename _Rb_tree<_Key, _Value, _KoV, _Compare, _Alloc>::const_iterator,
- typename _Rb_tree<_Key, _Value, _KoV, _Compare, _Alloc>::const_iterator>
-_Rb_tree<_Key, _Value, _KoV, _Compare, _Alloc>
- ::equal_range(const _Key& __k) const
-{
- return pair<const_iterator,const_iterator>(lower_bound(__k),
- upper_bound(__k));
-}
-
-inline int
-__black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root)
-{
- if (__node == 0)
- return 0;
- else {
- int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0;
- if (__node == __root)
- return __bc;
- else
- return __bc + __black_count(__node->_M_parent, __root);
- }
-}
-
-template <class _Key, class _Value, class _KeyOfValue,
- class _Compare, class _Alloc>
-bool _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const
-{
- if (_M_node_count == 0 || begin() == end())
- return _M_node_count == 0 && begin() == end() &&
- _M_header->_M_left == _M_header && _M_header->_M_right == _M_header;
-
- int __len = __black_count(_M_leftmost(), _M_root());
- for (const_iterator __it = begin(); __it != end(); ++__it) {
- _Link_type __x = (_Link_type) __it._M_node;
- _Link_type __L = _S_left(__x);
- _Link_type __R = _S_right(__x);
-
- if (__x->_M_color == _S_rb_tree_red)
- if ((__L && __L->_M_color == _S_rb_tree_red) ||
- (__R && __R->_M_color == _S_rb_tree_red))
- return false;
-
- if (__L && _M_key_compare(_S_key(__x), _S_key(__L)))
- return false;
- if (__R && _M_key_compare(_S_key(__R), _S_key(__x)))
- return false;
-
- if (!__L && !__R && __black_count(__x, _M_root()) != __len)
- return false;
- }
-
- if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))
- return false;
- if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))
- return false;
-
- return true;
-}
-
-// Class rb_tree is not part of the C++ standard. It is provided for
-// compatibility with the HP STL.
-
-template <class _Key, class _Value, class _KeyOfValue, class _Compare,
- class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) >
-struct rb_tree : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>
-{
- typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base;
- typedef typename _Base::allocator_type allocator_type;
-
- rb_tree(const _Compare& __comp = _Compare(),
- const allocator_type& __a = allocator_type())
- : _Base(__comp, __a) {}
-
- ~rb_tree() {}
-};
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_TREE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_uninitialized.h b/contrib/libstdc++/stl/stl_uninitialized.h
deleted file mode 100644
index 3146c82..0000000
--- a/contrib/libstdc++/stl/stl_uninitialized.h
+++ /dev/null
@@ -1,279 +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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H
-#define __SGI_STL_INTERNAL_UNINITIALIZED_H
-
-__STL_BEGIN_NAMESPACE
-
-// uninitialized_copy
-
-// Valid if copy construction is equivalent to assignment, and if the
-// destructor is trivial.
-template <class _InputIter, class _ForwardIter>
-inline _ForwardIter
-__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
- _ForwardIter __result,
- __true_type)
-{
- return copy(__first, __last, __result);
-}
-
-template <class _InputIter, class _ForwardIter>
-_ForwardIter
-__uninitialized_copy_aux(_InputIter __first, _InputIter __last,
- _ForwardIter __result,
- __false_type)
-{
- _ForwardIter __cur = __result;
- __STL_TRY {
- for ( ; __first != __last; ++__first, ++__cur)
- construct(&*__cur, *__first);
- return __cur;
- }
- __STL_UNWIND(destroy(__result, __cur));
-}
-
-
-template <class _InputIter, class _ForwardIter, class _Tp>
-inline _ForwardIter
-__uninitialized_copy(_InputIter __first, _InputIter __last,
- _ForwardIter __result, _Tp*)
-{
- typedef typename __type_traits<_Tp>::is_POD_type _Is_POD;
- return __uninitialized_copy_aux(__first, __last, __result, _Is_POD());
-}
-
-template <class _InputIter, class _ForwardIter>
-inline _ForwardIter
- uninitialized_copy(_InputIter __first, _InputIter __last,
- _ForwardIter __result)
-{
- return __uninitialized_copy(__first, __last, __result,
- __VALUE_TYPE(__result));
-}
-
-inline char* uninitialized_copy(const char* __first, const char* __last,
- char* __result) {
- memmove(__result, __first, __last - __first);
- return __result + (__last - __first);
-}
-
-inline wchar_t*
-uninitialized_copy(const wchar_t* __first, const wchar_t* __last,
- wchar_t* __result)
-{
- memmove(__result, __first, sizeof(wchar_t) * (__last - __first));
- return __result + (__last - __first);
-}
-
-// uninitialized_copy_n (not part of the C++ standard)
-
-template <class _InputIter, class _Size, class _ForwardIter>
-pair<_InputIter, _ForwardIter>
-__uninitialized_copy_n(_InputIter __first, _Size __count,
- _ForwardIter __result,
- input_iterator_tag)
-{
- _ForwardIter __cur = __result;
- __STL_TRY {
- for ( ; __count > 0 ; --__count, ++__first, ++__cur)
- construct(&*__cur, *__first);
- return pair<_InputIter, _ForwardIter>(__first, __cur);
- }
- __STL_UNWIND(destroy(__result, __cur));
-}
-
-template <class _RandomAccessIter, class _Size, class _ForwardIter>
-inline pair<_RandomAccessIter, _ForwardIter>
-__uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
- _ForwardIter __result,
- random_access_iterator_tag) {
- _RandomAccessIter __last = __first + __count;
- return pair<_RandomAccessIter, _ForwardIter>(
- __last,
- uninitialized_copy(__first, __last, __result));
-}
-
-template <class _InputIter, class _Size, class _ForwardIter>
-inline pair<_InputIter, _ForwardIter>
-__uninitialized_copy_n(_InputIter __first, _Size __count,
- _ForwardIter __result) {
- return __uninitialized_copy_n(__first, __count, __result,
- __ITERATOR_CATEGORY(__first));
-}
-
-template <class _InputIter, class _Size, class _ForwardIter>
-inline pair<_InputIter, _ForwardIter>
-uninitialized_copy_n(_InputIter __first, _Size __count,
- _ForwardIter __result) {
- return __uninitialized_copy_n(__first, __count, __result,
- __ITERATOR_CATEGORY(__first));
-}
-
-// Valid if copy construction is equivalent to assignment, and if the
-// destructor is trivial.
-template <class _ForwardIter, class _Tp>
-inline void
-__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __x, __true_type)
-{
- fill(__first, __last, __x);
-}
-
-template <class _ForwardIter, class _Tp>
-void
-__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last,
- const _Tp& __x, __false_type)
-{
- _ForwardIter __cur = __first;
- __STL_TRY {
- for ( ; __cur != __last; ++__cur)
- construct(&*__cur, __x);
- }
- __STL_UNWIND(destroy(__first, __cur));
-}
-
-template <class _ForwardIter, class _Tp, class _Tp1>
-inline void __uninitialized_fill(_ForwardIter __first,
- _ForwardIter __last, const _Tp& __x, _Tp1*)
-{
- typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
- __uninitialized_fill_aux(__first, __last, __x, _Is_POD());
-
-}
-
-template <class _ForwardIter, class _Tp>
-inline void uninitialized_fill(_ForwardIter __first,
- _ForwardIter __last,
- const _Tp& __x)
-{
- __uninitialized_fill(__first, __last, __x, __VALUE_TYPE(__first));
-}
-
-// Valid if copy construction is equivalent to assignment, and if the
-// destructor is trivial.
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter
-__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
- const _Tp& __x, __true_type)
-{
- return fill_n(__first, __n, __x);
-}
-
-template <class _ForwardIter, class _Size, class _Tp>
-_ForwardIter
-__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n,
- const _Tp& __x, __false_type)
-{
- _ForwardIter __cur = __first;
- __STL_TRY {
- for ( ; __n > 0; --__n, ++__cur)
- construct(&*__cur, __x);
- return __cur;
- }
- __STL_UNWIND(destroy(__first, __cur));
-}
-
-template <class _ForwardIter, class _Size, class _Tp, class _Tp1>
-inline _ForwardIter
-__uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x, _Tp1*)
-{
- typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD;
- return __uninitialized_fill_n_aux(__first, __n, __x, _Is_POD());
-}
-
-template <class _ForwardIter, class _Size, class _Tp>
-inline _ForwardIter
-uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x)
-{
- return __uninitialized_fill_n(__first, __n, __x, __VALUE_TYPE(__first));
-}
-
-// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,
-// __uninitialized_fill_copy.
-
-// __uninitialized_copy_copy
-// Copies [first1, last1) into [result, result + (last1 - first1)), and
-// copies [first2, last2) into
-// [result, result + (last1 - first1) + (last2 - first2)).
-
-template <class _InputIter1, class _InputIter2, class _ForwardIter>
-inline _ForwardIter
-__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
- _InputIter2 __first2, _InputIter2 __last2,
- _ForwardIter __result)
-{
- _ForwardIter __mid = uninitialized_copy(__first1, __last1, __result);
- __STL_TRY {
- return uninitialized_copy(__first2, __last2, __mid);
- }
- __STL_UNWIND(destroy(__result, __mid));
-}
-
-// __uninitialized_fill_copy
-// Fills [result, mid) with x, and copies [first, last) into
-// [mid, mid + (last - first)).
-template <class _ForwardIter, class _Tp, class _InputIter>
-inline _ForwardIter
-__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid,
- const _Tp& __x,
- _InputIter __first, _InputIter __last)
-{
- uninitialized_fill(__result, __mid, __x);
- __STL_TRY {
- return uninitialized_copy(__first, __last, __mid);
- }
- __STL_UNWIND(destroy(__result, __mid));
-}
-
-// __uninitialized_copy_fill
-// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
-// fills [first2 + (last1 - first1), last2) with x.
-template <class _InputIter, class _ForwardIter, class _Tp>
-inline void
-__uninitialized_copy_fill(_InputIter __first1, _InputIter __last1,
- _ForwardIter __first2, _ForwardIter __last2,
- const _Tp& __x)
-{
- _ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2);
- __STL_TRY {
- uninitialized_fill(__mid2, __last2, __x);
- }
- __STL_UNWIND(destroy(__first2, __mid2));
-}
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_UNINITIALIZED_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/stl_vector.h b/contrib/libstdc++/stl/stl_vector.h
deleted file mode 100644
index d1149e9..0000000
--- a/contrib/libstdc++/stl/stl_vector.h
+++ /dev/null
@@ -1,823 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_VECTOR_H
-#define __SGI_STL_INTERNAL_VECTOR_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#pragma set woff 1375
-#endif
-
-// The vector base class serves two purposes. First, its constructor
-// and destructor allocate (but don't initialize) storage. This makes
-// exception safety easier. Second, the base class encapsulates all of
-// the differences between SGI-style allocators and standard-conforming
-// allocators.
-
-#ifdef __STL_USE_STD_ALLOCATORS
-
-// Base class for ordinary allocators.
-template <class _Tp, class _Allocator, bool _IsStatic>
-class _Vector_alloc_base {
-public:
- typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return _M_data_allocator; }
-
- _Vector_alloc_base(const allocator_type& __a)
- : _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
- {}
-
-protected:
- allocator_type _M_data_allocator;
- _Tp* _M_start;
- _Tp* _M_finish;
- _Tp* _M_end_of_storage;
-
- _Tp* _M_allocate(size_t __n)
- { return _M_data_allocator.allocate(__n); }
- void _M_deallocate(_Tp* __p, size_t __n)
- { if (__p) _M_data_allocator.deallocate(__p, __n); }
-};
-
-// Specialization for allocators that have the property that we don't
-// actually have to store an allocator object.
-template <class _Tp, class _Allocator>
-class _Vector_alloc_base<_Tp, _Allocator, true> {
-public:
- typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
- allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Vector_alloc_base(const allocator_type&)
- : _M_start(0), _M_finish(0), _M_end_of_storage(0)
- {}
-
-protected:
- _Tp* _M_start;
- _Tp* _M_finish;
- _Tp* _M_end_of_storage;
-
- typedef typename _Alloc_traits<_Tp, _Allocator>::_Alloc_type _Alloc_type;
- _Tp* _M_allocate(size_t __n)
- { return _Alloc_type::allocate(__n); }
- void _M_deallocate(_Tp* __p, size_t __n)
- { _Alloc_type::deallocate(__p, __n);}
-};
-
-template <class _Tp, class _Alloc>
-struct _Vector_base
- : public _Vector_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
-{
- typedef _Vector_alloc_base<_Tp, _Alloc,
- _Alloc_traits<_Tp, _Alloc>::_S_instanceless>
- _Base;
- typedef typename _Base::allocator_type allocator_type;
-
- _Vector_base(const allocator_type& __a) : _Base(__a) {}
- _Vector_base(size_t __n, const allocator_type& __a) : _Base(__a) {
- _M_start = _M_allocate(__n);
- _M_finish = _M_start;
- _M_end_of_storage = _M_start + __n;
- }
-
- ~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
-};
-
-#else /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc>
-class _Vector_base {
-public:
- typedef _Alloc allocator_type;
- allocator_type get_allocator() const { return allocator_type(); }
-
- _Vector_base(const _Alloc&)
- : _M_start(0), _M_finish(0), _M_end_of_storage(0) {}
- _Vector_base(size_t __n, const _Alloc&)
- : _M_start(0), _M_finish(0), _M_end_of_storage(0)
- {
- _M_start = _M_allocate(__n);
- _M_finish = _M_start;
- _M_end_of_storage = _M_start + __n;
- }
-
- ~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
-
-protected:
- _Tp* _M_start;
- _Tp* _M_finish;
- _Tp* _M_end_of_storage;
-
- typedef simple_alloc<_Tp, _Alloc> _M_data_allocator;
- _Tp* _M_allocate(size_t __n)
- { return _M_data_allocator::allocate(__n); }
- void _M_deallocate(_Tp* __p, size_t __n)
- { _M_data_allocator::deallocate(__p, __n); }
-};
-
-#endif /* __STL_USE_STD_ALLOCATORS */
-
-template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
-class vector : protected _Vector_base<_Tp, _Alloc>
-{
-private:
- typedef _Vector_base<_Tp, _Alloc> _Base;
-public:
- typedef _Tp value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef typename _Base::allocator_type allocator_type;
- allocator_type get_allocator() const { return _Base::get_allocator(); }
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
- typedef reverse_iterator<iterator> reverse_iterator;
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
- 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;
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-protected:
-#ifdef __STL_HAS_NAMESPACES
- using _Base::_M_allocate;
- using _Base::_M_deallocate;
- using _Base::_M_start;
- using _Base::_M_finish;
- using _Base::_M_end_of_storage;
-#endif /* __STL_HAS_NAMESPACES */
-
-protected:
- void _M_insert_aux(iterator __position, const _Tp& __x);
- void _M_insert_aux(iterator __position);
-
-public:
- iterator begin() { return _M_start; }
- const_iterator begin() const { return _M_start; }
- iterator end() { return _M_finish; }
- const_iterator end() const { return _M_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 size_type(-1) / sizeof(_Tp); }
- size_type capacity() const
- { return size_type(_M_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); }
-
- explicit vector(const allocator_type& __a = allocator_type())
- : _Base(__a) {}
-
- vector(size_type __n, const _Tp& __value,
- const allocator_type& __a = allocator_type())
- : _Base(__n, __a)
- { _M_finish = uninitialized_fill_n(_M_start, __n, __value); }
-
- explicit vector(size_type __n)
- : _Base(__n, allocator_type())
- { _M_finish = uninitialized_fill_n(_M_start, __n, _Tp()); }
-
- vector(const vector<_Tp, _Alloc>& __x)
- : _Base(__x.size(), __x.get_allocator())
- { _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); }
-
-#ifdef __STL_MEMBER_TEMPLATES
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- vector(_InputIterator __first, _InputIterator __last,
- const allocator_type& __a = allocator_type()) : _Base(__a) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_initialize_aux(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_initialize_aux(_Integer __n, _Integer __value, __true_type) {
- _M_start = _M_allocate(__n);
- _M_end_of_storage = _M_start + __n;
- _M_finish = uninitialized_fill_n(_M_start, __n, __value);
- }
-
- template <class _InputIterator>
- void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
- __false_type) {
- _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first));
- }
-
-#else
- vector(const _Tp* __first, const _Tp* __last,
- const allocator_type& __a = allocator_type())
- : _Base(__last - __first, __a)
- { _M_finish = uninitialized_copy(__first, __last, _M_start); }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- ~vector() { destroy(_M_start, _M_finish); }
-
- vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x);
- void reserve(size_type __n) {
- if (capacity() < __n) {
- const size_type __old_size = size();
- iterator __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish);
- destroy(_M_start, _M_finish);
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __tmp;
- _M_finish = __tmp + __old_size;
- _M_end_of_storage = _M_start + __n;
- }
- }
-
- // assign(), a generalized assignment member function. Two
- // versions: one that takes a count, and one that takes a range.
- // The range version is a member template, so we dispatch on whether
- // or not the type is an integer.
-
- void assign(size_type __n, const _Tp& __val);
-
-#ifdef __STL_MEMBER_TEMPLATES
-
- template <class _InputIterator>
- void assign(_InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_assign_dispatch(__first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
- { assign((size_type) __n, (_Tp) __val); }
-
- template <class _InputIter>
- void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
- { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
-
- template <class _InputIterator>
- void _M_assign_aux(_InputIterator __first, _InputIterator __last,
- input_iterator_tag);
-
- template <class _ForwardIterator>
- void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
- 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 _Tp& __x) {
- if (_M_finish != _M_end_of_storage) {
- construct(_M_finish, __x);
- ++_M_finish;
- }
- else
- _M_insert_aux(end(), __x);
- }
- void push_back() {
- if (_M_finish != _M_end_of_storage) {
- construct(_M_finish);
- ++_M_finish;
- }
- else
- _M_insert_aux(end());
- }
- void swap(vector<_Tp, _Alloc>& __x) {
- __STD::swap(_M_start, __x._M_start);
- __STD::swap(_M_finish, __x._M_finish);
- __STD::swap(_M_end_of_storage, __x._M_end_of_storage);
- }
-
- iterator insert(iterator __position, const _Tp& __x) {
- size_type __n = __position - begin();
- if (_M_finish != _M_end_of_storage && __position == end()) {
- construct(_M_finish, __x);
- ++_M_finish;
- }
- else
- _M_insert_aux(__position, __x);
- return begin() + __n;
- }
- iterator insert(iterator __position) {
- size_type __n = __position - begin();
- if (_M_finish != _M_end_of_storage && __position == end()) {
- construct(_M_finish);
- ++_M_finish;
- }
- else
- _M_insert_aux(__position);
- return begin() + __n;
- }
-#ifdef __STL_MEMBER_TEMPLATES
- // Check whether it's an integral type. If so, it's not an iterator.
- template <class _InputIterator>
- void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
- _M_insert_dispatch(__pos, __first, __last, _Integral());
- }
-
- template <class _Integer>
- void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
- __true_type) {
- insert(__pos, (size_type) __n, (_Tp) __val);
- }
-
- template <class _InputIterator>
- void _M_insert_dispatch(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- __false_type) {
- _M_range_insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
- }
-#else /* __STL_MEMBER_TEMPLATES */
- void insert(iterator __position,
- const_iterator __first, const_iterator __last);
-#endif /* __STL_MEMBER_TEMPLATES */
-
- void insert (iterator __pos, size_type __n, const _Tp& __x);
-
- void pop_back() {
- --_M_finish;
- destroy(_M_finish);
- }
- iterator erase(iterator __position) {
- if (__position + 1 != end())
- copy(__position + 1, _M_finish, __position);
- --_M_finish;
- destroy(_M_finish);
- return __position;
- }
- iterator erase(iterator __first, iterator __last) {
- iterator __i = copy(__last, _M_finish, __first);
- destroy(__i, _M_finish);
- _M_finish = _M_finish - (__last - __first);
- return __first;
- }
-
- void resize(size_type __new_size, const _Tp& __x) {
- if (__new_size < size())
- erase(begin() + __new_size, end());
- else
- insert(end(), __new_size - size(), __x);
- }
- void resize(size_type __new_size) { resize(__new_size, _Tp()); }
- void clear() { erase(begin(), end()); }
-
-protected:
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _ForwardIterator>
- iterator _M_allocate_and_copy(size_type __n, _ForwardIterator __first,
- _ForwardIterator __last)
-{
- iterator __result = _M_allocate(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __result);
- return __result;
- }
- __STL_UNWIND(_M_deallocate(__result, __n));
- }
-#else /* __STL_MEMBER_TEMPLATES */
- iterator _M_allocate_and_copy(size_type __n, const_iterator __first,
- const_iterator __last)
- {
- iterator __result = _M_allocate(__n);
- __STL_TRY {
- uninitialized_copy(__first, __last, __result);
- return __result;
- }
- __STL_UNWIND(_M_deallocate(__result, __n));
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _InputIterator>
- void _M_range_initialize(_InputIterator __first,
- _InputIterator __last, input_iterator_tag)
- {
- for ( ; __first != __last; ++__first)
- push_back(*__first);
- }
-
- // This function is only called by the constructor.
- template <class _ForwardIterator>
- void _M_range_initialize(_ForwardIterator __first,
- _ForwardIterator __last, forward_iterator_tag)
- {
- size_type __n = 0;
- distance(__first, __last, __n);
- _M_start = _M_allocate(__n);
- _M_end_of_storage = _M_start + __n;
- _M_finish = uninitialized_copy(__first, __last, _M_start);
- }
-
- template <class _InputIterator>
- void _M_range_insert(iterator __pos,
- _InputIterator __first, _InputIterator __last,
- input_iterator_tag);
-
- template <class _ForwardIterator>
- void _M_range_insert(iterator __pos,
- _ForwardIterator __first, _ForwardIterator __last,
- forward_iterator_tag);
-
-#endif /* __STL_MEMBER_TEMPLATES */
-};
-
-template <class _Tp, class _Alloc>
-inline bool
-operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
-{
- return __x.size() == __y.size() &&
- equal(__x.begin(), __x.end(), __y.begin());
-}
-
-template <class _Tp, class _Alloc>
-inline bool
-operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
-{
- return lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
-}
-
-#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
-
-template <class _Tp, class _Alloc>
-inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
-{
- __x.swap(__y);
-}
-
-#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
-
-template <class _Tp, class _Alloc>
-vector<_Tp,_Alloc>&
-vector<_Tp,_Alloc>::operator=(const vector<_Tp, _Alloc>& __x)
-{
- if (&__x != this) {
- const size_type __xlen = __x.size();
- if (__xlen > capacity()) {
- iterator __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end());
- destroy(_M_start, _M_finish);
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __tmp;
- _M_end_of_storage = _M_start + __xlen;
- }
- else if (size() >= __xlen) {
- iterator __i = copy(__x.begin(), __x.end(), begin());
- destroy(__i, _M_finish);
- }
- else {
- copy(__x.begin(), __x.begin() + size(), _M_start);
- uninitialized_copy(__x.begin() + size(), __x.end(), _M_finish);
- }
- _M_finish = _M_start + __xlen;
- }
- return *this;
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::assign(size_t __n, const value_type& __val) {
- if (__n > capacity()) {
- vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
- __tmp.swap(*this);
- }
- else if (__n > size()) {
- fill(begin(), end(), __val);
- _M_finish = uninitialized_fill_n(_M_finish, __n - size(), __val);
- }
- else
- erase(fill_n(begin(), __n, __val), end());
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc> template <class _InputIter>
-void vector<_Tp, _Alloc>::_M_assign_aux(_InputIter __first, _InputIter __last,
- input_iterator_tag) {
- iterator __cur = begin();
- for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
- *__cur = *__first;
- if (__first == __last)
- erase(__cur, end());
- else
- insert(end(), __first, __last);
-}
-
-template <class _Tp, class _Alloc> template <class _ForwardIter>
-void
-vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last,
- forward_iterator_tag) {
- size_type __len = 0;
- distance(__first, __last, __len);
-
- if (__len > capacity()) {
- iterator __tmp = _M_allocate_and_copy(__len, __first, __last);
- destroy(_M_start, _M_finish);
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __tmp;
- _M_end_of_storage = _M_finish = _M_start + __len;
- }
- else if (size() >= __len) {
- iterator __new_finish = copy(__first, __last, _M_start);
- destroy(__new_finish, _M_finish);
- _M_finish = __new_finish;
- }
- else {
- _ForwardIter __mid = __first;
- advance(__mid, size());
- copy(__first, __mid, _M_start);
- _M_finish = uninitialized_copy(__mid, __last, _M_finish);
- }
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void
-vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x)
-{
- if (_M_finish != _M_end_of_storage) {
- construct(_M_finish, *(_M_finish - 1));
- ++_M_finish;
- _Tp __x_copy = __x;
- copy_backward(__position, _M_finish - 2, _M_finish - 1);
- *__position = __x_copy;
- }
- else {
- const size_type __old_size = size();
- const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
- iterator __new_start = _M_allocate(__len);
- iterator __new_finish = __new_start;
- __STL_TRY {
- __new_finish = uninitialized_copy(_M_start, __position, __new_start);
- construct(__new_finish, __x);
- ++__new_finish;
- __new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
- }
- __STL_UNWIND((destroy(__new_start,__new_finish),
- _M_deallocate(__new_start,__len)));
- destroy(begin(), end());
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __new_start;
- _M_finish = __new_finish;
- _M_end_of_storage = __new_start + __len;
- }
-}
-
-template <class _Tp, class _Alloc>
-void
-vector<_Tp, _Alloc>::_M_insert_aux(iterator __position)
-{
- if (_M_finish != _M_end_of_storage) {
- construct(_M_finish, *(_M_finish - 1));
- ++_M_finish;
- copy_backward(__position, _M_finish - 2, _M_finish - 1);
- *__position = _Tp();
- }
- else {
- const size_type __old_size = size();
- const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
- iterator __new_start = _M_allocate(__len);
- iterator __new_finish = __new_start;
- __STL_TRY {
- __new_finish = uninitialized_copy(_M_start, __position, __new_start);
- construct(__new_finish);
- ++__new_finish;
- __new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
- }
- __STL_UNWIND((destroy(__new_start,__new_finish),
- _M_deallocate(__new_start,__len)));
- destroy(begin(), end());
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __new_start;
- _M_finish = __new_finish;
- _M_end_of_storage = __new_start + __len;
- }
-}
-
-template <class _Tp, class _Alloc>
-void vector<_Tp, _Alloc>::insert(iterator __position, size_type __n,
- const _Tp& __x)
-{
- if (__n != 0) {
- if (size_type(_M_end_of_storage - _M_finish) >= __n) {
- _Tp __x_copy = __x;
- const size_type __elems_after = _M_finish - __position;
- iterator __old_finish = _M_finish;
- if (__elems_after > __n) {
- uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
- _M_finish += __n;
- copy_backward(__position, __old_finish - __n, __old_finish);
- fill(__position, __position + __n, __x_copy);
- }
- else {
- uninitialized_fill_n(_M_finish, __n - __elems_after, __x_copy);
- _M_finish += __n - __elems_after;
- uninitialized_copy(__position, __old_finish, _M_finish);
- _M_finish += __elems_after;
- fill(__position, __old_finish, __x_copy);
- }
- }
- else {
- const size_type __old_size = size();
- const size_type __len = __old_size + max(__old_size, __n);
- iterator __new_start = _M_allocate(__len);
- iterator __new_finish = __new_start;
- __STL_TRY {
- __new_finish = uninitialized_copy(_M_start, __position, __new_start);
- __new_finish = uninitialized_fill_n(__new_finish, __n, __x);
- __new_finish
- = uninitialized_copy(__position, _M_finish, __new_finish);
- }
- __STL_UNWIND((destroy(__new_start,__new_finish),
- _M_deallocate(__new_start,__len)));
- destroy(_M_start, _M_finish);
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __new_start;
- _M_finish = __new_finish;
- _M_end_of_storage = __new_start + __len;
- }
- }
-}
-
-#ifdef __STL_MEMBER_TEMPLATES
-
-template <class _Tp, class _Alloc> template <class _InputIterator>
-void
-vector<_Tp, _Alloc>::_M_range_insert(iterator __pos,
- _InputIterator __first,
- _InputIterator __last,
- input_iterator_tag)
-{
- for ( ; __first != __last; ++__first) {
- __pos = insert(__pos, *__first);
- ++__pos;
- }
-}
-
-template <class _Tp, class _Alloc> template <class _ForwardIterator>
-void
-vector<_Tp, _Alloc>::_M_range_insert(iterator __position,
- _ForwardIterator __first,
- _ForwardIterator __last,
- forward_iterator_tag)
-{
- if (__first != __last) {
- size_type __n = 0;
- distance(__first, __last, __n);
- if (size_type(_M_end_of_storage - _M_finish) >= __n) {
- const size_type __elems_after = _M_finish - __position;
- iterator __old_finish = _M_finish;
- if (__elems_after > __n) {
- uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
- _M_finish += __n;
- copy_backward(__position, __old_finish - __n, __old_finish);
- copy(__first, __last, __position);
- }
- else {
- _ForwardIterator __mid = __first;
- advance(__mid, __elems_after);
- uninitialized_copy(__mid, __last, _M_finish);
- _M_finish += __n - __elems_after;
- uninitialized_copy(__position, __old_finish, _M_finish);
- _M_finish += __elems_after;
- copy(__first, __mid, __position);
- }
- }
- else {
- const size_type __old_size = size();
- const size_type __len = __old_size + max(__old_size, __n);
- iterator __new_start = _M_allocate(__len);
- iterator __new_finish = __new_start;
- __STL_TRY {
- __new_finish = uninitialized_copy(_M_start, __position, __new_start);
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- __new_finish
- = uninitialized_copy(__position, _M_finish, __new_finish);
- }
- __STL_UNWIND((destroy(__new_start,__new_finish),
- _M_deallocate(__new_start,__len)));
- destroy(_M_start, _M_finish);
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __new_start;
- _M_finish = __new_finish;
- _M_end_of_storage = __new_start + __len;
- }
- }
-}
-
-#else /* __STL_MEMBER_TEMPLATES */
-
-template <class _Tp, class _Alloc>
-void
-vector<_Tp, _Alloc>::insert(iterator __position,
- const_iterator __first,
- const_iterator __last)
-{
- if (__first != __last) {
- size_type __n = 0;
- distance(__first, __last, __n);
- if (size_type(_M_end_of_storage - _M_finish) >= __n) {
- const size_type __elems_after = _M_finish - __position;
- iterator __old_finish = _M_finish;
- if (__elems_after > __n) {
- uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
- _M_finish += __n;
- copy_backward(__position, __old_finish - __n, __old_finish);
- copy(__first, __last, __position);
- }
- else {
- uninitialized_copy(__first + __elems_after, __last, _M_finish);
- _M_finish += __n - __elems_after;
- uninitialized_copy(__position, __old_finish, _M_finish);
- _M_finish += __elems_after;
- copy(__first, __first + __elems_after, __position);
- }
- }
- else {
- const size_type __old_size = size();
- const size_type __len = __old_size + max(__old_size, __n);
- iterator __new_start = _M_allocate(__len);
- iterator __new_finish = __new_start;
- __STL_TRY {
- __new_finish = uninitialized_copy(_M_start, __position, __new_start);
- __new_finish = uninitialized_copy(__first, __last, __new_finish);
- __new_finish
- = uninitialized_copy(__position, _M_finish, __new_finish);
- }
- __STL_UNWIND((destroy(__new_start,__new_finish),
- _M_deallocate(__new_start,__len)));
- destroy(_M_start, _M_finish);
- _M_deallocate(_M_start, _M_end_of_storage - _M_start);
- _M_start = __new_start;
- _M_finish = __new_finish;
- _M_end_of_storage = __new_start + __len;
- }
- }
-}
-
-#endif /* __STL_MEMBER_TEMPLATES */
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#pragma reset woff 1375
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_VECTOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/tempbuf.h b/contrib/libstdc++/stl/tempbuf.h
deleted file mode 100644
index aa4f289..0000000
--- a/contrib/libstdc++/stl/tempbuf.h
+++ /dev/null
@@ -1,61 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_TEMPBUF_H
-#define __SGI_STL_TEMPBUF_H
-
-#ifndef __SGI_STL_PAIR_H
-#include <pair.h>
-#endif
-#include <limits.h> /* XXX should use <climits> */
-#include <stddef.h> /* XXX should use <cstddef> */
-#include <stdlib.h> /* XXX should use <cstdlib> */
-#ifndef __TYPE_TRAITS_H
-#include <type_traits.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H
-#include <stl_construct.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H
-#include <stl_uninitialized.h>
-#endif
-#ifndef __SGI_STL_INTERNAL_TEMPBUF_H
-#include <stl_tempbuf.h>
-#endif
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::get_temporary_buffer;
-using __STD::return_temporary_buffer;
-using __STD::temporary_buffer;
-
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_TEMPBUF_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/tree.h b/contrib/libstdc++/stl/tree.h
deleted file mode 100644
index 77c57cb..0000000
--- a/contrib/libstdc++/stl/tree.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- */
-
-#ifndef __SGI_STL_TREE_H
-#define __SGI_STL_TREE_H
-
-#ifndef __SGI_STL_INTERNAL_TREE_H
-#include <stl_tree.h>
-#endif
-#include <algobase.h>
-#include <alloc.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::rb_tree;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_TREE_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/type_traits.h b/contrib/libstdc++/stl/type_traits.h
deleted file mode 100644
index b6a7dfc6..0000000
--- a/contrib/libstdc++/stl/type_traits.h
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __TYPE_TRAITS_H
-#define __TYPE_TRAITS_H
-
-#ifndef __STL_CONFIG_H
-#include <stl_config.h>
-#endif
-
-/*
-This header file provides a framework for allowing compile time dispatch
-based on type attributes. This is useful when writing template code.
-For example, when making a copy of an array of an unknown type, it helps
-to know if the type has a trivial copy constructor or not, to help decide
-if a memcpy can be used.
-
-The class template __type_traits provides a series of typedefs each of
-which is either __true_type or __false_type. The argument to
-__type_traits can be any type. The typedefs within this template will
-attain their correct values by one of these means:
- 1. The general instantiation contain conservative values which work
- for all types.
- 2. Specializations may be declared to make distinctions between types.
- 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers)
- will automatically provide the appropriate specializations for all
- types.
-
-EXAMPLE:
-
-//Copy an array of elements which have non-trivial copy constructors
-template <class T> void copy(T* source, T* destination, int n, __false_type);
-//Copy an array of elements which have trivial copy constructors. Use memcpy.
-template <class T> void copy(T* source, T* destination, int n, __true_type);
-
-//Copy an array of any type by using the most efficient copy mechanism
-template <class T> inline void copy(T* source,T* destination,int n) {
- copy(source, destination, n,
- typename __type_traits<T>::has_trivial_copy_constructor());
-}
-*/
-
-
-struct __true_type {
-};
-
-struct __false_type {
-};
-
-template <class _Tp>
-struct __type_traits {
- typedef __true_type this_dummy_member_must_be_first;
- /* Do not remove this member. It informs a compiler which
- automatically specializes __type_traits that this
- __type_traits template is special. It just makes sure that
- things work if an implementation is using a template
- called __type_traits for something unrelated. */
-
- /* The following restrictions should be observed for the sake of
- compilers which automatically produce type specific specializations
- of this class:
- - You may reorder the members below if you wish
- - You may remove any of the members below if you wish
- - You must not rename members without making the corresponding
- name change in the compiler
- - Members you add will be treated like regular members unless
- you add the appropriate support in the compiler. */
-
-
- typedef __false_type has_trivial_default_constructor;
- typedef __false_type has_trivial_copy_constructor;
- typedef __false_type has_trivial_assignment_operator;
- typedef __false_type has_trivial_destructor;
- typedef __false_type is_POD_type;
-};
-
-
-
-// Provide some specializations. This is harmless for compilers that
-// have built-in __types_traits support, and essential for compilers
-// that don't.
-
-#ifndef __STL_NO_BOOL
-
-__STL_TEMPLATE_NULL struct __type_traits<bool> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#endif /* __STL_NO_BOOL */
-
-__STL_TEMPLATE_NULL struct __type_traits<char> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<signed char> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<unsigned char> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#ifdef __STL_HAS_WCHAR_T
-
-__STL_TEMPLATE_NULL struct __type_traits<wchar_t> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#endif /* __STL_HAS_WCHAR_T */
-
-__STL_TEMPLATE_NULL struct __type_traits<short> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<unsigned short> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<int> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<unsigned int> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<long> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<unsigned long> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#ifdef __STL_LONG_LONG
-
-__STL_TEMPLATE_NULL struct __type_traits<long long> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<unsigned long long> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#endif /* __STL_LONG_LONG */
-
-__STL_TEMPLATE_NULL struct __type_traits<float> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<double> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<long double> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _Tp>
-struct __type_traits<_Tp*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-__STL_TEMPLATE_NULL struct __type_traits<char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<signed char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<unsigned char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<const char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<const signed char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-__STL_TEMPLATE_NULL struct __type_traits<const unsigned char*> {
- typedef __true_type has_trivial_default_constructor;
- typedef __true_type has_trivial_copy_constructor;
- typedef __true_type has_trivial_assignment_operator;
- typedef __true_type has_trivial_destructor;
- typedef __true_type is_POD_type;
-};
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-
-// The following could be written in terms of numeric_limits.
-// We're doing it separately to reduce the number of dependencies.
-
-template <class _Tp> struct _Is_integer {
- typedef __false_type _Integral;
-};
-
-#ifndef __STL_NO_BOOL
-
-__STL_TEMPLATE_NULL struct _Is_integer<bool> {
- typedef __true_type _Integral;
-};
-
-#endif /* __STL_NO_BOOL */
-
-__STL_TEMPLATE_NULL struct _Is_integer<char> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<signed char> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned char> {
- typedef __true_type _Integral;
-};
-
-#ifdef __STL_HAS_WCHAR_T
-
-__STL_TEMPLATE_NULL struct _Is_integer<wchar_t> {
- typedef __true_type _Integral;
-};
-
-#endif /* __STL_HAS_WCHAR_T */
-
-__STL_TEMPLATE_NULL struct _Is_integer<short> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned short> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<int> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned int> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<long> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned long> {
- typedef __true_type _Integral;
-};
-
-#ifdef __STL_LONG_LONG
-
-__STL_TEMPLATE_NULL struct _Is_integer<long long> {
- typedef __true_type _Integral;
-};
-
-__STL_TEMPLATE_NULL struct _Is_integer<unsigned long long> {
- typedef __true_type _Integral;
-};
-
-#endif /* __STL_LONG_LONG */
-
-#endif /* __TYPE_TRAITS_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/utility b/contrib/libstdc++/stl/utility
deleted file mode 100644
index df8c224..0000000
--- a/contrib/libstdc++/stl/utility
+++ /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.
- *
- *
- * Copyright (c) 1996,1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_UTILITY
-#define __SGI_STL_UTILITY
-
-#include <stl_config.h>
-#include <stl_relops.h>
-#include <stl_pair.h>
-
-#endif /* __SGI_STL_UTILITY */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/vector b/contrib/libstdc++/stl/vector
deleted file mode 100644
index 4bcdebc..0000000
--- a/contrib/libstdc++/stl/vector
+++ /dev/null
@@ -1,41 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_VECTOR
-#define __SGI_STL_VECTOR
-
-#include <stl_algobase.h>
-#include <stl_alloc.h>
-#include <stl_construct.h>
-#include <stl_uninitialized.h>
-#include <stl_vector.h>
-#include <stl_bvector.h>
-
-#endif /* __SGI_STL_VECTOR */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stl/vector.h b/contrib/libstdc++/stl/vector.h
deleted file mode 100644
index 231a227..0000000
--- a/contrib/libstdc++/stl/vector.h
+++ /dev/null
@@ -1,42 +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.
- *
- *
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_VECTOR_H
-#define __SGI_STL_VECTOR_H
-
-#include <algobase.h>
-#include <alloc.h>
-#include <stl_vector.h>
-
-#ifdef __STL_USE_NAMESPACES
-using __STD::vector;
-#endif /* __STL_USE_NAMESPACES */
-
-#endif /* __SGI_STL_VECTOR_H */
-
-// Local Variables:
-// mode:C++
-// End:
diff --git a/contrib/libstdc++/stlinst.cc b/contrib/libstdc++/stlinst.cc
deleted file mode 100644
index 2a221fb..0000000
--- a/contrib/libstdc++/stlinst.cc
+++ /dev/null
@@ -1,10 +0,0 @@
-// Instantiation file for the -*- C++ -*- Standard Library allocator templates
-// This file is part of the GNU ANSI C++ Library.
-
-#include <alloc.h>
-
-#ifndef __USE_MALLOC
-template class __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>;
-#endif
-
-template class __malloc_alloc_template<0>;
diff --git a/contrib/libstdc++/string b/contrib/libstdc++/string
deleted file mode 100644
index fa6f1ab..0000000
--- a/contrib/libstdc++/string
+++ /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;
-// typedef basic_string <wchar_t> wstring;
-} // extern "C++"
-
-#endif
diff --git a/contrib/libstdc++/strstream b/contrib/libstdc++/strstream
deleted file mode 100644
index ee360e0..0000000
--- a/contrib/libstdc++/strstream
+++ /dev/null
@@ -1,7 +0,0 @@
-// -*- C++ -*- forwarding header.
-// This file is part of the GNU ANSI C++ Library.
-
-#ifndef __STRSTREAM__
-#define __STRSTREAM__
-#include <strstream.h>
-#endif
diff --git a/contrib/libstdc++/tests/ChangeLog b/contrib/libstdc++/tests/ChangeLog
deleted file mode 100644
index 3bcb473..0000000
--- a/contrib/libstdc++/tests/ChangeLog
+++ /dev/null
@@ -1,132 +0,0 @@
-Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com)
-
- * gcc-2.95.3 Released.
-
-Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.2 Released.
-
-Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.1 Released.
-
-Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-1998-07-17 Jason Merrill <jason@yorick.cygnus.com>
-
- * tmap.cc: Use less<int>.
- * tlist.cc (main): Use remove_if.
-
-1998-07-13 Manfred Hollstein <manfred@s-direktnet.de>
-
- * Makefile.in (VERSION): Bump to 2.9.0.
-
-1998-07-12 Bob Sidebotham <rns@fore.com>
-
- * tstring.cc (findtest): New fn.
-
-1998-06-01 Jason Merrill <jason@yorick.cygnus.com>
-
- * tlist.cc, tvector.cc, tmap.cc: Remove explicit instantiations.
-
-Fri Oct 10 00:40:31 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tstring.cc (identitytest): s/remove/erase/.
-
-Thu Sep 25 19:48:22 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tstring.cc: Add some tests for the member templates.
-
-Wed Jun 11 11:00:10 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * tmap.cc: Explicitly instantiate allocator classes.
- * tvector.cc, tlist.cc: Likewise.
-
-Fri May 16 18:38:05 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * tcomplex.cc (main): If we're using short doubles, compensate for
- roundoff in result of pow(a,b).
-
-Thu May 1 17:37:53 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * configure.in (CHECK): Add $(CXXFLAGS).
- * Makefile.in (tcomplex): Add $(CXXFLAGS).
-
-Fri Apr 25 16:07:46 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * configure.in: Change "check" to "check-old". Add do-nothing
- check target.
-
-Sun Nov 3 12:44:48 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tstring.cc: Treat string literals as const.
-
-Tue Sep 24 18:00:20 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * tstring.cc, tcomplex.cc: Remove gratuitous uses of std/.
-
-Mon Jun 17 14:05:50 1996 Per Bothner <bothner@deneb.cygnus.com>
-
- * tlist.cc (test_splice): New test.
-
-Fri Mar 22 16:08:36 1996 Jason Merrill <jason@yorick.cygnus.com>
-
- * Makefile.in (VERSION): 2.8.0.
-
- * tlist.cc, tmap.cc, tvector.cc: Remove explicit instantiation
- directive.
-
-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/libstdc++/tests/Makefile.in b/contrib/libstdc++/tests/Makefile.in
deleted file mode 100644
index 057482f..0000000
--- a/contrib/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.9.0
-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) $(CXXFLAGS) -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/libstdc++/tests/configure.in b/contrib/libstdc++/tests/configure.in
deleted file mode 100644
index 06c5619..0000000
--- a/contrib/libstdc++/tests/configure.in
+++ /dev/null
@@ -1,65 +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
-package_makefile_rules_frag=Make.pack.r
-
-# 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} 2>${package_makefile_rules_frag}
-
-# post-target:
-
-CHECK=""
-
-for TEST in ${SIMPLE_TESTS} ; do
- echo "${TEST}: ${TEST}.o" '$(DEPLIBS)
- $(CXX) $(CXXFLAGS) -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
-
-if [ "${srcdir}" = "." ] ; then
- if [ "${with_target_subdir}" != "." ] ; then
- topsrcdir=${with_multisrctop}../../..
- else
- topsrcdir=${with_multisrctop}../..
- fi
-else
- topsrcdir=${srcdir}/../..
-fi
-
-if [ -d ${topsrcdir}/gcc ] ; then
- echo "
-check:
-check-old: ${CHECK}" >>Makefile
-else
- echo "
-check: ${CHECK}" >>Makefile
-fi
diff --git a/contrib/libstdc++/tests/tcomplex.cc b/contrib/libstdc++/tests/tcomplex.cc
deleted file mode 100644
index 5311f0d..0000000
--- a/contrib/libstdc++/tests/tcomplex.cc
+++ /dev/null
@@ -1,151 +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 <assert.h>
-#include <iostream.h>
-#include <complex>
-
-// 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";
- {
- double_complex p = pow(a, b);
- if(sizeof(float)==sizeof(double)) {
- long w = (long)(p.imag()*100000);
- if (w==-98642)
- p=double_complex(-0.753046,-0.986429);
- }
- cout << "pow(a, b) = " << p << "\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/libstdc++/tests/tcomplex.exp b/contrib/libstdc++/tests/tcomplex.exp
deleted file mode 100644
index 5bef15c..0000000
--- a/contrib/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/libstdc++/tests/tcomplex.inp b/contrib/libstdc++/tests/tcomplex.inp
deleted file mode 100644
index c4e1d84..0000000
--- a/contrib/libstdc++/tests/tcomplex.inp
+++ /dev/null
@@ -1 +0,0 @@
-(1.2, -34)
diff --git a/contrib/libstdc++/tests/tlist.cc b/contrib/libstdc++/tests/tlist.cc
deleted file mode 100644
index a37c999..0000000
--- a/contrib/libstdc++/tests/tlist.cc
+++ /dev/null
@@ -1,151 +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);
- g.remove_if (is_odd);
- 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/libstdc++/tests/tlist.exp b/contrib/libstdc++/tests/tlist.exp
deleted file mode 100644
index 65f7806..0000000
--- a/contrib/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/libstdc++/tests/tmap.cc b/contrib/libstdc++/tests/tmap.cc
deleted file mode 100644
index 900e66f..0000000
--- a/contrib/libstdc++/tests/tmap.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <map.h>
-#include <algo.h>
-#include <iostream.h>
-#include <function.h>
-
-#define int_less less<int>
-struct str_less {
- bool operator() (char* x, char* y) const { return strcmp(x,y) < 0; }
-};
-
-#if 0
-int SIZE;
-
-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/libstdc++/tests/tmap.exp b/contrib/libstdc++/tests/tmap.exp
deleted file mode 100644
index b7b5df2..0000000
--- a/contrib/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/libstdc++/tests/tstring.cc b/contrib/libstdc++/tests/tstring.cc
deleted file mode 100644
index 833d3d9..0000000
--- a/contrib/libstdc++/tests/tstring.cc
+++ /dev/null
@@ -1,249 +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 <string>
-#include <algorithm>
-#include <iostream.h>
-#include <stdlib.h>
-#include <assert.h>
-
-string X = "Hello";
-string Y = "world";
-string N = "123";
-string c;
-const 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);
-
- int ar[] = { 'H', 'e', 'l', 'l', 'o' };
- string is (ar, ar+sizeof(ar)/sizeof(ar[0]));
- cout << "is = " << is << endl;
- assert (is == "Hello");
-}
-
-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
-findtest()
-{
- string x;
- string::size_type pos;
- pos = x.find_last_not_of('X');
- assert(pos == string::npos);
- pos = x.find_last_not_of("XYZ");
- assert(pos == string::npos);
-
- string y("a");
- pos = y.find_last_not_of('X');
- assert(pos == 0);
- pos = y.find_last_not_of('a');
- assert(pos == string::npos);
- pos = y.find_last_not_of("XYZ");
- assert(pos == 0);
- pos = y.find_last_not_of("a");
- assert(pos == string::npos);
-
- string z("ab");
- pos = z.find_last_not_of('X');
- assert(pos == 1);
- pos = z.find_last_not_of("XYZ");
- assert(pos == 1);
- pos = z.find_last_not_of('b');
- assert(pos == 0);
- pos = z.find_last_not_of("Xb");
- assert(pos == 0);
- pos = z.find_last_not_of("Xa");
- assert(pos == 1);
- pos = z.find_last_of("ab");
- assert(pos == 1);
- pos = z.find_last_of("Xa");
- assert(pos == 0);
- pos = z.find_last_of("Xb");
- assert(pos == 1);
- pos = z.find_last_of("XYZ");
- assert(pos == string::npos);
- pos = z.find_last_of('a');
- assert(pos == 0);
- pos = z.find_last_of('b');
- assert(pos == 1);
- pos = z.find_last_of('X');
- assert(pos == string::npos);
-}
-
-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");
-
- int ar[] = { 'H', 'e', 'l', 'l', 'o' };
- x.replace (find (x.begin (), x.end (), 'l'),
- find (x.rbegin (), x.rend (), 'l').base (),
- ar, ar+sizeof(ar)/sizeof(ar[0]));
- cout << "x = " << x << endl;
- assert (x == "jeHelloo");
-}
-
-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.erase (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();
- findtest();
- 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/libstdc++/tests/tstring.exp b/contrib/libstdc++/tests/tstring.exp
deleted file mode 100644
index 4526279..0000000
--- a/contrib/libstdc++/tests/tstring.exp
+++ /dev/null
@@ -1,22 +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
-is = Hello
-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
-x = jeHelloo
-enter a word:word =abcdefghijklmnopqrstuvwxyz length = 26
-
-End of test
diff --git a/contrib/libstdc++/tests/tstring.inp b/contrib/libstdc++/tests/tstring.inp
deleted file mode 100644
index b0883f3..0000000
--- a/contrib/libstdc++/tests/tstring.inp
+++ /dev/null
@@ -1 +0,0 @@
-abcdefghijklmnopqrstuvwxyz
diff --git a/contrib/libstdc++/tests/tvector.cc b/contrib/libstdc++/tests/tvector.cc
deleted file mode 100644
index ef238ef..0000000
--- a/contrib/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/libstdc++/tests/tvector.exp b/contrib/libstdc++/tests/tvector.exp
deleted file mode 100644
index 84a9d1b..0000000
--- a/contrib/libstdc++/tests/tvector.exp
+++ /dev/null
@@ -1,4 +0,0 @@
-Fill of C array:
-/************************************************/
-Fill of vector<char>:
-/------------------------------------------------/
diff --git a/contrib/libstdc++/testsuite/ChangeLog b/contrib/libstdc++/testsuite/ChangeLog
deleted file mode 100644
index 3d76027..0000000
--- a/contrib/libstdc++/testsuite/ChangeLog
+++ /dev/null
@@ -1,94 +0,0 @@
-Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com)
-
- * gcc-2.95.3 Released.
-
-Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.2 Released.
-
-Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95.1 Released.
-
-Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com)
-
- * gcc-2.95 Released.
-
-Wed Nov 25 01:00:07 1998 Marc Espie <espie@quatramaran.ens.fr>
-
- * Makefile.in (just-check): Ignore errors.
-
-Sun Jun 28 00:00:10 1998 Carlo Wood <carlo@runaway.xs4all.nl>
-
- * lib/libstdc++.exp: Use global variable ld_library_path (not local)
- that is a lot more persistent; dejagnu-980528 needs this.
- * lib/libstdc++.exp (test_stdc++): Use regular expression " -lstdc.."
- to remove -lstdc++ arguments (not " -lstdc.*").
-
-Thu Dec 25 00:34:03 1997 Jeffrey A Law (law@cygnus.com)
-
- * lib/libstdc++.exp (test_libstdc++): Set LD_LIBRARY_PATH
- and SHLIB_PATH appropriately.
-
-Wed Sep 3 09:39:36 1997 Jeffrey A Law (law@cygnus.com)
-
- * lib/libstdc++.exp: Remove libg++_link_flags.
-
-Wed Aug 6 18:43:23 1997 Jason Merrill <jason@yorick.cygnus.com>
-
- * lib/libstdc++.exp: Remove libio_link_flags.
-
-Thu Jul 17 14:54:58 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * lib/libstdc++.exp (base_dir): Move from here...
- (test_libstdc++): To here.
- (LIBSTDCPP): Delete unused global decl.
-
-Tue Jun 17 01:46:49 1997 Bob Manson <manson@farmer>
-
- * lib/libstdc++.exp: Strip off leading LFs from both the pattern
- being matched against and the output from the board. Find the
- correct multilib libstdc++ to link with. Use g++_link_flags
- and libio_link_flags. Link in the status wrapper if needed.
- (libstdc++_init): New procedure.
-
-Tue Jun 3 17:16:39 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * lib/libstdc++.exp: Don't use global exec_output variable; the
- output is returned from remote_load instead.
-
-Tue Apr 29 17:20:05 1997 Mike Stump <mrs@cygnus.com>
-
- * lib/libstdc++.exp: Fixup so that $compile_args works better.
- * libstdc++.tests/test.exp: Also run with -O.
-
-Tue Apr 29 16:34:37 1997 Mike Stump <mrs@cygnus.com>
-
- * testsuite/lib/libstdc++.exp: Fixup so that we always have the
- same number of testcases, and so that we have meaningful testcase
- names.
-
-Tue Apr 29 13:05:14 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * lib/libstdc++.exp: Add support for --tool_opts.
-
-Mon Apr 28 11:10:25 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * Makefile.in: Add comment so target Makefile fragments get added.
- Removed clean rule, because it is added by configure.
-
- * configure.in (TESTS): Add.
-
-Sun Apr 27 15:03:10 1997 Brendan Kehoe <brendan@lisa.cygnus.com>
-
- * Makefile.in (clean): Add empty rule for now.
-
-Fri Apr 25 18:59:14 1997 Bob Manson <manson@charmed.cygnus.com>
-
- * lib/libstdc++.exp(test_libstdc++): Return on error. Generate a
- FAIL if the compile fails. Remove CRs from the output from the
- testcase.
diff --git a/contrib/libstdc++/testsuite/Makefile.in b/contrib/libstdc++/testsuite/Makefile.in
deleted file mode 100644
index 20f9ec9..0000000
--- a/contrib/libstdc++/testsuite/Makefile.in
+++ /dev/null
@@ -1,428 +0,0 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_alias = @build_alias@
-build_triplet = @build@
-host_alias = @host_alias@
-host_triplet = @host@
-target_alias = @target_alias@
-target_triplet = @target@
-AR = @AR@
-AS = @AS@
-ATOMICITY_INC_SRCDIR = @ATOMICITY_INC_SRCDIR@
-AWK = @AWK@
-BASIC_FILE_H = @BASIC_FILE_H@
-CC = @CC@
-CCODECVT_C = @CCODECVT_C@
-CCODECVT_H = @CCODECVT_H@
-CLOCALE_H = @CLOCALE_H@
-CMESSAGES_H = @CMESSAGES_H@
-CPP = @CPP@
-CPU_LIMITS_INC_SRCDIR = @CPU_LIMITS_INC_SRCDIR@
-CSTDIO_H = @CSTDIO_H@
-CXXCPP = @CXXCPP@
-C_INCLUDE_DIR = @C_INCLUDE_DIR@
-DEBUG_FLAGS = @DEBUG_FLAGS@
-DLLTOOL = @DLLTOOL@
-EXEEXT = @EXEEXT@
-EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
-GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
-GLIBCPP_IS_CROSS_COMPILING = @GLIBCPP_IS_CROSS_COMPILING@
-LIBIO_INCLUDES = @LIBIO_INCLUDES@
-LIBMATHOBJS = @LIBMATHOBJS@
-LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
-LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
-LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
-LIBTOOL = @LIBTOOL@
-LIBUNWIND_FLAG = @LIBUNWIND_FLAG@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
-OPT_LDFLAGS = @OPT_LDFLAGS@
-OS_INC_SRCDIR = @OS_INC_SRCDIR@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-SECTION_FLAGS = @SECTION_FLAGS@
-SECTION_LDFLAGS = @SECTION_LDFLAGS@
-STRIP = @STRIP@
-TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-WARN_FLAGS = @WARN_FLAGS@
-WERROR = @WERROR@
-baseline_file = @baseline_file@
-check_msgfmt = @check_msgfmt@
-enable_shared = @enable_shared@
-enable_static = @enable_static@
-glibcpp_CXX = @glibcpp_CXX@
-glibcpp_MOFILES = @glibcpp_MOFILES@
-glibcpp_POFILES = @glibcpp_POFILES@
-glibcpp_basedir = @glibcpp_basedir@
-glibcpp_builddir = @glibcpp_builddir@
-glibcpp_localedir = @glibcpp_localedir@
-glibcpp_prefixdir = @glibcpp_prefixdir@
-glibcpp_srcdir = @glibcpp_srcdir@
-glibcpp_thread_h = @glibcpp_thread_h@
-glibcpp_toolexecdir = @glibcpp_toolexecdir@
-glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
-gxx_include_dir = @gxx_include_dir@
-ifGNUmake = @ifGNUmake@
-libio_la = @libio_la@
-libtool_VERSION = @libtool_VERSION@
-toplevel_srcdir = @toplevel_srcdir@
-
-AUTOMAKE_OPTIONS = cygnus dejagnu
-
-DEJATOOL = libstdc++-v3
-
-EXPECT = `if [ -f @glibcpp_builddir@/../../expect/expect ] ; then \
- echo @glibcpp_builddir@/../../expect/expect ; \
- else echo expect ; fi`
-
-
-RUNTEST = `if [ -f @glibcpp_srcdir@/../dejagnu/runtest ] ; then \
- echo @glibcpp_srcdir@/../dejagnu/runtest ; \
- else echo runtest; fi`
-
-
-RUNTESTFLAGS =
-
-CXX_fake = @glibcpp_CXX@
-CXX = `echo $(CXX_fake) | sed 's/xgcc/g++/g'`
-CXXLINK = \
- LD_RUN_PATH=${LD_RUN_PATH:+$LD_RUN_PATH:}${glibcpp_builddir}/src/.libs\
- $(LIBTOOL) --tag=CXX --mode=link $(CXX) \
- $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
-
-
-INCLUDES = \
- -nostdinc++ \
- @GLIBCPP_INCLUDES@ @LIBSUPCXX_INCLUDES@ @TOPLEVEL_INCLUDES@
-
-@GLIBCPP_BUILD_ABI_CHECK_TRUE@noinst_PROGRAMS = @GLIBCPP_BUILD_ABI_CHECK_TRUE@abi_check
-@GLIBCPP_BUILD_ABI_CHECK_FALSE@noinst_PROGRAMS =
-abi_check_SOURCES = abi_check.cc
-mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-@GLIBCPP_BUILD_ABI_CHECK_FALSE@noinst_PROGRAMS =
-PROGRAMS = $(noinst_PROGRAMS)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I..
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-abi_check_OBJECTS = abi_check.$(OBJEXT)
-abi_check_LDADD = $(LDADD)
-abi_check_DEPENDENCIES =
-abi_check_LDFLAGS =
-CXXFLAGS = @CXXFLAGS@
-CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-DIST_COMMON = README Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = gtar
-GZIP_ENV = --best
-SOURCES = $(abi_check_SOURCES)
-OBJECTS = $(abi_check_OBJECTS)
-
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .S .c .cc .lo .o .obj .s
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --cygnus testsuite/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-mostlyclean-noinstPROGRAMS:
-
-clean-noinstPROGRAMS:
- -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-
-distclean-noinstPROGRAMS:
-
-maintainer-clean-noinstPROGRAMS:
-
-.c.o:
- $(COMPILE) -c $<
-
-# FIXME: We should only use cygpath when building on Windows,
-# and only if it is available.
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.o:
- $(COMPILE) -c $<
-
-mostlyclean-compile:
- -rm -f *.o core *.core
- -rm -f *.$(OBJEXT)
-
-clean-compile:
-
-distclean-compile:
- -rm -f *.tab.c
-
-maintainer-clean-compile:
-
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.s.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-.S.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-distclean-libtool:
-
-maintainer-clean-libtool:
-
-abi_check$(EXEEXT): $(abi_check_OBJECTS) $(abi_check_DEPENDENCIES)
- @rm -f abi_check$(EXEEXT)
- $(CXXLINK) $(abi_check_LDFLAGS) $(abi_check_OBJECTS) $(abi_check_LDADD) $(LIBS)
-.cc.o:
- $(CXXCOMPILE) -c $<
-.cc.obj:
- $(CXXCOMPILE) -c `cygpath -w $<`
-.cc.lo:
- $(LTCXXCOMPILE) -c $<
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = testsuite
-
-distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
-
-RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir
-
-check-DEJAGNU: site.exp
- srcdir=`cd $(srcdir) && pwd`; export srcdir; \
- EXPECT=$(EXPECT); export EXPECT; \
- if [ -f $(top_builddir)/../expect/expect ]; then \
- TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \
- export TCL_LIBRARY; \
- fi; \
- runtest=$(RUNTEST); \
- if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
- $$runtest $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
- else echo "WARNING: could not find \`runtest'" 1>&2; :;\
- fi
-site.exp: Makefile
- @echo 'Making a new site.exp file...'
- @test ! -f site.bak || rm -f site.bak
- @echo '## these variables are automatically generated by make ##' > $@-t
- @echo '# Do not edit here. If you wish to override these values' >> $@-t
- @echo '# edit the last section' >> $@-t
- @echo 'set tool $(DEJATOOL)' >> $@-t
- @echo 'set srcdir $(srcdir)' >> $@-t
- @echo 'set objdir' `pwd` >> $@-t
- @echo 'set host_alias $(host_alias)' >> $@-t
- @echo 'set host_triplet $(host_triplet)' >> $@-t
- @echo 'set target_alias $(target_alias)' >> $@-t
- @echo 'set target_triplet $(target_triplet)' >> $@-t
- @echo 'set build_alias $(build_alias)' >> $@-t
- @echo 'set build_triplet $(build_triplet)' >> $@-t
- @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
- @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
- @test ! -f site.exp || mv site.exp site.bak
- @mv $@-t site.exp
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am:
- $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-info-am:
-install-info: install-info-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile $(PROGRAMS)
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
-mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \
- mostlyclean-libtool mostlyclean-tags \
- mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
- clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-noinstPROGRAMS distclean-compile \
- distclean-libtool distclean-tags distclean-generic \
- clean-am
- -rm -f libtool
-
-distclean: distclean-am
-
-maintainer-clean-am: maintainer-clean-noinstPROGRAMS \
- maintainer-clean-compile maintainer-clean-libtool \
- maintainer-clean-tags maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
-clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile mostlyclean-libtool distclean-libtool \
-clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir check-DEJAGNU \
-info-am info dvi-am dvi check check-am installcheck-am installcheck \
-install-info-am install-info install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/contrib/libstdc++/testsuite/config/default.exp b/contrib/libstdc++/testsuite/config/default.exp
deleted file mode 100644
index dbe227b..0000000
--- a/contrib/libstdc++/testsuite/config/default.exp
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2001 Free Software Foundation, Inc.
-
-# This program 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 of the License, or
-# (at your option) any later version.
-#
-# This program 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 program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# libstdc++@gcc.gnu.org
-
-load_lib "standard.exp"
-
diff --git a/contrib/libstdc++/testsuite/configure.in b/contrib/libstdc++/testsuite/configure.in
deleted file mode 100644
index ad5f232..0000000
--- a/contrib/libstdc++/testsuite/configure.in
+++ /dev/null
@@ -1,24 +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=configure.in
-srcname="tests for ANSI C++ library, dejagnu style"
-package_makefile_frag=Make.pack
-package_makefile_rules_frag=Make.pack.r
-
-# 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"
-TESTS="tcomplex tstring tlist tmap tvector"
-MOSTLYCLEAN="*.o core ${TESTS} *.out"
-(. ${srcdir}/${TO_TOPDIR}libio/config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag}
-
-# post-target:
diff --git a/contrib/libstdc++/testsuite/lib/libstdc++.exp b/contrib/libstdc++/testsuite/lib/libstdc++.exp
deleted file mode 100644
index 3333dda..0000000
--- a/contrib/libstdc++/testsuite/lib/libstdc++.exp
+++ /dev/null
@@ -1,179 +0,0 @@
-# Copyright (C) 1997 Free Software Foundation, Inc.
-
-# This program 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 of the License, or
-# (at your option) any later version.
-#
-# This program 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 program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-lib-g++@prep.ai.mit.edu
-
-# This file was written by Bob Manson. (manson@cygnus.com)
-
-load_lib "libgloss.exp"
-
-global tmpdir
-
-if ![info exists tmpdir] {
- set tmpdir "/tmp"
-}
-
-#
-# Build the status wrapper library as needed.
-#
-proc libstdc++_init { args } {
- global wrapper_file;
- global wrap_compile_flags;
- set wrapper_file "";
- set wrap_compile_flags "";
- if [target_info exists needs_status_wrapper] {
- set result [build_wrapper "testglue.o"];
- if { $result != "" } {
- set wrapper_file [lindex $result 0];
- set wrap_compile_flags [lindex $result 1];
- } else {
- warning "Status wrapper failed to build."
- }
- }
-}
-#
-# Run the test specified by srcfile and resultfile. compile_args and
-# exec_args are additional arguments to be passed in when compiling and
-# running the testcase, respectively.
-#
-
-proc test_libstdc++ { options srcfile compile_args inpfile resultfile exec_args } {
- global base_dir
- global LIBSTDCPP
- global srcdir subdir objdir
- global TOOL_OPTIONS
- global ld_library_path
-
- if [info exists LIBSTDCPP] {
- set libstdcpp $LIBSTDCPP;
- } else {
- set gp [get_multilibs];
- if { $gp != "" } {
- if [file exists "$gp/libstdc++/libstdc++.a"] {
- set libstdcpp "-L$gp/libstdc++ -lstdc++";
- }
- }
- if ![info exists libstdcpp] {
- set libstdcpp [findfile $base_dir/../../libstdc++/libstdc++.a "-L$base_dir/../../libstdc++ -lstdc++" -lstdc++]
- }
- }
-
- verbose "using LIBSTDCPP = $libstdcpp" 2
- set args ""
-
- # Basically we want to build up a colon separated path list from
- # the value of $libstdcpp.
-
- # First strip away any -L arguments.
- regsub -all -- "-L" $libstdcpp "" ld_library_path
-
- # Then remove any -lstdc++ argument.
- regsub -all -- " -lstdc.." $ld_library_path "" ld_library_path
-
- # That's enough to make things work for the normal case.
- # If we wanted to handle an arbitrary value of libstdcpp,
- # then we'd have to do a lot more work.
-
- if { $compile_args != "" } {
- lappend args "additional_flags=$compile_args"
- }
- lappend args "incdir=.."
- lappend args "incdir=$srcdir/.."
- lappend args "incdir=$srcdir/../stl"
- lappend args "incdir=."
- if [info exists TOOL_OPTIONS] {
- lappend args "additional_flags=$TOOL_OPTIONS"
- }
-
- global wrapper_file wrap_compile_flags;
- # We have to include libio, for _G_config.h.
- lappend args "additional_flags=$wrap_compile_flags";
- lappend args "libs=$wrapper_file";
- lappend args "libs=$libstdcpp";
- lappend args "additional_flags=[libio_include_flags]"
- lappend args debug
-
- regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
- set executable "${objdir}/$out"
- set errname "[file tail $srcfile]"
- if { $compile_args != "" } {
- set errname "$errname $compile_args"
- }
-
- if { [target_compile $srcfile "$executable" executable $args] != "" } {
- fail "$errname compilation"
- setup_xfail "*-*-*"
- fail "$errname execution"
- setup_xfail "*-*-*"
- fail "$errname output"
- return;
- }
- pass "$errname compilation"
-
- set result [libstdc++_load $executable "$exec_args" "$inpfile"];
- set status [lindex $result 0];
- set output [lindex $result 1];
- $status "$errname execution"
- if { $status != "pass" } {
- setup_xfail "*-*-*"
- fail "$errname output"
- return;
- }
-
- verbose "resultfile is $resultfile"
- set id [open $resultfile r];
- set expected ""
- append expected [read $id];
- regsub -all "\r" "$output" "" output;
- regsub "\n*$" $expected "" expected
- regsub "\n*$" $output "" output
- regsub "^\n*" $expected "" expected
- regsub "^\n*" $output "" output
- regsub -all "\[ \t\]\[ \t\]*" $expected " " expected
- regsub -all "\[ \t\]*\n\n*" $expected "\n" expected
- regsub -all "\[ \t\]\[ \t\]*" $output " " output
- regsub -all "\[ \t\]*\n\n*" $output "\n" output
- verbose "expected is $expected"
- verbose "actual is $output"
- set passed 0;
- if {$options == "regexp_match"} {
- if [regexp $expected $output] {
- set passed 1;
- }
- } else {
- if { $expected == $output } {
- set passed 1;
- }
- }
- if { $passed == 1 } {
- pass "$errname output"
- } else {
- clone_output "expected was $expected"
- clone_output "output was $output"
- fail "$errname output"
- }
- close $id;
-}
-
-#
-# libstdc++_version -- extract and print the version number of libstdc++p
-#
-proc default_libstdc++_version {} {
-}
-
-proc default_libstdc++_start { } {
-}
diff --git a/contrib/libstdc++/testsuite/libstdc++.tests/test.exp b/contrib/libstdc++/testsuite/libstdc++.tests/test.exp
deleted file mode 100644
index 7368cfb..0000000
--- a/contrib/libstdc++/testsuite/libstdc++.tests/test.exp
+++ /dev/null
@@ -1,34 +0,0 @@
-global srcdir subdir
-
-catch "glob -nocomplain $srcdir/$subdir/../../tests/*.exp" srcfiles
-verbose "srcfiles are $srcfiles"
-
-set prefix ""
-foreach x $srcfiles {
- regsub "\\.exp$" $x "" prefix
- set bname [file tail $prefix]
- set args ""
- if [file exists $srcdir/$subdir/${bname}.arg] {
- set id [open "$srcdir/$subdir/${bname}.arg" r];
- set args [read -nonewline $id];
- close $id;
- }
- if [file exists $srcdir/$subdir/${bname}.xpo] {
- set resfile "$srcdir/$subdir/${bname}.xpo"
- set options "regexp_match"
- } else {
- set resfile "${prefix}.exp"
- set options ""
- }
-
- if [file exists ${prefix}.inp] {
- set inpfile ${prefix}.inp
- } else {
- set inpfile ""
- }
-
- verbose "inpfile is $inpfile"
-
- test_libstdc++ $options "${prefix}.cc" "" $inpfile $resfile $args
- test_libstdc++ $options "${prefix}.cc" "-O" $inpfile $resfile $args
-}
diff --git a/contrib/libstdc++/testsuite_flags.in b/contrib/libstdc++/testsuite_flags.in
deleted file mode 100755
index 1a24b5e..0000000
--- a/contrib/libstdc++/testsuite_flags.in
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-
-#
-# This script computes the various flags needed to run GNU C++ testsuites
-# (compiler specific as well as library specific).
-#
-# Written by Benjamin Kosnik <bkoz@redhat.com>
-# Gabriel Dos Reis <gdr@codesourcery.com>
-#
-
-# Print a message saying how this script is intended to be invoked
-print_usage() {
- cat <<EOF
-Usage:
- testsuite_flags --install-includes
- --build-includes
- --build-cxx
- --install-cxx
- --cxxflags
-EOF
-}
-
-# Establish configure-generated directory structure.
-BUILD_DIR=@glibcpp_builddir@
-SRC_DIR=@glibcpp_srcdir@
-PREFIX_DIR=@glibcpp_prefixdir@
-query=$1
-
-case ${query} in
- --install-includes)
- INCLUDES="-I${SRC_DIR}/testsuite"
- echo ${INCLUDES}
- ;;
- --build-includes)
- INCLUDES="-nostdinc++ @GLIBCPP_INCLUDES@
- -I${SRC_DIR}/libsupc++ -I${SRC_DIR}/libio
- -I${SRC_DIR}/include/backward
- -I${SRC_DIR}/testsuite"
- echo ${INCLUDES}
- ;;
- --install-cxx)
- CXX=${PREFIX_DIR}/bin/g++
- echo ${CXX}
- ;;
- --build-cxx)
- CC_build="@glibcpp_CXX@"
- CXX=`echo $CC_build | sed 's/xgcc/g++/g'`
- echo ${CXX}
- ;;
- --cxxflags)
- CXXFLAGS=' -g @SECTION_FLAGS@ @SECTION_LDFLAGS@
- -fmessage-length=0
- -DDEBUG_ASSERT -DLOCALEDIR="@glibcpp_localedir@" '
- echo ${CXXFLAGS}
- ;;
- *)
- print_usage
- ;;
-esac
-
-exit 0
diff --git a/contrib/libstdc++/valarray b/contrib/libstdc++/valarray
deleted file mode 100644
index a938b6a..0000000
--- a/contrib/libstdc++/valarray
+++ /dev/null
@@ -1,8 +0,0 @@
-// Main header for -*- C++ -*- valarray classes.
-
-#ifndef __VALARRAY__
-#define __VALARRAY__
-
-#include <std/std_valarray.h>
-
-#endif
diff --git a/contrib/libstdc++/valarray.cc b/contrib/libstdc++/valarray.cc
deleted file mode 100644
index 5e7fe0c..0000000
--- a/contrib/libstdc++/valarray.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <std/std_valarray.h>
-
-// Some Explicit Instanciations.
-template class multiplies<size_t>;
-template size_t accumulate(size_t*, size_t*, size_t, multiplies<size_t>);
-
-template void
- __valarray_fill(size_t* __restrict__, size_t, const size_t&);
-
-template void
- __valarray_copy(const size_t* __restrict__, size_t, size_t* __restrict__);
-
-template valarray<size_t>::valarray(size_t);
-template valarray<size_t>::~valarray();
-template valarray<size_t>::valarray(const valarray<size_t>&);
-template size_t valarray<size_t>::size() const;
-template size_t& valarray<size_t>::operator[](size_t);
-template size_t valarray<size_t>::product() const;
-
-
-void __gslice_to_index(size_t __o, const valarray<size_t>& __l,
- const valarray<size_t>& __s,
- valarray<size_t>& __i)
-{
- const size_t __n = __l.size();
- size_t* const __t = static_cast<size_t*>(alloca(__n*sizeof(size_t)));
- __valarray_fill(__t, __n, size_t(0));
- const size_t __z = __i.size();
- __valarray_fill(&__i[0], __z, __o);
- for (size_t __j=0; __j<__z; ++__j) {
- for (size_t __k=0; __k<__n; ++__k)
- __i[__j] += __s[__k]*__t[__k];
- ++__t[__n-1];
- for (size_t __k=__n-1; __k; --__k) {
- if (__t[__k] >= __l[__k]) {
- __t[__k] = 0;
- ++__t[__k-1];
- }
- }
- }
-}
-
-_Indexer::_Indexer(size_t __o, const valarray<size_t>& __l,
- const valarray<size_t>& __s)
- : _M_count(1), _M_start(__o), _M_size(__l), _M_stride(__s),
- _M_index(__l.size() ? __l.product() : 0)
-{ __gslice_to_index(__o, __l, __s, _M_index); }
-
-
-
OpenPOWER on IntegriCloud